HRESULT dalRouterCreateConfiguration (DAL_INTERFACE_ID_ENUM routerId, DAL_RATE_MODE_ENUM rateMode, uint32 inputDevices, uint32 outputDevices) { DAL_ROUTER_DESC * pRouter; uint8 dst, cnt, bhi, nbch, rtrentry, ch; HRESULT hResult; uROUTER_SETUP hwsetup; if (routerId != eDAL_INTERFACE_1) { hResult = E_DAL_INTERFACE_NOT_DEFINED; sysLogError(hResult, __LINE__, moduleName); return hResult; } pRouter = &dalRouterDesc[routerId]; pRouter->rateMode = rateMode; pRouter->inputDevices = inputDevices | DEVICE_BIT(DEV_MUTED); pRouter->outputDevices = outputDevices; pRouter->nbEntries = 0; #ifdef _MIXFIX_DAL if ((rateMode==eDAL_RATE_MODE_HIGH) && (inputDevices & DEVICE_BIT(DEV_MIXER_RX))) { outputDevices |= DEVICE_BIT(DEV_APB_TX); //force the APB into the system mixfixEnable (TRUE); } else { mixfixEnable (FALSE); } #endif //_MIXFIX_DAL cnt = 0; bhi = (rateMode == eDAL_RATE_MODE_HIGH) ? 1 : 0; rtrentry = 0; //keeps track of the physical router entry for (dst = DEV_AES_TX; dst < NUM_DEVICES_TX ; dst++) { if (DEVICE_BIT(dst) & outputDevices) { nbch = TX_DEV_CHANNELS[dst][bhi]; for (ch = 0; ch < nbch; ch++) { pRouter->entries[cnt].dest_description.entry = DEV_DESCR(dst) | CH_DESCR(ch) | TYPE_DESCR(BLOCK_1_TYPE); #ifdef _MIXFIX_DAL if ((rateMode==eDAL_RATE_MODE_HIGH) && (inputDevices & DEVICE_BIT(DEV_MIXER_RX)) && (dst == DEV_APB_TX)) { #ifdef _MIXFIX_PERFECT4 pRouter->entries[cnt].src_description.entry = DEV_DESCR(DEV_MIXER_RX) | CH_DESCR(((ch<4)?ch:(ch+4))) | TYPE_DESCR(BLOCK_1_TYPE); #else //_MIXFIX_PERFECT4 pRouter->entries[cnt].src_description.entry = DEV_DESCR(DEV_MIXER_RX) | CH_DESCR(ch) | TYPE_DESCR(BLOCK_1_TYPE); #endif //_MIXFIX_PERFECT4 } else { pRouter->entries[cnt].src_description.entry = DEV_DESCR(DEV_MUTED) | CH_DESCR(ch) | TYPE_DESCR(BLOCK_1_TYPE); } #else //_MIXFIX_DAL pRouter->entries[cnt].src_description.entry = DEV_DESCR(DEV_MUTED) | CH_DESCR(ch) | TYPE_DESCR(BLOCK_1_TYPE); #endif //_MIXFIX_DAL pRouter->entryOfs[cnt++] = rtrentry; rtrentry += 1; } } } pRouter->nbEntries = cnt; // At this point we have initialized the internal router structure. // Make sure the router is stopped, we don't know what is in it. pRouter->pRouterSetup->bit.on = ROUTER_OFF; for (cnt = 0; cnt < pRouter->nbEntries; cnt++) { updateRouterEntry (pRouter, cnt); } //now all entries are in place and muted, update count and start router if (rtrentry) { hwsetup.bit.numEntry = rtrentry-1; hwsetup.bit.on = ROUTER_ON; hwsetup.bit.peakon = 1; pRouter->pRouterSetup->reg = hwsetup.reg; } return NO_ERROR; }
HRESULT dalRouterCreateConfiguration (DAL_INTERFACE_ID_ENUM routerId, DAL_RATE_MODE_ENUM rateMode, uint32 inputDevices, uint32 outputDevices) { DAL_ROUTER_DESC * pRouter; uint8 dst, cnt, bhi, nbch, rtrentry, ch; HRESULT hResult; uROUTER_SETUP hwsetup; if (routerId != eDAL_INTERFACE_1 && routerId != eDAL_INTERFACE_2) { hResult = E_DAL_INTERFACE_NOT_DEFINED; sysLogError(hResult, __LINE__, moduleName); return hResult; } pRouter = &dalRouterDesc[routerId]; pRouter->rateMode = rateMode; pRouter->inputDevices = inputDevices | DEVICE_BIT(DEV_MUTED); pRouter->outputDevices = outputDevices; pRouter->nbEntries = 0; cnt = 0; bhi = (rateMode == eDAL_RATE_MODE_HIGH) ? 1 : 0; rtrentry = 0; //keeps track of the physical router entry for (dst = DEV_AES_TX; dst < DEV_AVS_ADI1; dst++) { if (DEVICE_BIT(dst) & outputDevices) { nbch = TX_DEV_CHANNELS[dst][bhi]; for (ch = 0; ch < nbch; ch++) { pRouter->entries[cnt].dest_description.entry = DEV_DESCR(dst) | CH_DESCR(ch) | TYPE_DESCR(BLOCK_1_TYPE); pRouter->entries[cnt].src_description.entry = DEV_DESCR(DEV_MUTED) | CH_DESCR(ch) | TYPE_DESCR(BLOCK_1_TYPE); pRouter->entryOfs[cnt++] = rtrentry; rtrentry += (bhi+1); } } } #ifndef FULL_BLK_FIRST //we need to deal with the two AVS transmitters for (dst = DEV_AVS_ADI1; dst <= DEV_AVS_ADI2; dst++) { if (DEVICE_BIT(dst) & outputDevices) { // 8 or 4 "1" blocks for (ch = 0; ch < (bhi ? 4 : 8); ch++) { pRouter->entries[cnt].dest_description.entry = DEV_DESCR(dst) | CH_DESCR(ch) | TYPE_DESCR(BLOCK_1_TYPE); pRouter->entries[cnt].src_description.entry = DEV_DESCR(DEV_MUTED) | CH_DESCR(ch) | TYPE_DESCR(BLOCK_1_TYPE); pRouter->entryOfs[cnt++] = rtrentry; rtrentry += (bhi+1); } if (!bhi) { //8 block pRouter->entries[cnt].dest_description.entry = DEV_DESCR(dst) | CH_DESCR(CH_ID8) | TYPE_DESCR(BLOCK_8_TYPE); pRouter->entries[cnt].src_description.entry = DEV_DESCR(DEV_MUTED) | CH_DESCR(CH_ID8) | TYPE_DESCR(BLOCK_8_TYPE); pRouter->entryOfs[cnt++] = rtrentry; rtrentry += 8; } else { //4 block pRouter->entries[cnt].dest_description.entry = DEV_DESCR(dst) | CH_DESCR(CH_ID4) | TYPE_DESCR(BLOCK_4_TYPE); pRouter->entries[cnt].src_description.entry = DEV_DESCR(DEV_MUTED) | CH_DESCR(CH_ID4) | TYPE_DESCR(BLOCK_4_TYPE); pRouter->entryOfs[cnt++] = rtrentry; rtrentry += 4*2; } } } #else //we need to deal with the two AVS transmitters for (dst = DEV_AVS_ADI1; dst <= DEV_AVS_ADI2; dst++) { if (DEVICE_BIT(dst) & outputDevices) { // 8 or 4 "1" blocks for (ch = (bhi ? 4: 8); ch < (bhi ? 8 : 16); ch++) { pRouter->entries[cnt].dest_description.entry = DEV_DESCR(dst) | CH_DESCR(ch) | TYPE_DESCR(BLOCK_1_TYPE); pRouter->entries[cnt].src_description.entry = DEV_DESCR(DEV_MUTED) | CH_DESCR(ch) | TYPE_DESCR(BLOCK_1_TYPE); pRouter->entryOfs[cnt++] = rtrentry; rtrentry += (bhi+1); } if (!bhi) { //8 block pRouter->entries[cnt].dest_description.entry = DEV_DESCR(dst) | CH_DESCR(CH_ID0) | TYPE_DESCR(BLOCK_8_TYPE); pRouter->entries[cnt].src_description.entry = DEV_DESCR(DEV_MUTED) | CH_DESCR(CH_ID0) | TYPE_DESCR(BLOCK_8_TYPE); pRouter->entryOfs[cnt++] = rtrentry; rtrentry += 8; } else { //4 block pRouter->entries[cnt].dest_description.entry = DEV_DESCR(dst) | CH_DESCR(CH_ID0) | TYPE_DESCR(BLOCK_4_TYPE); pRouter->entries[cnt].src_description.entry = DEV_DESCR(DEV_MUTED) | CH_DESCR(CH_ID0) | TYPE_DESCR(BLOCK_4_TYPE); pRouter->entryOfs[cnt++] = rtrentry; rtrentry += 4*2; } } } #endif pRouter->nbEntries = cnt; // At this point we have initialized the internal router structure. // Make sure the router is stopped, we don't know what is in it. pRouter->pRouterSetup->bit.on = ROUTER_OFF; for (cnt = 0; cnt < pRouter->nbEntries; cnt++) { updateRouterEntry (pRouter, cnt); } //now all entries are in place and muted, update count and start router if (rtrentry) { hwsetup.bit.numEntry = rtrentry-1; hwsetup.bit.on = ROUTER_ON; pRouter->pRouterSetup->reg = hwsetup.reg; } return NO_ERROR; }