📄 example_full.lst
字号:
176 1 /* initialize DRX driver */
177 1 if ( DRX_Init( demodulators ) != DRX_STS_OK )
178 1 {
179 2 XERROR("failure: error initializing driver\n");
180 2 }
181 1 XPRINTF("success: DRX driver initialized\n");
182 1
183 1 /* probe function for demod, can be called before demod is opened */
184 1 if ( DRX_Ctrl( &demod, DRX_CTRL_PROBE_DEVICE, NULL ) != DRX_STS_OK )
185 1 {
186 2 XERROR("failure: no DRX397xD detected\n");
187 2 }
188 1 XPRINTF("success: DRX397xD detected\n");
189 1
190 1 /* open demodulator instance */
191 1 if ( DRX_Open( &demod ) != DRX_STS_OK )
192 1 {
193 2 XERROR("failure: error opening demodulator\n");
194 2 }
195 1 XPRINTF("success: demodulator instance opened\n");
196 1
197 1 /* show version information */
198 1 if ( DRX_Ctrl( &demod, DRX_CTRL_VERSION, &versionList ) != DRX_STS_OK )
199 1 {
200 2 XERROR("failure: error retrieving version information\n");
201 2 }
202 1 XPRINTF("\nVersion Info:\n");
203 1 while ( versionList != NULL )
204 1 {
205 2 pDRXVersion_t version = versionList->version;
206 2 if (version)
207 2 {
208 3 XPRINTF( "%s : %s\n", version->moduleName, version->vString );
209 3 }
210 2 versionList = versionList->next;
211 2 }
212 1
213 1 XPRINTF( "\n" );
214 1
215 1 /*-----------------------------------------------------------------------*/
216 1 /* (3) Configure hardware dependent settings */
217 1 /*-----------------------------------------------------------------------*/
218 1
219 1 #if 0
/* if required, enable the RF-AGC */
/* - For most of the supplied configurations of MOPLL based tuners their internal */
/* RF-AGC loop is used and the DRX397xD's RF-AGC should remain disabled. */
/* - When using the Microtune MT2060 silicon tuner, the RF-AGC should be enabled. */
/* - When using the XCeive XC3028 silicon tuner, the RF-AGC should remain disabled. */
C51 COMPILER V8.02 EXAMPLE_FULL 02/11/2009 09:41:00 PAGE 5
{
DRX3973DCfgAgc_t RfAgc;
DRXCfg_t config = { DRX3973D_CFG_RF_AGC, NULL };
/* set RF-AGC mode to "_AUTO", default mode is "_OFF" */
config.cfgData = &RfAgc;
RfAgc.ctrlMode = DRX3973D_AGC_CTRL_AUTO;
RfAgc.settleLevel = 544;
if ( DRX_Ctrl( &demod, DRX_CTRL_SET_CFG, &config ) != DRX_STS_OK )
{
XERROR("failure: error enabling RF-AGC\n");
}
XPRINTF("success: enabled RF-AGC\n" );
}
#endif
241 1
242 1
243 1 #if 0
/* if required, enable the PGA (Programmable Gain Amplifier) */
/* - The PGA is only available for the types: DRX3973D, DRX3974D and DRX3977D */
/* - If available, the PGA should be enabled when not using an IF-amplifier */
{
Bool_t enablePGA = TRUE;
DRXCfg_t config = { DRX3973D_CFG_PGA, NULL };
config.cfgData = &enablePGA;
if ( DRX_Ctrl( &demod, DRX_CTRL_SET_CFG, &config ) != DRX_STS_OK )
{
XERROR("failure: error enabling PGA\n");
}
XPRINTF("success: enabled PGA\n" );
}
#endif
259 1
260 1
261 1 #if 0
/* if required, re-configure the IF-AGC */
{
DRX3973DCfgAgc_t IfAgc;
DRXCfg_t config = { DRX3973D_CFG_IF_AGC, NULL };
/* re-configure IF-AGC, default ctrlMode is "_AUTO" */
config.cfgData = &IfAgc;
IfAgc.ctrlMode = DRX3973D_AGC_CTRL_AUTO;
IfAgc.settleLevel = 140; /* range [0, ... , 1023], 1/n of fullscale range */
IfAgc.minOutputLevel = 0; /* range [0, ... , 1023], 1/n of fullscale range */
IfAgc.maxOutputLevel = 1023; /* range [0, ... , 1023], 1/n of fullscale range */
IfAgc.speed = 904; /* range [0, ... , 1023], 1/n of fullscale range */
if ( DRX_Ctrl( &demod, DRX_CTRL_SET_CFG, &config ) != DRX_STS_OK )
{
XERROR("failure: error configuring IF-AGC\n");
}
XPRINTF("success: configured IF-AGC\n" );
}
#endif
282 1
283 1 #if 0
/* if required, use the user I/O pin (UIO) for output/input */
{
DRXUIOCfg_t uioCfg = { DRX_UIO1, DRX_UIO_MODE_READWRITE };
C51 COMPILER V8.02 EXAMPLE_FULL 02/11/2009 09:41:00 PAGE 6
DRXUIOData_t uioData = { DRX_UIO1, FALSE };
/* Set UIO pin to read/write mode */
if( DRX_Ctrl( &demod, DRX_CTRL_UIO_CFG, &uioCfg ) != DRX_STS_OK )
{
XERROR("failure: error configuring UIO pin\n");
}
XPRINTF("success: configured UIO pin\n" );
/* Set UIO pin to desired level (FALSE = LOW, TRUE = HIGH) */
uioData.value = TRUE;
if( DRX_Ctrl( &demod, DRX_CTRL_UIO_WRITE, &uioData ) != DRX_STS_OK )
{
XERROR("failure: error setting UIO output value\n");
}
XPRINTF("success: UIO pin set to %d\n", uioData.value );
/* Get value at the UIO pin (FALSE = LOW, TRUE = HIGH) */
if( DRX_Ctrl( &demod, DRX_CTRL_UIO_READ, &uioData ) != DRX_STS_OK )
{
XERROR("failure: error retrieving UIO input value\n");
}
XPRINTF("success: value at UIO pin is %d\n", uioData.value );
}
#endif
312 1
313 1 #if 0
/* If required, change MPEG output configuration */
{
DRXCfgMPEGOutput_t outputConfig;
DRXCfg_t config = { DRX_CFG_MPEG_OUTPUT, &outputConfig };
/* re-configure MPEG output */
config.cfgData = &outputConfig;
outputConfig.enableMPEGOutput = TRUE;
outputConfig.insertRSByte = TRUE;
outputConfig.enableParallel = TRUE;
outputConfig.invertDATA = FALSE;
outputConfig.invertERR = FALSE;
outputConfig.invertSTR = FALSE;
outputConfig.invertVAL = FALSE;
outputConfig.invertCLK = FALSE;
if ( DRX_Ctrl( &demod, DRX_CTRL_SET_CFG, &config ) != DRX_STS_OK )
{
XERROR("failure: error re-configuring MPEG output\n");
}
XPRINTF("success: re-configured MPEG output\n" );
}
#endif
337 1
338 1 #if 0
/* Optionally, the Impulse Noise Cruncher (INC) can be enabled/disabled */
/* - The INC will lead to better performance in environments where a */
/* lot of impulse noise is to be expected, e.g. near highways, etc. */
/* - Depending on the hardware, enabling it might affect adjacent- or */
/* co-channel performance slightly. */
/* - For DRX397xD type A2 the INC is disabled by default, for DRX397xD */
/* type B1 it is enabled by default. */
{
Bool_t incVal = TRUE; /* TRUE to enable INC, FALSE to disable INC */
DRXCfg_t config = { DRX3973D_CFG_IMP_NOISE, NULL };
C51 COMPILER V8.02 EXAMPLE_FULL 02/11/2009 09:41:00 PAGE 7
config.cfgData = &incVal;
if ( DRX_Ctrl( &demod, DRX_CTRL_SET_CFG, &config ) != DRX_STS_OK )
{
XERROR("failure: error enabling/disabling Impulse Noise Cruncher\n");
}
XPRINTF("success: enabled/disabled Impulse Noise Cruncher\n" );
}
#endif
358 1
359 1 XPRINTF("\n");
360 1
361 1 /*-----------------------------------------------------------------------*/
362 1 /* (4) Program channel and wait for lock */
363 1 /*-----------------------------------------------------------------------*/
364 1
365 1 /* set channel parameters */
366 1 channelParams.frequency = DESIRED_FREQUENCY; /* [kHz] */
367 1 channelParams.bandwidth = DESIRED_BANDWIDTH;
368 1 channelParams.mirror = DRX_MIRROR_AUTO;
369 1 channelParams.constellation = DRX_CONSTELLATION_AUTO;
370 1 channelParams.hierarchy = DRX_HIERARCHY_AUTO;
371 1 channelParams.priority = DRX_PRIORITY_HIGH;
372 1 channelParams.coderate = DRX_CODERATE_AUTO;
373 1 channelParams.guard = DRX_GUARD_AUTO;
374 1 channelParams.fftmode = DRX_FFTMODE_AUTO;
375 1 channelParams.classification = DRX_CLASSIFICATION_AUTO;
376 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -