#include "main.h"

int main(void)
{
    sciInit();
    gioInit();
    getBoardIdentification();

    if (PmId == PROCB){
        Puts("\r\nBoard PROCB\r\n");
    }else if (PmId == NAVB){
        Puts("Board NAVB\r\n");
    }else{
        Puts("Board ACTB\r\n");
    }

    FTTE_Service_Initializer();
/*
    if (pdPASS
            != xTaskCreate(FTTE_Service_Initializer, "FTTE_TASK", configMINIMAL_STACK_SIZE, NULL,
                           FTTE_TASK_PRIORITY, NULL))
    {
        Puts("ERROR creating task; aborting.\n");
        abort();
    }
*/
    GNC_Service_Initializer();
    FPS_Service_Initializer();
    /*
    if (pdPASS
            != xTaskCreate(GNC_TASK, "GNC_TASK", configMINIMAL_STACK_SIZE, NULL,
                           GNC_TASK_PRIORITY, NULL))
    {
        Puts("ERROR creating task; aborting.\n");
        abort();
    }

    if (pdPASS
            != xTaskCreate(FPS_TASK, "FPS_TASK", 100, NULL, FPS_TASK_PRIORITY,
                           NULL))
    {
        Puts("ERROR creating task; aborting.\n");
        abort();
    }
*/
    Puts("Starting FreeRTOS Scheduler\r\n");
    vTaskStartScheduler();
    //_enable_IRQ();

    while (1);
}

void getBoardIdentification(void)
{
    PmId = (PmId_T) gioGetBit(gioPORTA, 0);
}
