/**@brief Function for bootloader main entry. */ int main(void) { uint32_t err_code; bool dfu_start = false; bool app_reset = (NRF_POWER->GPREGRET == BOOTLOADER_DFU_START); // This check ensures that the defined fields in the bootloader corresponds with actual // setting in the nRF51 chip. APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START); APP_ERROR_CHECK_BOOL(NRF_FICR->CODEPAGESIZE == CODE_PAGE_SIZE); // Initialize. timers_init(); gpiote_init(); buttons_init(); bootloader_init(); // Check if we reset in the middle of a firmware update if (bootloader_dfu_sd_in_progress()) { err_code = bootloader_dfu_sd_update_continue(); APP_ERROR_CHECK(err_code); softdevice_init(!app_reset); scheduler_init(); err_code = bootloader_dfu_sd_update_finalize(); APP_ERROR_CHECK(err_code); } else { // If stack is present then continue initialization of bootloader. softdevice_init(!app_reset); scheduler_init(); } // Check if the Bootloader Control pin is low. If so, enter the bootloader // mode. dfu_start = (nrf_gpio_pin_read(BOOTLOADER_CTRL_PIN) == 0); // If the Bootloader Control pin is low or the application in the flash // is not valid, enter the bootloader mode. if (dfu_start || (!bootloader_app_is_valid(DFU_BANK_0_REGION_START))) { err_code = sd_power_gpregret_clr(POWER_GPREGRET_GPREGRET_Msk); APP_ERROR_CHECK(err_code); // Initiate an update of the firmware. err_code = bootloader_dfu_start(); APP_ERROR_CHECK(err_code); } // If the application was or now is valid, run it if (bootloader_app_is_valid(DFU_BANK_0_REGION_START)) { // Select a bank region to use as application region. // @note: Only applications running from DFU_BANK_0_REGION_START is supported. bootloader_app_start(DFU_BANK_0_REGION_START); } NVIC_SystemReset(); }
int main (void) { // Initialize the system Initialize(); scheduler_init("led_task",0); scheduler_init("motor_task",1); set_timer(); enableIRQ(); Execute_Led_Task(); while(1); }
int pony_init(int argc, char** argv) { options_t opt; memset(&opt, 0, sizeof(options_t)); // Defaults. opt.mpmcq = true; opt.cd_min_deferred = 4; opt.cd_max_deferred = 18; opt.cd_conf_group = 6; opt.gc_initial = 1 << 14; opt.gc_factor = 2.0f; argc = parse_opts(argc, argv, &opt); #if defined(PLATFORM_IS_LINUX) pony_numa_init(); #endif heap_setinitialgc(opt.gc_initial); heap_setnextgcfactor(opt.gc_factor); pony_exitcode(0); scheduler_init(opt.threads, opt.noyield, opt.forcecd, opt.mpmcq); cycle_create(opt.cd_min_deferred, opt.cd_max_deferred, opt.cd_conf_group); return argc; }
int mote_main(void) { board_init(); scheduler_init(); openwsn_init(); scheduler_start(); return 0; // this line should never be reached }
int main(void) { TASK *cdc_demo_task_cb; /* Initialize scheduler. */ scheduler_init(); /* Initialize memory. */ mem_init(); /* Initialize file system. */ fs_init(); /* Initialize USB stack. */ usb_init(); /* Create a task for CDC demo. */ cdc_demo_task_cb = (TASK *)mem_static_alloc(sizeof(TASK) + 4096); task_create(cdc_demo_task_cb, "CDCDEMO", (uint8_t *)(cdc_demo_task_cb + 1), 4096, &cdc_demo_task, (void *)(NULL)); scheduler_task_add(cdc_demo_task_cb, TASK_APERIODIC, 5, 0); /* Run scheduler. */ os_run(); return (0); }
int main(void) { /* LEDS */ DDRB=0xFF; /* uart*/ uart_init(); // kbd_init(); scheduler_init(); /* ajoute la scrutation du clavier */ // scheduler_add_periodical_event(kbd_get_pressed, 100); /* envoie les caracteres du clavier vers l'uart */ // kbd_register_event(menu_control); /* creation du device */ fdevopen( (int (*)(char)) uart0_send, (int (*)(void))uart0_recv, 0); // se place sur le 1er fils menu_goto(menu_down(menu_current())); menu_print(); sei(); while(1); return 0; }
int main() { signal_stack = malloc (StackSize); if (signal_stack == NULL) { printf("Cant malloc\n"); exit(1); } int i; for (i=1; i<NumberOfContexts; i++) { MyTreads[i].ContextStatus = 0;//Free Tread } int l = (Interval*1000)%1000000; AlarmInterval.it_interval.tv_sec = 0; AlarmInterval.it_interval.tv_usec = l; AlarmInterval.it_value.tv_sec = 0; AlarmInterval.it_value.tv_usec = l; if (setitimer(ITIMER_REAL, &AlarmInterval, 0)<0) { printf("Timer cant be set\n"); exit(1); }; signal(SIGALRM, schedul_function); scheduler_init(&SchedulerContext); int Thread1 = thread_create(thread_1); int Thread2 = thread_create(thread_2); thread_wait(Thread1); thread_wait(Thread2); return 0; }
int platform_init(struct sof *sof) { int ret; struct dai *esai; clock_init(); scheduler_init(); platform_timer_start(platform_timer); sa_init(sof); clock_set_freq(CLK_CPU(cpu_get_id()), CLK_MAX_CPU_HZ); /* init DMA */ ret = edma_init(); if (ret < 0) return -ENODEV; /* initialize the host IPC mechanims */ ipc_init(sof); ret = dai_init(); if (ret < 0) return -ENODEV; esai = dai_get(SOF_DAI_IMX_ESAI, 0, DAI_CREAT); if (!esai) return -ENODEV; dai_probe(esai); return 0; }
void __init kern_start() { struct thread *main_thread; mach_start(); kprintf("Starting Koowaldah v%s kernel.\n", VERSION_STRING); /* memory allocation machinery: zones, buddy allocator, slices */ init_mem_info(); paging_init(); galloc_init(); kqueue_init(); timers_init(); sched0_load(); scheduler_init(); main_thread = thread_create(&kernel_main_thread, "GOD", NULL); if (!main_thread) { kprintf("Failed to create main kernel thread\n"); bug(); } thread_switch_to(main_thread); bug(); }
int mote_main(OpenMote* self) { board_init(self); scheduler_init(self); openwsn_init(self); scheduler_start(self); return 0; // this line should never be reached }
/** * @brief ChibiOS/RT initialization. * @details After executing this function the current instructions stream * becomes the main thread. * @pre Interrupts must be still disabled when @p chSysInit() is invoked * and are internally enabled. * @post The main thread is created with priority @p NORMALPRIO. * @note This function has special, architecture-dependent, requirements, * see the notes into the various port reference manuals. * * @special */ void chSysInit(void) { static Thread mainthread; port_init(); scheduler_init(); vt_init(); #if CH_USE_MEMCORE core_init(); #endif #if CH_USE_HEAP heap_init(); #endif #if CH_DBG_ENABLE_TRACE trace_init(); #endif /* Now this instructions flow becomes the main thread.*/ setcurrp(_thread_init(&mainthread, NORMALPRIO)); currp->p_state = THD_STATE_CURRENT; chSysEnable(); #if !CH_NO_IDLE_THREAD /* This thread has the lowest priority in the system, its role is just to serve interrupts in its context while keeping the lowest energy saving mode compatible with the system status.*/ chThdCreateStatic(_idle_thread_wa, sizeof(_idle_thread_wa), IDLEPRIO, (tfunc_t)_idle_thread, NULL); #endif }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; // Initialize timers_init(); ble_stack_init(); bsp_module_init(); scheduler_init(); gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); // Start execution timers_start(); err_code = ble_advertising_start(BLE_ADV_MODE_FAST); APP_ERROR_CHECK(err_code); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; // Initialize timers_init(); ble_stack_init(); bsp_module_init(); scheduler_init(); gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); adc_init(); // Start execution timers_start(); err_code = ble_advertising_start(BLE_ADV_MODE_FAST); APP_ERROR_CHECK(err_code); // Enter main loop for (;;) { if(start_adc_sampling == true) { nrf_drv_saadc_sample_convert(0, &adc_value); ble_android_characteristic_update(&m_android, &adc_value); start_adc_sampling = false; } app_sched_execute(); // power_manage(); } }
void main(void) { //configuring P1OUT |= 0x04; // set P1.2 for debug P4DIR |= 0x20; // P4.5 as output (for debug) gina_init(); scheduler_init(); leds_init(); if (*(&eui64+3)==0x09) { // this is a GINA board (not a basestation) gyro_init(); large_range_accel_init(); magnetometer_init(); sensitive_accel_temperature_init(); } radio_init(); timer_init(); P1OUT &= ~0x04; // clear P1.2 for debug //check sensor configuration is right gyro_get_config(); large_range_accel_get_config(); magnetometer_get_config(); sensitive_accel_temperature_get_config(); //scheduler_push_task(ID_TASK_APPLICATION); scheduler_register_application_task(&task_application_imu_radio, 0, FALSE); scheduler_start(); }
/** * Kernel entry point */ void kmain(struct multiboot_info* info, unsigned int magic) { initMemoryMap(info); mm_pagination_init(); setupGDT(); setupIDT(); stdin = STACK_TOP_MAPPING; stdout = (STACK_TOP_MAPPING + sizeof(FILE)); stderr = (STACK_TOP_MAPPING + 2 * sizeof(FILE)); cache_init(); ata_init(info); fs_load(); fifo_init(); scheduler_init(); struct Process* idleProcess = process_table_new(idle, "idle", NULL, 1, NO_TERMINAL, 0); struct Process* shellProcess = process_table_new(tty_run, "tty", idleProcess, 1, NO_TERMINAL, 0); struct Process* cacheProcess = process_table_new(cache_flush, "cache_flush",idleProcess, 1, NO_TERMINAL, 0); yield(); while (1) {} }
/** * @brief Function for application main entry. */ int main(void) { uint32_t err_code; //Initialize. app_trace_init(); leds_init(); scheduler_init(); timers_init(); iot_timer_init(); button_init(); ble_stack_init(); advertising_init(); ip_stack_init (); //Start execution. advertising_start(); //Enter main loop. for (;;) { //Execute event schedule. app_sched_execute(); //Sleep waiting for an application event. err_code = sd_app_evt_wait(); APP_ERROR_CHECK(err_code); } }
/**@brief Function for application main entry. */ int main(void) { // Initialize timers_init(); gpiote_init(); ble_stack_init(); bsp_module_init(); scheduler_init(); gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); // Start execution timers_start(); advertising_start(); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; bool erase_bonds; // Initialize timers_init(); nrf_log_init(); buttons_leds_init(&erase_bonds); ble_stack_init(); device_manager_init(erase_bonds); db_discovery_init(); scheduler_init(); gap_params_init(); advertising_init(); services_init(); conn_params_init(); // Start execution err_code = ble_advertising_start(BLE_ADV_MODE_FAST); APP_ERROR_CHECK(err_code); NRF_LOG("\r\nCTS Start!\r\n"); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { bool erase_bonds; uint32_t err_code; // Initialize. app_trace_init(); timers_init(); uart_init(); buttons_leds_init(&erase_bonds); ble_stack_init(); APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE); printf("BLE ANCS\n"); device_manager_init(erase_bonds); db_discovery_init(); scheduler_init(); gap_params_init(); service_init(); advertising_init(); conn_params_init(); // Start execution. err_code = ble_advertising_start(BLE_ADV_MODE_FAST); APP_ERROR_CHECK(err_code); // Enter main loop. for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Application main function. */ int main(void) { // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); bond_manager_init(); ble_stack_init(); scheduler_init(); gap_params_init(); advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE); services_init(); sensor_sim_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution timers_start(); advertising_start(); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); simple_uart_config(UART_RTS, UART_TX, UART_CTS, UART_RX, 0); ble_stack_init(); scheduler_init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); // Start execution //app_button_enable(); advertising_start(); uart_tx_str("nRF51822 run"); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
void test_database_init() { scheduler_t* scheduler; PGresult* db_result; GString* sql; scheduler = scheduler_init(testdb, NULL); database_init(scheduler); FO_ASSERT_PTR_NOT_NULL(scheduler->db_conn); sprintf(sqltmp, check_scheduler_tables, PQdb(scheduler->db_conn)); sql = g_string_new(sqltmp); g_string_append(sql, "'users';"); /* get the url for the fossology instance */ db_result = database_exec(scheduler, sql->str); //printf("sql: %s\n", sql->str); // TODO skip this test since the order reported here is random, also it will crash if PQntuples < 5 #if 0 if(PQresultStatus(db_result) == PGRES_TUPLES_OK && PQntuples(db_result) != 0) { //printf("result: %s\n", g_strdup(PQgetvalue(db_result, 0, 0))); FO_ASSERT_STRING_EQUAL(g_strdup(PQgetvalue(db_result, 0, 0)), "user_pk"); FO_ASSERT_STRING_EQUAL(g_strdup(PQgetvalue(db_result, 1, 0)), "user_name"); FO_ASSERT_STRING_EQUAL(g_strdup(PQgetvalue(db_result, 2, 0)), "root_folder_fk"); FO_ASSERT_STRING_EQUAL(g_strdup(PQgetvalue(db_result, 3, 0)), "user_desc"); FO_ASSERT_STRING_EQUAL(g_strdup(PQgetvalue(db_result, 4, 0)), "user_seed"); } #endif PQclear(db_result); g_string_free(sql, TRUE); scheduler_destroy(scheduler); }
void test_database_update_event() { scheduler_t* scheduler; char sql[512]; PGresult* db_result; scheduler = scheduler_init(testdb, NULL); FO_ASSERT_PTR_NULL(scheduler->db_conn); database_init(scheduler); FO_ASSERT_PTR_NOT_NULL(scheduler->db_conn); Prepare_Testing_Data(scheduler); database_update_event(scheduler, NULL); sprintf(sql, "SELECT * FROM job;"); db_result = database_exec(scheduler, sql); //printf("result: %s", PQget(db_result, 0, "job_name")); if(PQresultStatus(db_result) == PGRES_TUPLES_OK && PQntuples(db_result) != 0) { FO_ASSERT_STRING_EQUAL(PQget(db_result, 0, "job_name"), "testing file"); FO_ASSERT_EQUAL(atoi(PQget(db_result, 0, "job_user_fk")), 1); } PQclear(db_result); database_reset_queue(scheduler); scheduler_destroy(scheduler); }
/* * Main Loop */ int main() { LOG("--------------------------------\r\n"); /* Unmask interrupt for output compare match A on TC0 */ timers_setup_timer(TIMER_COUNTER0, TIMER_MODE_CTC, 1000UL); TIMSK0 |= (1 << OCIE0A); lcd_load_custom_character(degree_symbol, CUSTOM_SYMBOL_DEGREE); cli_init(); motor_init(&g_timers_state); log_init(); scheduler_init(&g_timers_state, g_tasks, COUNT_OF(g_tasks)); interpolator_init(&g_timers_state); sei(); log_start(); /* Main Loop: Run Tasks scheduled by scheduler */ while (1) { int i; for (i = 0; i < 50; i++) { serial_check(); /* needs to be called frequently */ } scheduler_service(); } }
static void __init start_of_day(void) { init_IRQ(); scheduler_init(); /* create idle domain */ idle_domain = domain_create(IDLE_DOMAIN_ID, 0, 0); if ((idle_domain == NULL) || (alloc_vcpu(idle_domain, 0, 0) == NULL)) BUG(); set_current(idle_domain->vcpu[0]); idle_vcpu[0] = current; initialize_keytable(); /* Register another key that will allow for the the Harware Probe * to be contacted, this works with RiscWatch probes and should * work with Chronos and FSPs */ register_keyhandler('^', key_hw_probe_attn, "Trap to Hardware Probe"); /* allow the dumping of the devtree */ register_keyhandler('D', key_ofdump , "Dump OF Devtree"); timer_init(); rcu_init(); serial_init_postirq(); do_initcalls(); }
/** Test destroy cell queue with no interference from other queues. */ static void test_cmux_destroy_cell_queue(void *arg) { circuitmux_t *cmux = NULL; channel_t *ch = NULL; circuit_t *circ = NULL; cell_queue_t *cq = NULL; packed_cell_t *pc = NULL; tor_libevent_cfg cfg; memset(&cfg, 0, sizeof(cfg)); tor_libevent_initialize(&cfg); scheduler_init(); #ifdef ENABLE_MEMPOOLS init_cell_pool(); #endif /* ENABLE_MEMPOOLS */ (void) arg; cmux = circuitmux_alloc(); tt_assert(cmux); ch = new_fake_channel(); ch->has_queued_writes = has_queued_writes; ch->wide_circ_ids = 1; circ = circuitmux_get_first_active_circuit(cmux, &cq); tt_assert(!circ); tt_assert(!cq); circuitmux_append_destroy_cell(ch, cmux, 100, 10); circuitmux_append_destroy_cell(ch, cmux, 190, 6); circuitmux_append_destroy_cell(ch, cmux, 30, 1); tt_int_op(circuitmux_num_cells(cmux), OP_EQ, 3); circ = circuitmux_get_first_active_circuit(cmux, &cq); tt_assert(!circ); tt_assert(cq); tt_int_op(cq->n, OP_EQ, 3); pc = cell_queue_pop(cq); tt_assert(pc); tt_mem_op(pc->body, OP_EQ, "\x00\x00\x00\x64\x04\x0a\x00\x00\x00", 9); packed_cell_free(pc); pc = NULL; tt_int_op(circuitmux_num_cells(cmux), OP_EQ, 2); done: circuitmux_free(cmux); channel_free(ch); packed_cell_free(pc); #ifdef ENABLE_MEMPOOLS free_cell_pool(); #endif /* ENABLE_MEMPOOLS */ }
void kmain(multiboot_info_t* mbd, unsigned long magic) { if(magic != MULTIBOOT_BOOTLOADER_MAGIC) { scrn_setmode(GREEN,BLACK); scrn_print("Algo salio muy muy mal. No se que mas decirte."); return; } scrn_cls(); scrn_setmode(GREEN,BLACK); scrn_print("BIENVENIDO A juampiOS\n\t" "Estamos trabajando para ofrecerle " "el OS del futuro.\n"); scrn_print("INICIALIZANDO GDT..."); gdt_init(); gdt_flush(); scrn_print("OK\nINICIALIZANDO IDT PARA LAS EXCEPCIONES..."); initialize_exception_handlers(); idt_init_exceptions(); remap_pic(); scrn_print("OK\nINICIALIZANDO IDT PARA LAS INTERRUPCIONES Y SYSCALLS..."); irq_init_handlers(); syscalls_initialize(); idt_init_interrupts(); idt_init_syscalls(); idt_flush(); irq_sti_force(); scrn_printf("OK\nCHEQUEANDO ESTADO DE LOS MODULOS..."); scrn_printf("%u MODULOS CARGADOS\n",mbd->mods_count); scrn_print("CHECKEANDO ESTADO DE LA MEMORIA\n"); // Chequeamos que la cantidad de memoria RAM presente. if(mbd->flags & 1) { scrn_printf("\tCantidad de RAM en el sistema:\n" "\t\tLower: %u Kb, Upper: %u Kb\n", mbd->mem_lower,mbd->mem_upper); } else { kernel_panic("Mapa de memoria de GRUB invalido"); } scrn_print("INICIALIZANDO LAS ESTRUCTURAS DE MEMORIA DEL KERNEL..."); module_t* grub_modules = (module_t*) mbd->mods_addr; uint kernel_end_addr = grub_modules[mbd->mods_count-1].mod_end; // El mapa de memoria upper es a partir del primer megabyte ergo el primer // lugar donde nos vamos de largo es 1024 kilobytes mas la memoria que dice GRUB paging_init(kernel_end_addr, (1024+mbd->mem_upper)*1024); scrn_printf("OK\n"); scrn_print("INICIALIZANDO DISCO ATA\n"); hdd_init(); scrn_printf("INICIALIZANDO FILESYSTEM MINIX\n"); init_disk_super_block(); keybuffer_init(1024); scheduler_init(); void * buffer = (void *) grub_modules[0].mod_start; jump_to_initial(buffer); while(1) ; }
void check_spinn_packet_con_setup(void) { scheduler_init(&s); buffer_init(&b, BUFFER_SIZE); spinn_packet_pool_init(&pool); packets_received = 0; }
int mote_main(void) { board_init(); scheduler_init(); openstack_init(); if (idmanager_getMyID(ADDR_64B)->addr_64b[7]==0xbb) { idmanager_setIsDAGroot(TRUE); } scheduler_start(); return 0; // this line should never be reached }
// The kernel main function. Initialize everything and start the kernel // debugger. The two arguments are the physical address of the Multiboot info // structure and the bootloader magic number respectively. void init() { int r; // Initialize the console first to print messages during the initialization cons_init(); kprintf("Argentum Operating System\n"); arch_init(); kmem_cache_init(); kmem_cache_sizes_init(); vm_init(); process_init(); thread_init(); ipc_init(); scheduler_init(); sync_init(); clock_init(); if ((r = process_create_system(system_main, NULL)) < 0) kprintf("Cannot create system process: %s\n", strerror(-r)); if (module_start) { Boot_image *image = (Boot_image *) module_start; if(image->magic != 0x12345678) panic("invalid bootimage"); for (unsigned i = 0; i < image->length; i++) { uint8_t *binary = (uint8_t *) image + image->headers[i].offset; size_t size = image->headers[i].length; if (binary < module_start || binary >= module_end) panic("invalid bootimage"); if ((binary + size) <= module_start || (binary + size) > module_end) panic("invalid bootimage"); r = process_create((uint8_t *) image + image->headers[i].offset, image->headers[i].length, PROCESS_TYPE_USER, NULL); if (r < 0) panic("Cannot create process: %s", strerror(-r)); } } scheduler_start(); for (;;) { kdb_main(NULL); } }