/* Configure ADC ROM Driver and pripheral */ static int adcrom_config(void) { ADC_CFG_T cfg = { ADC_SEQ_A_CONFIG, ADC_SEQ_B_CONFIG, ADC_CONFIG, 0 /* Divider will be calculated during run time */ }; cfg.clkDiv = 0xFF; /* Configure the ADC */ ROM_ADC_Configure(hADC, &cfg); /* Calibrate the ADC */ if (ROM_ADC_Calibrate(hADC, Chip_Clock_GetSystemClockRate()) != LPC_OK) { DEBUGSTR("ERROR: Calibrating ADC\r\n"); while (1) {} } DEBUGSTR("ADC Initialized and Calibrated successfully!\r\n"); /* Channel configurations */ ROM_ADC_ConfigureCh(hADC, 0, ADC_CH_THRES_DATA | ADC_CH_THRES_SEL1 | ADC_CH_THRES_CROSSING); ROM_ADC_ConfigureCh(hADC, 1, ADC_CH_THRES_DATA); return 0; }
/* Function to initialize the IPC message queue */ void IPC_initMsgQueue(void *data, int size, int count) { struct ipc_queue *qrd; /* Sanity Check */ if (!size || !count || !data) { DEBUGSTR("ERROR:IPC Queue size invalid parameters\r\n"); while (1) {} } /* Check if size is a power of 2 */ if (count & (count - 1)) { DEBUGSTR("ERROR:IPC Queue size not power of 2\r\n"); while (1) { /* BUG: Size must always be power of 2 */ } } qrd = &q_ipc[CPUID_CURR]; memset(qrd, 0, sizeof(*qrd)); qrd->count = count; qrd->size = size; qrd->data = data; qrd->valid = QUEUE_MAGIC_VALID; if (!IPC_EventHandler) { IPC_EventHandler = IPC_EventHandler_sa; } }
/***************************************************************************** * Private functions ****************************************************************************/ static void PMC_Get_Wakeup_option(uint8_t *Wakeup_rtc) { FlagStatus exitflag; uint8_t buffer = 0xFF; DEBUGSTR(menu1); exitflag = RESET; while (exitflag == RESET) { /* Get user input */ buffer = DEBUGIN(); if ((buffer == 'W') || (buffer == 'w')) { DEBUGSTR("WAKEUP0 pin selected \r\n"); *Wakeup_rtc = 0; exitflag = SET; } if ((buffer == 'R') || (buffer == 'r')) { DEBUGSTR("RTC Alarm selected \r\n"); *Wakeup_rtc = 1; exitflag = SET; } } }
void DoneHooksReg() { #ifdef HOOKS_USE_VIRT_REGISTRY #ifdef _DEBUG //WARNING!!! OutputDebugString must NOT be used from ConEmuHk::DllMain(DLL_PROCESS_DETACH). See Issue 465 DEBUGSTR(L"ConEmuHk: Deinitializing registry virtualization!\n"); #endif if (gpRegKeyHooks) { free(gpRegKeyHooks); gpRegKeyHooks = NULL; } CloseRootKeys(); if (gpRegKeyStore) { gpRegKeyStore->Free(); free(gpRegKeyStore); gpRegKeyStore = NULL; } #ifdef _DEBUG //WARNING!!! OutputDebugString must NOT be used from ConEmuHk::DllMain(DLL_PROCESS_DETACH). See Issue 465 DEBUGSTR(L"ConEmuHk: Registry virtualization deinitialized!\n"); #endif #endif }
/* * FUNCTION: TaperDegreesToDistance * * PARAMETERS: p -- Pointer to Menu * * USES GLOBALS: * * DESCRIPTION: Convert the full angle degrees to inch/foot of diameter. * * * RETURNS: * */ int8 TaperDegreesToDistance(TMENU_DATA * p) { // Convert the included angle in degrees to inch/inch of diameter. p->Data.FloatValue = tan((p->Data.FloatValue)/2 * RADIANS_PER_DEGREE)*2; // Then check if metric measurements are wanted. if (p->Dependancy != (uint8)0) { // DEBUGSTR("To Metric Var is dependant on %02X\n",p->Dependancy ); // First get menu from FLASH into data structure memcpypgm2ram( (void *)&d, (MEM_MODEL rom void *)&MenuData[p->Dependancy], sizeof(TMENU_DATA) ); // Then test the flag. if (GetFlagVar(&d)) { // If the metric flag is set convert the value to metric. DEBUGSTR("Convert to Metric\n"); p->Data.FloatValue *= 25.4; return('m'); } else return('"'); } else return(' '); }
/* Using printf might cause text section overflow */ static void Print_Val(const char *str, uint32_t val) { char buf[9]; int ret; buf[8] = 0; DEBUGSTR(str); ret = Hex2Str(buf, val); DEBUGSTR(&buf[8 - ret]); DEBUGSTR("\r\n"); }
bool InitHooksReg() { bool lbRc = false; #ifdef HOOKS_USE_VIRT_REGISTRY CESERVER_CONSOLE_MAPPING_HDR* pInfo = GetConMap(); if (!pInfo || !(pInfo->isHookRegistry&1) || !*pInfo->sHiveFileName) return false; DEBUGSTR(L"ConEmuHk: Preparing for registry virtualization\n"); HookItem HooksRegistry[] = { /* ************************ */ {(void*)OnRegCloseKey, "RegCloseKey", advapi32}, {(void*)OnRegCreateKeyA, "RegCreateKeyA", advapi32}, {(void*)OnRegCreateKeyW, "RegCreateKeyW", advapi32}, {(void*)OnRegCreateKeyExA, "RegCreateKeyExA", advapi32}, {(void*)OnRegCreateKeyExW, "RegCreateKeyExW", advapi32}, {(void*)OnRegOpenKeyA, "RegOpenKeyA", advapi32}, {(void*)OnRegOpenKeyW, "RegOpenKeyW", advapi32}, {(void*)OnRegOpenKeyExA, "RegOpenKeyExA", advapi32}, {(void*)OnRegOpenKeyExW, "RegOpenKeyExW", advapi32}, {(void*)OnRegDeleteKeyA, "RegDeleteKeyA", advapi32}, {(void*)OnRegDeleteKeyW, "RegDeleteKeyW", advapi32}, /* ************************ */ {(void*)OnRegConnectRegistryA, "RegConnectRegistryA", advapi32}, {(void*)OnRegConnectRegistryW, "RegConnectRegistryW", advapi32}, /* ************************ */ {0} }; lbRc = (InitHooks(HooksRegistry) >= 0); if (lbRc) { PrepareHookedKeyList(); DEBUGSTR(L"ConEmuHk: Registry virtualization prepared\n"); // Если advapi32.dll уже загружена - можно сразу дернуть экспорты if (ghAdvapi32) { RegOpenKeyEx_f = (RegOpenKeyEx_t)GetProcAddress(ghAdvapi32, "RegOpenKeyExW"); RegCreateKeyEx_f = (RegCreateKeyEx_t)GetProcAddress(ghAdvapi32, "RegCreateKeyExW"); RegCloseKey_f = (RegCloseKey_t)GetProcAddress(ghAdvapi32, "RegCloseKey"); } } else { DEBUGSTR(L"ConEmuHk: Registry virtualization failed!\n"); } #else lbRc = true; #endif return lbRc; }
/** * @brief Main entry point * @return Nothing */ int main(void) { SPIFIobj *obj = &spifi_obj; uint32_t spifi_clk_mhz; SPIFIopers opers; int ret; spifi_rom_init(spifi); /* Initialize the board & LEDs for error indication */ Board_Init(); /* Since this code runs from SPIFI no special initialization required here */ prepare_write_data(data_buffer, sizeof(data_buffer)); spifi_clk_mhz = Chip_Clock_GetRate(CLK_MX_SPIFI) / 1000000; /* Typical time tCS is 20 ns min, we give 200 ns to be on safer side */ if (spifi_init(obj, spifi_clk_mhz / 5, S_RCVCLK | S_FULLCLK, spifi_clk_mhz)) { DEBUGSTR("Error initializing SPIFI interface!\r\n"); Board_LED_Set(1, 1); goto end_prog; } /* Prepare the operations structure */ memset(&opers, 0, sizeof(SPIFIopers)); opers.dest = (char *) SPIFI_WRITE_SECTOR_OFFSET; opers.length = sizeof(data_buffer); /* opers.options = S_VERIFY_PROG; */ /* NOTE: All interrupts must be disabled before calling program as * any triggered interrupts might attempt to run a code from SPIFI area */ ret = spifi_program(obj, (char *) data_buffer, &opers); if (ret) { DEBUGOUT("Error 0x%x: Programming of data buffer to SPIFI Failed!\r\n", ret); Board_LED_Set(1, 1); goto end_prog; } DEBUGSTR("SPIFI Programming successful!\r\n"); if (verify_spifi_data((uint8_t *) SPIFI_WRITE_SECTOR_ADDRESS, sizeof(data_buffer))) { DEBUGSTR("Error verifying the SPIFI data\r\n"); Board_LED_Set(1, 1); goto end_prog; } Board_LED_Set(0, 1); DEBUGSTR("SPIFI Data verified!\r\n"); end_prog: while(1) {__WFI();} }
/* Show RTC time in UT format */ static void showTime(uint32_t rtcCount) { struct tm currTime; #ifdef USE_CASCTIME char tempBuff[256]; #endif ConvertRtcTime(rtcCount, &currTime); #ifdef USE_CASCTIME DEBUGOUT(asctime_r(&currTime, tempBuff)); #else DEBUGOUT("Raw RTC tick value = %u\r\n", rtcCount); /* Todays date */ DEBUGOUT("DATE: %02d:%02d:%04d\r\n", currTime.tm_mon + 1, currTime.tm_mday, (currTime.tm_year + TM_YEAR_BASE)); /* Current time */ DEBUGOUT("TIME: %02d:%02d:%02d\r\n", currTime.tm_hour, currTime.tm_min, currTime.tm_sec); /* Day of week and year */ DEBUGOUT("tm_wday = %01d, tm_yday = %03d\r\n", currTime.tm_wday, currTime.tm_yday); #endif DEBUGSTR("\r\n"); }
/** * @brief main routine for ADC example * @return Function should not exit */ int main(void) { uint16_t dataADC; int j; SystemCoreClockUpdate(); Board_Init(); Init_ADC_PinMux(); DEBUGSTR("ADC Demo\r\n"); /* ADC Init */ Chip_ADC_Init(LPC_ADC, &ADCSetup); Chip_ADC_EnableChannel(LPC_ADC, ADC_CH0, ENABLE); while (1) { /* Start A/D conversion */ Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING); /* Waiting for A/D conversion complete */ while (Chip_ADC_ReadStatus(LPC_ADC, ADC_CH0, ADC_DR_DONE_STAT) != SET) {} /* Read ADC value */ Chip_ADC_ReadValue(LPC_ADC, ADC_CH0, &dataADC); /* Print ADC value */ DEBUGOUT("ADC value is 0x%x\r\n", dataADC); /* Delay */ j = 500000; while (j--) {} } /* Should not run to here */ return 0; }
/** * @brief MRT example main function * @return Status (This function will not return) */ int main(void) { int mrtch; /* Generic Initialization */ SystemCoreClockUpdate(); Board_Init(); DEBUGSTR("LPC15xx MRT Example \r\n"); /* MRT Initialization and disable all timers */ Chip_MRT_Init(); for (mrtch = 0; mrtch < MRT_CHANNELS_NUM; mrtch++) { Chip_MRT_SetDisabled(Chip_MRT_GetRegPtr(mrtch)); } /* Enable the interrupt for the MRT */ NVIC_EnableIRQ(MRT_IRQn); /* Enable timers 0 and 1 in repeat mode with different rates */ setupMRT(0, MRT_MODE_REPEAT, 2);/* 2Hz rate */ setupMRT(1, MRT_MODE_REPEAT, 5);/* 5Hz rate */ /* Enable timer 2 in single one mode with the interrupt restarting the timer */ setupMRT(2, MRT_MODE_ONESHOT, 7); /* Will fire in 1/7 seconds */ /* All processing and MRT reset in the interrupt handler */ while (1) { __WFI(); } return 0; }
void CConEmuPipe::Close() { SafeCloseHandle(mh_Pipe); SafeFree(pIn); SafeFree(pOut); DEBUGSTR(L"Pipe::Close()\n"); }
// Find the name of the DLL and inject it. BOOL Inject( LPPROCESS_INFORMATION ppi ) { DWORD len; WCHAR dll[MAX_PATH]; int type; #if (MYDEBUG > 0) if (GetModuleFileNameEx( ppi->hProcess, NULL, dll, lenof(dll) )) DEBUGSTR( L"%s", dll ); #endif type = ProcessType( ppi ); if (type == 0) return FALSE; len = GetModuleFileName( NULL, dll, lenof(dll) ); while (dll[len-1] != '\\') --len; #ifdef _WIN64 wsprintf( dll + len, L"ANSI%d.dll", type ); if (type == 32) InjectDLL32( ppi, dll ); else InjectDLL64( ppi, dll ); #else wcscpy( dll + len, L"ANSI32.dll" ); InjectDLL32( ppi, dll ); #endif return TRUE; }
BOOL WINAPI MyCreateProcessW( LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpThreadAttributes, LPSECURITY_ATTRIBUTES lpProcessAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) { PROCESS_INFORMATION pi; if (!CreateProcessW( lpApplicationName, lpCommandLine, lpThreadAttributes, lpProcessAttributes, bInheritHandles, dwCreationFlags | CREATE_SUSPENDED, lpEnvironment, lpCurrentDirectory, lpStartupInfo, &pi )) return FALSE; DEBUGSTR( L"CreateProcessW: \"%s\", \"%s\"", (lpApplicationName == NULL) ? L"" : lpApplicationName, (lpCommandLine == NULL) ? L"" : lpCommandLine ); Inject( &pi, lpProcessInformation, dwCreationFlags ); return TRUE; }
/** Initialize the CGI environment * This function registers the pairs of file's name and CGI function for the HTTPD server * @returns nothing*/ void initCGIs( void) { http_set_cgi_handlers(cgi_handlers, (sizeof (cgi_handlers) / sizeof (tCGI) ) ); DEBUGSTR("httpCGIHandlers registered...............[OK]\r\n"); return; }
BOOL HookAPIAllMod( PHookFn Hooks, BOOL restore ) { HANDLE hModuleSnap; MODULEENTRY32 me; BOOL fOk; // Take a snapshot of all modules in the current process. hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, GetCurrentProcessId() ); if (hModuleSnap == INVALID_HANDLE_VALUE) { DEBUGSTR( L"error: %S(%d)", __FILE__, __LINE__ ); return FALSE; } // Fill the size of the structure before using it. me.dwSize = sizeof(MODULEENTRY32); // Walk the module list of the modules. for (fOk = Module32First( hModuleSnap, &me ); fOk; fOk = Module32Next( hModuleSnap, &me )) { // We don't hook functions in our own module. if (me.hModule != hDllInstance && me.hModule != hKernel) { //attempting to ignore NVIDIA 3D wrapper modules that seem to be in conflict on some systems if (_wcsnicmp(me.szModule, L"nvd3d9wrap", 10) == 0) { DEBUGSTR(L"Ignoring %s", me.szModule); continue; } DEBUGSTR( (restore) ? L"Unhooking from %s" : L"Hooking in %s", me.szModule ); // Hook this function in this module. if (!HookAPIOneMod( me.hModule, Hooks, restore )) { CloseHandle( hModuleSnap ); return FALSE; } } } CloseHandle( hModuleSnap ); return TRUE; }
void showData(char *reg, uint16_t *dat) { int i, j; DEBUGSTR("Showing data from :"); DEBUGSTR(reg); DEBUGSTR("\r\n"); /* Hard coded for a 2x8 16-bit displays */ for (i = 0; i < 2; i++) { for (j = 0; j < 8; j++) { Print_Val16(*dat); dat++; } DEBUGSTR("\r\n"); } }
/* Prints the information of the M0/M4 image to screen */ static void print_image_info(const char *pre, const struct image_sig *img) { DEBUGSTR("***************************************\r\n"); DEBUGOUT("%s: Header found at %p\r\n", pre, img); DEBUGOUT("%s: Included Examples: %s%s%s%s%s\r\n", pre, img->capability & EX_BLINKY ? "BLINKY" : "", img->capability & EX_USBHOST ? ", USB_Host" : "", img->capability & EX_USBDEV ? ", USB_Device" : "", img->capability & EX_LWIP ? ", lwIP" : "", img->capability & EX_EMWIN ? ", emWin" : ""); DEBUGOUT("%s: OS Used: %s\r\n", pre, img->os == 1 ? "NONE (STANDALONE)" : (img->os == 2 ? "FreeRTOS" : "UCOS-III")); DEBUGOUT("%s: Built on %s %s\r\n", pre, img->build_date, img->build_time); DEBUGSTR("***************************************\r\n"); }
HMODULE WINAPI MyLoadLibraryW( LPCWSTR lpFileName ) { HMODULE hMod = LoadLibraryW( lpFileName ); if (hMod && hMod != hKernel) { DEBUGSTR( L"Hooking in %s (LoadLibraryW)", lpFileName ); HookAPIOneMod( hMod, Hooks, FALSE ); } return hMod; }
FARPROC WINAPI MyGetProcAddress( HMODULE hModule, LPCSTR lpProcName ) { PHookFn hook; FARPROC proc; proc = GetProcAddress( hModule, lpProcName ); if (proc) { if (hModule == hKernel) { // Ignore LoadLibrary so other hooks continue to work (our version // might end up at a different address). if (proc == Hooks[0].oldfunc || proc == Hooks[1].oldfunc) return proc; for (hook = Hooks+2; hook->name; ++hook) { if (proc == hook->oldfunc) { DEBUGSTR( L"GetProcAddress: %S", lpProcName ); return hook->newfunc; } } } else if (Hooks[0].apifunc) // assume if one is defined, all are { if (proc == Hooks[0].apifunc || proc == Hooks[1].apifunc) return proc; for (hook = Hooks+2; hook->name; ++hook) { if (proc == hook->apifunc) { DEBUGSTR( L"GetProcAddress: %S", lpProcName ); return hook->newfunc; } } } } return proc; }
int8 SetOnboardStepper(TMENU_DATA * p) { DEBUGSTR("Enabling SPI MicroStepper\n"); SSPSTAT = 0x40; // Transmit on clock high. SSPCON1 = 0x20; // FOsc/4, Enable SPI, Clock Idle Low. bMOTOR_LATCH = 0; SSPBUF = 0; fStepHappened = 0; // Prevent shutdown from doing anything to motor. MicroStep(0,0); // Set motor off. }
HMODULE WINAPI MyLoadLibraryExW( LPCWSTR lpFileName, HANDLE hFile, DWORD dwFlags ) { HMODULE hMod = LoadLibraryExW( lpFileName, hFile, dwFlags ); if (hMod && hMod != hKernel && !(dwFlags & LOAD_LIBRARY_AS_DATAFILE)) { DEBUGSTR( L"Hooking in %s (LoadLibraryExW)", lpFileName ); HookAPIOneMod( hMod, Hooks, FALSE ); } return hMod; }
/* Function to blink the LED to show the error code * caused by M0 image boot failure */ static void booting_m0_failure(uint32_t msec) { int32_t cnt = 60000 / (msec * 2); DEBUGSTR("ERROR: Boot failure!!\r\n"); while (cnt--) { Board_LED_Set(ERROR_LED, 1); MSleep(msec); Board_LED_Set(ERROR_LED, 0); MSleep(msec); } }
void CGestures::DumpGesture(LPCWSTR tp, const GESTUREINFO& gi) { wchar_t szDump[256]; _wsprintf(szDump, SKIPLEN(countof(szDump)) L"Gesture(x%08X {%i,%i} %s", (DWORD)gi.hwndTarget, gi.ptsLocation.x, gi.ptsLocation.y, tp); // tp - имя жеста switch (gi.dwID) { case GID_PRESSANDTAP: { DWORD h = LODWORD(gi.ullArguments); _wsprintf(szDump+_tcslen(szDump), SKIPLEN(32) L" Dist={%i,%i}", (int)(short)LOWORD(h), (int)(short)HIWORD(h)); break; } case GID_ROTATE: { DWORD h = LODWORD(gi.ullArguments); _wsprintf(szDump+_tcslen(szDump), SKIPLEN(32) L" %i", (int)LOWORD(h)); break; } } if (gi.dwFlags&GF_BEGIN) wcscat_c(szDump, L" GF_BEGIN"); if (gi.dwFlags&GF_END) wcscat_c(szDump, L" GF_END"); if (gi.dwFlags&GF_INERTIA) { wcscat_c(szDump, L" GF_INERTIA"); DWORD h = HIDWORD(gi.ullArguments); _wsprintf(szDump+_tcslen(szDump), SKIPLEN(32) L" {%i,%i}", (int)(short)LOWORD(h), (int)(short)HIWORD(h)); } if (gpSetCls->isAdvLogging >= 2) { gpConEmu->LogString(szDump); } else { #ifdef USE_DUMPGEST wcscat_c(szDump, L")\n"); DEBUGSTR(szDump); #endif } }
/* Prints an 8-bit value */ static void Print_Val16(uint16_t val) { char buf[] = "0xXXXX "; buf[5] = "0123456789ABCDEF"[val & 0x0F]; val >>= 4; buf[4] = "0123456789ABCDEF"[val & 0x0F]; val >>= 4; buf[3] = "0123456789ABCDEF"[val & 0x0F]; val >>= 4; buf[2] = "0123456789ABCDEF"[val & 0x0F]; DEBUGSTR(buf); }
//Initialise cgi environment int CGIinit( void) { // cgi_handler.pcCGIName = "/actuadores.cgi"; // // cgi_handler.pfnCGIHandler = actuatorsHandler; http_set_cgi_handlers(cgi_handlers, 2); DEBUGSTR("httpCGIHandler initialized............[OK]\r\n"); return 0; }
BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved ) { BOOL bResult = TRUE; HMODULE api; PHookFn hook; if (dwReason == DLL_PROCESS_ATTACH) { hDllInstance = hInstance; // save Dll instance handle DEBUGSTR( L"hDllInstance = %p", hDllInstance ); // Get the entry points to the original functions. hKernel = GetModuleHandleA( APIKernel ); for (hook = Hooks; hook->name; ++hook) { hook->oldfunc = GetProcAddress( hKernel, hook->name ); api = GetModuleHandleA( hook->lib ); if (api) hook->apifunc = GetProcAddress( api, hook->name ); } bResult = HookAPIAllMod( Hooks, FALSE ); OriginalAttr(); DisableThreadLibraryCalls( hInstance ); } else if (dwReason == DLL_PROCESS_DETACH) { if (lpReserved == NULL) { DEBUGSTR( L"Unloading" ); HookAPIAllMod( Hooks, TRUE ); } else { DEBUGSTR( L"Terminating" ); } } return( bResult ); }
/* Get a string to save from the UART */ static uint32_t MakeString(uint8_t *str) { int index, byte; char strOut[2]; /* Get a string up to 32 bytes to write into Flash */ DEBUGSTR("\r\nEnter a string to write into Flash\r\n"); DEBUGSTR("Up to 32 bytes in length, press ESC to accept\r\n"); /* Setup header */ strncpy((char *) str, CHKTAG, CHKTAG_SIZE); /* Read until escape, but cap at 32 characters */ index = 0; strOut[1] = '\0'; #if defined(DEBUG_ENABLE) byte = DEBUGIN(); while ((index < 32) && (byte != ESC_CHAR)) { if (byte != EOF) { strOut[0] = str[4 + index] = (uint8_t) byte; DEBUGSTR(strOut); index++; } byte = DEBUGIN(); } #else /* Suppress warnings */ (void) byte; (void) strOut; /* Debug input not enabled, so use a pre-setup string */ strncpy((char *) &str[4], "12345678", 8); index = 8; #endif str[3] = (uint8_t) index; return (uint32_t) index; }
/* initialization routine for Multicore examples */ static void prvSetupHardware(void) { SystemCoreClockUpdate(); Board_Init(); /* Time to Start M0APP */ if (M0Image_Boot(CPUID_M0APP, (uint32_t) BASE_ADDRESS_M0APP) < 0) { DEBUGSTR("Unable to BOOT M0APP Core!"); } #ifdef BASE_ADDRESS_M0SUB if (M0Image_Boot(CPUID_M0SUB, (uint32_t) BASE_ADDRESS_M0SUB) < 0) { DEBUGSTR("Unable to BOOT M0SUB Core!"); } #endif /* Initialize the IPC Queue */ IPCEX_Init(); /* Start the tick timer */ SysTick_Config(SystemCoreClock / 1000); }
/* * FUNCTION: TaperDistanceToDegrees * * PARAMETERS: p -- Pointer to Menu * * USES GLOBALS: * * DESCRIPTION: Convert taper in inch/ft to degrees. * * RETURNS: Nothing. * */ int8 TaperDistanceToDegrees(TMENU_DATA * p) { // Conversions are often dependant on whether another flag is set. if (p->Dependancy != (uint8)0) { // DEBUGSTR("To Imperial Var is dependant on %02X\n",p->Dependancy ); // First get menu from FLASH into data structure memcpypgm2ram( (void *)&d, (MEM_MODEL rom void *)&MenuData[p->Dependancy], sizeof(TMENU_DATA) ); // Then test the flag. if (GetFlagVar(&d)) { // If the metric flag is set convert the value to imperial. DEBUGSTR("Convert to Imperial\n"); p->Data.FloatValue /= 25.4; } } // Now we know we have imperial units in inch per inch and then degrees // finally change that to (included) angle degrees. p->Data.FloatValue = (atan(p->Data.FloatValue / 2) / RADIANS_PER_DEGREE) * 2; return(' '); }