1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef __APP_THREAD_H__ 5 #define __APP_THREAD_H__ 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif 10 11 #define APP_MAILBOX_MAX (20) 12 13 enum APP_MODUAL_ID_T { 14 APP_MODUAL_KEY = 0, 15 APP_MODUAL_AUDIO, 16 APP_MODUAL_BATTERY, 17 APP_MODUAL_BT, 18 APP_MODUAL_FM, 19 APP_MODUAL_SD, 20 APP_MODUAL_LINEIN, 21 APP_MODUAL_USBHOST, 22 APP_MODUAL_USBDEVICE, 23 APP_MODUAL_WATCHDOG, 24 APP_MODUAL_AUDIO_MANAGE, 25 APP_MODUAL_ANC, 26 APP_MODUAL_SMART_MIC, 27 #ifdef __PC_CMD_UART__ 28 APP_MODUAL_CMD, 29 #endif 30 #ifdef TILE_DATAPATH 31 APP_MODUAL_TILE, 32 #endif 33 APP_MODUAL_MIC, 34 #ifdef VOICE_DETECTOR_EN 35 APP_MODUAL_VOICE_DETECTOR, 36 #endif 37 APP_MODUAL_OHTER, 38 39 APP_MODUAL_NUM 40 }; 41 42 typedef struct { 43 uint32_t message_id; 44 uint32_t message_ptr; 45 uint32_t message_Param0; 46 uint32_t message_Param1; 47 uint32_t message_Param2; 48 } APP_MESSAGE_BODY; 49 50 typedef struct { 51 uint32_t src_thread; 52 uint32_t dest_thread; 53 uint32_t system_time; 54 uint32_t mod_id; 55 APP_MESSAGE_BODY msg_body; 56 } APP_MESSAGE_BLOCK; 57 58 typedef int (*APP_MOD_HANDLER_T)(APP_MESSAGE_BODY *); 59 60 int app_mailbox_put(APP_MESSAGE_BLOCK* msg_src); 61 62 int app_mailbox_free(APP_MESSAGE_BLOCK* msg_p); 63 64 int app_mailbox_get(APP_MESSAGE_BLOCK** msg_p); 65 66 int app_os_init(void); 67 68 int app_set_threadhandle(enum APP_MODUAL_ID_T mod_id, APP_MOD_HANDLER_T handler); 69 70 void * app_os_tid_get(void); 71 72 bool app_is_module_registered(enum APP_MODUAL_ID_T mod_id); 73 74 #ifdef __cplusplus 75 } 76 #endif 77 78 #endif//__FMDEC_H__ 79