void diceCliInstallTools(void) { HRESULT hResult = NO_ERROR; hResult += cliInstallCLIDescriptor(Sync_Descriptor); hResult += cliInstallCLIDescriptor(HPLL_Descriptor); hResult += cliInstallCLIDescriptor(Dump_Descriptor); hResult += cliInstallCLIDescriptor(DSAI_Descriptor); hResult += cliInstallCLIDescriptor(AES_Descriptor); hResult += cliInstallCLIDescriptor(BLOCKSYNC_Descriptor); hResult += cliInstallCLIDescriptor(I2S_RSMF_Descriptor); hResult += cliInstallCLIDescriptor(I2S_RS192_Descriptor); hResult += cliInstallCLIDescriptor(I2S_RSC_Descriptor); hResult += cliInstallCLIDescriptor(I2S_RSCI_Descriptor); hResult += cliInstallCLIDescriptor(I2S_RSDF_Descriptor); hResult += cliInstallCLIDescriptor(I2S_TSMF_Descriptor); hResult += cliInstallCLIDescriptor(I2S_TS192_Descriptor); hResult += cliInstallCLIDescriptor(I2S_TSC_Descriptor); hResult += cliInstallCLIDescriptor(I2S_TSCI_Descriptor); hResult += cliInstallCLIDescriptor(I2S_TSDF_Descriptor); hResult += cliInstallCLIDescriptor(I2S_DEFAULT_Descriptor); if (hResult != NO_ERROR) { cliOutputLine("error installing avs cli tools"); } }
void diceCliInstallTools(void) { HRESULT hResult = NO_ERROR; hResult += cliInstallCLIDescriptor(clkSrc_Descriptor); hResult += cliInstallCLIDescriptor(Dump_Descriptor); hResult += cliInstallCLIDescriptor(AES_Descriptor); hResult += cliInstallCLIDescriptor(AES_ProModeDescriptor); hResult += cliInstallCLIDescriptor(AES_CopyProtectDescriptor); hResult += cliInstallCLIDescriptor(AES_PreEmphasisDescriptor); hResult += cliInstallCLIDescriptor(AES_CategoryDescriptor); hResult += cliInstallCLIDescriptor(BLOCKSYNC_Descriptor); hResult += cliInstallCLIDescriptor(diceClkSync_Descriptor); hResult += cliInstallCLIDescriptor(diceClkMode_Descriptor); hResult += cliInstallCLIDescriptor(diceClkEClk_Descriptor); hResult += cliInstallCLIDescriptor(diceClkReset_Descriptor); hResult += cliInstallCLIDescriptor(diceAESEnable_Descriptor); hResult += cliInstallCLIDescriptor(diceAESSetMasterClk_Descriptor); hResult += cliInstallCLIDescriptor(diceAESDualwire_Descriptor); hResult += cliInstallCLIDescriptor(diceAdatEnable_Descriptor); if (hResult != NO_ERROR) { cliOutputLine("error installing dice cli tools"); } //This is a hack, zluo hpllCliInstallTools(); }
HRESULT cliBuiltInTool_SPLASH(void) { HRESULT hResult = NO_ERROR; cliOutputLine(""); cliOutputLine("**********************************************************"); cliOutputLine("* TC Command Line Interface System *"); cliOutputLine("* Copyright 2003-2011 by TC Applied Technologies Ltd. *"); cliOutputLine("**********************************************************"); if (cliBuiltInToolSplashCB != NULL) { hResult = (cliBuiltInToolSplashCB)(); } return hResult; }
HRESULT lmPrintList(LM_CONTEXT* list, LM_PRINT_LIST_ELEM_CB callback) { HRESULT hResult = NO_ERROR; LM_ELEMENT* elem = 0; uint32 count = 0; if (list == NULL) { hResult = E_NULL_PTR; sysLogError(hResult, __LINE__, moduleName); return hResult; } cliPrintf("lmPrintList:\n\r"); cliPrintf("listsize:\t%i\n\r", list->listsize); cliPrintf("nextfree:\t%i\n\r", list->nextfree); cliPrintf("elemsize:\t%i\n\r", list->elemsize); cliPrintf("allocated:\t%i\n\r", list->allocated); cliPrintf("elemcount:\t%i\n\r", list->elemcount); cliPrintf("mode:\t\t%s\n\r", (list->mode & LM_LISTMODE_EXCLUSIVEACCESS) ? "LM_LISTMODE_EXCLUSIVEACCESS" : "unknown"); cliPrintf("lmMutexSemID:\t%i\n\r", list->lmMutexSemID); // walk through the list elements elem = (LM_ELEMENT*) &(list->elements); for (count = 0; count < list->elemcount; count++) { if (lmCheckElementAllocated(elem) == NO_ERROR) { cliOutputLine("------------------------------------"); cliPrintf("element[%i]:\n\r", count); cliPrintf("position:\t%i\n\r", elem->position); cliPrintf("flags:\t\t%s%s\n\r", (elem->flags & ELEMFLAG_LOCKED) ? "ELEMFLAG_LOCKED" : "", (elem->flags & ELEMFLAG_AVAILABLE) ? "ELEMFLAG_AVAILABLE" : ""); if (callback) { (callback) (&(elem->data)); } } lmMoveAheadElementSize(list->elemsize, &elem); } cliOutputLine("------------------------------------"); return hResult; }
void memTestCliInstallTools(void) { HRESULT hResult = NO_ERROR; hResult += cliInstallCLIDescriptor(memTest_Descriptor); if (hResult != NO_ERROR) { cliOutputLine("error installing memTest cli tools"); } }
void dsCliInstallTools(void) { HRESULT hResult = NO_ERROR; hResult += cliInstallCLIDescriptor(dsCliShow_Descriptor); hResult += cliInstallCLIDescriptor(dsCliTest_Descriptor); if (hResult != NO_ERROR) { cliOutputLine("error installing ds cli tools"); } }
HRESULT avsTestCliInstallTools(void) { HRESULT hResult = NO_ERROR; hResult += cliInstallCLIDescriptor(avsCapture_Descriptor); hResult += cliInstallCLIDescriptor(avsDump_Descriptor); if (hResult != NO_ERROR) { cliOutputLine("error installing avsTest cli tools"); } return hResult; }
void myAppCliInstallTools(void) { HRESULT hResult = NO_ERROR; // This is where the developer will put her CLI tool installs // for example: // hResult += cliInstallCLIDescriptor(MyAppCli_Descriptor); // ... if (hResult != NO_ERROR) { cliOutputLine("error installing myApp cli tools"); } }
void grayCliInstallTools(void) { HRESULT hResult = NO_ERROR; hResult += cliInstallCLIDescriptor(grayCliSetup_Descriptor); hResult += cliInstallCLIDescriptor(grayCliSetMode_Descriptor); hResult += cliInstallCLIDescriptor(grayCliGetMode_Descriptor); hResult += cliInstallCLIDescriptor(grayCliSetAccMode_Descriptor); hResult += cliInstallCLIDescriptor(grayCliGetAccMode_Descriptor); hResult += cliInstallCLIDescriptor(grayCliCallback_Descriptor); hResult += cliInstallCLIDescriptor(grayCliIntLog_Descriptor); //hResult += cliInstallCLIDescriptor(grayCliVolume_Descriptor); if (hResult != NO_ERROR) { cliOutputLine("error installing gray cli tools"); } }
void hpllCliInstallTools(void) { HRESULT hResult = NO_ERROR; hResult += cliInstallCLIDescriptor(hpllDivider_Descriptor); hResult += cliInstallCLIDescriptor(hpllPhaseOffset_Descriptor); hResult += cliInstallCLIDescriptor(hpllJitterBW_Descriptor); hResult += cliInstallCLIDescriptor(hpllMaxGliderRate_Descriptor); hResult += cliInstallCLIDescriptor(hpllClock_Descriptor); hResult += cliInstallCLIDescriptor(hpllCoast_Descriptor); hResult += cliInstallCLIDescriptor(hpllReference_Descriptor); hResult += cliInstallCLIDescriptor(hpllEnable_Descriptor); hResult += cliInstallCLIDescriptor(hpllDump_Descriptor); hResult += cliInstallCLIDescriptor(hpllReset_Descriptor); if (hResult != NO_ERROR) { cliOutputLine("error installing hpll cli tools"); } }
void mixer8CliInstallTools(void) { HRESULT hResult = NO_ERROR; hResult += cliInstallCLIDescriptor(mixer8GetMaster_Descriptor); hResult += cliInstallCLIDescriptor(mixer8SetMaster_Descriptor); hResult += cliInstallCLIDescriptor(mixer8GetChannel_Descriptor); hResult += cliInstallCLIDescriptor(mixer8SetChannel_Descriptor); hResult += cliInstallCLIDescriptor(mixer8SetAux_Descriptor); hResult += cliInstallCLIDescriptor(mixer8GetAux_Descriptor); hResult += cliInstallCLIDescriptor(mixer8SetCoef_Descriptor); hResult += cliInstallCLIDescriptor(mixer8Dump_Descriptor); hResult += cliInstallCLIDescriptor(mixer8DumpChannel_Descriptor); hResult += cliInstallCLIDescriptor(mixer8ReadOverFlow_Descriptor); if (hResult != NO_ERROR) { cliOutputLine("error installing mixer8 cli tools"); } }
void cliBuiltInInstallTools(void) { HRESULT hResult = NO_ERROR; hResult += cliInstallCLIDescriptor(ENV_Descriptor); hResult += cliInstallCLIDescriptor(GET_Descriptor); hResult += cliInstallCLIDescriptor(SET_Descriptor); hResult += cliInstallCLIDescriptor(SETM_Descriptor); hResult += cliInstallCLIDescriptor(GMS_Descriptor); hResult += cliInstallCLIDescriptor(DUMP_Descriptor); hResult += cliInstallCLIDescriptor(SPLASH_Descriptor); hResult += cliInstallCLIDescriptor(EXIT_Descriptor); hResult += cliInstallCLIDescriptor(RESET_Descriptor); hResult += cliInstallCLIDescriptor(ECHO_Descriptor); hResult += cliInstallCLIDescriptor(PROMPT_Descriptor); if (hResult != NO_ERROR) { cliOutputLine("error installing built-in cli tools"); } }
void myAppCliInstallTools(void) { HRESULT hResult = NO_ERROR; // This is where the developer will put her CLI tool installs // for example: // hResult += cliInstallCLIDescriptor(evmSpi_Descriptor); // ... hResult += cliInstallCLIDescriptor(evmModes_Descriptor); hResult += cliInstallCLIDescriptor(evmMode_Descriptor); hResult += cliInstallCLIDescriptor(evmMidi_Descriptor); hResult += cliInstallCLIDescriptor(meterMode_Descriptor); hResult += cliInstallCLIDescriptor(meterCfg_Descriptor); hResult += cliInstallCLIDescriptor(evmAC3out_Descriptor); hResult += cliInstallCLIDescriptor(evmMode11rxCfg_Descriptor); hResult += cliInstallCLIDescriptor(evmMode11txCfg_Descriptor); if (hResult != NO_ERROR) { cliOutputLine("error installing myApp cli tools"); } }
HRESULT cliBuiltInTool_GET(uint32 argc, char** argv) { HRESULT hResult = NO_ERROR; char* addressarg = 0; uint32 size = 0; char tempstring[kTempBufferSize]; uint32 displaytype = kCLI_DISPLAYTYPE_HEX; uint32 oldvalue = 0; uint32 newvalue = 0; CLIVariableChangedCallback varcallback = 0; CLIDescriptor* variable = 0; uint32 address = 0; // Make sure that the minimum number of arguments exists if (argc < 2) { hResult = E_CLI_TOOFEWARGUMENTS; sysLogError(hResult, __LINE__, moduleName); return hResult; } if (argc > 4) { hResult = E_CLI_TOOMANYARGUMENTS; sysLogError(hResult, __LINE__, moduleName); return hResult; } addressarg=argv[1]; // get address and size of the variable. hResult = cliBuiltInToolGetAddress(addressarg, &address, &size, &varcallback, &displaytype); if (hResult != NO_ERROR) return hResult; // Get the old value hResult = cliBuiltInToolGetValue(addressarg, address, size, varcallback, &oldvalue); if (hResult != NO_ERROR) return hResult; // figure out which METHOD the user is intending to use. // DIRECT BIT ACCESS METHOD: // This method handles the set tool form of: // get <variable|address> bit X if (argc>=4 && strcmp(argv[2],"bit")==0) { uint32 bitnumber = 0; uint32 mask = 1; // Figure out which bit to get. hResult = cliBuiltInToolGetNumber(3, argv, variable, &bitnumber); if (hResult != NO_ERROR) return hResult; if (bitnumber > size) { cliOutputLine("GET ERROR: the bit value was out of range."); return hResult; } // Check for an alternative display type. displaytype = kCLI_DISPLAYTYPE_BOOLEAN; // create the mask we require. mask = mask << (bitnumber-1); newvalue = oldvalue & mask; } // SIMPLE METHOD // This function handles the simplest method of get: // get <variable|address> [binary|hex|decimal|boolean] if (argc >= 2 && argc <= 3) { // Check for an alternative display type. if (argc == 3) { if (strcmp("binary",argv[2])==0) { displaytype=kCLI_DISPLAYTYPE_BINARY; } if (strcmp("boolean",argv[2])==0) { displaytype=kCLI_DISPLAYTYPE_BOOLEAN; } if (strcmp("decimal",argv[2])==0) { displaytype=kCLI_DISPLAYTYPE_DECIMAL; } if (strcmp("hex",argv[2])==0) { displaytype=kCLI_DISPLAYTYPE_HEX; } } newvalue = oldvalue; } // Again use the appropriate pointer, which matches the specified size // of the variable. This gets rid of the problems with having to // worry about byte ordering. if (kCLI_DISPLAYTYPE_HEX==displaytype) { switch (size) { case 32: sprintf(tempstring,"%s= 0x%08X",addressarg,newvalue); break; case 24: sprintf(tempstring,"%s= 0x%06X",addressarg,newvalue); break; case 16: sprintf(tempstring,"%s= 0x%04X",addressarg,newvalue); break; case 8: sprintf(tempstring,"%s= 0x%02X",addressarg,newvalue); break; } } if (kCLI_DISPLAYTYPE_DECIMAL==displaytype) { sprintf(tempstring,"%s= %d",addressarg,newvalue); } if (kCLI_DISPLAYTYPE_BOOLEAN==displaytype) { sprintf(tempstring,"%s= ",addressarg); if (newvalue) { strcat(tempstring,"true"); } else { strcat(tempstring,"false"); } } if (kCLI_DISPLAYTYPE_BINARY==displaytype) { uint32 i = 0; sprintf(tempstring,"%s= ",addressarg); for (i = size; i > 0; i--) { uint32 mask = (uint32) (1 << (i-1)); if ((newvalue) & mask) { strcat(tempstring,"1"); } else { strcat(tempstring,"0"); } } } cliOutputLine(tempstring); return hResult; }
HRESULT cliBuiltInTool_ENV(uint32 argc, char** argv) { HRESULT hResult = NO_ERROR; uint32 counter=0; CLIDescriptor** elem=0; uint32 index=0; char tempstring[80]; argc = argc; argv = argv; cliOutputLine("Environment Variables:"); cliOutputLine("------------------------------------------------------------"); while (lmGetNthElement(cliEnvironmentList, (void **) &elem, counter++, &index) == NO_ERROR) { char* varname = 0; uint32 value = 0; uint32* pValue = 0; uint32 displaytype = 0; uint32 displaysize = 32; char* variablefields = NULL; char spacer[40]; CLIVariableChangedCallback varcallback = 0; kvGetValue(*elem, kCLI_Name, (uint32*)&varname); kvGetValue(*elem, kCLI_Variable,(uint32*)&pValue); kvGetValue(*elem, kCLI_VariableDisplayType, &displaytype); kvGetValue(*elem, kCLI_VariableSize, &displaysize); kvGetValue(*elem, kCLI_Function, (uint32*)&varcallback); kvGetValue(*elem, kCLI_VariableBitFields, (uint32*)&variablefields); memset(spacer,' ',ARRAYSIZE(spacer)); spacer[24-strlen(varname)]=0; if (varcallback) { // For virtual variable, it will have a varcallback, that we can ask for the value of the variable. hResult = (varcallback)(kCLI_VariableCallbackOperation_GET,varname,0L,&value); if (hResult != NO_ERROR) { sprintf(tempstring,"%s%s= N/A",varname,spacer); cliOutputLine(tempstring); hResult = NO_ERROR; continue; } } else { // For normal variables which just point to a place in memory. if (pValue) { value=*pValue; } } if (varname) { if (kCLI_DISPLAYTYPE_HEX==displaytype) { switch (displaysize) { case 32: sprintf(tempstring,"%s%s= 0x%08X",varname,spacer,value); break; case 24: sprintf(tempstring,"%s%s= 0x%06X",varname,spacer,value); break; case 16: sprintf(tempstring,"%s%s= 0x%04X",varname,spacer,value); break; case 8: sprintf(tempstring,"%s%s= 0x%02X",varname,spacer,value); break; } cliOutputRaw(tempstring); } if (kCLI_DISPLAYTYPE_DECIMAL==displaytype) { sprintf(tempstring,"%s%s= %d",varname,spacer,value); cliOutputRaw(tempstring); } if (kCLI_DISPLAYTYPE_BOOLEAN==displaytype) { sprintf(tempstring,"%s%s= ",varname,spacer); if (value) { strcat(tempstring,"true"); } else { strcat(tempstring,"false"); } cliOutputRaw(tempstring); } if (kCLI_DISPLAYTYPE_BINARY==displaytype) { uint32 i = 0; sprintf(tempstring,"%s%s= ",varname,spacer); for (i = displaysize; i > 0; i--) { uint32 mask = (uint32) (1 << (i-1)); if ((value) & mask) { strcat(tempstring,"1"); } else { strcat(tempstring,"0"); } } cliOutputRaw(tempstring); } // Check to see if we should display fields in the variables. if (variablefields) { cliPrintVariableFields(value,variablefields); } cliOutputLine(" "); } lmReleaseElement(cliEnvironmentList,index); } return hResult; }
HRESULT cliBuiltInTool_SET(uint32 argc, char** argv) { HRESULT hResult = NO_ERROR; char* addressarg = 0; uint32 address = 0; uint32 size = 32; uint32 oldvalue = 0; uint32 newvalue = 0; CLIVariableChangedCallback varcallback = 0; CLIDescriptor* variable = 0; uint32 index = 0; BOOL bNewValueSet = FALSE; // Make sure that the minimum number of arguments exists if (argc < 3) { hResult = E_CLI_TOOFEWARGUMENTS; sysLogError(hResult, __LINE__, moduleName); return hResult; } if (argc > 6) { hResult = E_CLI_TOOMANYARGUMENTS; sysLogError(hResult, __LINE__, moduleName); return hResult; } index++; // index = 1 addressarg = argv[index]; // get address and size of the variable. hResult = cliBuiltInToolGetAddress(addressarg, &address, &size, &varcallback, NULL); if (hResult != NO_ERROR) return hResult; // get the old value hResult = cliBuiltInToolGetValue(addressarg, address, size, varcallback, &oldvalue); if (hResult != NO_ERROR) return hResult; // figure out which METHOD the user is intending to use. // DIRECT BIT ACCESS METHOD: // This method handles the set tool form of: // set <variable|address> bit X <off|on> index++; // index = 2 if (index < argc && strcmp(argv[index],"bit")==0) { uint32 bitnumber=0; uint32 mask=1; index++; // index = 3 // the next two arguments should be <number> <on|off> hResult = cliBuiltInToolGetNumber(index, argv, variable, &bitnumber); if (hResult != NO_ERROR) return hResult; if (bitnumber > size) { cliOutputLine("SET ERROR: the bit value was out of range."); return hResult; } // create the mask we require. mask = mask << (bitnumber-1); mask = ~mask; newvalue = oldvalue & mask; bNewValueSet = TRUE; // If the last argument is valid then turn on the bit. index++; // index = 4 if (strcmp(argv[index],"on")!=0 && strcmp(argv[index],"off") !=0) { cliOutputLine("SET ERROR: Argument #5 must be either 'on'|'off'."); return hResult; } if (strcmp(argv[index],"on")==0) { mask = 1; mask = mask << (bitnumber-1); newvalue = newvalue | mask; } } // AND'd method // This handles the set of form: // set <variable|address> and N // index = 2 if (index < argc && strcmp(argv[index],"and")==0) { uint32 value = 0; index++; // index = 3 hResult = cliBuiltInToolGetNumber(index, argv, variable, &value); if (hResult != NO_ERROR) return hResult; newvalue = oldvalue & value; bNewValueSet = TRUE; index++; // index = 4 } // OR'd method // This handles the set of form: // set <variable|address> or N // index = 2 or 4 if (index < argc && strcmp(argv[index],"or")==0) { uint32 value = 0; index++; // index = 3 or 5 hResult = cliBuiltInToolGetNumber(index, argv, variable, &value); if (hResult != NO_ERROR) return hResult; if (bNewValueSet == TRUE) { oldvalue = newvalue; } newvalue = oldvalue | value; bNewValueSet = TRUE; index++; // index = 4 or 6 } // SIMPLE METHOD // This function handles the simplest method of set: // set <variable|address> <newvalue> if (index < argc && index == 2) { uint32 value = 0; hResult = cliBuiltInToolGetNumber(index, argv, variable, &value); if (hResult != NO_ERROR) return hResult; newvalue = value; bNewValueSet = TRUE; } hResult = cliBuiltInToolSetValue(addressarg, address, size, varcallback, oldvalue, newvalue); if (hResult != NO_ERROR) return hResult; return hResult; }
void targetVendorDefsPrintVendorID(uint32 vendorID) { cliPrintf("vendorID: 0x%06x\n\r", vendorID); cliOutputLine("-----------------------------------------------------------------------"); }