XilinxProcessorIPLib/drivers/rfdc/examples/xrfdc_mts_example.c
int RFdcMTS_Example(u16 RFdcDeviceId)
{
	int status, status_adc, status_dac, i;
	u32 factor;
	XRFdc_Config *ConfigPtr;
	XRFdc *RFdcInstPtr = &RFdcInst;
#ifndef __BAREMETAL__
	struct metal_device *deviceptr;
#endif

	struct metal_init_params init_param = METAL_INIT_DEFAULTS;

	if (metal_init(&init_param)) {
		printf("ERROR: Failed to run metal initialization\n");
		return XRFDC_FAILURE;
	}
	metal_set_log_level(METAL_LOG_DEBUG);
    ConfigPtr = XRFdc_LookupConfig(RFdcDeviceId);
    if (ConfigPtr == NULL) {
		return XRFDC_FAILURE;
	}

#ifndef __BAREMETAL__
	status = XRFdc_RegisterMetal(RFdcInstPtr, RFdcDeviceId, &deviceptr);
	if (status != XRFDC_SUCCESS) {
		return XRFDC_FAILURE;
	}
#endif

    status = XRFdc_CfgInitialize(RFdcInstPtr, ConfigPtr);
    if (status != XRFDC_SUCCESS) {
        printf("RFdc Init Failure\n\r");
    }

    printf("=== RFdc Initialized - Running Multi-tile Sync ===\n");

    /* ADC MTS Settings */
    XRFdc_MultiConverter_Sync_Config ADC_Sync_Config;

    /* DAC MTS Settings */
    XRFdc_MultiConverter_Sync_Config DAC_Sync_Config;

    /* Run MTS for the ADC & DAC */
    printf("\n=== Run DAC Sync ===\n");

    /* Initialize DAC MTS Settings */
    XRFdc_MultiConverter_Init (&DAC_Sync_Config, 0, 0, XRFDC_TILE_ID0);
    DAC_Sync_Config.Tiles = 0x3;	/* Sync DAC tiles 0 and 1 */

    status_dac = XRFdc_MultiConverter_Sync(RFdcInstPtr, XRFDC_DAC_TILE,
					&DAC_Sync_Config);
    if(status_dac == XRFDC_MTS_OK){
	printf("INFO : DAC Multi-Tile-Sync completed successfully\n");
    }else{
	printf("ERROR : DAC Multi-Tile-Sync did not complete successfully. Error code is %u \n",status_dac);
	return status_dac;
    }

    printf("\n=== Run ADC Sync ===\n");

    /* Initialize ADC MTS Settings */
    XRFdc_MultiConverter_Init (&ADC_Sync_Config, 0, 0, XRFDC_TILE_ID0);
    ADC_Sync_Config.Tiles = 0xF;	/* Sync ADC tiles 0, 1, 2, 3 */

    status_adc = XRFdc_MultiConverter_Sync(RFdcInstPtr, XRFDC_ADC_TILE,
					&ADC_Sync_Config);
    if(status_adc == XRFDC_MTS_OK){
	printf("INFO : ADC Multi-Tile-Sync completed successfully\n");
    }else{
		printf("ERROR : ADC Multi-Tile-Sync did not complete successfully. Error code is %u \n",status_adc);
		return status_adc;
    }

    /*
     * Report Overall Latency in T1 (Sample Clocks) and
     * Offsets (in terms of PL words) added to each FIFO
     */
     printf("\n\n=== Multi-Tile Sync Report ===\n");
     for(i=0; i<4; i++) {
         if((1<<i)&DAC_Sync_Config.Tiles) {
                 XRFdc_GetInterpolationFactor(RFdcInstPtr, i, 0, &factor);
                 printf("DAC%d: Latency(T1) =%3d, Adjusted Delay"
				 "Offset(T%d) =%3d\n", i, DAC_Sync_Config.Latency[i],
						 factor, DAC_Sync_Config.Offset[i]);
         }
     }
     for(i=0; i<4; i++) {
         if((1<<i)&ADC_Sync_Config.Tiles) {
                 XRFdc_GetDecimationFactor(RFdcInstPtr, i, 0, &factor);
                 printf("ADC%d: Latency(T1) =%3d, Adjusted Delay"
				 "Offset(T%d) =%3d\n", i, ADC_Sync_Config.Latency[i],
						 factor, ADC_Sync_Config.Offset[i]);
         }
     }

    return XRFDC_MTS_OK;
}
/****************************************************************************/
/**
*
* This function runs a MTS test on the RFSoC data converter device using the
* driver APIs.
* This function does the following tasks:
*	- Initialize the RFdc device driver instance
*	- Test MTS feature.
*
* @param	RFdcDeviceId is the XPAR_<XRFDC_instance>_DEVICE_ID value
*		from xparameters.h.
*
* @return
*		- XRFDC_SUCCESS if the example has completed successfully.
*		- XRFDC_FAILURE if the example has failed.
*
* @note   	None
*
****************************************************************************/
This function runs a MTS test on the RFSoC data converter device using the
driver APIs.
This function does the following tasks:
Initialize the RFdc device driver instance
Test MTS feature.
This function runs a MTS test on the RFSoC data converter device using the driver APIs . This function does the following tasks : Initialize the RFdc device driver instance Test MTS feature .
int RFdcMTS_Example(u16 RFdcDeviceId)
{
	int status, status_adc, status_dac, i;
	u32 factor;
	XRFdc_Config *ConfigPtr;
	XRFdc *RFdcInstPtr = &RFdcInst;
#ifndef __BAREMETAL__
	struct metal_device *deviceptr;
#endif
	struct metal_init_params init_param = METAL_INIT_DEFAULTS;
	if (metal_init(&init_param)) {
		printf("ERROR: Failed to run metal initialization\n");
		return XRFDC_FAILURE;
	}
	metal_set_log_level(METAL_LOG_DEBUG);
    ConfigPtr = XRFdc_LookupConfig(RFdcDeviceId);
    if (ConfigPtr == NULL) {
		return XRFDC_FAILURE;
	}
#ifndef __BAREMETAL__
	status = XRFdc_RegisterMetal(RFdcInstPtr, RFdcDeviceId, &deviceptr);
	if (status != XRFDC_SUCCESS) {
		return XRFDC_FAILURE;
	}
#endif
    status = XRFdc_CfgInitialize(RFdcInstPtr, ConfigPtr);
    if (status != XRFDC_SUCCESS) {
        printf("RFdc Init Failure\n\r");
    }
    printf("=== RFdc Initialized - Running Multi-tile Sync ===\n");
    XRFdc_MultiConverter_Sync_Config ADC_Sync_Config;
    XRFdc_MultiConverter_Sync_Config DAC_Sync_Config;
    printf("\n=== Run DAC Sync ===\n");
    XRFdc_MultiConverter_Init (&DAC_Sync_Config, 0, 0, XRFDC_TILE_ID0);
    DAC_Sync_Config.Tiles = 0x3;	
    status_dac = XRFdc_MultiConverter_Sync(RFdcInstPtr, XRFDC_DAC_TILE,
					&DAC_Sync_Config);
    if(status_dac == XRFDC_MTS_OK){
	printf("INFO : DAC Multi-Tile-Sync completed successfully\n");
    }else{
	printf("ERROR : DAC Multi-Tile-Sync did not complete successfully. Error code is %u \n",status_dac);
	return status_dac;
    }
    printf("\n=== Run ADC Sync ===\n");
    XRFdc_MultiConverter_Init (&ADC_Sync_Config, 0, 0, XRFDC_TILE_ID0);
    ADC_Sync_Config.Tiles = 0xF;	
    status_adc = XRFdc_MultiConverter_Sync(RFdcInstPtr, XRFDC_ADC_TILE,
					&ADC_Sync_Config);
    if(status_adc == XRFDC_MTS_OK){
	printf("INFO : ADC Multi-Tile-Sync completed successfully\n");
    }else{
		printf("ERROR : ADC Multi-Tile-Sync did not complete successfully. Error code is %u \n",status_adc);
		return status_adc;
    }
     printf("\n\n=== Multi-Tile Sync Report ===\n");
     for(i=0; i<4; i++) {
         if((1<<i)&DAC_Sync_Config.Tiles) {
                 XRFdc_GetInterpolationFactor(RFdcInstPtr, i, 0, &factor);
                 printf("DAC%d: Latency(T1) =%3d, Adjusted Delay"
				 "Offset(T%d) =%3d\n", i, DAC_Sync_Config.Latency[i],
						 factor, DAC_Sync_Config.Offset[i]);
         }
     }
     for(i=0; i<4; i++) {
         if((1<<i)&ADC_Sync_Config.Tiles) {
                 XRFdc_GetDecimationFactor(RFdcInstPtr, i, 0, &factor);
                 printf("ADC%d: Latency(T1) =%3d, Adjusted Delay"
				 "Offset(T%d) =%3d\n", i, ADC_Sync_Config.Latency[i],
						 factor, ADC_Sync_Config.Offset[i]);
         }
     }
    return XRFDC_MTS_OK;
}
int RFdcMTS_Example ( u16 RFdcDeviceId ) { int status , status_adc , status_dac , i ; u32 factor ; XRFdc_Config * ConfigPtr ; XRFdc * RFdcInstPtr = & RFdcInst ; #ifndef __BAREMETAL__ struct metal_device * deviceptr ; #endif struct metal_init_params init_param = METAL_INIT_DEFAULTS ; if ( metal_init ( & init_param ) ) { printf ( " \n " ) ; return XRFDC_FAILURE ; } metal_set_log_level ( METAL_LOG_DEBUG ) ; ConfigPtr = XRFdc_LookupConfig ( RFdcDeviceId ) ; if ( ConfigPtr == NULL ) { return XRFDC_FAILURE ; } #ifndef __BAREMETAL__ status = XRFdc_RegisterMetal ( RFdcInstPtr , RFdcDeviceId , & deviceptr ) ; if ( status != XRFDC_SUCCESS ) { return XRFDC_FAILURE ; } #endif status = XRFdc_CfgInitialize ( RFdcInstPtr , ConfigPtr ) ; if ( status != XRFDC_SUCCESS ) { printf ( " \n \r " ) ; } printf ( " \n " ) ; XRFdc_MultiConverter_Sync_Config ADC_Sync_Config ; XRFdc_MultiConverter_Sync_Config DAC_Sync_Config ; printf ( " \n \n " ) ; XRFdc_MultiConverter_Init ( & DAC_Sync_Config , 0 , 0 , XRFDC_TILE_ID0 ) ; DAC_Sync_Config . Tiles = 0x3 ; status_dac = XRFdc_MultiConverter_Sync ( RFdcInstPtr , XRFDC_DAC_TILE , & DAC_Sync_Config ) ; if ( status_dac == XRFDC_MTS_OK ) { printf ( " \n " ) ; } else { printf ( " \n " , status_dac ) ; return status_dac ; } printf ( " \n \n " ) ; XRFdc_MultiConverter_Init ( & ADC_Sync_Config , 0 , 0 , XRFDC_TILE_ID0 ) ; ADC_Sync_Config . Tiles = 0xF ; status_adc = XRFdc_MultiConverter_Sync ( RFdcInstPtr , XRFDC_ADC_TILE , & ADC_Sync_Config ) ; if ( status_adc == XRFDC_MTS_OK ) { printf ( " \n " ) ; } else { printf ( " \n " , status_adc ) ; return status_adc ; } printf ( " \n \n \n " ) ; for ( i = 0 ; i < 4 ; i ++ ) { if ( ( 1 << i ) & DAC_Sync_Config . Tiles ) { XRFdc_GetInterpolationFactor ( RFdcInstPtr , i , 0 , & factor ) ; printf ( " " " \n " , i , DAC_Sync_Config . Latency [ i ] , factor , DAC_Sync_Config . Offset [ i ] ) ; } } for ( i = 0 ; i < 4 ; i ++ ) { if ( ( 1 << i ) & ADC_Sync_Config . Tiles ) { XRFdc_GetDecimationFactor ( RFdcInstPtr , i , 0 , & factor ) ; printf ( " " " \n " , i , ADC_Sync_Config . Latency [ i ] , factor , ADC_Sync_Config . Offset [ i ] ) ; } } return XRFDC_MTS_OK ; }
This function runs a MTS test on the RFSoC data converter device using the
driver APIs.
This function runs a MTS test on the RFSoC data converter device using the driver APIs .
/* ADC MTS Settings */ /* DAC MTS Settings */ /* Run MTS for the ADC & DAC */ /* Initialize DAC MTS Settings */ /* Sync DAC tiles 0 and 1 */ /* Initialize ADC MTS Settings */ /* Sync ADC tiles 0, 1, 2, 3 */ /*
     * Report Overall Latency in T1 (Sample Clocks) and
     * Offsets (in terms of PL words) added to each FIFO
     */