You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.0 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved.
* Description: mailbox interface for liteOS
*/
#ifndef __LOS_MAILBOX_H__
#define __LOS_MAILBOX_H__
#include "td_type.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
enum cpu_id {
HPP = 0,
TPP,
TCPU,
ACPU,
VMCU0,
VMCU1,
DMCU0,
CPU_MAX,
};
#define GEN_MBX_SESSION(side0, side1, num) \
(((num) & 0xFF) << 8 | ((side0) & 0xF) << 4 | ((side1) & 0xF))
/* define session ID for user */
#define SOC_MBX_ACPU2HIL_BOOT GEN_MBX_SESSION(HPP, ACPU, 1)
#define EXT_MBX_ACPU2HRF_BOOT GEN_MBX_SESSION(HPP, ACPU, 2)
#define EXT_MBX_ACPU2HRF_ACPU_DVFS GEN_MBX_SESSION(HPP, ACPU, 3)
#define SOC_MBX_ACPU2HRF_GPU_DVFS GEN_MBX_SESSION(HPP, ACPU, 4)
#define EXT_MBX_ACPU2VMCU0_VFMW GEN_MBX_SESSION(VMCU0, ACPU, 5)
#define EXT_MBX_TCPU2VMCU0_SSM GEN_MBX_SESSION(VMCU0, TCPU, 6)
#define SOC_MBX_ACPU2HRF_CHECK GEN_MBX_SESSION(HPP, ACPU, 7)
#define SOC_MBX_TCPU2HRF_CHECK GEN_MBX_SESSION(HPP, TCPU, 8)
#define EXT_MBX_ACPU2HRF_PMOC GEN_MBX_SESSION(HPP, ACPU, 9)
#define SOC_MBX_TCPU2HRF_PMOC GEN_MBX_SESSION(HPP, TCPU, 10)
#define EXT_MBX_TCPU2VMCU0_SSM_2 GEN_MBX_SESSION(VMCU0, TCPU, 11)
#define EXT_MBX_ACPU2DMCU0 GEN_MBX_SESSION(DMCU0, ACPU, 17)
typedef void (*session_callback)(td_u32 handle, const void *data);
td_s32 drv_mbx_open(td_u32 session_id);
td_s32 drv_mbx_close(td_u32 handle);
td_s32 drv_mbx_register_irq_callback(td_u32 handle, session_callback func, const void * const data);
td_s32 drv_mbx_rx(td_u32 handle, td_u8 *msg, td_u32 msg_len, const td_u32 * const rx_len, td_u32 timeout);
td_s32 drv_mbx_tx(td_u32 handle, const td_u8 *msg, td_u32 msg_len, const td_u32 * const tx_len,
td_u32 timeout);
td_s32 drv_mbx_deinit(void);
td_s32 drv_mbx_init(enum cpu_id local_cpu);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#endif /* __MAILBOX_H__ */