/**************************************************************************** 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. ****************************************************************************/ #ifndef _APP_CUS_TASK_H_ #define _APP_CUS_TASK_H_ #include "app_common.h" #include "app_types.h" #ifdef __cplusplus extern "C" { #endif #define APP_CUS_HANDLE_TASK_PRIO (8) #define APP_CUS_PENDING_LIMIT (32) #define APP_CUS_TASK_PRIO_QUE (1) #define APP_CUS_TASK_TIMER_PERIOD_MS (1000) typedef void (*iot_cus_task_mismatch_dlt645_proc_fn)(iot_pkt_t *pkt645); typedef struct _iot_cus_task_t { /* task handle. */ iot_task_h task; /* uart handle. */ iot_uart_h uart_h; /* timer handle. */ timer_id_t peroid_timer; } iot_cus_task_t; /* message type for customer task. */ typedef enum { E_CUS_MSG_START = 0, /* customer task message from uart. */ E_CUS_MSG_FROM_UART, /* customer task message from customer task. */ E_CUS_MSG_FROM_CUSTASK, /* customer task message from main task. */ E_CUS_MSG_FROM_MAINTASK, /* customer task message from timer. */ E_CUS_MSG_FROM_TIMER, E_CUS_MSG_END } iot_cus_task_msg_e; /* message id for customer task. */ typedef enum { E_CUS_MSG_ID_START = 0, /* customer task receive bytes from uart. */ E_CUS_MSG_ID_BYTES_RECV, /* customer task send bytes to uart or other task. */ E_CUS_MSG_ID_BYTES_SEND, /* customer task receive dlt645 frame from main task or uart. */ E_CUS_MSG_ID_645PKT_RECV, /* period timer of customer task triggered. */ E_CUS_MSG_ID_TMR_TRIGGER, /* on line or off line event to customer task. */ E_CUS_MSG_ID_ONOFF_LINE, E_CUS_MSG_ID_END } iot_cus_task_msg_id_e; #define APP_CUS_MSG_VALID(msg) ((msg)>E_CUS_MSG_START && (msg)