YB_Platform/inc/osp_ape.h

264 lines
8.9 KiB
C
Raw Normal View History

2023-07-13 11:27:03 +08:00
#ifndef __OSP_APE_INTERFACE_H__
#define __OSP_APE_INTERFACE_H__
/****************************UCP2.0 Platform start***********************************/
2024-05-17 13:58:40 +08:00
#define MAX_BUF_VERSION_LEN (128)
typedef struct SpuVersionInfo {
char platform_commit[MAX_BUF_VERSION_LEN];
char platform_tag[MAX_BUF_VERSION_LEN];
char platform_build_date[MAX_BUF_VERSION_LEN/2];
} SpuVersionInfo_t;
2023-07-13 11:27:03 +08:00
/************************************************************************************/
/* shell相关接口定义 */
/************************************************************************************/
2024-05-17 13:58:40 +08:00
/*
* : spu_show_version
* : void
* SPU侧的版本信息
* ret: void
*/
void spu_show_version(void);
/*
* : SPU侧的版本信息
* : pVersion [out]:
* SPU侧版本信息
* ret: 0-success, 1-error
*/
int32_t spu_version_get(SpuVersionInfo_t *pVersion);
2023-07-13 11:27:03 +08:00
/* shell命令回调函数类型 */
typedef unsigned long (*OSP_FUNCPTR)();
/*
spu_insert_cmd_ext
name : shell命令:_ape:i_ape,7
pfunc : shell命令的回调函数
desc : shell命令的描述
argnum : shell命令的参考个数
shell命令
*/
void spu_insert_cmd_ext(char *name, OSP_FUNCPTR pfunc, char *desc, uint32_t argnum);
/************************************************************************************/
/* 调试信息输出相关 */
/************************************************************************************/
/*
osp_sendLog
level1
pbufbuf地址osp_msg_head预留
size
cell_id
*/
void osp_sendLog(int level, char* pbuf, int size, int cell_id);
/*
osp_sendLog_print
level1
pbufbuf地址osp_msg_head预留
size
cell_id
*/
void osp_sendLog_print(int level,char* pbuf, int size, int cell_id);
/************************************************************************************/
/* 任务相关接口定义 */
/************************************************************************************/
/* 任务类型 */
typedef enum OSP_TASK_TYPE
{
OSP_NORMAL_TYPE, /* 周期性任务普通任务经测试1 tick是200ms */
OSP_TIMER_TYPE, /* 定时点触发任务 */
OSP_EVENT_TYPE, /* 事件触发任务 */
OSP_DRIVER_TYPE, /* 驱动任务 */
OSP_OSP_TYPE, /* 平台任务 */
}task_type;
/* 函数类型*/
typedef void(*OSP_TASKENTRY_FUNC)();
typedef int(*OSP_TASKINIT_FUNC)(void);
2023-07-13 11:27:03 +08:00
/* 任务信息结构体 */
typedef struct OSP_TASK_INFO_EX
{
uint32_t task_id; /* 任务Id物理层用1-55 */
char *task_name; /* 任务名称(要求长度不能增加31字节) */
uint32_t task_prio; /* 任务优先级物理层用1-55数字越小优先级越高 */
uint32_t stack_size; /* 堆栈大小 */
uint32_t task_type; /* 任务类型 当OSP_TIMER_TYPE时s_bitmap和t_off才有效 */
uint32_t delay_value; /* 是否需要延时 0不延时 ; n: 延时n个tick */
uint32_t s_bitmap; /* slot bit map : 最多支持10个时隙每个时隙最多50个点 */
uint32_t t_off; /* 偏移时间 */
OSP_TASKINIT_FUNC task_init; /* 任务初始化 */
OSP_TASKENTRY_FUNC task_entry; /* 任务循环体 */
}osp_task_info_ex;
/*
osp_task_create
task_st_info *
*/
extern int osp_task_create(osp_task_info_ex *);
/*
osp_del_task
prio :
scsId: scs id
2023-07-13 11:27:03 +08:00
*/
extern void osp_del_task(int prio, int scsId);
/*
osp_var_init
*/
extern void osp_var_init(void);
2023-07-13 11:27:03 +08:00
/*
smart_int_disable
*/
extern void smart_int_disable(void);
/*
smart_int_enable
*/
extern void smart_int_enable(void);
/*
使
osp_strlen
str :
*/
extern int osp_strlen(const char * str); /* 该接口目前无人维护,强烈建议不再使用 */
/************************************************************************************/
/* 消息通信相关接口 */
/************************************************************************************/
/* 消息类型 */
typedef enum OSP_MSG_TYPE
{
UCP4008_KERNEL_INTER = 0, /* 核间通信 */
UCP4008_OSP_HANDSHAKE = 7, /* 握手消息 */
UCP4008_OSP_CFG_FILE, /* 微码配置文件消息 */
UCP4008_OSP_DDR_INIT, /* DDR初始化配置消息 */
UCP4008_OSP_DUMP, /* DUMP消息 */
UCP4008_OSP_LOG, /* LOG消息 */
UCP4008_OSP_SHELL, /* Shell消息 */
UCP4008_OSP_SHELL_ECHO, /* Shell回显消息 */
UCP4008_KERNEL_INNER = 0xFF,/* 核内通信 */
}osp_msg_type;
#define OSP_MSG_HEAD_LEN (12) /* OSP消息头的长度消息头的具体定义在osp_msg.h中 */
/*
osp_alloc_msg
DDR上
size
0
-NULLPTR
*/
extern char *osp_alloc_msg(int size);
/*
osp_send_msg
msg_addr
msg_len
msg_type
src_core_idID
dst_core_idID
src_task_idID
dst_task_idID
0
-2
-1
*/
extern int osp_send_msg(uint32_t msg_addr,
uint32_t msg_len,
uint8_t msg_type,
uint8_t src_core_id,
uint8_t dst_core_id,
uint8_t src_task_id,
uint8_t dst_task_id);
/************************************************************************************/
/* 配置文件相关接口 */
/************************************************************************************/
/*
osp_get_cfgfile
DDR地址及长度
name64
pbufDDR中的地址
psizeDDR中配置文件的长度
0
-1
-2
*/
extern int osp_get_cfgfile(char* name, uint32_t *pbuf, int* psize);
/************************************************************************************/
/* 定时点相关接口 */
/************************************************************************************/
/*
osp_timer_sync
使
int scsId:ID号
typedef enum _tagScsID
{
LTE_SCS_ID = 0,
NR_SCS_30K,
NR_SCS_60K,
NR_SCS_120K,
SCS_NULL = 0xFFFF
}numScsID;
*/
extern void osp_timer_sync(int scsId); /* 使能任务定时点 */
/*
osp_timer_unsync
int scsId:ID号
typedef enum _tagScsID
{
LTE_SCS_ID = 0,
NR_SCS_30K,
NR_SCS_60K,
NR_SCS_120K,
SCS_NULL = 0xFFFF
}numScsID;
*/
extern void osp_timer_unsync(int scsId);
2023-07-13 11:27:03 +08:00
/*
spu_get_oam_handle_id
inst_id0/1
OAM队列的handle_id
*/
extern int32_t spu_get_oam_handle_id(uint8_t inst_id);
2023-07-13 11:27:03 +08:00
#endif