214 lines
4.2 KiB
C
Executable File
214 lines
4.2 KiB
C
Executable File
/****************************************************************************
|
|
*
|
|
* Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
|
*
|
|
* This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
|
* be copied by any method or incorporated into another program without
|
|
* the express written consent of Aerospace C.Power. This Information or any portion
|
|
* thereof remains the property of Aerospace C.Power. The Information contained herein
|
|
* is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
|
* liability for its use in any way and conveys no license or title under
|
|
* any patent or copyright and makes no representation or warranty that this
|
|
* Information is free from patent or copyright infringement.
|
|
*
|
|
* ****************************************************************************/
|
|
|
|
/* os shim includes */
|
|
#include "os_types.h"
|
|
#include "os_task.h"
|
|
#include "os_utils.h"
|
|
|
|
/* common includes */
|
|
#include "iot_io.h"
|
|
#include "iot_bitops.h"
|
|
#include "iot_pkt_api.h"
|
|
#include "iot_ipc.h"
|
|
#include "iot_plc_lib.h"
|
|
#include "iot_dbglog_api.h"
|
|
#include "iot_config.h"
|
|
#include "iot_pkt.h"
|
|
|
|
/* driver includes */
|
|
#include "iot_clock.h"
|
|
#include "iot_uart.h"
|
|
#include "iot_led.h"
|
|
|
|
/* cli includes */
|
|
#include "iot_cli.h"
|
|
#include "iot_uart_h.h"
|
|
|
|
/* debug includes*/
|
|
#include "dbg_io.h"
|
|
|
|
#include "apb_glb_reg.h"
|
|
#include "apb_dma.h"
|
|
#include "apb.h"
|
|
|
|
#include "hw_reg_api.h"
|
|
#include "pin_rf.h"
|
|
#include "ana.h"
|
|
|
|
#include "dma_hw.h"
|
|
#include "dma_sw.h"
|
|
#include "hal_sadc.h"
|
|
|
|
extern int platform_init();
|
|
|
|
os_task_h test_init_handle;
|
|
|
|
static const iot_pkt_config_t test_pkt_config =
|
|
{
|
|
{
|
|
{
|
|
256,
|
|
50,
|
|
PKT_OWNER_ALL,
|
|
},
|
|
{
|
|
600,
|
|
50,
|
|
PKT_OWNER_ALL,
|
|
},
|
|
{
|
|
1100,
|
|
15,
|
|
PKT_OWNER_ALL,
|
|
},
|
|
{
|
|
2200,
|
|
6,
|
|
PKT_OWNER_ALL,
|
|
},
|
|
{
|
|
0,
|
|
0,
|
|
PKT_OWNER_NONE,
|
|
},
|
|
{
|
|
0,
|
|
0,
|
|
PKT_OWNER_NONE,
|
|
},
|
|
{
|
|
0,
|
|
0,
|
|
PKT_OWNER_NONE,
|
|
},
|
|
{
|
|
0,
|
|
0,
|
|
PKT_OWNER_NONE,
|
|
},
|
|
}
|
|
};
|
|
|
|
void sadc_test_task_init()
|
|
{
|
|
os_task_h handle;
|
|
|
|
handle = os_create_task(sadc_test_task, NULL, 6);
|
|
//create the tasks;
|
|
if (handle != NULL)
|
|
{
|
|
iot_printf("task create successfully...\n");
|
|
}
|
|
}
|
|
|
|
void sadc_test_init()
|
|
{
|
|
/* init common modules */
|
|
iot_bitops_init();
|
|
|
|
/* init os related modules and utilities */
|
|
os_utils_init();
|
|
|
|
/* init dbglog module */
|
|
//iot_dbglog_init();
|
|
|
|
/* init pkt module */
|
|
//iot_pkt_init(&test_pkt_config);
|
|
(void)test_pkt_config;
|
|
|
|
/* init ipc module */
|
|
iot_ipc_init();
|
|
|
|
/*init uart module*/
|
|
iot_uart_init(0);
|
|
|
|
sadc_test_task_init();
|
|
}
|
|
|
|
void sadc_init_task(void *arg)
|
|
{
|
|
iot_printf("task 1 entry....\n");
|
|
|
|
for (;;)
|
|
{
|
|
sadc_test_init();
|
|
os_delete_task(test_init_handle);
|
|
}
|
|
}
|
|
|
|
int32_t sadc_task_init()
|
|
{
|
|
/* start plc lib task */
|
|
test_init_handle = os_create_task(sadc_init_task, NULL, 9);
|
|
|
|
//create the tasks;
|
|
if (test_init_handle != NULL)
|
|
{
|
|
iot_printf("task 1 init successfully...\n");
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int32_t sadc_task_start()
|
|
{
|
|
//start the tasks;
|
|
os_start_kernel();
|
|
|
|
return 0;
|
|
}
|
|
|
|
int32_t iot_platform_init()
|
|
{
|
|
// int r = 0;
|
|
/*platform intialization*/
|
|
platform_init();
|
|
|
|
//resource initializations;
|
|
system_clock_init();
|
|
|
|
system_uart_init();
|
|
|
|
dbg_uart_init();
|
|
|
|
iot_led_init();
|
|
return 0;
|
|
}
|
|
|
|
int32_t iot_module_init(void)
|
|
{
|
|
//platform intialization;
|
|
iot_platform_init();
|
|
|
|
//create all the tasks;
|
|
sadc_task_init();
|
|
|
|
iot_printf("starting...\n");
|
|
|
|
return 0;
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
//module init;
|
|
iot_module_init();
|
|
|
|
//module start;
|
|
sadc_task_start();
|
|
|
|
return 0;
|
|
}
|