Exemplo n.º 1
0
int main(void)
{
	// SystemINIT
	SystemInit();

	// Init Debug Serial
	serial_init();

	// Init COOS
	CoInitOS ();

	// Setup tasks

	cli_init();		  // Init Serial Client
	ip_init();        // Init IP Stack
	http_init();	  // Init HTTP Server

	// Start Tasks!
	CoStartOS ();

	// Never to get here!!!
	while(1)
    {
    }
}
Exemplo n.º 2
0
Arquivo: main.c Projeto: inf3ct3d/fmtr
int main(void)
{
	/* Enable GPIO block clock */
	SYSCON_AHBPeriphClockCmd(SYSCON_AHBPeriph_GPIO, ENABLE);

	CoInitOS();

	/* Create Blink Task 0 */
	CoCreateTask( taskBlink0,
				  (void *)0,
				  PRIORITY_BLINK_TASK0,
			      &stkBlink0[SIZE_BLINK_TASK0-1],
			      SIZE_BLINK_TASK0 );

	/* Create Blink Task 1 */
	CoCreateTask( taskBlink1,
				  (void *)0,
				  PRIORITY_BLINK_TASK1,
			      &stkBlink1[SIZE_BLINK_TASK1-1],
			      SIZE_BLINK_TASK1 );

	CoStartOS();

	while(1);
}
Exemplo n.º 3
0
/**
 *******************************************************************************
 *    Main function
 *******************************************************************************
 */
int main()
{		
  	RCC_Configuration();				/*!< Configure the system clocks      */   
  	NVIC_Configuration();			    /*!< NVIC Configuration               */ 
	UART_Configuration ();				/*!< UART configuration               */

	uart_printf ("\n\r\n\r");
	uart_printf ("\r System initial...                  ");
	uart_printf (" [OK]. \n");
	uart_printf ("\r System Clock have been configured as 60MHz!\n\n");

    uart_printf ("\r +------------------------------------------------+ \n");
	uart_printf ("\r | CooCox RTOS Demo for Cortex-M3 MCU(STM32F10x). |	\n");
	uart_printf ("\r | Demo in Keil MCBSTM32 Board.                   | \n");
	uart_printf ("\r +------------------------------------------------+ \n\n");



	uart_printf ("\r Initial CooCox RTOS...              ");
	CoInitOS();							/*!< Initial CooCox RTOS 			  */
	uart_printf (" [OK]. \n");


	uart_printf ("\r Create a \"task_init\" task...        ");
	CoCreateTask(task_init, (void *)0, 10,&task_init_Stk[TASK_STK_SIZE-1], TASK_STK_SIZE);
	uart_printf (" [OK]. \n");


	uart_printf ("\r Start multi-task.                   ");
	CoStartOS();


	while (1);
}
Exemplo n.º 4
0
int main(void) {
    CoInitOS();
    lwip_init();
    http_init();
    CoStartOS();
    
    while(1);
}
Exemplo n.º 5
0
int main() {
    CoInitOS();

    CoCreateTask(task_led, (void *)0, TASK_LED_PRI, &task_led_stack[TASK_LED_STACK_SIZE - 1], TASK_LED_STACK_SIZE);

    CoStartOS();

    return 0;
}
Exemplo n.º 6
0
int main()
{
	SystemInit();
	printf("aaa");
	CoInitOS();
	lwip_init_task();
	http_init();
	CoStartOS();

	while(1);
}
Exemplo n.º 7
0
/**
 *******************************************************************************
 * @brief		main function	   
 * @param[in] 	None	 
 * @param[out] 	None  
 * @retval		None	 
 *******************************************************************************
 */
int main (){
  CoInitOS ();				 /*!< Initial CooCox CoOS          */

  /*!< Create three tasks	*/
  CoCreateTask ((FUNCPtr)taskA,(void *)123,0,&taskA_stk[STACK_SIZE_TASKA-1],STACK_SIZE_TASKA);
  CoCreateTask ((FUNCPtr)taskB,(void *)&par,1,&taskB_stk[STACK_SIZE_TASKB-1],STACK_SIZE_TASKB);
  CoCreateTask ((FUNCPtr)taskC,(void *)0,2,&taskC_stk[STACK_SIZE_TASKC-1],STACK_SIZE_TASKC);
  CoStartOS ();			    /*!< Start multitask	           */  

  while (1);                /*!< The code don''t reach here	   */
}
Exemplo n.º 8
0
int main(void)
{
	initializeBoard();
	CoInitOS();
	//CoCreateTask(USART_rx,0,0,&USART1_stk[STACK_SIZE_DEFAULT-1],STACK_SIZE_DEFAULT);
	CoCreateTask(blinkLED,0,0,&blinkLED_stk[STACK_SIZE_DEFAULT-1],STACK_SIZE_DEFAULT);
	CoCreateTask(btPRESS,0,1,&btPRESS_stk[STACK_SIZE_DEFAULT-1],STACK_SIZE_DEFAULT);
	//CoCreateTask(GPIO_LCD1602,0,0,&updateLCD_stk[STACK_SIZE_DEFAULT-1],STACK_SIZE_DEFAULT);
	CoStartOS();

	while(1);
}
Exemplo n.º 9
0
// ------------------------------------------------------------------------
//  main( ) - Main program creates task0 and then starts CoOS kernel.
//
// ------------------------------------------------------------------------
int main(void)
{
	// initialize the LPCXpresso board by:
	// 		turning on clock signal for the GPIO peripheral.
	// 		setting GPIO port 0, bit22 for output (to drive LED2)
	initializeBoard();

	// initialize the CoOS real time kernel
	CoInitOS();

	// create task1
	CoCreateTask(task1,0,0,&task1_stk[STACK_SIZE_DEFAULT-1],STACK_SIZE_DEFAULT);

	// start the CoOS real time kernel
	CoStartOS();

	// you should never get here!
    while(1);
}
Exemplo n.º 10
0
int main(void)
{
    cpuInit();
    uartInit(BAUDRATE);
    i2cInit();

    TASKHANDLES System;
    System.flight_control.armed=0;
    System.flight_control.error=0;    
    System.lock.i2c = CoCreateMutex ( );
    
    CoInitOS();

    CoCreateTask( ledTask,
            &System,
            PRIORITY_LED_TASK,
            &stkLED[SIZE_LED_TASK-1],
            SIZE_LED_TASK );

    CoCreateTask( radioTask,
            &System,
            PRIORITY_RADIO_TASK,
            &stkRADIO[SIZE_RADIO_TASK-1],
            SIZE_RADIO_TASK );

    CoCreateTask( flightTask,
            &System,
            PRIORITY_FLIGHT_TASK,
            &stkFLIGHT[SIZE_FLIGHT_TASK-1],
            SIZE_FLIGHT_TASK );    


    printf("Starting OS!!\n");

    CoStartOS();
    printf("ERROR");
    while(1);
}
Exemplo n.º 11
0
void menusTask(void * pdata)
{
  opentxInit();

#if defined(PCBTARANIS) && defined(REV9E)
  while (1) {
    uint32_t pwr_check = pwrCheck();
    if (pwr_check == e_power_off) {
      break;
    }
    else if (pwr_check == e_power_press) {
      continue;
    }
#else
  while (pwrCheck() != e_power_off) {
#endif
    U64 start = CoGetOSTime();
    perMain();
    // TODO remove completely massstorage from sky9x firmware
    U32 runtime = (U32)(CoGetOSTime() - start);
    // deduct the thread run-time from the wait, if run-time was more than 
    // desired period, then skip the wait all together
    if (runtime < MENU_TASK_PERIOD_TICKS) {
      CoTickDelay(MENU_TASK_PERIOD_TICKS - runtime);
    }
  }

#if defined(REV9E)
  topLcdOff();
#endif

  BACKLIGHT_OFF();

#if defined(PCBTARANIS)
  displaySleepBitmap();
#else
  lcd_clear();
  displayPopup(STR_SHUTDOWN);
#endif

  opentxClose();
  boardOff(); // Only turn power off if necessary
}

extern void audioTask(void* pdata);

void tasksStart()
{
  CoInitOS();

#if defined(CLI)
  cliStart();
#endif

#if defined(BLUETOOTH)
  btTaskId = CoCreateTask(btTask, NULL, 15, &btStack[BT_STACK_SIZE-1], BT_STACK_SIZE);
#endif

  mixerTaskId = CoCreateTask(mixerTask, NULL, 5, &mixerStack[MIXER_STACK_SIZE-1], MIXER_STACK_SIZE);
  menusTaskId = CoCreateTask(menusTask, NULL, 10, &menusStack[MENUS_STACK_SIZE-1], MENUS_STACK_SIZE);
  audioTaskId = CoCreateTask(audioTask, NULL, 7, &audioStack[AUDIO_STACK_SIZE-1], AUDIO_STACK_SIZE);

#if !defined(SIMU)
  audioMutex = CoCreateMutex();
  mixerMutex = CoCreateMutex();
#endif

  CoStartOS();
}
Exemplo n.º 12
0
int main(void)
{
	CoInitOS();
	CoStartOS();
}
Exemplo n.º 13
0
int main()
{
    UART_CFG_Type uart_config;
    UART_FIFO_CFG_Type uart_fifo_config;
    TIM_TIMERCFG_Type timer_config;
    TIM_MATCHCFG_Type timer_match;
    OS_TID uart_task_id = 0;
    OS_TID activity_task_id = 0;
    uint32_t reset_flags = 0;

    reset_flags = LPC_SYSCON->SYSRSTSTAT;

    SEQ_Initialize();
    PROTO_Reset();
    PROTO_SetHandlers(g_protocol_handlers);

    SYSCON_AHBPeriphClockCmd(SYSCON_AHBPeriph_GPIO, ENABLE);

    // Reset pin
    IOCON_SetPinFunc(IOCON_PIO0_0, PIO0_0_FUN_RESET);

    // Status LED pin
    ACTIVITY_SET_PIN();
    GPIO_SetDir(ACTIVITY_PORT, ACTIVITY_PIN, 1);
    GPIO_ResetBits(ACTIVITY_PORT, ACTIVITY_PIN);

    // Timer activity LED pin
    TIMER_ACTIVITY_SET_PIN();
    GPIO_SetDir(TIMER_ACTIVITY_PORT, TIMER_ACTIVITY_PIN, 1);
    GPIO_ResetBits(TIMER_ACTIVITY_PORT, TIMER_ACTIVITY_PIN);

    // RGB control
    RED_SET_PIN();
    GREEN_SET_PIN();
    BLUE_SET_PIN();
    GPIO_SetDir(RED_PORT, RED_PIN, 1);
    GPIO_SetDir(GREEN_PORT, GREEN_PIN, 1);
    GPIO_SetDir(BLUE_PORT, BLUE_PIN, 1);
    GPIO_ResetBits(RED_PORT, RED_PIN);
    GPIO_ResetBits(GREEN_PORT, GREEN_PIN);
    GPIO_ResetBits(BLUE_PORT, BLUE_PIN);

    timer_config.PrescaleOption = TIM_PRESCALE_TICKVAL;
    timer_config.PrescaleValue = 1;
    TIM_Init(LPC_TMR32B0, TIM_TIMER_MODE, &timer_config);

    timer_match.MatchChannel = 0;
    timer_match.IntOnMatch = ENABLE;
    timer_match.StopOnMatch = DISABLE;
    timer_match.ResetOnMatch = ENABLE;
    timer_match.ExtMatchOutputType = 0;
    timer_match.MatchValue = SystemCoreClock / (TICKS_PER_SECOND * 256);
    TIM_ConfigMatch(LPC_TMR32B0, &timer_match);

    TIM_Cmd(LPC_TMR32B0, ENABLE);
    NVIC_EnableIRQ(TIMER_32_0_IRQn);

    // UART
    IOCON_SetPinFunc(IOCON_PIO1_6, PIO1_6_FUN_RXD);   /* UART RXD - PIO1_6 */
    IOCON_SetPinFunc(IOCON_PIO1_7, PIO1_7_FUN_TXD);   /* UART RXD - PIO1_7 */

    uart_config.Baud_rate = 115200;
    uart_config.Databits = UART_DATABIT_8;
    uart_config.Parity = UART_PARITY_NONE;
    uart_config.Stopbits = UART_STOPBIT_1;

    UART_Init(LPC_UART, &uart_config);

    uart_fifo_config.FIFO_Level = UART_FIFO_TRGLEV0;
    uart_fifo_config.FIFO_ResetRxBuf = ENABLE;
    uart_fifo_config.FIFO_ResetTxBuf = ENABLE;
    UART_FIFOConfig(LPC_UART, &uart_fifo_config);

    UART_TxCmd(LPC_UART, ENABLE);

    // SPI
    CL632_Init();
    // Select page 0 and no paging access
    CL632_SpiWriteByte(0x00, 0x00);
    CL632_SpiWriteByte(0x00, 0x00);

    // LCD
    // LCD backlite control
    LCD_BACKLITE_SET_PIN();
    GPIO_SetDir(LCD_BACKLITE_PORT, LCD_BACKLITE_PIN, 1);
    GPIO_ResetBits(LCD_BACKLITE_PORT, LCD_BACKLITE_PIN);

    // LCD Data bus
    LCD_DATA_SET_PINS();
    GPIO_SetDir(LCD_DATA_PORT, LCD_DATA_BUS, 1);
    GPIO_ResetBits(LCD_DATA_PORT, LCD_DATA_BUS);

    LCD_RS_SET_PIN();
    GPIO_SetDir(LCD_RS_PORT, LCD_RS_PIN, 1);
    GPIO_ResetBits(LCD_RS_PORT, LCD_RS_PIN);

    LCD_RW_SET_PIN();
    GPIO_SetDir(LCD_RW_PORT, LCD_RW_PIN, 1);
    GPIO_ResetBits(LCD_RW_PORT, LCD_RW_PIN);

    LCD_E_SET_PIN();
    GPIO_SetDir(LCD_E_PORT, LCD_E_PIN, 1);
    GPIO_ResetBits(LCD_E_PORT, LCD_E_PIN);

    KS0066_PowerUpDelay();
    KS0066_FunctionSet();
    KS0066_WaitForIdle();
    KS0066_DisplayOnOffControl(KS0066_DISPCTL_DISPLAY_ON);
    KS0066_WaitForIdle();
    KS0066_ClearDisplay();
    KS0066_WaitForIdle();

    CoInitOS();
    GPIO_SetBits(ACTIVITY_PORT, ACTIVITY_PIN);

    uart_task_id = CoCreateTask(uartTask, NULL, UART_TASK_PRIORITY,
            GetStackTop(uartTaskStack), GetStackSize(uartTaskStack));

    activity_task_id = CoCreateTask(activityTask, NULL, ACTIVITY_TASK_PRIORITY,
            GetStackTop(activityTaskStack), GetStackSize(activityTaskStack));

    if (uart_task_id == E_CREATE_FAIL || activity_task_id == E_CREATE_FAIL) {
        UART_PrintString("INIT ERROR");
        UART_PrintString(kNewLine);
    }

    if (reset_flags & 0x01)
        UART_PrintString("RST:PU");
    else if (reset_flags & 0x02)
        UART_PrintString("RST:RST");
    else if (reset_flags & 0x04)
        UART_PrintString("RST:WDT");
    else if (reset_flags & 0x08)
        UART_PrintString("RST:BOD");
    else if (reset_flags & 0x10)
        UART_PrintString("RST:SOFT");
    else
        UART_PrintString("RST");

    UART_PrintString(kNewLine);

    PrintVersionString(UART_WriteChar);
    UART_PrintString(kNewLine);
    func_printf_nofloat(UART_WriteChar, "COOS:%d\r\n", CoGetOSVersion());

    KS0066_WriteString("V:" __DATE__ " " __TIME__, KS0066_WRAP_FLAG);

    CoStartOS();

    //while (1) {
    //}

    return 0;
}