193 lines
6.7 KiB
C
193 lines
6.7 KiB
C
//#ifdef IDE_TEST
|
||
#ifndef __OSP_INTERFACE_H__
|
||
#define __OSP_INTERFACE_H__
|
||
#if 0
|
||
/****************************UCP2.0 Platform start***********************************/
|
||
|
||
/************************************************************************************/
|
||
/* 任务相关接口定义 */
|
||
/************************************************************************************/
|
||
/* 任务类型 */
|
||
typedef enum OSP_TASK_TYPE
|
||
{
|
||
OSP_NORMAL_TYPE, /* 周期性任务(普通任务) */
|
||
OSP_TIMER_TYPE, /* 定时点触发任务 */
|
||
OSP_EVENT_TYPE, /* 事件触发任务 */
|
||
OSP_DRIVER_TYPE, /* 驱动任务 */
|
||
OSP_OSP_TYPE, /* 平台任务 */
|
||
}task_type;
|
||
|
||
/* 函数类型*/
|
||
typedef void(*OSP_TASKENTRY_FUNC)();
|
||
typedef void(*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 : 待删除的任务的优先级
|
||
函数功能:任务删除接口
|
||
*/
|
||
extern void osp_del_task(int prio);
|
||
|
||
/*
|
||
函数名称:ucp_enter_critical
|
||
函数功能:关中断
|
||
*/
|
||
extern void smart_int_disable(void);
|
||
|
||
/*
|
||
函数名称:ucp_exit_critical
|
||
函数功能:开中断
|
||
*/
|
||
extern void smart_int_enable(void);
|
||
|
||
/*
|
||
函数名称:osp_del_task
|
||
函数入参:prio : 待删除的任务的优先级
|
||
函数功能:任务删除接口
|
||
*/
|
||
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字节)
|
||
pbuf:DDR中的地址
|
||
psize:DDR中配置文件的长度
|
||
函数返回值:
|
||
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_get_ddr_mem
|
||
函数功能:获取物理层DDR的首地址
|
||
函数参数:无
|
||
函数返回值:物理层DDR的首地址
|
||
*/
|
||
extern uint32_t osp_get_ddr_mem(void);
|
||
|
||
/*
|
||
函数名称:osp_heap_malloc
|
||
函数功能:从DDR里分配内存
|
||
函数参数:size :需要分配的内存空间
|
||
函数返回值:分配到的DDR内存地址
|
||
*/
|
||
extern char *osp_heap_malloc(uint32_t size);
|
||
|
||
/*
|
||
函数名称:osp_heap_free
|
||
函数功能:释放DDR里分配内存
|
||
函数参数:需要释放的内存空间
|
||
函数返回值:无
|
||
*/
|
||
extern void osp_heap_free(char *p);
|
||
|
||
#endif
|
||
//#endif
|
||
#endif
|