//------------------------------ // Main game loop //------------------------------ int main(int argc, char* argv[]) { srand(time(0)); if(sys_init() == false) { return 1; } if(sys_loadfiles() == false) { return 1; } set_clips(); sys_configload(); while(quit == false) { startTimer = SDL_GetTicks(); sys_input(); game_logic(); draw_everything(); //Update the screen if(SDL_Flip(screen) == -1) { return 1; } endTimer = SDL_GetTicks(); deltaTimer = endTimer - startTimer; if ( deltaTimer < ( 1000 / FPS )) { SDL_Delay( ( 1000 / FPS ) - deltaTimer ); } } sys_configupdate(); sys_cleanup(); return 0; }
/*--- codigo de la funcion ---*/ int Main(void){ char *pt_str = str; leds_off(); sys_init(); // inicializacion de la placa, interrupciones, puertos Eint4567_init(); keyboard_init(); Uart_Init(115200); // inicializacion de la Uart Uart_Config(); // configuración de interrupciones y buffers while(1){ *pt_str = Uart_Getch1(); // leer caracter if(pt_str[0] == 'L'){ led1_on(); led2_off(); } else if (pt_str[0] == 'R'){ led2_on(); led1_off(); } else { D8Led_symbol(pt_str[0]-'0'); } } }
int mymain(void) { char buf[100]; // system sys_init(); // uart init uart_init(); //puts("hello, world! \n"); puts("\n\n" __DATE__ " " __TIME__ "\n"); puts("welcome to my boot v1.0 \n"); // UTXH0 -> data while (1) { puts("akaedu $ "); gets(buf); puts("your input:"); puts(buf); puts("\n"); } while(1); return 0; }
int main(int argc, char *argv[]) { log_init(NAME); if (options_parse(&argc, argv) != 0) { exit(1); } sys_init(); if (comm_init()) { exit(2); } log_str("Test mode: %d", opt_mode); if (opt_mode) { comm_sink_register("A", (comm_sink_func_t) sink_event, NULL); comm_source_register("B", 0); } else { comm_sink_register("B", (comm_sink_func_t) sink_event, NULL); comm_source_register("A", 0); } sys_run(); return 0; }
int main(void) { sys_init(); oled_init(); timer_init(TIMER1); timer_set_ms(TIMER1,16); // Initial parameters uint8_t x = OLED_WIDTH / 2; // x initial position uint8_t y = OLED_HEIGHT / 2; // y initial position uint8_t dx = 1; // x speed uint8_t dy = 1; // y speed oled_clearDisplay(); oled_drawPixel(x,y); oled_render(); timer_start(TIMER1); while(1) { if(oledUpdate) { LED ^= 1; oled_clearDisplay(); move(&x, &y, &dx, &dy); oled_render(); oledUpdate = 0; } } return (0); }
int main(int argc, char *argv[] ) { unsigned char data = 0; char temp = 0; int ret = 0; if((ret = sys_init())<0) { printf("LIBFTDI init failed, exit\n"); exit(1); } while(1){ // Write_JTAG(&ux400_ftdic, 0x0, 0xff, 3); // Read_JTAG(&ux400_ftdic, &data, 1); // printf("data = %d.\n", data); // Write_JTAG(&ux400_ftdic, 0xff, 0xff, 3); // Read_JTAG(&ux400_ftdic, &data, 1); // printf("data = %d.\n", data); } }
void bt_init ( void ) { sys_init(); mem_init(); memp_init(); pbuf_init(); UART2PrintString("mem mgmt initialized\r\n"); lwbt_memp_init(); phybusif_init(""); cb = malloc(sizeof(struct phybusif_cb)); phybusif_reset(cb); if(hci_init() != ERR_OK) { UART2PrintString("HCI initialization failed!\r\n"); return; } l2cap_init(); sdp_init(); rfcomm_init(); UART2PrintString("Bluetooth initialized.\r\n"); bt_spp_start(); UART2PrintString("Applications started.\r\n"); }
int main() { int i =0; volatile int j = 0, pass = 0, fail = 0; //Global interrupt enable. CyGlobalIntEnable; sys_init(); //initiate data pattern. for (j =0; j < 0x200; j++) { Read_buffer_1[j] = (char)j; } //MountDisk(); for (j =0; j < 100; j++) { SD_Sector_Write(Read_buffer_1, j); SD_Sector_Read(Read_buffer_2, j); if (0 == memcmp(Read_buffer_1, Read_buffer_2, 0x200)) pass++; else fail++; } for(;;) { /* Place your application code here. */ } }
void slr_init(void) { /* VERBOSE set by slr -t or -g */ char *vs = getenv("VERBOSE"); bool verbose = false; if (vs && vs[0]) verbose = true; char *data = getenv("SLR_DATA"); if (data) load_binary_data(data, &__slr_base, verbose); char *fdata = getenv("SLR_FDATA"); if (fdata) load_binary_data(fdata, &__fibre_base, verbose); /* MGSYS_QUIET set by user */ if (getenv("MGSYS_QUIET") != NULL) verbose_boot = 0; #if !defined(__slc_os_init_via_main__) /* hlsim/ptl must be initialized via main first, so sys_init gets called from _main() instead. */ sys_init(NULL, NULL, NULL); #endif }
//----------------------------------------------------------------------------- int main(void) { uint32_t cnt = 0; bool fast = false; sys_init(); timer_init(); uart_init(115200); uart_puts("\r\nHello, world!\r\n"); HAL_GPIO_LED_out(); HAL_GPIO_LED_clr(); HAL_GPIO_BUTTON_in(); HAL_GPIO_BUTTON_pullup(); while (1) { if (HAL_GPIO_BUTTON_read()) cnt = 0; else if (cnt < 5001) cnt++; if (5000 == cnt) { fast = !fast; timer_set_period(fast ? PERIOD_FAST : PERIOD_SLOW); uart_putc('.'); } } return 0; }
/*--- codigo de la funcion ---*/ void Main(void) { sys_init(); /* inicializacion de la placa, interrupciones, puertos y UART */ Lcd_Test(); /* inicializacion LCD y visualizacion texto y rectangulos */ while(1); }
int main(int argc, char **argv) { int status; if (argc!=2) { fprintf(stderr, "usage: tci_lower <mode>\n"); exit(-1); } linux_sys_mode=atoi(argv[1]); switch(linux_sys_mode) { case 0: fprintf(stderr, "TCI_UPPER: A\n"); break; case 1: fprintf(stderr, "TCI_UPPER: B\n"); break; default: fprintf(stderr, "invalid mode (0 or 1)\n"); return -1; break; } sys_init(); prh_tci_init(); while(1); }
int main(int argc, char **argv) { t_bdaddr iutBdAddr; if (argc < 2) { fprintf(stderr, "usage: tester_l2cap <test_num>"); exit(-1); } test_num=atoi(argv[1]); linux_sys_mode=0; fprintf(stderr, "L2CAP TESTER: TEST No. %d", test_num); sys_init(linux_sys_mode); fprintf(stderr,"L2CAP TESTER: starting the stack\n"); MGR_Init(0); l2_init_lower_tester(); MGR_ParseHexBDAddress(IUT_BDADDR, &iutBdAddr); l2_lower_tester(test_num, iutBdAddr); while(1); }
/*--- codigo de funciones ---*/ void Main(void) { /* Inicializa controladores */ sys_init(); // Inicializacion de la placa, interrupciones y puertos timer_init(); // Inicializacion del temporizador mybutton_init(); // inicializamos los pulsadores. Cada vez que se pulse se verá reflejado en el 8led D8Led_init(); // inicializamos el 8led /* Valor inicial de los leds */ leds_off(); led1_on(); while (1) { /* Cambia los leds con cada interrupcion del temporizador */ if (switch_leds == 1) { leds_switch(); switch_leds = 0; } comprobar_boton(); } }
int main(void) { /* setup controller */ sys_init(); /* setup u8g and m2 libraries */ setup(); /* application main loop */ for(;;) { m2_CheckKey(); if ( m2_HandleKey() ) { /* picture loop */ u8g_FirstPage(&u8g); do { draw(); m2_CheckKey(); } while( u8g_NextPage(&u8g) ); } set_next_state(); } }
void Main() { // Initialize the system: sys_init(); InitializeSystem(); // Initialize the output: TurnOnLCD(); Set8Led(0); // Initialize the data: InitializeGame(); // Initialize the input: SetOnKeyboardDown(OnKeyboardDown); InitializeKeyboardInterrupts(); SetOnButtonDown(OnButtonDown); SetOnButtonUp(OnButtonUp); InitializeButtonsInterrupts(); // Initialize the timers: SimpleInitializeTimerInterrupts(TIMER_ID0, MAX_TIME_COUNT, (unsigned)UpdateOnTimer); // Initialize the UART1: InitializeUART(BAUDS_115200); //ActivateInterruptsUART1((unsigned)OnReceiveUART); // Call the main loop: MainLoopWithPolling(); }
int main(void) { __disable_interrupt(); sys_init(); __delay_cycles(8000000);//Защита от коротких нажатий P1OUT |= BIT6; //защелкиваем питание led(1); ADC10_Init(); AFE_Init(); rf_init(); TACCR0 = 0xFFFF;// запуск таймера __enable_interrupt(); while (1) { if(rf_rx_data_ready_fg) { onRF_MessageReceived(); rf_rx_data_ready_fg = 0; } if (packetDataReady){ uchar packetSize = assemblePacket(); rf_send((uchar*)&packet_buf[0], packetSize); packetDataReady = 0; } if(rf_rx_data_ready_fg || packetDataReady){ // идем по циклу снова }else{ __bis_SR_register(CPUOFF + GIE); // Уходим в спящий режим } } }
int main(int argc, char *argv[] ) { unsigned char fan = 0; char temp = 0; int ret = 0; if(argc != 2){ printf("usage: ux400opm 1/0\n"); exit(0); } if((ret = sys_init())<0) { printf("LIBFTDI init failed, exit\n"); exit(1); } temp = cpldver(); if(temp < 0 ) { printf("Read CPLD version failed, exit\n"); exit(1); } if(atoi(argv[1]) == 1){ opm_pwr(OPM_ON); }else{ opm_pwr(OPM_OFF); } ftdi_usb_close(&ux400_ftdic); ftdi_deinit(&ux400_ftdic); }
/*--- codigo de funciones ---*/ void Main(void) { /* Inicializa controladores */ exception_init(); sys_init(); // Inicializacion de la placa, interrupciones y puertos timer_init(); // Inicializacion del temporizador Eint4567_init(); // inicializamos los pulsadores. Cada vez que se pulse se verá reflejado en el 8led D8Led_init(); // inicializamos el 8led Timer2_Inicializar(); /* Configura el Timer2 */ Timer3_Inicializar(); /* Configura el Timer2 */ pila_Init(); Timer0_Empezar(); Timer2_Empezar(); juegoSudoku(); //push_debug(0xFFFFFFFF,Timer2_Leer()); while(1); }
void init(void) { sys_init(); spis_init(&spis_dev); spis_set_select_cb(&spis_dev, spis_select, NULL); spis_set_deselect_cb(&spis_dev, spis_deselect, NULL); }
void Main(void) { /* Inicializa controladores */ sys_init(); // Inicializacion de la placa, interrupciones y puertos D8Led_init(); // inicializamos el 8led Button_init(0, 9); // inicializamos los pulsadores. Cada vez que se pulse se verá reflejado en el 8led init_game(); }
/*USER INIT FUNCTION, called in main.c*/ int user_init (HTTP_INFO *info) { sys_init (info); net_init (info); io_init (info); //init variables from conf file pm_init (info); return 0; }
void init(void) { sys_init(); pwm_init(&pwm0); pwm_init(&pwm1); pwm_init(&pwm2); pwm_init(&pwm3); }
void init() { sys_init(); // this utest requires very basic gpio module also gpio_init_pin(&gpio_mco); gpio_init_pin(&gpio_systick); }
/** * Perform Sanity check of user-configurable values, and initialize all modules. */ void lwip_init(void) { /* Sanity check user-configurable values */ lwip_sanity_check(); /* Modules initialization */ stats_init(); #if !NO_SYS sys_init(); #endif /* !NO_SYS */ mem_init(); memp_init(); pbuf_init(); netif_init(); #if LWIP_SOCKET lwip_socket_init(); #endif /* LWIP_SOCKET */ ip_init(); #if LWIP_ARP etharp_init(); #endif /* LWIP_ARP */ #if LWIP_RAW raw_init(); #endif /* LWIP_RAW */ #if LWIP_UDP udp_init(); #endif /* LWIP_UDP */ #if LWIP_TCP tcp_init(); #endif /* LWIP_TCP */ #if LWIP_SNMP snmp_init(); #endif /* LWIP_SNMP */ #if LWIP_AUTOIP autoip_init(); #endif /* LWIP_AUTOIP */ #if LWIP_IGMP igmp_init(); #endif /* LWIP_IGMP */ #if LWIP_DNS dns_init(); #endif /* LWIP_DNS */ #if LWIP_TIMERS sys_timeouts_init(); #endif /* LWIP_TIMERS */ #if !NO_SYS /* in the Xilinx lwIP 1.2.0 port, lwip_init() was added as a convenience utility function to initialize all the lwIP layers. lwIP 1.3.0 introduced lwip_init() in the base lwIP itself. However a user cannot use lwip_init() regardless of whether it is raw or socket modes. The following call to lwip_sock_init() is made to make sure that lwIP is properly initialized in both raw & socket modes with just a call to lwip_init(). */ lwip_sock_init(); #endif }
void platform_init_OT() { buffers_init(); //buffers init must be first in order to do core dumps vl_init(); //Veelite init must be second radio_init(); //radio init third sys_init(); //system init last }
void neko_standalone_init() { # ifndef CONSOLE_MODE sys_init(); ui_main(); # endif std_main(); regexp_main(); zlib_main(); }
/** * Perform Sanity check of user-configurable values, and initialize all modules. */ void lwip_init(void) { /*++ Changed by Espressif ++*/ MEMP_NUM_TCP_PCB = 5; TCP_WND = (4 * TCP_MSS); TCP_MAXRTX = 3; TCP_SYNMAXRTX = 6; /*-- --*/ /* Modules initialization */ stats_init(); #if !NO_SYS sys_init(); #endif /* !NO_SYS */ /*++ Changed by Espressif ++*/ #if 0 mem_init(&_bss_end); #endif /*-- --*/ memp_init(); pbuf_init(); netif_init(); #if LWIP_SOCKET lwip_socket_init(); #endif /* LWIP_SOCKET */ ip_init(); #if LWIP_ARP etharp_init(); #endif /* LWIP_ARP */ #if LWIP_RAW raw_init(); #endif /* LWIP_RAW */ #if LWIP_UDP udp_init(); #endif /* LWIP_UDP */ #if LWIP_TCP tcp_init(); #endif /* LWIP_TCP */ #if LWIP_SNMP snmp_init(); #endif /* LWIP_SNMP */ #if LWIP_AUTOIP autoip_init(); #endif /* LWIP_AUTOIP */ #if LWIP_IGMP igmp_init(); #endif /* LWIP_IGMP */ #if LWIP_DNS dns_init(); #endif /* LWIP_DNS */ #if LWIP_TIMERS sys_timeouts_init(); #endif /* LWIP_TIMERS */ }
int main(int argc, char **argv) { int a; #if !WIN_DB linux_sys_mode=0; sys_init(linux_sys_mode); #else // startHost(); #endif fprintf(stderr,"starting the stack\n"); /* prh_mgr_initStack(argc,argv); */ MGR_Init(0); MGR_SetSecurityMode(MGR_NOSECURITY, NULL); HCI_WriteScanEnable(3); /* MGR_SetConnectableMode(MGR_CONNECTABLE,test); a = MGR_SetDiscoverableMode(MGR_GENERALDISCOVERY,test); */ pDebugCheck(); Test_Data_Base_Setup(); pDebugCheck(); SDP_OpenSearch(); fprintf(stderr,"SDP server up and running.\n"); while(1) { #if WIN_DB Sleep(1000); #else pDebugSleep(1); #endif } }
int main(int argc, char *argv[]) { char *app; int use_ssl = 1; // 0 = disable SSL, 2 = allow insecure SSL if (options_parse(&argc, argv) != 0) { exit(1); } if (opt_daemon) { run_as_daemon(); } /* Init exec environment */ env_init(argc, argv); /* Init log management */ log_init("hakit"); log_str(options_summary); log_str("Using libwebsockets version " LWS_LIBRARY_VERSION " build " LWS_BUILD_HASH); /* Init system runtime */ sys_init(); /* Init communication engine */ if (opt_no_ssl) { use_ssl = 0; } else if (opt_insecure_ssl) { use_ssl = 2; } if (comm_init(use_ssl, opt_no_hkcp ? 0:1, opt_hosts)) { return 2; } if (opt_monitor) { comm_monitor((comm_sink_func_t) monitor_sink_event, NULL); } /* Init module management */ if (hk_mod_init(opt_class_path)) { return 2; } app = env_app(); if (app != NULL) { if (hk_mod_load(app)) { return 3; } hk_obj_start_all(); } sys_run(); return 0; }