static void root_task(void *p) { kprintf(" Root task started...\n"); clock_init(INT_SYSTICK); systick_init(); kprintf(" Clock subsystem inited.\n"); console_init(); kprintf(" Console subsystem inited.\n"); kservice_init(); kprintf(" tkservice started.\n"); // command_init(); // kprintf(" Shell subsystem inited.\n"); samv_agent_init(); kprintf(" Samv agent inited.\n"); #ifdef INCLUDE_GDB_STUB // gdb_stub_init(); // kprintf(" gdb stub inited.\n"); #endif /* INCLUDE_GDB_STUB */ /* a temp wrapper */ // net_task_init(); // lwip_sys_init(); // kprintf(" LWIP inited.\n"); udelay_init(); user_app_init(); kprintf(" Root task ended.\n"); }
int main() { /* * Initialize the SYSTICK timer */ systick_init(); /* * Demonstrate use of LED.h/LED.c - modifies hardware registers using C */ LED_init(); LED_update(LED_BLUE_ON); LED_update(LED_BLUE_OFF); LED_update(LED_RED_ON | LED_BLUE_ON | LED_ORANGE_ON | LED_GREEN_ON ); /* * Demonstrate use of in-line assembly - enable interrupts */ __asm (" cpsie i \n" ); /* Initialize the USART for 9600, 8N1, send '!' - calls into USART2.S */ /* NOTE: must set USART2 interrupt config register to enable TX/RX interrupts */ USART2_init(); USART2_send('!'); uint32_t test_val = 785904457; printHex(785904457); /* Wait here forever */ while(1); /* We'll never reach this line */ return 0; }
void init_system(void) { /* keep mosfet closed to ground (circuit on) */ gpio_pre_init(); /* timing first, needed for all delays */ systick_init(); /* get globalb config */ config_read(); lcd_init_gpio(); lcd_init_fsmc(); /* lcd inid always before touch_init, since it resets lcd */ lcd_init(); ui_init(); gpio_init(); adc_init(); audio_init(); rtc_init(); touch_init(); }
/*================================================================================== * 函 数 名: Set_System * 参 数: None * 功能描述: 初始化系统 * 返 回 值: None * 备 注: * 作 者: gaodb * 创建时间: 2012.10 ==================================================================================*/ void Set_System(void) { rcc_init(); peri_clk_init(); NVIC_Configuration(); pins_init(); systick_init(); timer2_init(); timer4_init(); RAY12_ADC_Init(); LCD_Config(); DispInit(); uart1_init(BAUD_RATE_57600); uart2_init(BAUD_RATE_57600); dac1_init(); sys_variable_init(); }
int main(void) { disable_global_int(); init_clk_system(); init_gpio(); init_status_led(); init_spi(); systick_init(); enable_global_int(); INT8U counter = 0; while(1) { /* System part of the super loop. */ while(!ticks); // The following will be executed every 5mS ticks--; if (!--alive_timer) { alive_timer = TIM_500_MSEC; GPIO_PORTF_DATA_R ^= 0x01; SSI0_DR_R = counter++; // Send this through SPI } /* Application part of the super loop. */ //counter = SSI0_SR_R; } return (0); }
/*============================================================================= * Function : * Description : * Input Para : * Output Para : * Return Value : =============================================================================*/ void drv_all_init(void) { ENABLE_IRQ(); led_init(); led_on(2); uart_init(); systick_init(); // hwtm_init(); // key_init(); // rtc_init(); // SRAM_Init(); /* Initialize the LCD */ // STM3210E_LCD_Init(); // adc_init(); // return 0; }
void init_ethernet(void) { enc28j60_comm_init(); UARTprintf("Welcome\n"); enc_init(mac_addr); systick_init(); lwip_init(); #if !LWIP_DHCP IP4_ADDR(&gw_g, 10,0,0,1); IP4_ADDR(&ipaddr_g, 10,0,0,100); IP4_ADDR(&netmask_g, 255, 255, 255, 0) #else IP4_ADDR(&gw_g, 0,0,0,0); IP4_ADDR(&ipaddr_g, 0,0,0,0); IP4_ADDR(&netmask_g, 0, 0, 0, 0); #endif netif_add(&netif_g, &ipaddr_g, &netmask_g, &gw_g, NULL, enc28j60_init, ethernet_input); netif_set_default(&netif_g); #if !LWIP_DHCP netif_set_up(&netif_g); #else dhcp_start(&netif_g); #endif }
int main(void) { cpu_init(); uart_init(); systick_init(); AdsPinConfig(); spi_init(); init_ethernet(); httpd_init(); last_arp_time = last_tcp_time = 0; while(1) { //MAP_SysCtlSleep(); task_lwip(); task_enc(); task_ads(); } return 0; }
static void setup(void) { // rcc rcc_clock_setup_hse_3v3(&rcc_hse_25mhz_3v3[RCC_CLOCK_3V3_168MHZ]); // systick systick_init(); // LED ping LED_ping_init(); // tty tty_init(&my_tty); // USB CDC/ACM cdcacm_init(); // TTY stdio tty_stdio_init(&my_tty); // connect TTY to USB. cdcacm_register_receive_callback(usb_to_tty); tty_register_send_callback(&my_tty, tty_to_usb); // wait for user to connect. cdcacm_open(); }
int main() { /* config gpio for led */ RCC_AHB1ENR = (1 << 6); GPIOG_MODER = 0x14000000; //GPIOG_OTYPER &= ~(1 << 13); //GPIOG_OTYPER is default push-pull GPIOG_OSPEEDR = 0x14000000; systick_init(); unsigned char flag = 0; unsigned int temp; while(1){ do{ temp = STK_CTRL; }while((temp&0x01)&&(!(temp&(1<<16)))); if(flag){ GPIOG_BSRR = 0x00002000; //PG13 ON flag = 0; }else{ GPIOG_BSRR = 0x20000000; //PG13 OFF flag = 1; } } }
/** * @brief main routine for example * @return Function should not exit. */ int main(void) { USBD_API_INIT_PARAM_T usb_param; USB_CORE_DESCS_T desc; ErrorCode_t ret = LPC_OK; /* Initialize board and chip */ SystemCoreClockUpdate(); Board_Init(); /* Init millisecond timer tick driver */ systick_init(); /* enable clocks and pinmux */ usb_pin_clk_init(); /* initialize call back structures */ memset((void *) &usb_param, 0, sizeof(USBD_API_INIT_PARAM_T)); usb_param.usb_reg_base = LPC_USB_BASE + 0x200; usb_param.max_num_ep = 2; usb_param.mem_base = USB_STACK_MEM_BASE; usb_param.mem_size = USB_STACK_MEM_SIZE; /* Set the USB descriptors */ desc.device_desc = (uint8_t *) USB_DeviceDescriptor; desc.string_desc = (uint8_t *) USB_StringDescriptor; /* Note, to pass USBCV test full-speed only devices should have both * descriptor arrays point to same location and device_qualifier set * to 0. */ desc.high_speed_desc = USB_FsConfigDescriptor; desc.full_speed_desc = USB_FsConfigDescriptor; desc.device_qualifier = 0; /* USB Initialization */ ret = USBD_API->hw->Init(&g_hUsb, &desc, &usb_param); if (ret == LPC_OK) { /* Mice are generally low or full speed devices and not high speed. */ USBD_API->hw->ForceFullSpeed(g_hUsb, 1); ret = Keyboard_init(g_hUsb, (USB_INTERFACE_DESCRIPTOR *) &USB_FsConfigDescriptor[sizeof(USB_CONFIGURATION_DESCRIPTOR)], &usb_param.mem_base, &usb_param.mem_size); if (ret == LPC_OK) { /* enable USB interrupts */ NVIC_EnableIRQ(USB_IRQn); /* now connect */ USBD_API->hw->Connect(g_hUsb, 1); } } while (1) { /* Do Keyboard tasks */ Keyboard_Tasks(); /* Sleep until next IRQ happens */ __WFI(); } }
//Initialize functions for the board //Starts up void init(void) { setup_flash(); setup_clocks(); setup_nvic(); systick_init(SYSTICK_RELOAD_VAL); board_setup_gpio(); setup_timers(); board_setup_usb(); series_init(); disableDebugPorts(); }
void init(void) { setup_flash(); setup_clocks(); setup_nvic(); systick_init(SYSTICK_RELOAD_VAL); wirish::priv::board_setup_gpio(); setup_adcs(); setup_timers(); wirish::priv::board_setup_usb(); wirish::priv::series_init(); boardInit(); }
void init(void) { setupFlash(); setupClocks(); setupNVIC(); systick_init(SYSTICK_RELOAD_VAL); gpio_init_all(); afio_init(); setupADC(); setupTimers(); setupUSB(); boardInit(); }
void init(void) { setupFlash(); setupClocks(); setupNVIC(); systick_init(SYSTICK_RELOAD_VAL); gpio_init_all(); afio_init(); setupADC(); setupTimers(); // usb_cdcacm_enable(BOARD_USB_DISC_DEV, BOARD_USB_DISC_BIT); boardInit(); }
/******************************************************************************* * function : hw_init ******************************************************************************/ void hw_init(void) { #if CONFIG_SYSCLOCK == CONFIG_SYSCLOCK_16MHZ hw_initSysclock(); #endif systick_init(CONFIG_SYSTICK_1MS); RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN; led_init(); btn_init(); }
void init(void) { setupFlash(); setupClocks(); setupNVIC(); systick_init(SYSTICK_RELOAD_VAL); gpio_init_all(); afio_init(); setupADC(); setupTimers(); // setupUSB(); #if !defined(BOARD_STM32VLD) setupUSB(); #endif boardInit(); }
/** * \brief Initialize the leJOS driver and all required submodules * * Initialization contains: AINTC, systick, sensor ports, motor ports, SPI controller, ADC, hardware buttons, LEDs * * \return none **/ void leJOS_init(void) { if (!is_AINTC_initialized) { // This should be done only once per application - if we use OSEK, leJOS_init will be called at least 2 times interrupt_init(); systick_init(); is_AINTC_initialized = 1; } sensor_init(); spi_init(); adc_init(); motor_init(); led_init(); button_init(); // Confirm that the initialization was successful by setting the LEDs to green led_set(LED_BOTH, LED_GREEN); }
void init(void) { setupFlash(); // ok setupClocks(); // ok setupNVIC(); // ok systick_init(SYSTICK_RELOAD_VAL); // ok gpio_init_all(); // ok afio_init(); // ok setupADC(); // adcs increase mA! setupTimers(); }
void _main(void) { LED_GPIO_Configuration(); USART_Configuration(USART1); #ifdef __DEBUG__ printfs("this is in init fuction.\r\n"); printfs("usart1's initation is compelete.\r\n"); printfs("three lights can bright.\r\n"); #endif systick_init(); #ifdef __DEBUG__ printfs("system ticket clock's initation is compelete.\r\n"); printfs("\r\n"); printfs("now into the tft's initation.\r\n"); #endif LCD_Init(); set_orgin(120, 120); }
int main(void) { /* initialize the hardware */ led_init(); systick_init(); blink(2); systick_delayms(500); /* Loop forever */ unsigned int i; for (i = 3; ; i+=2) { if (isPrime(i)) { blink(i); systick_delayms(500); } } }
int __init main() { /* keep the calling order below because of dependencies */ sys_init(); mm_init(); fs_init(); device_init(); systick_init(); scheduler_init(); console_init(); make_init_task(); load_user_task(); /* that are registered statically */ softirq_init(); #ifdef CONFIG_TIMER timer_init(); #endif #ifndef DEFSTR #define DEFMKSTR(x) #x #define DEFSTR(x) DEFMKSTR(x) #endif /* a banner */ printk("yaos %s %s\n", DEFSTR(VERSION), DEFSTR(MACHINE)); /* switch from boot stack memory to new one */ set_user_sp(init.mm.sp); set_kernel_sp(init.mm.kernel.sp); /* everything ready now */ #ifndef ARMv7A sei(); #endif resched(); /* it doesn't really reach up to this point. init task becomes idle as * its context is already set to idle */ __context_restore(current); __ret_from_exc(0); freeze(); return 0; }
void fsm_set_state(state_t new_state) { /* only do this if the FSM has been locked! */ if( fsm_mutex == MUTEX_LOCKED ) { state = new_state; switch( state ) { case STATE_RESET: case STATE_1: default: /* Initialize the LEDs */ LED_init(); /* Initialize the USART2 for x-over internet communication */ USART2_init(state1_USART2_callback_fn); /* Initialize the USART3 for x-over internet communication */ USART3_init(state1_USART3_callback_fn); /* Turn on just the blue LED */ LED_update( LED_ORANGE_OFF | LED_RED_OFF | LED_BLUE_ON | LED_GREEN_OFF ); break; case STATE_2: /* Turn on the orange LED only */ LED_update( LED_ORANGE_ON | LED_RED_OFF | LED_BLUE_OFF | LED_GREEN_OFF ); //Set up the USART interrupts to buffer the received data from the PING USART3_init(state2_USART3_callback_fn); USART2_init(state2_USART2_callback_fn); //Send a ping message to the server Wifly_Send_Ping(); //Start up a 1 second timer - wait 1 second then print message_reported = 0; systick_init(receive_message_systick_callback); set_systick_time(1); break; } } }
int main(void) { uint8_t t=0; SystemInit(); systick_init(); init_usart(usart1); //init_rtc(); // init_net(); len=0; //buffer[0]=1; //send(usart1,buffer,1); while (1) { process_net(); //if(t!=timer.sec) if(rtc_flag==1) { rtc_flag=0; //time_get(); //t=timer.sec; //debug_format("%d-----\r\n",l); //l++; //debug_format("Time: %0.4dÄê%0.2dÔÂ%0.2dÈÕ %0.2d:%0.2d:%0.2d\r\n",timer.w_year,timer.w_month,timer.w_date,timer.hour,timer.min,timer.sec); } //send(usart4,buffer,len); if(delay>30) { //time_show(); len=receive(usart1,buffer); if(len>0) { //send(usart1,buffer,len); debug_format("the receive len is %d \r\n",len); len=0; } delay=0; } } }
int main(void) { systick_init(); eep_init(); //读取EEPROM内的数据 lcd_init(); key_init(); io_init(); pwm_init(); ntc_init(); while (1) { if (time_1ms_flag == 1) { //1ms进入一次 time_1ms_flag = 0; } if(time_10ms_flag == 1) { //10ms进入一次 time_10ms_flag = 0; key_scan(); } if(time_100ms_flag == 1) { //100ms进入一次 time_100ms_flag = 0; key_done(); } if(time_1s_flag == 1) { //1s执行一次 time_1s_flag = 0; } } }
INT16S start_rtcs_scheduler(void) /***************************************************************************** * Input : - * Output : - * Function : The RTCS scheduler ******************************************************************************/ { // contains temp status of semaphores. // INT16U semaphores_task = 0; ENTER_CRITICAL(); task_setup(); init_tasks(); systick_init(); EXIT_CRITICAL(); while(1) { if (systick_get()) { systick_decrement(); for (rtcs_i = 0; rtcs_i < LAST_TASK+1; rtcs_i++) { if ((task_state[rtcs_i] == RUNNING) && (task_time[rtcs_i] > 0)) { task_time[rtcs_i]--; } } for (rtcs_i = 0; rtcs_i < LAST_TASK+1; rtcs_i++) { if _READY(rtcs_i) { task_time[rtcs_i] = 0; current_task = rtcs_i; // Call task. (*task[rtcs_i])(); } } } // if (tick_flag) } // while(!) return 0; }
/* * @brief stm32 board specific init * @param none * @return none * @note none */ void stm32utils_system_init(void) { setupFlash(); setupClocks(); setupNVIC(); systick_init(SYSTICK_RELOAD_VAL); gpio_init_all(); afio_init(); setupADC(); setupTimers(); setupUSART(USARTx, SERIAL_BAUDRATE); gpio_set_mode(GPIOA, 0, GPIO_OUTPUT_PP); gpio_write_bit(GPIOA, 0, 0); gpio_set_mode(GPIOA, 1, GPIO_OUTPUT_PP); gpio_write_bit(GPIOA, 1, 0); gpio_set_mode(GPIOA, 12, GPIO_OUTPUT_PP); gpio_write_bit(GPIOA, 12, 0); }
int main(void) { struct gpio_pin heartbeat_led; struct timer heartbeat_timer; struct aparser_ctx uart_parser; cli(); gpio_init_output(&yellow_led, &PORTC, 0, false); gpio_init_output(&heartbeat_led, &PORTB, 5, false); timer_set_period_ms(&heartbeat_timer, 500); servo_init(); uart_init(); systick_init(); aparser_init(&uart_parser, 2); aparser_register_commands(&uart_parser, uart_parser_item); wdt_enable(WDTO_500MS); sei(); for (;;) { uint8_t data; if (uart_getchar(&data) == UART_RETCODE_SUCCESS) { uart_putchar(data); aparser_update_and_execute(&uart_parser, data); } if (timer_has_expired(&heartbeat_timer)) { timer_restart(&heartbeat_timer); gpio_toggle(&heartbeat_led); } wdt_reset(); } return 0; }
void startup_task(void *p_arg) { INT8U err; systick_init(); /* Initialize the SysTick. */ #if (OS_TASK_STAT_EN > 0) OSStatInit(); /* Determine CPU capacity. */ #endif /* TODO: create application tasks here */ err = OSTaskCreate(led_toggle, (void *)0, &led_toggle_stk[LED_TOGGLE_STK_SIZE-1], LED_TOGGLE_PRIO); err = OSTaskCreate(tcp_ip, (void *)0, &tcp_ip_stk[TCP_IP_STK_SIZE-1], TCP_IP_PRIO); if (OS_ERR_NONE != err) while(1) ; OSTaskDel(OS_PRIO_SELF); }
void main(void) { /* Set up the USART2 9600-8N1 and to call USART2_callback_fn when new data arrives */ USART2_init(USART2_callback_fn); /* Set up the USART3 9600-8N1 and to call USART2_callback_fn when new data arrives */ USART3_init(USART3_callback_fn); /* Set up and initialize the LEDs. */ LED_init(); /* Configure user pushbutton and call pushbutton_callback_fn when button press-released */ userbutton_init(userbutton_callback_fn); /* Initialize the systick timer with its callback function */ systick_init(systick_callback_fn); set_systick_disabled(); /* initialize the finite state machine */ fsm_init(); //Test ping the server Wifly_Send_Ping(); /* Enable interrupts - do this after initializing the system */ __asm (" cpsie i \n" ); //Put the wifi module into command mode // USART3_putchar('$'); // USART3_putchar('$'); // USART3_putchar('$'); // USART2_putchar('$'); // USART2_putchar('$'); // USART2_putchar('$');// USART2_putstr("$$$\n\r\0"); /* Wait here forever - everything is now interrupt driven */ while(1) { ;;; } }