示例#1
0
文件: myApp.c 项目: CDoggen/axum-fw
// The actual callback function called by DAL
static HRESULT myDalCallBack (DAL_CB_EVENT_MASK events, DAL_EVENTS * pExtEvents, uint32 data)
{
	uint16			aesStatus;
	uint32			extStatus=0; //extended status to the driver
	DAL_STATUS		dalStatus;
	
	// We want to tell the diceDriver about the locked status of the clock domain
	// and sample rate etc.
	
	// let's collect AES/ADAT/AVS interface lock status.
	// We pass this on to the driver. It is not needed for the driver/streaming operation
	// but it can be obtained by control panels to provide visual feedback to the user
	aesGetStatus (&aesStatus);
	if (aesStatus & AES_STAT_LOCK0) extStatus |= DD_EXT_STATUS_AES0_LOCKED;
	if (aesStatus & AES_STAT_LOCK1) extStatus |= DD_EXT_STATUS_AES1_LOCKED;
	if (aesStatus & AES_STAT_LOCK2) extStatus |= DD_EXT_STATUS_AES2_LOCKED;
	if (aesStatus & AES_STAT_LOCK3) extStatus |= DD_EXT_STATUS_AES3_LOCKED;
	
	//let's update the slip information
	if (pExtEvents->aes_events & (DAL_CB_AES0_SLIP | DAL_CB_AES0_RPT)) extStatus |= DD_EXT_STATUS_AES0_SLIP;
	if (pExtEvents->aes_events & (DAL_CB_AES1_SLIP | DAL_CB_AES1_RPT)) extStatus |= DD_EXT_STATUS_AES1_SLIP;
	if (pExtEvents->aes_events & (DAL_CB_AES2_SLIP | DAL_CB_AES2_RPT)) extStatus |= DD_EXT_STATUS_AES2_SLIP;
	if (pExtEvents->aes_events & (DAL_CB_AES3_SLIP | DAL_CB_AES3_RPT)) extStatus |= DD_EXT_STATUS_AES3_SLIP;
	
	//let's collect ADAT interface lock status.	
	if (adatIsLocked(0)) extStatus |= DD_EXT_STATUS_ADAT_LOCKED;
	//let's update the slip information
	//if (pExtEvents->adat_events & (DAL_CB_ADAT_SLIP | DAL_CB_ADAT_RPT)) extStatus |= DD_EXT_STATUS_ADAT_SLIP;
	
	//let's collect AVS interface lock status (for debuggin purposes)
	if (avsRxIsLocked(AVS_PLUG_ID1)) extStatus |= DD_EXT_STATUS_ARX1_LOCKED;
	if (avsRxIsLocked(AVS_PLUG_ID2)) extStatus |= DD_EXT_STATUS_ARX2_LOCKED;
	//let's update the slip information	
	if (pExtEvents->avs_events & (DAL_CB_AVS1_SLIP | DAL_CB_AVS1_RPT)) extStatus |= DD_EXT_STATUS_ARX1_SLIP;
	if (pExtEvents->avs_events & (DAL_CB_AVS2_SLIP | DAL_CB_AVS2_RPT)) extStatus |= DD_EXT_STATUS_ARX2_SLIP;
	

	// At last the most important thing, get the "dal" status and call diceDriver
	// The diceDriver must know when the device is unlocked and locked so it can perform
	// proper synchronization of streams.
	dalGetCurrentStatus  (eDAL_INTERFACE_1, &dalStatus);
	diceDriverSetStatus  (dalStatus.state == eDAL_STATE_LOCKED, 
						  dalStatus.lockedNominalRate, 
						  dalStatus.lockedRateHz, extStatus);
	
	// And make sure the codecs gets updated, see function defined above.
	updateCodec(&dalStatus);

	// Now some application specific stuff, we do the LED's
	updateStatusLEDs();
	return NO_ERROR;
}
示例#2
0
static HRESULT myDalCallBack (DAL_CB_EVENT_MASK events, DAL_EVENTS * pExtEvents, uint32 data)
{
    uint16			aesStatus;
    uint32			extStatus=0; //extended status to the driver
    DAL_STATUS		dalStatus;

    // We want to tell the avcDriver about the locked status of the clock domain
    // and sample rate etc.

    //let's collect AES interface lock status.
    aesGetStatus (&aesStatus);
    if (aesStatus & AES_STAT_LOCK0) extStatus |= DD_EXT_STATUS_AES0_LOCKED;
    if (aesStatus & AES_STAT_LOCK1) extStatus |= DD_EXT_STATUS_AES1_LOCKED;
    if (aesStatus & AES_STAT_LOCK2) extStatus |= DD_EXT_STATUS_AES2_LOCKED;
    if (aesStatus & AES_STAT_LOCK3) extStatus |= DD_EXT_STATUS_AES3_LOCKED;
    //let's update the slip information
    if (pExtEvents->aes_events & (DAL_CB_AES0_SLIP | DAL_CB_AES0_RPT)) extStatus |= DD_EXT_STATUS_AES0_SLIP;
    if (pExtEvents->aes_events & (DAL_CB_AES1_SLIP | DAL_CB_AES1_RPT)) extStatus |= DD_EXT_STATUS_AES1_SLIP;
    if (pExtEvents->aes_events & (DAL_CB_AES2_SLIP | DAL_CB_AES2_RPT)) extStatus |= DD_EXT_STATUS_AES2_SLIP;
    if (pExtEvents->aes_events & (DAL_CB_AES3_SLIP | DAL_CB_AES3_RPT)) extStatus |= DD_EXT_STATUS_AES3_SLIP;

    //let's collect ADAT interface lock status.
    if (adatIsLocked()) extStatus |= DD_EXT_STATUS_ADAT_LOCKED;
    //let's update the slip information
    if (pExtEvents->adat_events & (DAL_CB_ADAT_SLIP | DAL_CB_ADAT_RPT)) extStatus |= DD_EXT_STATUS_ADAT_SLIP;

    //let's collect AVS interface lock status
    if (avsRxIsLocked(AVS_PLUG_ID1)) extStatus |= DD_EXT_STATUS_ARX1_LOCKED;
    if (avsRxIsLocked(AVS_PLUG_ID2)) extStatus |= DD_EXT_STATUS_ARX2_LOCKED;
    if (avsRxIsLocked(AVS_PLUG_ID3)) extStatus |= DD_EXT_STATUS_ARX3_LOCKED;
    if (avsRxIsLocked(AVS_PLUG_ID4)) extStatus |= DD_EXT_STATUS_ARX4_LOCKED;
    //let's update the slip information
    if (pExtEvents->avs_events & (DAL_CB_AVS1_SLIP | DAL_CB_AVS1_RPT)) extStatus |= DD_EXT_STATUS_ARX1_SLIP;
    if (pExtEvents->avs_events & (DAL_CB_AVS2_SLIP | DAL_CB_AVS2_RPT)) extStatus |= DD_EXT_STATUS_ARX2_SLIP;
    if (pExtEvents->avs_events & (DAL_CB_AVS3_SLIP | DAL_CB_AVS3_RPT)) extStatus |= DD_EXT_STATUS_ARX3_SLIP;
    if (pExtEvents->avs_events & (DAL_CB_AVS4_SLIP | DAL_CB_AVS4_RPT)) extStatus |= DD_EXT_STATUS_ARX4_SLIP;


    // At last the most important thing, get the "dal" status and call diceDriver
    dalGetCurrentStatus  (eDAL_INTERFACE_1, &dalStatus);
    avcDriverSetStatus (dalStatus.state == eDAL_STATE_LOCKED, dalStatus.lockedNominalRate,
                        dalStatus.lockedRateHz);

    // Actually now that we are at it, let's indicate lock on an LED
    if (dalStatus.state == eDAL_STATE_LOCKED)
        LED_ON(LOCKUP_LED_ID);
    else
        LED_OFF(LOCKUP_LED_ID);
    return NO_ERROR;
}
示例#3
0
// This thread handles the MIDI indicate LED's
// It also makes sure that the codec gets initialized.
static void myMidiIndicateThread(void *dummy)
{	
	//make sure update codec get's called if we already have lock
	DAL_STATUS		dalStatus;
	dalGetCurrentStatus  (eDAL_INTERFACE_1, &dalStatus);
	updateCodec(&dalStatus);

	DO_FOREVER
	{	
		TCTaskWait(200); //every 200ms
		uint8 act = uart1_activity ();
		amDisplayLed (AM_LED_MIDI_IN,act&UART_RX_ACTIVITY);
		amDisplayLed (AM_LED_MIDI_OUT,act&UART_TX_ACTIVITY);
	}
}