YB_Platform/inc/osp_ape.h
2024-05-17 13:58:40 +08:00

264 lines
8.9 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __OSP_APE_INTERFACE_H__
#define __OSP_APE_INTERFACE_H__
/****************************UCP2.0 Platform start***********************************/
#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;
/************************************************************************************/
/* shell相关接口定义 */
/************************************************************************************/
/*
* 函数名称: 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);
/* 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
函数入参level固定传1
函数入参pbuf申请的buf地址osp_msg_head预留
函数入参size消息大小
函数入参cell_id小区标识
函数功能:调试信息输出(字符串型接口)
*/
void osp_sendLog(int level, char* pbuf, int size, int cell_id);
/*
函数名称osp_sendLog_print
函数入参level固定传1
函数入参pbuf申请的buf地址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);
/* 任务信息结构体 */
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
函数功能:任务删除接口
*/
extern void osp_del_task(int prio, int scsId);
/*
函数名称osp_var_init
函数入参:无
函数功能:设置配置文件标识位
*/
extern void osp_var_init(void);
/*
函数名称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_id源核ID
dst_core_id目的核ID
src_task_id源任务ID
dst_task_id目的任务ID
函数返回值:
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地址及长度
函数参数name微码配置文件名称约定长度不能超过64字节
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);
/*
函数名称spu_get_oam_handle_id
函数入参inst_id小区编号0/1
函数功能根据小区编号返回对应的OAM队列的handle_id
*/
extern int32_t spu_get_oam_handle_id(uint8_t inst_id);
#endif