PROCESS_THREAD(rest_server_example, ev, data) { PROCESS_BEGIN(); PRINTF("Starting Erbium Example Server\n"); PRINTF("uIP buffer: %u\n", UIP_BUFSIZE); PRINTF("LL header: %u\n", UIP_LLH_LEN); PRINTF("IP+UDP header: %u\n", UIP_IPUDPH_LEN); PRINTF("REST max chunk: %u\n", REST_MAX_CHUNK_SIZE); /* if static routes are used rather than RPL */ #if !UIP_CONF_IPV6_RPL && !defined (CONTIKI_TARGET_MINIMAL_NET) && !defined (CONTIKI_TARGET_NATIVE) set_global_address(); configure_routing(); #endif /* Initialize the OSD Hardware. */ hw_init(); /* Initialize the REST engine. */ rest_init_engine(); /* Activate the application-specific resources. */ rest_activate_resource(&resource_info); SENSORS_ACTIVATE(t4_servo_sensor); rest_activate_resource(&resource_t4_servo); /* Define application-specific events here. */ while(1) { PROCESS_WAIT_EVENT(); } PROCESS_END(); }
static inline void main_init( void ) { hw_init(); sys_time_init(); led_init(); usb_serial_init(); int_enable(); }
/*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) { /* Initialize the ti1225 driver. */ int r, devind; long v; if((r=tsc_calibrate()) != OK) panic("tsc_calibrate failed: %d", r); v = 0; (void) env_parse("instance", "d", 0, &v, 0, 255); instance = (int) v; v = 0; (void) env_parse("debug", "d", 0, &v, 0, 1); debug = (int) v; devind = hw_probe(instance); if (devind < 0) return(ENODEV); hw_init(&port, devind); return(OK); }
void main(void) { int cdc_in; int uart_in; volatile UINT8 u8Error; PTBPE_PTBPE5 = 1; // DEMOFLEXISJMSD board PTBDD_PTBDD5 = _IN; // Initialize Button in hw_init(); /* MCU Initialization */ SPI_Init(); /* SPI Module Init */ u8Error=SD_Init(); /* SD Card Init */ FAT_Read_Master_Block(); /* FAT Driver Init */ cdc_in=uart_in=0xff+1; /* USB CMX Init */ usb_cfg_init(); cdc_init(); while(PTBD_PTBD5); /* Wait until button clic */ CDC_Send_String("\r\n\r\n\tSD Card Terminal\r\n"); while(1) { cdc_process(); /* USB CMX CDC process */ FAT_LS(); /* Simple function that shows the content*/ MiniCom(); /* User Interface call */ } }
void main(void) { int cdc_in; int uart_in; volatile UINT8 u8Error; hw_init(); MCU_init(); GL_Init( GL_FD_HORIZONTAL | GL_FD_TOUCH_BEEP_ON, GLF_65K_COLORS, GLF_16M_COLORS, &OnDrawScreenBackground ); win_main_font = (GL_HFONT) & Arial_16px; GL_Screen_Activate((GL_HSCREEN) &screen); SPI_Init(); if ((u8Error = SD_Init()) != INIT_FAILS) { FAT_Read_Master_Block(); loadFiles(); redraw(); SD_LOADED_BEEP(); } else { NO_SD_BEEP(); } EnableInterrupts; while (1) { // handle touch (FIXME typo in GL lib (HaDNle)) GL_TS_HadnleActions(); } }
/********** INIT *************************************************************/ void init_rctx( void ) { hw_init(); sys_time_init(); #ifdef LED led_init(); #endif #ifdef USE_UART1 Uart1Init(); #endif #ifdef ADC adc_init(); adc_buf_channel(ADC_CHANNEL_VSUPPLY, &vsupply_adc_buf, DEFAULT_AV_NB_SAMPLE); #endif #ifdef RADIO_CONTROL ppm_init(); #endif int_enable(); /** - wait 0.5s (for modem init ?) */ uint8_t init_cpt = 30; while (init_cpt) { if (sys_time_periodic()) init_cpt--; } #if defined DATALINK #if DATALINK == XBEE xbee_init(); #endif #endif /* DATALINK */ }
int main(void) { hw_init(); while(1) { /* Set LED on */ reg_wr((u32)GPIOI_BSRR, (0x1 << 1) ); /* Start Timer2 */ reg_set(TIM2_CR1, 1); /* Wait Timer2 ends */ while(reg_rd(TIM2_CR1) & 1) ; /* Set LED off */ reg_wr((u32)GPIOI_BSRR, (0x1 << 17) ); /* Start Timer2 */ reg_set(TIM2_CR1, 1); /* Wait Timer2 ends */ while(reg_rd(TIM2_CR1) & 1) ; } }
static inline void main_init( void ) { hw_init(); sys_time_init(); main_init_adc(); bench_sensors_init(); int_enable(); }
void main( void ) { errno = 0; intr_disable(); intr_init(); hw_init(); /* print a banner */ printf( "%s %s\n", os_name, os_version ); memory_init(); device_init(); vfs_init(); /* new line after all initialisation messages */ printf("\n"); kb_init(); console_init(); intr_enable(); /* fire up the shell! */ for(;;) { shell_start(); printf("Respawning shell\n"); } }
void main(void) { hw_init(); while(1){ } }
static inline void main_init( void ) { hw_init(); sys_time_init(); led_init(); uart0_init_tx(); int_enable(); }
PROCESS_THREAD(freakusb_process, ev, data_proc) { PROCESS_POLLHANDLER(freakusb_pollhandler()); PROCESS_BEGIN(); usb_init(); hw_init(); cdc_init(); /* TODO: Implement this when we decide to accept commands over the USB */ cdc_reg_rx_handler(test_avr_usb_rx_handler); /* hook the putchar function to the printf and use it for stdout */ stdout = &file_str; /* kick off the polling function */ process_poll(&freakusb_process); while (1) { PROCESS_YIELD(); } PROCESS_END(); }
int main() { volatile int i; trace_append("%s: setup FreeRTOS...\n", __func__); MboxQueue = xQueueCreate( 32, sizeof( unsigned int* ) ); vSemaphoreCreateBinary(InitDoneSemaphore); xSemaphoreTake(InitDoneSemaphore, portMAX_DELAY); hw_init(); xTaskCreate(LedFlash, "led", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, NULL); xTaskCreate(IpcTask, "ipc", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL); xTaskCreate(RdaemonTask, "rdaemon", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL); trace_append("%s: start FreeRTOS...\n", __func__); vTaskStartScheduler(); /* Just sit and flash the LED quickly if we fail */ while( 1 ) { for( i = 0; i < 50000; i++ ); toggle_bit(GPIO_DATAOUT, 25); } }
int main(void) { hw_init(); sblp_init(); DDRB |= _BV(PA0) | _BV(PA1); while(1) _delay_ms(500); }
int main(void) { uint16_t diff; int16_t count_deviation; uint32_t count; char count_string[COUNT_STRING_LEN + 1]; char pwm_string[3 + 1]; int16_t c_int = 0; int16_t vc = 0; WDTCTL = WDTPW + WDTHOLD; hw_init(); gps_startup_delay(); while(!(gps_disable_nmea_output())); while(!(gps_set_gps_only())); while(1) { if (P1IN & CLK_PPS) { PJOUT |= LED4; } else { PJOUT &= ~LED4; } if (meas_finished == 1) { meas_finished = 0; diff = end_count - start_count; count_deviation = (int16_t) (diff - SETPOINT_COUNT_MOD); /* visual lock indication */ if (count_deviation < -FDEV_DEADZONE) { PJOUT = LED1; } else if (count_deviation > FDEV_DEADZONE) { PJOUT = LED3; } else { PJOUT = LED2; } /* output absolute count number to USART */ count = SETPOINT_COUNT + count_deviation; i32toa(count, COUNT_STRING_LEN, count_string); count_string[COUNT_STRING_LEN] = ' '; debug_transmit_string_fixed(count_string, COUNT_STRING_LEN + 1); /* control algorithm, count_deviation contains the control error */ c_int = c_int + count_deviation; if (c_int > 200) c_int = 200; if (c_int < -200) c_int = -200; vc = (32768 - 350 * c_int) >> 8; if (vc > 255) vc = 255; if (vc < 0) vc = 0; TA1CCR2 = vc; /* output PWM for debug purposes */ i32toa((uint32_t)vc, 3, pwm_string); pwm_string[3] = '\n'; debug_transmit_string_fixed(pwm_string, 3 + 1); } } /* while(1) */
void OSD::init() { pinMode(MAX7456_SELECT,OUTPUT); pinMode(MAX7456_VSYNC, INPUT_PULLUP); detectMode(); hw_init(); }
session_t *net_init(const char *interface, const uint8_t src_ip_addr[], uint16_t src_port, const uint8_t dst_ip_addr[], uint16_t dst_port, protocol_t protocol, int recv_timeout) { session_t *s = malloc(sizeof(session_t)); if(s == 0) return 0; s->session_id = hw_init(interface); if(s->session_id == -1) { free(s); return 0; } if(hw_if_addr(s->session_id, interface, s->src_addr) == -1) { net_free(s); return 0; } memcpy(s->src_ip, src_ip_addr, IP_ADDR_LEN); s->port = src_port; s->recv_timeout = recv_timeout; switch(protocol) { case TCP_NOCONNECT: case TCP: s->protocol = IP_PROTOCOL_TCP; break; case UDP: s->protocol = IP_PROTOCOL_UDP; break; case ICMP: s->protocol = IP_PROTOCOL_ICMP; break; default: net_free(s); return 0; } // Save interface name for further use s->interface = malloc(strlen(interface) + 1); strcpy(s->interface, interface); ndp_initialize(interface, src_ip_addr); if(protocol == TCP) if(tcp_connect(s, dst_ip_addr, dst_port) == 0) { net_free(s); return 0; } return s; }
static inline void main_init( void ) { hw_init(); sys_time_init(); baro_init(); // DEBUG_SERVO1_INIT(); // DEBUG_SERVO2_INIT(); }
void OSD::init() { pinMode(MAX7456_SELECT,OUTPUT); pinMode(MAX7456_VSYNC, INPUT_PULLUP); // digitalWrite(MAX7456_VSYNC,HIGH); //enabling pull-up resistor detectMode(); hw_init(); }
static inline void main_init( void ) { hw_init(); sys_time_init(); led_init(); uart0_init(); vor_int_demod_init(); VorDacInit(); vor_adc_init(); int_enable(); }
int main(void) { int i; hw_init(); setbuf(stdout, 0); printf("connect usb drive...\n"); while (!hw_usb_connected()) hw_usb_process(); printf("usb drive connected\n"); while (!hw_usb_enum_done()) hw_usb_process(); printf("usb drive enum done\n"); hw_led_red(1); printf("test conditions:\n"); printf(" rw size: %d\n", rw_szie); printf(" rw count: %d\n", rw_count); printf(" cache mode: %s\n", cache_mode ? "dynamic" : "static"); if (!open_filedev()) goto Finish; if (!mbr_scan()) goto Finish; /*Execute tests for every scaned partition.*/ for (i = 0; i < 4; i++) { if (!bdevs.partitions[i].bdif) continue; printf("do tests for mbr_entry %d:\n", i); printf(" offeset: 0x%"PRIx64", %"PRIu64"MB\n", bdevs.partitions[i].part_offset, bdevs.partitions[i].part_offset / (1024 * 1024)); printf(" size: 0x%"PRIx64", %"PRIu64"MB\n", bdevs.partitions[i].part_size, bdevs.partitions[i].part_size / (1024 * 1024)); tim_wait_ms(TEST_DELAY_MS); if (!do_tests(&bdevs.partitions[i])) goto Finish; } printf("press RESET button to restart\n"); Finish: while (1) { tim_wait_ms(500); hw_led_green(1); tim_wait_ms(500); hw_led_green(0); } }
static inline void main_init( void ) { hw_init(); sys_time_init(); led_init(); comm_init(COMM_TELEMETRY); rc_init(); int_enable(); }
static inline void main_init( void ) { hw_init(); sys_time_init(); led_init(); comm_init(DA_COMM); comm_add_tx_callback(DA_COMM, test_message_tx); comm_add_rx_callback(DA_COMM, test_message_rx); int_enable(); }
int emu10k1_init(struct emu10k1_card *card) { /* Init Card */ if (hw_init(card) < 0) return -1; voice_init(card); addxmgr_init(card); DPD(2, " hw control register -> %#x\n", emu10k1_readfn0(card, HCFG)); return 0; }
//----------------------------------------------------------------------------------------------------// // @func - xilkernel_init //! @desc //! Initialize the system - This function is called at the start of system. //! It initializes the system. //! - Initializes the process vector table. //! - Creates the Idle process (pid - 0). //! - Creates the static set of processes. //! @return //! - Nothing. //----------------------------------------------------------------------------------------------------// void xilkernel_init(void) { unsigned int i = 0 ; DBG_PRINT("XMK: Initializing Hardware.\r\n"); hw_init(); // Do hardware specific initialization DBG_PRINT("XMK: System initialization.\r\n"); for( ; i < MAX_PROCESS_CONTEXTS; i++ ) { ptable[i].is_allocated = 0 ; ptable[i].pcontext.isrflag = 0; } #ifdef MB_XILKERNEL kernel_sp = (void*)((unsigned int)&_stack + SSTACK_PTR_ADJUST); #elif defined(PPC_XILKERNEL) kernel_sp = (void*)((unsigned int)&__stack + SSTACK_PTR_ADJUST); #endif readyq_init(); #ifdef CONFIG_PTHREAD_SUPPORT pthread_init(); #endif #ifdef CONFIG_SEMA sem_heap_init(); #endif #ifdef CONFIG_MSGQ msgq_init(); #endif #ifdef CONFIG_SHM shm_init(); #endif #ifdef CONFIG_BUFMALLOC bufmalloc_init (); #endif init_idle_task (); #ifdef CONFIG_STATIC_ELF_PROCESS_SUPPORT se_process_init() ; // Create statically specified separate executable processes #endif #ifdef CONFIG_STATIC_PTHREAD_SUPPORT kb_pthread_init (); // Create statically specified kernel bundled threads #endif #ifdef CONFIG_TIME soft_tmr_init (); #endif }
static inline void main_init( void ) { hw_init(); sys_time_init(); led_init(); uart0_init(); motor_power = 0; wt_servo_init(); wt_servo_set(500); spi_init(); wt_baro_init(); int_enable(); }
void OSD::init() { #ifndef SLAVE_BUILD pinMode(MAX7456_SELECT,OUTPUT); pinMode(MAX7456_VSYNC, INPUT_PULLUP); pinMode(MAX7456_RESET_PIN, OUTPUT); digitalWrite(MAX7456_RESET_PIN, HIGH); #endif reset(); detectMode(); hw_init(); }
static int __devinit emu10k1_init(struct emu10k1_card *card) { /* Init Card */ if (hw_init(card) != CTSTATUS_SUCCESS) return CTSTATUS_ERROR; voice_init(card); timer_init(card); addxmgr_init(card); DPD(2, " hw control register -> %x\n", sblive_readfn0(card, HCFG)); return CTSTATUS_SUCCESS; }
int main(void) { hw_init(); sys_time_init(); overo_link_init(); DEBUG_SERVO1_INIT(); while (1) { if (sys_time_periodic()) main_periodic(); main_event(); } return 0; }
bool Display::init(void) { memset(&_flags, 0, sizeof(_flags)); _healthy = hw_init(); if (!_healthy) { return false; } // update all on display update_all(); hw_update(); return true; }