/*
 * Copyright (c) 2015, Freescale Semiconductor, Inc.
 * Copyright 2016-2017 NXP
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/* FreeRTOS kernel includes. */
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
#include "timers.h"

/* Freescale includes. */
#include "board.h"
#include "clock_config.h"
#include "fsl_debug_console.h"
#include "fsl_device_registers.h"
#include "fsl_gpio.h"
#include "peripherals.h"
#include "pin_mux.h"
#include "ff.h"
#include "diskio.h"

#include "user_tasks.h"

/*******************************************************************************
 * Definitions
 ******************************************************************************/

FATFS g_file_system;

/*******************************************************************************
 * Prototypes
 ******************************************************************************/

/*******************************************************************************
 * Code
 ******************************************************************************/
/*!
 * @brief Application entry point.
 */
int main(void)
{
    /* Init board hardware. */
    BOARD_ConfigMPU();
    BOARD_InitBootPins();
    BOARD_InitBootClocks();
    BOARD_InitBootPeripherals();
    BOARD_InitDebugConsole();

    BaseType_t ret;

    ret = xTaskCreate(hello_task, "HELO_TASK", 512, NULL, 4, &g_hello_task_handle);
    if(ret != pdPASS) goto err_out;

    ret = xTaskCreate(CardDetectTask, "CARD_TASK", 1024, NULL, 4, &g_card_detect_task_handle);
    if(ret != pdPASS) goto err_out;
    
    vTaskStartScheduler();

err_out:

    for (;;) {

    }
}