pinebuds/apps/common/app_thread.h

96 lines
2.1 KiB
C
Raw Permalink Normal View History

2022-08-15 04:20:27 -05:00
/***************************************************************************
*
* Copyright 2015-2019 BES.
* All rights reserved. All unpublished rights reserved.
*
* No part of this work may be used or reproduced in any form or by any
* means, or stored in a database or retrieval system, without prior written
* permission of BES.
*
* Use of this work is governed by a license granted by BES.
* This work contains confidential and proprietary information of
* BES. which is protected by copyright, trade secret,
* trademark and other intellectual property rights.
*
****************************************************************************/
#ifndef __APP_THREAD_H__
#define __APP_THREAD_H__
#include <stdbool.h>
#include <stdint.h>
2022-08-15 04:20:27 -05:00
#ifdef __cplusplus
extern "C" {
#endif
#define APP_MAILBOX_MAX (20)
enum APP_MODUAL_ID_T {
APP_MODUAL_KEY = 0,
APP_MODUAL_AUDIO,
APP_MODUAL_BATTERY,
APP_MODUAL_BT,
APP_MODUAL_FM,
APP_MODUAL_SD,
APP_MODUAL_LINEIN,
APP_MODUAL_USBHOST,
APP_MODUAL_USBDEVICE,
APP_MODUAL_WATCHDOG,
APP_MODUAL_AUDIO_MANAGE,
APP_MODUAL_ANC,
APP_MODUAL_SMART_MIC,
#ifdef __PC_CMD_UART__
APP_MODUAL_CMD,
2022-08-15 04:20:27 -05:00
#endif
#ifdef TILE_DATAPATH
APP_MODUAL_TILE,
2022-08-15 04:20:27 -05:00
#endif
APP_MODUAL_MIC,
2022-08-15 04:20:27 -05:00
#ifdef VOICE_DETECTOR_EN
APP_MODUAL_VOICE_DETECTOR,
2022-08-15 04:20:27 -05:00
#endif
APP_MODUAL_CUSTOM_FUNCTION,
APP_MODUAL_OHTER,
APP_MODUAL_WNR,
2022-08-15 04:20:27 -05:00
APP_MODUAL_NUM
2022-08-15 04:20:27 -05:00
};
typedef struct {
uint32_t message_id;
uint32_t message_ptr;
uint32_t message_Param0;
uint32_t message_Param1;
uint32_t message_Param2;
2022-08-15 04:20:27 -05:00
} APP_MESSAGE_BODY;
typedef struct {
uint32_t src_thread;
uint32_t dest_thread;
uint32_t system_time;
uint32_t mod_id;
APP_MESSAGE_BODY msg_body;
2022-08-15 04:20:27 -05:00
} APP_MESSAGE_BLOCK;
typedef int (*APP_MOD_HANDLER_T)(APP_MESSAGE_BODY *);
int app_mailbox_put(APP_MESSAGE_BLOCK *msg_src);
2022-08-15 04:20:27 -05:00
int app_mailbox_free(APP_MESSAGE_BLOCK *msg_p);
2022-08-15 04:20:27 -05:00
int app_mailbox_get(APP_MESSAGE_BLOCK **msg_p);
2022-08-15 04:20:27 -05:00
int app_os_init(void);
int app_set_threadhandle(enum APP_MODUAL_ID_T mod_id,
APP_MOD_HANDLER_T handler);
2022-08-15 04:20:27 -05:00
void *app_os_tid_get(void);
2022-08-15 04:20:27 -05:00
bool app_is_module_registered(enum APP_MODUAL_ID_T mod_id);
#ifdef __cplusplus
}
2022-08-15 04:20:27 -05:00
#endif
#endif //__FMDEC_H__