static void myAppCreateHighRateDAL(void) { cliPrintf("high rate dal.\n\r"); if(PreviousDAL) dalUninstallCallback(myDalCallBack); //Let's build our audio configuration with "dal", We want to allow all rates above 96KHz dalCreateInterface(eDAL_INTERFACE_1, eDAL_RATE_MODE_HIGH, MY_INPUT_DEVICES_HIGH, MY_OUTPUT_DEVICES_HIGH); //default we will run at internal rate 48KHz, the computer will change that when attached dalSetClockSource (eDAL_INTERFACE_1, eDAL_CLK_SRC_AVS_SYT1, eDAL_NOMINAL_RATE_192); //we need to setup our routing //let the 4 AES channels take data from the first Isoc receiver dalSetRoute(eDAL_INTERFACE_1, TX_AES_CH0_3, RX_AVS1_CH0_3); //let the first 8 Isoc 1 transmitter channels take data from the 8 AES channels dalSetRoute(eDAL_INTERFACE_1, TX_AVS1_CH0_3, RX_AES_CH0_3); //the call back function defined above needs to be installed into "dal" dalInstallCallback(&myDalSubscribedEvents, 200, myDalCallBack, 0); //configure device for MIDI based on a function in targetBoard. For the EVAL //board this is determined by DIP SW 1 myAvcDriverTxConfigLow[0].midiChannels = 1; myAvcDriverRxConfigLow[0].midiChannels = 1; avcDriverConfigure (myAvcDriverTxConfigLow, MY_NB_TX_ISOC_STREAMS_HIGH, myAvcDriverRxConfigLow, MY_NB_RX_ISOC_STREAMS_HIGH, myAvcDriverCallBack); myAppInitializeI2S(); myAppSetI2SHigh(); // now we are ready to start the whole thing, it actually wont start until we return from // this function as threads are not enabled yet. If we want to have some code running after // this we need to create a thread. We don't need that here, our call backs will do things // for us. dalStartInterface(eDAL_INTERFACE_1); }
// This function creates the DAL based on a rateMode. This is typically // called as a result of the host/driver requesting a rateMode change. // Under driver comtrol this should not be called except as a result of // the driver requesting it. // This function is also called at boot initialization and could be used to // initialize a 'stand alone' mode of the device in case no computer is // connected. static void myAppCreateDAL(DAL_RATE_MODE_ENUM ratemode) { //Let's build our audio configuration with "dal", We will only allow rates within the window of //the nominal rate requested by the driver. dalCreateInterface(eDAL_INTERFACE_1, ratemode,pCurrentMode->inputDevices,pCurrentMode->outputDevices); //Execute the routing for this mode pCurrentMode->fRouting(ratemode); STREAM_CFG * pCfg; switch (ratemode) { default: case eDAL_RATE_MODE_LOW: pCfg = pCurrentMode->low;break; case eDAL_RATE_MODE_MID: pCfg = pCurrentMode->mid;break; case eDAL_RATE_MODE_HIGH: pCfg = pCurrentMode->high;break; } //This might have resulted in a configuration change so we call //the diceDriver module to update the configuration diceDriverConfigureNew(pCfg->pTxStreamCfg, pCfg->nbTxStreams, pCfg->pRxStreamCfg, pCfg->nbRxStreams, MY_DEVICE_NICK_NAME, myDiceDriverCallBack, pCurrentMode->clocksCaps, pCurrentMode->clockNames); //Now we can start the interface dalStartInterface(eDAL_INTERFACE_1); }
void StandAloneInitialize (void) { //we need to figure out what dal to create EAP_STND_ALONE_CFG const * pStdaCfg; DAL_RATE_MODE_ENUM rate_mode = eDAL_RATE_MODE_LOW_MID; DAL_NOMINAL_RATE_ENUM rate = eDAL_NOMINAL_RATE_ANY; DAL_CLOCK_SOURCE_ENUM clksrc; pStdaCfg = eapGetStandaloneCfg(); clksrc = CLOCK_SOURCE[pStdaCfg->clkSrc]; if (clksrc == eDAL_CLK_SRC_AESRX0) { rate_mode = eDAL_RATE_MODE_ALL; //auto lock to 32k-192k } else { //illegal, do something rate = eDAL_NOMINAL_RATE_48; } dalCreateInterface(eDAL_INTERFACE_1, rate_mode, STDA_INPUT_DEVICES,STDA_OUTPUT_DEVICES); dalSetClockSource (eDAL_INTERFACE_1, clksrc, rate); dalStartInterface(eDAL_INTERFACE_1); //update the routing now according to the currently locked rate mode, in auto modes this might change //so in that case this function must be called. updateStdaRouting(); }
static HRESULT myAppChangeSR(DICE_DRIVER_CB_DATA * pData) { HRESULT hResult = NO_ERROR; uint32 notify = 0; if (dalRateByID (pData->rate)->rateMode != lastDriverRateMode) { lastDriverRateMode = dalRateByID (pData->rate)->rateMode; dalCreateInterface(eDAL_INTERFACE_1, lastDriverRateMode, INPUT_DEVICES,OUTPUT_DEVICES); eapDriverChangeRateMode (lastDriverRateMode); dalStartInterface(eDAL_INTERFACE_1); //Send the RX and TX Configuration Notification notify |= DD_NOTIFY_RX_CFG_CHG_BIT | DD_NOTIFY_TX_CFG_CHG_BIT; } //Change the Clock Now dalSetClockSource (eDAL_INTERFACE_1, pData->source, pData->rate); //Send the Clock Setting Accept Notification notify |= DD_NOTIFY_CLOCK_ACP; diceDriverNotifyHost(notify); return hResult; }