2023-07-13 11:27:03 +08:00
|
|
|
|
#ifndef __INTER_MSG_REG_H__
|
|
|
|
|
#define __INTER_MSG_REG_H__
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define FUN_IRQ_MAX_NUM 512
|
|
|
|
|
#define IRQ_MAX_NUM 32
|
|
|
|
|
#define IRQ_SYS_MASK_NUM 16
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef unsigned int uint32_t;
|
|
|
|
|
typedef unsigned int UINT32;
|
|
|
|
|
|
|
|
|
|
typedef void (*irq_handler)();
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
all_irq,
|
|
|
|
|
fun_s,
|
|
|
|
|
fun_e,
|
|
|
|
|
// clear_cnt_error,
|
|
|
|
|
// irq_check_error
|
|
|
|
|
|
|
|
|
|
}irq_cnt_type_t;
|
|
|
|
|
|
|
|
|
|
typedef unsigned int uint32_t;
|
|
|
|
|
typedef unsigned short uint16_t;
|
|
|
|
|
typedef unsigned char uint8_t;
|
|
|
|
|
typedef signed int int32_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
|
|
|
|
|
uint32_t reg_irq_cnt; //0x00
|
|
|
|
|
uint32_t reg_irq_val[IRQ_MAX_NUM]; //0x04-0x80
|
|
|
|
|
|
|
|
|
|
uint32_t reg_irq_cpu_id; //0x84
|
|
|
|
|
|
|
|
|
|
uint32_t irq_cnt; //0x88
|
|
|
|
|
|
|
|
|
|
uint32_t fun_start_cnt_all; //0x8c
|
|
|
|
|
uint32_t fun_end_cnt_all; //0x90
|
2023-08-18 20:30:52 +08:00
|
|
|
|
uint32_t cur_irq_num; //0x94
|
|
|
|
|
uint32_t fun_run_cnt[FUN_IRQ_MAX_NUM]; //0x98-0x894
|
2023-07-13 11:27:03 +08:00
|
|
|
|
|
2023-08-18 20:30:52 +08:00
|
|
|
|
// uint32_t last_irq_num; //0x8a4
|
2023-07-13 11:27:03 +08:00
|
|
|
|
|
2023-08-18 20:30:52 +08:00
|
|
|
|
uint32_t irq_sys_mask[IRQ_SYS_MASK_NUM]; //0x894 -0x8d0
|
|
|
|
|
uint32_t irq_sys_status[IRQ_SYS_MASK_NUM]; //0x8d4 -0x910
|
|
|
|
|
uint32_t apc_csu_allpendevent0; //0x914
|
|
|
|
|
uint32_t apc_csu_intmaskl; //0x918
|
2023-07-13 11:27:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}irq_debug_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2023-08-18 20:30:52 +08:00
|
|
|
|
函数名称:smart_irq_request
|
|
|
|
|
输入参数: vector
|
|
|
|
|
输入参数:func
|
|
|
|
|
返回类型: int
|
|
|
|
|
返回值: 小于0 表示失败
|
|
|
|
|
返回值: 0 表示成功
|
|
|
|
|
函数功能: 中断注册接口
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
extern int smart_irq_request(uint32_t vector,irq_handler func);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-08-18 20:30:52 +08:00
|
|
|
|
函数名称:smart_irq_enable
|
|
|
|
|
输入参数: vector
|
|
|
|
|
返回类型: int
|
|
|
|
|
返回值: 小于0 表示失败
|
|
|
|
|
返回值: 0 表示成功
|
|
|
|
|
函数功能: 中断使能接口
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_irq_enable(uint32_t vector);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-08-18 20:30:52 +08:00
|
|
|
|
函数名称:smart_irq_disable
|
|
|
|
|
输入参数: vector
|
|
|
|
|
返回类型: int
|
|
|
|
|
返回值: 小于0 表示失败
|
|
|
|
|
返回值: 0 表示成功
|
|
|
|
|
函数功能: 中断去使能接口
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_irq_disable(uint32_t vector);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-08-18 20:30:52 +08:00
|
|
|
|
函数名称:smart_irq_debug_init
|
|
|
|
|
输入参数: debug_base_addr
|
|
|
|
|
输入参数:len_bytes
|
|
|
|
|
返回类型: int
|
|
|
|
|
返回值: 小于0 表示失败
|
|
|
|
|
返回值: 0 表示成功
|
|
|
|
|
函数功能: 中断调试接口,
|
|
|
|
|
注意:
|
|
|
|
|
通过地址与,长度指定相应的buf 数据空间,存放相应的中断调试信息。
|
|
|
|
|
这些调试信息已经格式化,地址由用户指定,len_bytes 不能小于sizeof(irq_debug_t)
|
|
|
|
|
数据格式化内容是 irq_debug_t
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_irq_debug_init(uint32_t debug_base_addr, uint32_t len_bytes);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-08-18 20:30:52 +08:00
|
|
|
|
函数名称:smart_irq_get_type_cnt
|
|
|
|
|
输入参数: num_type
|
|
|
|
|
返回类型: int
|
|
|
|
|
返回值: 0 表示当前type 类型计数为0
|
|
|
|
|
返回值: 非0 表示当前type 类型有计数
|
|
|
|
|
函数功能: 获取某种中断计数
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern uint32_t smart_irq_get_type_cnt(irq_cnt_type_t num_type);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-08-18 20:30:52 +08:00
|
|
|
|
函数名称:smart_irq_get_run_cnt
|
|
|
|
|
输入参数: irq_num:中断号
|
|
|
|
|
返回类型: int
|
|
|
|
|
返回值: 小于0 表示获取失败。输入参数有问题
|
|
|
|
|
返回值: 为0 表示相应中断没有触发
|
|
|
|
|
返回值: 非0 表示中断产生的次数
|
|
|
|
|
函数功能:获取相应中断号的中断计数
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_irq_get_run_cnt(uint32_t irqnum);
|
|
|
|
|
|
|
|
|
|
/*
|
2023-08-18 20:30:52 +08:00
|
|
|
|
函数名称:smart_get_cpuid
|
|
|
|
|
输入参数: 无
|
|
|
|
|
返回类型: int
|
|
|
|
|
返回值: 当前的cpuid 号
|
|
|
|
|
函数功能:获取当前核cpuid 号
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_get_cpuid();
|
|
|
|
|
|
|
|
|
|
/*
|
2023-08-18 20:30:52 +08:00
|
|
|
|
函数名称:smart_irq_init
|
|
|
|
|
输入参数: cpuid
|
|
|
|
|
返回类型: int
|
|
|
|
|
返回值: 非0 初始化失败
|
|
|
|
|
函数功能:中断初始化
|
2023-07-13 11:27:03 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern int smart_irq_init(int cpuid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|