// +FHDR------------------------------------------------------------
//                 Copyright (c) 2022 SmartLogic.
//                       ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename      : ape_test_case5.s.c
// Author        : 
// Created On    : 2022-11-02
// Last Modified :
// -----------------------------------------------------------------
// Description:
//
//
// -FHDR------------------------------------------------------------

#include "typedef.h"
#include "osp_task.h"
#include "osp_timer.h"
#include "ucp_printf.h"

/**************************************************************************/
/*                                 APE0                                   */
void ape0_test_timer0(void);
void ape0_test_timer3(void);

void ape0_event_task1(uint32_t address, uint32_t size);
void ape0_event_task2(uint32_t address, uint32_t size);
void ape0_event_task3(uint32_t address, uint32_t size);

/********************************************/
/* APE0: 2个定时点任务，2个事件任务 */
/* 优先级：Timer0 > Event1 > Event2 > Timer3 */
void ape0_test_task_reg(void)
{
    osp_task_info_ex ape0_timer_0 = {40, (int8_t*)"ape0_test_timer0", 40, 1024, OSP_TIMER_TYPE, 0, 0x3FF, 10,  NULL, (OSP_TASKENTRY_FUNC)ape0_test_timer0};
    osp_task_info_ex ape0_event_1 = {41, (int8_t*)"ape0_test_event1", 41, 1024, OSP_EVENT_TYPE, 0, 0,     0,   NULL, (OSP_TASKENTRY_FUNC)ape0_event_task1};
    osp_task_info_ex ape0_event_2 = {42, (int8_t*)"ape0_test_event2", 42, 1024, OSP_EVENT_TYPE, 0, 0,     0,   NULL, (OSP_TASKENTRY_FUNC)ape0_event_task2};
    osp_task_info_ex ape0_timer_3 = {43, (int8_t*)"ape0_test_timer3", 43, 1024, OSP_TIMER_TYPE, 0, 0x3FF, 300, NULL, (OSP_TASKENTRY_FUNC)ape0_test_timer3};
    osp_task_info_ex ape0_event_3 = {44, (int8_t*)"ape0_test_event3", 44, 1024, OSP_EVENT_TYPE, 0, 0,     0,   NULL, (OSP_TASKENTRY_FUNC)ape0_event_task3};

    osp_task_create(&ape0_timer_0);
    osp_task_create(&ape0_event_1);
    osp_task_create(&ape0_event_2);
    osp_task_create(&ape0_timer_3);
    osp_task_create(&ape0_event_3);

    osp_timer_sync(1);
    return;
}

/**************************************************************************/
/*                                 APE1                                   */
void ape1_test_timer0(void);
void ape1_test_timer3(void);

void ape1_event_task1(uint32_t address, uint32_t size);
void ape1_event_task2(uint32_t address, uint32_t size);
void ape1_event_task3(uint32_t address, uint32_t size);

/********************************************/
/* APE1: 2个定时点任务，2个事件任务 */
/* 优先级：Timer0 > Event1 > Event2 > Timer3 */
void ape1_test_task_reg(void)
{
    osp_task_info_ex ape1_timer_0 = {40, (int8_t*)"ape1_test_timer0", 40, 1024, OSP_TIMER_TYPE, 0, 0x3FF, 10,  NULL, (OSP_TASKENTRY_FUNC)ape1_test_timer0};
    osp_task_info_ex ape1_event_1 = {41, (int8_t*)"ape1_test_event1", 41, 1024, OSP_EVENT_TYPE, 0, 0,     0,   NULL, (OSP_TASKENTRY_FUNC)ape1_event_task1};
    osp_task_info_ex ape1_event_2 = {42, (int8_t*)"ape1_test_event2", 42, 1024, OSP_EVENT_TYPE, 0, 0,     0,   NULL, (OSP_TASKENTRY_FUNC)ape1_event_task2};
    osp_task_info_ex ape1_timer_3 = {43, (int8_t*)"ape1_test_timer3", 43, 1024, OSP_TIMER_TYPE, 0, 0x3FF, 300, NULL, (OSP_TASKENTRY_FUNC)ape1_test_timer3};
    osp_task_info_ex ape1_event_3 = {44, (int8_t*)"ape1_test_event3", 44, 1024, OSP_EVENT_TYPE, 0, 0,     0,   NULL, (OSP_TASKENTRY_FUNC)ape1_event_task3};

    osp_task_create(&ape1_timer_0);
    osp_task_create(&ape1_event_1);
    osp_task_create(&ape1_event_2);
    osp_task_create(&ape1_timer_3);
    osp_task_create(&ape1_event_3);

    osp_timer_sync(1);
    return;
}

