/*(
 * Kneron Peripheral API - SDC Test function
 *
 * Copyright (C) 2019 Kneron, Inc. All rights reserved.
 *
 */
#include <stdio.h>
#include <string.h>
#include "cmsis_os2.h"
#include "project.h"
#include "kdrv_cmsis_core.h"
#include "kdrv_uart.h"
#include "kdrv_system.h"
#include "kdrv_power.h"
#include "kdrv_pwm.h"
#include "kdrv_sdc.h"
#include "base.h"
#include "io.h"
#include "kdrv_ddr.h"
#include "kmdw_console.h"
#include "kdrv_status.h"
extern void kdrv_system_init(void);
extern void sdc_test_main(void);


/**
 * @brief main, main dispatch function
 */
int main(void)
{
    kdrv_system_init();                 // system default clock and power initialize
    kdrv_uart_initialize();             // uart initialize
    kdrv_uart_console_init(MSG_PORT, MSG_PORT_BAUDRATE, NULL);       // uart0 initialize for log
    kdrv_system_init_ncpu();            // init ncpu/ddr power domain, this is a must for ddr
    kdrv_ddr_system_init(DDR_INIT_ALL); // ddr initialize
    /* pwmtimer initialize for 1ms timer */
    if(kdrv_pwmtimer_initialize(PWMTIMER1, PWMTMR_1MSEC_PERIOD) != KDRV_STATUS_OK) {
        kmdw_printf("Init timer%d Fail!\n",PWMTIMER1);
    }
    SystemCoreClockUpdate();            // System Initialization
    osKernelInitialize();               // Initialize CMSIS-RTOS
    sdc_test_main();
    while(1) {
    }
}
