/***************************************************************************** * Enters 'bootloader mode' where a new encrypted firmware upgrade can be * sent over UART. *****************************************************************************/ void enterBootloaderMode(void) { FLASH_init(); /* Enable UART */ BLUART_init(); /* If the current firmware is invalid, but temp storage is * enabled and contains a valid firmware, copy this firmware * to boot region immediately. */ if ( USE_TEMP_STORAGE && !isFirmwareValid() && isTempStorageValid() ) { copyFirmwareFromTempStorage(); markFirmwareAsVerified(); } /* Check if bootloader pin is pulled low. If it is left high * enter EM2 to save power. The MCU will wake up when pin is * pulled low. */ if ( GPIO_PinInGet(BOOTLOADER_PIN) ) { enterLowPowerWait(); } /* Wait for commands over UART */ commandLoop(); }
int SC_TerminalClient::run(int argc, char** argv) { Options& opt = mOptions; if (!parseOptions(argc, argv, opt)) { return mReturnCode; } // finish argv processing const char* codeFile = 0; if (argc > 0) { codeFile = argv[0]; opt.mDaemon = true; argv++; argc--; } opt.mArgc = argc; opt.mArgv = argv; // read library configuration file if (opt.mLibraryConfigFile) { int argLength = strlen(opt.mLibraryConfigFile); SC_LanguageConfig::readLibraryConfigYAML(opt.mLibraryConfigFile); } else SC_LanguageConfig::readDefaultLibraryConfig(); // initialize runtime initRuntime(opt); // startup library mShouldBeRunning = true; compileLibrary(); // enter main loop if (codeFile) executeFile(codeFile); if (opt.mCallRun) runMain(); if (opt.mDaemon) { daemonLoop(); } else { initInput(); if( shouldBeRunning() ) startInput(); if( shouldBeRunning() ) commandLoop(); endInput(); cleanupInput(); } if (opt.mCallStop) stopMain(); // shutdown library shutdownLibrary(); flush(); shutdownRuntime(); return mReturnCode; }
int main(void) { #ifdef DEBUG_TEST_LOOP testMode(); #endif init(); commandLoop(); }
int main( int argc, char** argv ) { int listensock; struct sockaddr_in server; struct sockaddr_in client; int clientlen; if ( ( listensock = socket( AF_INET, SOCK_STREAM, 0 ) ) == -1 ) { perror( "Could not create server socket for transfer" ); return -1; } server.sin_family = AF_INET; server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons( TRANSFERPORT ); if ( bind( listensock, (struct sockaddr *)&server, sizeof(server) ) == -1 ) { perror( "Could not bind server socket for transfer" ); close( listensock ); return -1; } if ( listen( listensock, 1 ) == -1 ) { perror( "Could not enter listen state for transfer" ); close( listensock ); return -1; } clientlen = sizeof( client ); if ( ( sock = accept( listensock, (struct sockaddr*)&client, &clientlen ) ) == -1 ) { perror( "Could not accept connection for transfer" ); close( listensock ); return -1; } // Handle the commands if ( commandLoop() == -1) { close( sock ); close( listensock ); exit( EXIT_FAILURE ); } // Cleanup close( sock ); close( listensock ); return EXIT_SUCCESS; }
bool_t exhaustive_query(const char * prefix) { RainbowTable_t * rainbowTable = NULL; char password[MAX_PASSWORD_LEN]; if (verifyDEHTExists(prefix)) { rainbowTable = initializeExaustiveTable(prefix, password, sizeof(password) - 1); if (NULL != rainbowTable) { commandLoop(rainbowTable, password); finalizeExaustiveTable(rainbowTable); return TRUE; } } return FALSE; }
/*! \brief Main loop. * * Most of the action is interrupt driven. * * @return Never exits */ void main(void) { EnableInterrupts; /* enable interrupts */ //TERMIO_Init(); //initdebugMessageBuffer(); //dprint("main():Starting\r\n"); autoInitClock(); // initCrystalClock(clockFactors[clksel_12MHz]); #if (DEBUG&SCI_DEBUG) != 0) debugSCIInit(); debugPuts("main(): Starting\r"); #endif init(); commandLoop(); // doesn't return // for(;;) { // dprint("main():Waiting\r\n"); // wait(); // } }
void SC_TerminalClient::daemonLoop() { commandLoop(); }