static HRESULT mixer8GetChannel_Tool(uint32 index, uint32 reg) { HRESULT hResult = NO_ERROR; if( (index < 1) || (index > 8 ) ) { hResult = E_BAD_INPUT_PARAMETERS; return hResult; } index--; switch( reg ) { case 0: cliPrintf("mixer8.Channel[%d].Mute = %08X \n\r", index, mixer8.ChannelParameters[index].Mute); break; case 1: cliPrintf("mixer8.Channel[%d].Solo = %08X \n\r", index, mixer8.ChannelParameters[index].Solo); break; case 2: cliPrintf("mixer8.Channel[%d].Fader = %08X \n\r", index, mixer8.ChannelParameters[index].Fader); break; case 3: cliPrintf("mixer8.Channel[%d].Pan = %08X \n\r", index, mixer8.ChannelParameters[index].Pan); break; case 4: cliPrintf("mixer8.Channel[%d].Coupled = %08X \n\r", index, mixer8.ChannelParameters[index].Coupled); break; } return hResult; }
static HRESULT mixer8GetAux_Tool(uint32 ch_index, uint32 aux_index, uint32 reg) { HRESULT hResult = NO_ERROR; if( (ch_index < 1) || (ch_index > 8 ) || (aux_index < 1) || (aux_index > 6 ) ) { hResult = E_BAD_INPUT_PARAMETERS; return hResult; } ch_index--; aux_index--; switch(reg) { case 0: cliPrintf("mixer8.Channel[%d].Aux[%d].On = %08X \n\r", ch_index, aux_index, mixer8.ChannelParameters[ch_index].Aux[aux_index].On); break; case 1: cliPrintf("mixer8.Channel[%d].Aux[%d].PrePost = %08X \n\r", ch_index, aux_index, mixer8.ChannelParameters[ch_index].Aux[aux_index].PrePost); break; case 2: cliPrintf("mixer8.Channel[%d].Aux[%d].Value = %08X \n\r", ch_index, aux_index, mixer8.ChannelParameters[ch_index].Aux[aux_index].Value); break; } return hResult; }
HRESULT grayCliIntLogDump(uint32 mode) { HRESULT hResult = NO_ERROR; uint32 i; uint32 count = 0; BOOL bEnable = FALSE; count = grayEventGetIntCounts(); cliPrintf("IntLog Total Events [%i]: %8i Enabled\n\r", GRAY_ENC_ITEMS, count); for (i = 0; i < GRAY_ENC_ITEMS; i++) { count = grayEventGetIntCount(i); bEnable = grayEventIsIntEnabled(i); if ((mode == MODE_DUMP) || (mode == MODE_DUMP_IFSET && count) || (mode == MODE_DUMP_IFENABLE && bEnable)) { cliPrintf("Gray Rotary Encoder [%i]: %8i %s\n\r", i, count, (bEnable) ? "+" : " "); } } return hResult; }
HRESULT grayCliIntLogRegs(void) { HRESULT hResult = NO_ERROR; cliPrintf("GRAY_INT_SETUP : 0x%08x\n\r", *((volatile uint32 *) GRAY_INT_SETUP)); cliPrintf("GRAY_INT_STATUS: 0x%08x\n\r", *((volatile uint32 *) GRAY_INT_STATUS)); cliPrintf("GRAY_COUNTERS: 0x%08x\n\r", *((volatile uint32 *) GRAY_COUNTERS)); return hResult; }
static HRESULT myAppChangeSR(AVC_DRIVER_CB_DATA * pData) { HRESULT hResult = NO_ERROR; uint32 notify = 0; cliPrintf("Change SR: old=%x, new=%x\n\r", OldRate, pData->rate); switch(pData->rate) { case eDAL_NOMINAL_RATE_32: case eDAL_NOMINAL_RATE_44_1: case eDAL_NOMINAL_RATE_48: if(OldRate > eDAL_NOMINAL_RATE_48) { cliPrintf(" low rate\n\r"); myAppCreateLowRateDAL(); //Send the RX and TX Configuration Notification notify |= DD_NOTIFY_RX_CFG_CHG_BIT | DD_NOTIFY_TX_CFG_CHG_BIT; } break; case eDAL_NOMINAL_RATE_88_2: case eDAL_NOMINAL_RATE_96: if((OldRate < eDAL_NOMINAL_RATE_88_2) || (OldRate > eDAL_NOMINAL_RATE_96)) { myAppCreateMidRateDAL(); //Send the RX and TX Configuration Notification notify |= DD_NOTIFY_RX_CFG_CHG_BIT | DD_NOTIFY_TX_CFG_CHG_BIT; } break; case eDAL_NOMINAL_RATE_176_4: case eDAL_NOMINAL_RATE_192: if(OldRate < eDAL_NOMINAL_RATE_176_4) { myAppCreateHighRateDAL(); //Send the RX and TX Configuration Notification notify |= DD_NOTIFY_RX_CFG_CHG_BIT | DD_NOTIFY_TX_CFG_CHG_BIT; } break; default: cliPrintf("No change.\n\r"); break; } OldRate = pData->rate; if(hResult == NO_ERROR) { //Change the Clock Now dalSetClockSource (eDAL_INTERFACE_1, pData->source, pData->rate); //Send the Clock Setting Accept Notification notify |= DD_NOTIFY_CLOCK_ACP; OldRate = pData->rate; } return hResult; }
HRESULT myModesDump(void) { uint32 i; cliPrintf("Dump MODES\n"); for (i=0; i<MYMODES_NBMODES; i++) { cliPrintf("%-3i %c %s\n",i,(curMode==i)?'*':' ',modeDesc[isChipDiceJR()?1:0][i]->modeName); } cliPrintf("\n"); return NO_ERROR; }
static void dumpAESError(void) { uint8 i; uAESRX_ERROR error[4]; for (i=0; i<4; i++) aesGetRxError(i, &error[i], TRUE); cliPrintf("AES Errors R=Repeat, S=Slip, P=Parity, C=CRC:\n\r"); cliPrintf("\tAES0 : %c%c%c%c\n\r", error[0].bit.u_run ? 'R' : ' ', error[0].bit.o_run ? 'S' : ' ',error[0].bit.pty_err ? 'P' : ' ', error[0].bit.crc_err ? 'C' : ' '); cliPrintf("\tAES1 : %c%c%c%c\n\r", error[1].bit.u_run ? 'R' : ' ', error[1].bit.o_run ? 'S' : ' ',error[1].bit.pty_err ? 'P' : ' ', error[1].bit.crc_err ? 'C' : ' '); cliPrintf("\tAES2 : %c%c%c%c\n\r", error[2].bit.u_run ? 'R' : ' ', error[2].bit.o_run ? 'S' : ' ',error[2].bit.pty_err ? 'P' : ' ', error[2].bit.crc_err ? 'C' : ' '); cliPrintf("\tAES3 : %c%c%c%c\n\r", error[3].bit.u_run ? 'R' : ' ', error[3].bit.o_run ? 'S' : ' ',error[3].bit.pty_err ? 'P' : ' ', error[3].bit.crc_err ? 'C' : ' '); }
static void dumpDSAI(void) { cliPrintf("DSAI0 Rx registers:\n\r"); cliPrintf("\tSETUP : 0x%04x\n\r", pDiceDSAIRx0->setup.reg); cliPrintf("\tMASTER_SETUP : 0x%04x\n\r", pDiceDSAIRx0->masterSetup.reg); cliPrintf("\tSAMPLE_ERROR : 0x%04x\n\r", pDiceDSAIRx0->sampleError); cliPrintf("DSAI0 Tx registers:\n\r"); cliPrintf("\tSETUP : 0x%04x\n\r", pDiceDSAITx0->setup.reg); cliPrintf("\tMASTER_SETUP : 0x%04x\n\r", pDiceDSAITx0->masterSetup.reg); cliPrintf("\tSAMPLE_ERROR : 0x%04x\n\r", pDiceDSAITx0->sampleError); cliPrintf("\tCH_MUTE : 0x%04x\n\r", pDiceDSAITx0->txMuteCh.reg); }
static HRESULT cliBuiltInToolGetNumber(uint32 index, char** argv, CLIDescriptor* variable, uint32* value) { HRESULT hResult = NO_ERROR; if (!is_number(argv[index],strlen(argv[index]))) { if (variable) { hResult = cliLookUpConstant(variable, argv[index], value); } else { hResult = E_CLI_BADARGUMENTS; } } if (hResult != NO_ERROR) { cliPrintf("SET ERROR: argument #%i must be a number\n\r", index+1); return hResult; } if (is_number(argv[index],strlen(argv[index]))==2) { *value = hex2int(argv[index],strlen(argv[index])); } else { *value = (uint32) dec2int(argv[index],strlen(argv[index])); } return hResult; }
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); }
static void printTime (uint32 time) { uint32 sec,cyc, ofs; sec = (time & 0xFE000000) >> 25; cyc = (time & 0x01FFF000) >> 12; ofs = (time & 0x00000FFF); cliPrintf ("%03i:%04i:%04i ",sec,cyc,ofs); }
static void dumpRouter(void) { uROUTER_SETUP routerSetup; uROUTER_ENTRY routerEntry; uint32 i; cliPrintf("Router 1 registers:\n\r"); diceRegRead(DICE_ROUTER1_SETUP, &routerSetup.reg); cliPrintf("\tROUTER1_SETUP : 0x%04x\n\r", routerSetup.reg); for (i = 0; i < routerSetup.bit.numEntry+1; i++) { diceRegRead((DICE_ROUTER1_ENTRY+(i*4)), &routerEntry.reg); cliPrintf("\tROUTER1_ENTRY[%03i] : 0x%03x 0x%04x %4s ch %-2i -> %4s ch %-2i\n\r", i, (routerEntry.reg>>16)&0xfff,routerEntry.reg&0xffff,srcNames[routerEntry.bit.srcBlkID],routerEntry.bit.srcCh, dstNames[routerEntry.bit.dstBlkID],routerEntry.bit.dstCh); } }
HRESULT cliBuiltInTool_DUMP(void* address, uint32 unitsize, uint32 numberofitems, uint32 itemsperline) { HRESULT hResult = NO_ERROR; uint32 addr = (uint32) address; uint32 numberofbytes = numberofitems * unitsize; uint32 bytesperline = itemsperline * unitsize; uint32 counter = 0; char tempdata[kTempBufferSize]; char fmtdata[20]; if (unitsize != 1 && unitsize != 2 && unitsize != 4) { hResult = E_BAD_INPUT_PARAMETERS; sysLogError(hResult, __LINE__, moduleName); return hResult; } if (itemsperline == 0) bytesperline = 16; while (numberofbytes) { address = (void *) addr; counter = 0; tempdata[0] = 0; if (numberofbytes >= bytesperline) { counter = bytesperline; numberofbytes -= bytesperline; } else { counter = numberofbytes; numberofbytes = 0; } while (counter) { switch (unitsize) { case 1: sprintf(fmtdata,"%02X ", (uint8) (*((uint8 *) addr))); break; case 2: sprintf(fmtdata,"%04X ", (uint16) (*((uint16 *) addr))); break; case 4: sprintf(fmtdata,"%08X ", (uint32) (*((uint32 *) addr))); break; } strcat(tempdata, fmtdata); counter -= unitsize; addr += unitsize; } cliPrintf("0x%08X: %s\n\r", address, tempdata); } return hResult; }
static HRESULT hpllDump_Tool(void) { HRESULT hResult = NO_ERROR; uint32 v1, v2; if(hpllIsLocked(0)) cliPrintf("HPLL is locked.\n\r"); else cliPrintf("HPLL is not locked.\n\r"); hResult += hpllGetClock(&v1); cliPrintf("\tclock: %d\n\r", v1); hResult += hpllGetDividers(0, &v1, &v2); cliPrintf("\tpreDiv: %d, addDiv: %d\n\r", v1, v2); hResult += hpllGetPeriod(0, (uint16*)&v1, (uint16*)&v2); cliPrintf("\tcount: %d, diff: %d\n\r", v1, v2); return hResult; }
static HRESULT mixer8GetMaster_Tool(uint32 reg) { HRESULT hResult = NO_ERROR; switch( reg ) { case 0: cliPrintf("mixer8.MasterEnable = %08X \n\r", mixer8.Enable); break; case 1: cliPrintf("mixer8.MasterCapabilities = %08X \n\r", mixer8.SupportedConfiguration); break; case 2: cliPrintf("mixer8.CurrentConfiguration = %08X \n\r", mixer8.CurrentConfiguration); break; case 3: cliPrintf("mixer8.MasterGain = %08X \n\r", mixer8.MasterGain); break; case 4: cliPrintf("mixer8.MasterMute = %08X \n\r", mixer8.MasterMute); break; case 5: cliPrintf("mixer8.MasterPan = %08X \n\r", mixer8.MasterPan); break; } return hResult; }
static void dumpRouter(void) { uROUTER_SETUP routerSetup; uROUTER_ENTRY routerEntry; uint32 i; cliPrintf("Router 1 registers:\n\r"); diceRegRead(DICE_ROUTER1_SETUP, &routerSetup.reg); cliPrintf("\tROUTER1_SETUP : 0x%04x\n\r", routerSetup.reg); for (i = 0; i < routerSetup.bit.numEntry+1; i++) { diceRegRead((DICE_ROUTER1_ENTRY+(i*4)), &routerEntry.reg); cliPrintf("\tROUTER1_ENTRY[%03i] : 0x%04x\n\r", i, routerEntry.reg); } cliPrintf("Router 2 registers:\n\r"); diceRegRead(DICE_ROUTER2_SETUP, &routerSetup.reg); cliPrintf("\tROUTER2_SETUP : 0x%04x\n\r", routerSetup.reg); for (i = 0; i < routerSetup.bit.numEntry+1; i++) { diceRegRead((DICE_ROUTER2_ENTRY+(i*4)), &routerEntry.reg); cliPrintf("\tROUTER2_ENTRY[%03i] : 0x%04x\n\r", i, routerEntry.reg); } }
static HRESULT mixer8Dump(void) { HRESULT hResult = NO_ERROR; uint32 i; cliPrintf("mixer8 coeff:\n\r"); for (i = 0; i < 8; i++) { cliPrintf("%08X %08X %08X %08X %08X %08X %08X %08X\n\r", mixer8.ShadowCoeffs[i*8+0], mixer8.ShadowCoeffs[i*8+1], mixer8.ShadowCoeffs[i*8+2], mixer8.ShadowCoeffs[i*8+3], mixer8.ShadowCoeffs[i*8+4], mixer8.ShadowCoeffs[i*8+5], mixer8.ShadowCoeffs[i*8+6], mixer8.ShadowCoeffs[i*8+7]); } cliPrintf("\n\r"); return hResult; }
HRESULT dsCliTest(uint32 mode) { HRESULT hResult = NO_ERROR; DataStream ds; uint8 data[4] = {0x12,0x34,0x56,0x78}; uint32 read[4]; uint32 i; BOOL bEncode; #if 0 //def _SYSDEBUG BOOL dataStreamLoggingSafe = dataStreamLogging; dataStreamLogging = TRUE; #endif //_SYSDEBUG cliPrintf("dsCliTest\n\r"); cliPrintf("data:\t\t"); for (i = 0; i < 4; i++) cliPrintf("0x%02x ", data[i]); cliPrintf("\n\r"); hResult = dsOpenStream(&ds, data, sizeof(data), dsMODE_READ | mode); if (hResult != NO_ERROR) return hResult; bEncode = FALSE; hResult = dsHandleBits(&ds, 4, &read[0], bEncode); if (hResult != NO_ERROR) return hResult; hResult = dsHandleBits(&ds, 4, &read[1], bEncode); if (hResult != NO_ERROR) return hResult; hResult = dsHandleBits(&ds, 8, &read[2], bEncode); if (hResult != NO_ERROR) return hResult; hResult = dsHandleBits(&ds, 16, &read[3], bEncode); if (hResult != NO_ERROR) return hResult; dsCloseStream(&ds); #if 0 //def _SYSDEBUG dataStreamLogging = dataStreamLoggingSafe; #endif //_SYSDEBUG cliPrintf("dsCliTest\n\r"); cliPrintf("read:\t\t"); for (i = 0; i < 4; i++) cliPrintf("0x%08x ", read[i]); cliPrintf("\n\r"); return hResult; }
void grayCliCallbackPrintValue(uint8 enc, int8 change) { uint32 oldvalue = 0; int32 newvalue = 0; oldvalue = grayCliPrintValue; newvalue = oldvalue + change; if (newvalue < 0x000000) newvalue = 0x000000; if (newvalue > 1000) newvalue = 1000; grayCliPrintValue = newvalue; cliPrintf("callBackPrintValue%i: change:%i oldvalue:%i newvalue:%i\n\r", enc, change, oldvalue, newvalue); // cliPrintf("callBackPrintValue%i: value:%i\n\r", enc, newvalue); }
HRESULT grayCliGetAccMode(uint32 encId) { HRESULT hResult = NO_ERROR; uint32 enc; uint32 accMode; char accModeStr[16]; uint32 all = GRAY_ENC_ITEMS; // cliPrintf("enc default accMode: %i\n\r", GRAY_ENC_ACC_MODE_DEFAULT); for (enc = 0; enc < GRAY_ENC_ITEMS; enc++) { if (encId == all || encId == enc) { hResult = grayEventGetAccMode(enc, &accMode); if (hResult != NO_ERROR) return hResult; switch (accMode) { case GRAY_ENC_ACC_MODE_NONE: sprintf(accModeStr, "none"); break; case GRAY_ENC_ACC_MODE_TYPE1: sprintf(accModeStr, "type1"); break; case GRAY_ENC_ACC_MODE_TYPE2: sprintf(accModeStr, "type2"); break; case GRAY_ENC_ACC_MODE_CUSTOM: sprintf(accModeStr, "custom"); break; default: sprintf(accModeStr, "unknown"); break; } cliPrintf("enc%i mode: accMode:%s (%i)\n\r", enc, accModeStr, accMode); } } return hResult; }
HRESULT grayCliGetMode(uint32 encId) { HRESULT hResult = NO_ERROR; uint32 enc; uint32 mode; char pollStr[16]; char modeStr[16]; uint32 all = GRAY_ENC_ITEMS; // cliPrintf("enc default mode: %i\n\r", GRAY_ENC_MODE_DEFAULT); sprintf(pollStr, "%s", grayEventGetPollEnable() ? "polling" : "interrupt"); for (enc = 0; enc < GRAY_ENC_ITEMS; enc++) { if (encId == all || encId == enc) { hResult = grayEventGetMode(enc, &mode); if (hResult != NO_ERROR) return hResult; switch (mode) { case GRAY_ENC_MODE_DIRECT: sprintf(modeStr, "direct"); break; case GRAY_ENC_MODE_DEFERRED: sprintf(modeStr, "deferred"); break; default: sprintf(modeStr, "unknown"); break; } cliPrintf("enc%i mode: %s %s (%i)\n\r", enc, pollStr, modeStr, mode); } } return hResult; }
static void dumpAESState(void) { BOOL bEnable; BOOL bLocked; uint8 master; uint16 aesStatus; aesRxGetEnable (&bEnable); bLocked = aesIsMasterLocked (); aesGetMasterClk(&master); aesGetStatus (&aesStatus); cliPrintf("AES State:\n\r"); cliPrintf("\tMaster : AES%i\n\r",master); cliPrintf("\tState : %s\n\r", bEnable ? (bLocked ? "Locked" : "Unlocked") : "Disabled"); cliPrintf("\tAES0 : %s V=%i\n\r", (aesStatus & AES_STAT_LOCK0) ? "Locked " : "Unlocked", (aesStatus & AES_STAT_VALIDITY0) ? 1 : 0); cliPrintf("\tAES1 : %s V=%i\n\r", (aesStatus & AES_STAT_LOCK1) ? "Locked " : "Unlocked", (aesStatus & AES_STAT_VALIDITY1) ? 1 : 0); cliPrintf("\tAES2 : %s V=%i\n\r", (aesStatus & AES_STAT_LOCK2) ? "Locked " : "Unlocked", (aesStatus & AES_STAT_VALIDITY2) ? 1 : 0); cliPrintf("\tAES3 : %s V=%i\n\r", (aesStatus & AES_STAT_LOCK3) ? "Locked " : "Unlocked", (aesStatus & AES_STAT_VALIDITY3) ? 1 : 0); }
HRESULT dsCliShow(void) { HRESULT hResult = NO_ERROR; #ifdef _LITTLE_ENDIAN cliPrintf("_LITTLE_ENDIAN:\t\tdefined\n\r"); #else //_LITTLE_ENDIAN cliPrintf("_LITTLE_ENDIAN:\t\tundefined\n\r"); #endif //_LITTLE_ENDIAN cliPrintf("dsMODE_PLATFORMENDIAN:\t%i\n\r", dsMODE_PLATFORMENDIAN); cliPrintf("dsMODE_NATIVE:\t\t%i\n\r", dsMODE_NATIVE); cliPrintf("dsMODE_BIGENDIAN:\t%i\n\r", dsMODE_BIGENDIAN); cliPrintf("dsMODE_LITTLEENDIAN:\t%i\n\r", dsMODE_LITTLEENDIAN); return hResult; }
void TorqueControl(void *pvParams) { uint8 buff[10]; int i = 0; int d = 0; EventBits_t uxBits; const TickType_t xTicksToWait = 5000; enum {ON, OFF} torquer_state = OFF; Real control_signal_r[3]; uint8 control_signal[3]; double state[13]; char output[20]; while(1) { if(xQueueReceive(controlSignalQ, state, 5000) == pdTRUE) { snprintf(output,50,"%f %f %f\n\0", state[0], state[1], state[2]); cliPrintf(output); } else { vTaskDelay(20); } /*d=0; uxBits = xEventGroupWaitBits(torqueSignalEG, 1<<0 | 1<<1 | 1<<2, pdTRUE, pdFALSE, xTicksToWait); if( ( uxBits & 1<<0 ) != 0 ) // update signal { if(xQueueReceive(controlSignalQ, control_signal_r, 0) == pdTRUE) { // scale in range of 0 to 100 % of 0.2 torquer maximum if(control_signal_r[0] > 0.2) { control_signal_r[0] = 0.2; } if(control_signal_r[1] > 0.2) { control_signal_r[1] = 0.2; } if(control_signal_r[2] > 0.2) { control_signal_r[2] = 0.2; } if(control_signal_r[0] < -0.2) { control_signal_r[0] = -0.2; } if(control_signal_r[1] < -0.2) { control_signal_r[1] = -0.2; } if(control_signal_r[2] < -0.2) { control_signal_r[2] = -0.2; } control_signal[0] = (signed char)(control_signal_r[0]*600); control_signal[1] = (signed char)(control_signal_r[1]*600); control_signal[2] = (signed char)(control_signal_r[2]*600); if(torquer_state == ON) { i++; taskENTER_CRITICAL(); i2cSetSlaveAdd(i2cREG1, 4); buff[0] = 1; buff[1] = ((uint8)control_signal[0]); buff[2] = ((uint8)control_signal[1]); buff[3] = ((uint8)control_signal[2]); i2cSetMode(i2cREG1, I2C_MASTER | I2C_TRANSMITTER | I2C_STOP_COND); i2cSetCount(i2cREG1, 4); i2cSetStart(i2cREG1); i2cSend(i2cREG1, 4, buff); taskEXIT_CRITICAL(); } } } else if( ( uxBits & 1<<1 ) != 0 ) // OFF signal { torquer_state = OFF; taskENTER_CRITICAL(); i2cSetSlaveAdd(i2cREG1, 4); buff[0] = 1; buff[1] = 0; buff[2] = 0; buff[3] = 0; i2cSetMode(i2cREG1, I2C_MASTER | I2C_TRANSMITTER | I2C_STOP_COND); i2cSetCount(i2cREG1, 4); i2cSetStart(i2cREG1); i2cSend(i2cREG1, 4, buff); taskEXIT_CRITICAL(); } else if( ( uxBits & 1<<2 ) != 0 ) // ON signal { torquer_state = ON; taskENTER_CRITICAL(); i2cSetSlaveAdd(i2cREG1, 4); buff[0] = 1; buff[1] = ((uint8)control_signal[0]); buff[2] = ((uint8)control_signal[1]); buff[3] = ((uint8)control_signal[2]); i2cSetMode(i2cREG1, I2C_MASTER | I2C_TRANSMITTER | I2C_STOP_COND); i2cSetCount(i2cREG1, 4); i2cSetStart(i2cREG1); i2cSend(i2cREG1, 4, buff); taskEXIT_CRITICAL(); } while(d < 50) { d++; }*/ } }
// SplashCB static HRESULT SplashCB(void) { HRESULT hResult = NO_ERROR; cliPrintf("* Running Dice JR/Mini 1394 Appl *\n"); if (isChipDiceJR()) { cliPrintf("* Chip Detected : DICE JR (TCD2220) *\n"); } else { cliPrintf("* Chip Detected : DICE Mini (TCD2210) *\n"); } cliPrintf("* Board S/N: %08d *\n", serialNo); cliPrintf("* Built with SDK Version: %02d.%02d.%02d, build %04d *\n", kTCAT_DICE_VERSION_MAJOR, kTCAT_DICE_VERSION_MINOR, kTCAT_DICE_VERSION_SUB, kTCAT_DICE_VERSION_BUILD); #ifdef _USE_OLD_VERSION_INFO cliPrintf("* Firmware Application Version: %02d.%02d *\n", diceApp_vendor_major_rev(), diceApp_vendor_minor_rev()); #else cliPrintf("* Firmware Application Version: %02d.%02d.%02d, build %04d *\n", diceApp_vendor_major_rev(), diceApp_vendor_minor_rev(), diceApp_vendor_sub_rev(), diceApp_vendor_build_rev()); #endif cliPrintf(diceApp_build_time()); cliPrintf("* MIDI is "); #ifdef USE_UART1_FOR_MIDI { cliPrintf("enabled."); } #else { cliPrintf("disabled."); } #endif cliPrintf(" *\n"); cliPrintf("**********************************************************\n"); cliPrintf("* Target: DICE EVM002 Evaluation Board *\n"); #ifdef _MLAN #ifdef _OPEN_MLAN cliPrintf("* Driver: Generic Transporter mLAN *\n"); #else // _OPEN_MLAN cliPrintf("* Driver: mLAN *\n"); #endif #elif defined _DICE_DRIVER cliPrintf("* Driver: DiceDriver *\n"); #elif defined _AVC cliPrintf("* Driver: AV/C *\n"); #else cliPrintf("* Driver: No Driver *\n"); #endif #ifdef _SPECIAL_PARTITION_MEMORY cliPrintf("* AVS special memory partitions *\n"); #endif #ifdef _EAP cliPrintf("* EAP is supported. *\n"); #endif uint8 cpldVer; BOOL cpldSupported; targetGetCPLDInfo (&cpldVer, &cpldSupported); cliPrintf("* *\n"); cliPrintf("* CPLD: (the CPLD handles Switch and LED's) *\n"); cliPrintf("* Ver: %01X.%01X %-44s*\n",(uint32)(cpldVer>>4)&0xf,cpldVer&0xf,cpldSupported?"Full LED/SW Support":"PLEASE UPDATE CPLD TO VER 1 OR HIGHER"); cliPrintf("**********************************************************\n"); return hResult; }
static void dumpADAT(void) { BOOL bEnable; BOOL bLocked; uADATRX_STATUS error; adatRxGetEnable (&bEnable); bLocked = adatIsLocked (); adatRxGetError(&error, TRUE); cliPrintf("ADAT Rx:\n\r"); cliPrintf("\tState : %s\n\r", bEnable ? (bLocked ? "Locked" : "Unlocked") : "Disabled"); cliPrintf("ADAT Errors R=Repeat, S=Slip\n\r"); cliPrintf("\tErrors : %c%c%\n\r", error.bit.u_run ? 'R' : ' ', error.bit.o_run ? 'S' : ' '); cliPrintf("ADAT Rx registers:\n\r"); cliPrintf("\tSETUP : 0x%04x\n\r", pDiceADATRx->setup.reg); cliPrintf("\tSTATUS : 0x%04x\n\r", pDiceADATRx->status.reg); cliPrintf("ADAT Tx registers:\n\r"); cliPrintf("\tUSER_SETUP : 0x%04x\n\r", pDiceADATTx->userSetup.reg); cliPrintf("\tMUX_SETUP : 0x%04x\n\r", pDiceADATTx->muxSetup.reg); cliPrintf("\tCH_MUTE : 0x%04x\n\r", pDiceADATTx->chMute.reg); }
static void dumpTDIF(void) { cliPrintf("TDIF Rx registers:\n\r"); cliPrintf("\tSETUP : 0x%04x\n\r", pDiceTDIFRx->setup.reg); cliPrintf("\tCH_SETUP[0] : 0x%04x\n\r", pDiceTDIFRx->chSetup[0].reg); cliPrintf("\tCH_SETUP[1] : 0x%04x\n\r", pDiceTDIFRx->chSetup[1].reg); cliPrintf("\tCH_SETUP[2] : 0x%04x\n\r", pDiceTDIFRx->chSetup[2].reg); cliPrintf("\tCH_SETUP[3] : 0x%04x\n\r", pDiceTDIFRx->chSetup[3].reg); cliPrintf("\tSTATUS : 0x%04x\n\r", pDiceTDIFRx->status.reg); cliPrintf("\tPHASE_DIFF : 0x%04x\n\r", pDiceTDIFRx->phaseDiff); cliPrintf("\tINVERSION : 0x%04x\n\r", pDiceTDIFRx->inversion.reg); cliPrintf("TDIF Tx registers:\n\r"); cliPrintf("\tCH_SETUP[0] : 0x%04x\n\r", pDiceTDIFTx->chSetup[0].reg); cliPrintf("\tCH_SETUP[1] : 0x%04x\n\r", pDiceTDIFTx->chSetup[1].reg); cliPrintf("\tCH_SETUP[2] : 0x%04x\n\r", pDiceTDIFTx->chSetup[2].reg); cliPrintf("\tCH_SETUP[3] : 0x%04x\n\r", pDiceTDIFTx->chSetup[3].reg); cliPrintf("\tCH_SETUP[4] : 0x%04x\n\r", pDiceTDIFTx->chSetup[4].reg); cliPrintf("\tCH_SETUP[5] : 0x%04x\n\r", pDiceTDIFTx->chSetup[5].reg); cliPrintf("\tCH_SETUP[6] : 0x%04x\n\r", pDiceTDIFTx->chSetup[6].reg); cliPrintf("\tCH_SETUP[7] : 0x%04x\n\r", pDiceTDIFTx->chSetup[7].reg); cliPrintf("\tCH_MUTE : 0x%04x\n\r", pDiceTDIFTx->chMute.reg); cliPrintf("\tINVERSION : 0x%04x\n\r", pDiceTDIFTx->inversion.reg); }
static void dumpI2S(void) { cliPrintf("I2S0 Rx registers:\n\r"); cliPrintf("\tCLK_SETUP : 0x%04x\n\r", pDiceI2SRx0->clkSetup.reg); cliPrintf("\tCH_SETUP[0] : 0x%04x\n\r", pDiceI2SRx0->chSetup[0].reg); cliPrintf("\tCH_SETUP[1] : 0x%04x\n\r", pDiceI2SRx0->chSetup[1].reg); cliPrintf("\tCH_SETUP[2] : 0x%04x\n\r", pDiceI2SRx0->chSetup[2].reg); cliPrintf("\tCH_SETUP[3] : 0x%04x\n\r", pDiceI2SRx0->chSetup[3].reg); cliPrintf("I2S0 Tx registers:\n\r"); cliPrintf("\tCLK_SETUP : 0x%04x\n\r", pDiceI2STx0->clkSetup.reg); cliPrintf("\tCH_SETUP[0] : 0x%04x\n\r", pDiceI2STx0->chSetup[0].reg); cliPrintf("\tCH_SETUP[1] : 0x%04x\n\r", pDiceI2STx0->chSetup[1].reg); cliPrintf("\tCH_SETUP[2] : 0x%04x\n\r", pDiceI2STx0->chSetup[2].reg); cliPrintf("\tCH_SETUP[3] : 0x%04x\n\r", pDiceI2STx0->chSetup[3].reg); cliPrintf("\tCH_MUTE : 0x%04x\n\r", pDiceI2STx0->chMute.reg); }
static void dumpClock(void) { cliPrintf("Clock registers:\n\r"); cliPrintf("\tSYNC_CLK_SEL : 0x%04x\n\r", pDiceClock->syncClkSel.reg); cliPrintf("\tROUTER_CLK_SEL : 0x%04x\n\r", pDiceClock->routerClkSel.reg); cliPrintf("\tWC_EC_SEL : 0x%04x\n\r", pDiceClock->wcEcSel.reg); cliPrintf("\tBLOCK_SYNC : 0x%04x\n\r", pDiceClock->blockSync.reg); cliPrintf("\tHPLL_CLK_SEL : 0x%04x\n\r", pDiceClock->hpllClkSel.reg); cliPrintf("\tSR_CNT_SEL : 0x%04x\n\r", pDiceClock->srCntSel.reg); cliPrintf("\tSR_MODE_SEL : 0x%04x\n\r", pDiceClock->srModeSel.reg); cliPrintf("\tRX_CLK_DMN_SEL : 0x%04x\n\r", pDiceClock->rxClkDmnSel.reg); cliPrintf("\tTX_CLK_DMN_SEL : 0x%04x\n\r", pDiceClock->txClkDmnSel.reg); cliPrintf("\tAESRX_MCK_SEL : 0x%04x\n\r", pDiceClock->aesRxMckSel.reg); cliPrintf("\tADATRX_MCK_SEL : 0x%04x\n\r", pDiceClock->adatRxMckSel.reg); cliPrintf("\tTDIFRX_MCK_SEL : 0x%04x\n\r", pDiceClock->tdifRxMckSel.reg); cliPrintf("\tADAT_SMUX_SEL : 0x%04x\n\r", pDiceClock->adatSMuxSel.reg); cliPrintf("\tPRESCALER_1 : 0x%04x\n\r", pDiceClock->prescaler1Sel); cliPrintf("\tPRESCALER_2 : 0x%04x\n\r", pDiceClock->prescaler2Sel); cliPrintf("\tHYBRID_PLL_SET : 0x%04x\n\r", pDiceClock->hybridPllSetup); cliPrintf("\tSR_COUNT_1 : 0x%04x\n\r", pDiceClock->srCount1); cliPrintf("\tSR_COUNT_2 : 0x%04x\n\r", pDiceClock->srCount2); cliPrintf("\tSR_COUNT_1MAX : 0x%04x\n\r", pDiceClock->srCount1Max); cliPrintf("\tSR_COUNT_2MAX : 0x%04x\n\r", pDiceClock->srCount2Max); }
static void dumpHPLL(DICE_HPLL *pDiceHPLL) { cliPrintf("HPLL registers:\n\r"); cliPrintf("\tcaf_enable : %3i", (unsigned long)pDiceHPLL->caf_enable); cliPrintf("\tfract_res : %3i\n\r", pDiceHPLL->fract_res); cliPrintf("\tcaf_select : %3i", pDiceHPLL->caf_select); cliPrintf("\tburst_len : %3i\n\r", pDiceHPLL->burst_len); cliPrintf("\tu_treshold : %3i", pDiceHPLL->u_treshold); cliPrintf("\tx1x2_mode : %3i\n\r", pDiceHPLL->x1x2_mode); cliPrintf("\tbandwidth_f : %3i", pDiceHPLL->bandwidth_f); cliPrintf("\tsink_e : %3i\n\r", pDiceHPLL->sink_e); cliPrintf("\tbandwidth_c : %3i", pDiceHPLL->bandwidth_c); cliPrintf("\tanchor_e : %3i\n\r", pDiceHPLL->anchor_e); cliPrintf("\tshape_f : %3i", pDiceHPLL->shape_f); cliPrintf("\te_anc_val : %3i\n\r", pDiceHPLL->e_anc_val); cliPrintf("\tshape_v : %3i", pDiceHPLL->shape_v); cliPrintf("\tedet_x1 : %3i\n\r", pDiceHPLL->edet_x1); cliPrintf("\tmax_slew_f : %3i", pDiceHPLL->max_slew_f); cliPrintf("\tedet_x2 : %3i\n\r", pDiceHPLL->edet_x2); cliPrintf("\tmax_slew_v : %3i", pDiceHPLL->max_slew_v); cliPrintf("\tediv_c : %3i\n\r", pDiceHPLL->ediv_c); cliPrintf("\tloos_thr : %3i", pDiceHPLL->loos_thr); cliPrintf("\tediv_f : %3i\n\r", pDiceHPLL->ediv_f); cliPrintf("\tmin_period : %3i", pDiceHPLL->min_period); cliPrintf("\tediv_s : %3i\n\r", pDiceHPLL->ediv_s); cliPrintf("\tmax_period : %3i", pDiceHPLL->max_period); cliPrintf("\tinvert_cde : %3i\n\r", pDiceHPLL->invert_cde); cliPrintf("\tndiv_f : %3i", pDiceHPLL->ndiv_f); cliPrintf("\thobble_cde : %3i\n\r", pDiceHPLL->hobble_cde); cliPrintf("\tndiv_e : %3i", pDiceHPLL->ndiv_e); cliPrintf("\tdivide_cj : %3i\n\r", pDiceHPLL->divide_cj); cliPrintf("\tndiv_b : %3i", pDiceHPLL->ndiv_b); cliPrintf("\tinvert_cj : %3i\n\r", pDiceHPLL->invert_cj); cliPrintf("\tphase_lag : %3i", pDiceHPLL->phase_lag); cliPrintf("\tmain_status : 0x%04x\n\r", pDiceHPLL->main_status); cliPrintf("\tinstance_id : 0x%04x", pDiceHPLL->instance_id); cliPrintf("\trevision_id : 0x%04x\n\r", pDiceHPLL->revision_id); }