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.

70 lines
2.4 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved.
* Description: mailbox export interface definition.
*/
#ifndef _MBX_H_
#define _MBX_H_
#include <linux/types.h>
#ifdef __cplusplus
#if __cplusplus
extern "C"
{
#endif
#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 ACPU2HPP_MAILBOX_HANDLE 16
#define ACPU2TPP_MAILBOX_HANDLE 12
/* define session ID for user */
#define EXT_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 EXT_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 EXT_MBX_ACPU2HRF_CHECK gen_mbx_session(HPP, ACPU, 7)
#define EXT_MBX_TCPU2HRF_CHECK gen_mbx_session(HPP, TCPU, 8)
#define EXT_MBX_ACPU2HRF_PMOC gen_mbx_session(HPP, ACPU, 9)
#define EXT_MBX_TCPU2HRF_PMOC gen_mbx_session(HPP, TCPU, 10)
#define EXT_MBX_ACPU2HRF_ADSP gen_mbx_session(HPP, ACPU, 11)
#define EXT_MBX_ACPU2TPP_CA_MSG gen_mbx_session(ACPU, TPP, 12)
#define EXT_MBX_TCPU2TPP_CA_MSG gen_mbx_session(TCPU, TPP, 13)
#define EXT_MBX_TCPU2VMCU0_SSM_2 gen_mbx_session(VMCU0, TCPU, 14)
#define EXT_MBX_ACPU2HRF_REG_RW gen_mbx_session(HPP, ACPU, 15)
#define EXT_MBX_ACPU2HRF_KEYPROVISION gen_mbx_session(HPP, ACPU, 16)
#define EXT_MBX_ACPU2DMCU0 gen_mbx_session(DMCU0, ACPU, 17)
typedef void(*session_callback)(unsigned int handle, const void *data);
int drv_mbx_open(unsigned int session_id);
int drv_mbx_register_irq_callback(unsigned int handle, session_callback func, const void *const data);
int drv_mbx_rx(unsigned int handle, unsigned char *msg, unsigned int msg_len,
unsigned int *rx_len, unsigned int timeout);
int drv_mbx_tx(unsigned int handle, const unsigned char *msg, unsigned int msg_len,
unsigned int *tx_len, unsigned int timeout);
int drv_mbx_close(unsigned int handle);
int drv_mbx_write_hrf_reg(unsigned int reg, unsigned int value);
int drv_mbx_read_hrf_reg(unsigned int reg, unsigned int *value);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cpluscplus */
#endif /* _MBX_H_ */