int main() { /* Semaphore creation */ vSemaphoreCreateBinary(ahrs_task_semaphore); vSemaphoreCreateBinary(flight_control_task_semaphore); /* Peripheral initialization */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); led_init(); debug_port_init(); usart3_init(57600); i2c1_init(); spi1_init(); timer1_init(); pwm_timer4_init(); pwm_timer5_init(); pwm_capture_timer2_init(); pwm_capture_timer3_init(); pwm_capture_timer8_init(); //Make sure all the peripheral is finished the initialization delay_ms(5); /* Device initialization */ while(mpu6050_init()); while(hmc5983_init()); nrf24l01_init(); motor_init(); /* Task creation */ //Attitude and Heading Reference System (AHRS) task xTaskCreate(ahrs_task, (portCHAR *)"AHRS task", 4096, NULL, tskIDLE_PRIORITY + 3, NULL); xTaskCreate(flight_control_task, (portCHAR *)"Flight control task", 4096, NULL, tskIDLE_PRIORITY + 2, NULL); #ifndef DEBUG_PRINT //USART plot task xTaskCreate(usart_plot_task, (portCHAR *)"USART plot task", 2048, NULL, tskIDLE_PRIORITY + 1, NULL); #endif /* Start schedule */ vTaskStartScheduler(); return 0; }
void msm_serial_debug_init(unsigned int base, int irq, struct device *clk_device, int signal_irq) { int ret; void *port; debug_clk = clk_get(clk_device, "uart_clk"); if (debug_clk) clk_enable(debug_clk); port = ioremap(base, 4096); if (!port) return; init_data.base = base; init_data.irq = irq; init_data.clk_device = clk_device; init_data.signal_irq = signal_irq; debug_port_base = (unsigned int) port; debug_signal_irq = signal_irq; debug_port_init(); debug_prompt(); msm_fiq_select(irq); msm_fiq_set_handler(debug_fiq, 0); msm_fiq_enable(irq); ret = request_irq(signal_irq, debug_irq, IRQF_TRIGGER_RISING, "debug", 0); if (ret) printk(KERN_ERR "serial_debugger: could not install signal_irq"); #if defined(CONFIG_MSM_SERIAL_DEBUGGER_CONSOLE) register_console(&msm_serial_debug_console); #endif debugger_enable = 1; }
int main() { /* Semaphore creation */ vSemaphoreCreateBinary(ahrs_task_semaphore); /* Peripheral initialization */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); led_init(); debug_port_init(); usart3_init(57600); i2c1_init(); timer2_init(); //Make sure all the peripheral is finished the initialization delay_ms(1000); /* Device initialization */ while(mpu6050_init()); led_on(LED1); //Initialization is finished /* Task creation */ //Attitude and Heading Reference System (AHRS) task xTaskCreate(ahrs_task, (portCHAR *)"AHRS task", 4096, NULL, tskIDLE_PRIORITY + 2, NULL); //USART plot task xTaskCreate(usart_plot_task, (portCHAR *)"USART plot task", 2048, NULL, tskIDLE_PRIORITY + 1, NULL); /* Start schedule */ vTaskStartScheduler(); return 0; }