78 lines
2.4 KiB
C
78 lines
2.4 KiB
C
|
/****************************************************************************
|
|||
|
|
|||
|
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 _MAILBOX_H_
|
|||
|
#define _MAILBOX_H_
|
|||
|
|
|||
|
#ifdef __cplusplus
|
|||
|
extern "C" {
|
|||
|
#endif
|
|||
|
|
|||
|
/**
|
|||
|
* @brief iot_mb_msg_cb() - 当某个core收到数据时,该函数被自动调用
|
|||
|
* @param core_id: 表示数据是从哪个core发来的
|
|||
|
*/
|
|||
|
typedef void(*iot_mb_msg_cb)(int core_id);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief iot_mb_open() - 打开mailbox并注册中断回调函数
|
|||
|
* @param cb: 接收到数据时的回调函数,该函数要完成数据的读取和处理
|
|||
|
*/
|
|||
|
uint32_t iot_mb_open(iot_mb_msg_cb cb);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief iot_mb_close() - 关闭mailbox
|
|||
|
*/
|
|||
|
uint32_t iot_mb_close(void);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief iot_mb_write() - 向其他core发送数据
|
|||
|
* @param core_id: 指示发送给哪个core,注意不能发送给自己
|
|||
|
* @param data : 要发送的数据
|
|||
|
*/
|
|||
|
uint32_t iot_mb_write(uint32_t core_id, uint32_t data);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief iot_mb_read() - 读取其他core发来的数据
|
|||
|
* @param core_id: 指示从哪个core读取数据
|
|||
|
* @param p_data : 内存地址
|
|||
|
*/
|
|||
|
uint32_t iot_mb_read(uint32_t core_id, uint32_t *p_data);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief iot_mb_get_read_space() - 获取指定的core向本core发了多少字节的数据,单位WORD
|
|||
|
* @param core_id: 指示获取哪个core
|
|||
|
*/
|
|||
|
uint32_t iot_mb_get_read_space(uint32_t core_id);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief iot_mb_get_write_space() - 获取指定的core还能接收多少字节的数据,单位WORD
|
|||
|
* @param core_id: 指示获取哪个core
|
|||
|
*/
|
|||
|
uint32_t iot_mb_get_write_space(uint32_t core_id);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief iot_mb_init() - 初始化mailbox
|
|||
|
*/
|
|||
|
void iot_mb_init(void);
|
|||
|
uint32_t iot_mb_mask();
|
|||
|
uint32_t iot_mb_unmask();
|
|||
|
|
|||
|
#ifdef __cplusplus
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
#endif
|