lishuang.xie e34abce4e1 update New Feature#1113
1. update component to week40
2. add new function smart_no_idle_sw_init
3. change name of smart_ddr_spinlock_init
4. change type of smart_task_del and smart_enable_q_nempty
5. if call smart_enable_q_nempty return faild, we'll call 8 times
6. if call smart_task_del return faild, we'll record
7. smart_reclaim_init_res() don't be called!!!
8. test:
   8.1 SPU(case14)+ARM(case3) :PASS
   8.2 SPU(case20)+ARM(case20):PASS
   8.3 SPU(case21)+ARM(case21):PASS
   8.4 SPU(case34)+ARM(case5) :PASS
   8.5 SPU(case44)+ARM(case5) :PASS
2023-10-12 10:28:46 +08:00

307 lines
7.1 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 __SMARTOS_H__
#define __SMARTOS_H__
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
typedef void (*start_hook_func)(int);
typedef void (*irq_handler)();
typedef enum
{
smart_all_irq,
smart_fun_s,
smart_fun_e,
smart_clear_cnt_error,
smart_irq_check_error
}smart_irq_cnt_type_t;
/*
函数名称smart_kernel_init
输入参数: usr_startup
输入参数: cpuid
返回类型void
函数功能smart系统初始化接口
*/
extern void smart_kernel_init(start_hook_func *usr_startup,int cpuid);
/*
函数名称smart_irq_enable
输入参数: vector
返回类型int
返回值 小于0 注册
返回值等于0 成功
函数功能: 使能对应中断号的intmask
*/
int smart_irq_enable(uint32_t vector);
/*
函数名称smart_irq_disable
输入参数: vector
返回类型int
返回值 小于0 注册
返回值等于0 成功
函数功能: 屏蔽对应中断号对应的intmask
*/
int smart_irq_disable(uint32_t vector);
/*
函数名称smart_irq_request
输入参数: vector
输入参数: func 函数指针
返回类型int
返回值 小于0 注册失败
返回值等于0 注册成功
函数功能: 中断注册接口
*/
extern int smart_irq_request(uint32_t vector,irq_handler func);
/*
函数名称smart_irq_free
参数vector
返回值0:成功 非0失败
函数功能:中断注销
*/
extern int smart_irq_free(uint32_t vector);
/*
函数名称smart_int_disable
参数:无
返回值:无
函数功能:关中断
*/
extern void smart_int_disable();
/*
函数名称smart_int_enable
参数:无
返回值:无
函数功能:开中断
*/
extern void smart_int_enable();
/*
函数名称smart_get_curprio
输入参数: 无
返回类型int
返回值 小于0获取失败
返回值大于0获取成功
*/
extern int smart_get_curprio();
/*
函数名称smart_get_cpuid
输入参数: 无
返回类型int
返回值 小于0获取失败
返回值大于0获取成功
*/
extern int smart_get_cpuid();
/*
函数名称smart_task_create
输入参数: void (*task)(void *p_arg)
输入参数:*p_arg
输入参数:*ptos; 栈顶
输入参数prio 优先级
输入参数id 任务id 号
输入参数:*pbos 栈底
输入参数stk_size; 堆栈大小
返回类型int
返回值0任务注册成功
函数功能:注册任务
*/
extern uint8_t smart_task_create (void (*task)(void *p_arg),
void *p_arg,
uint32_t *ptos,
uint8_t prio,
uint16_t id,
uint32_t *pbos,
uint32_t stk_size);
/*
函数名称smart_tick_sleep
输入参数: cycle
参数类型: int
返回值:无
函数功能休眠tick 时间
*/
extern void smart_tick_sleep(int cycle);
/*
函数名称smart_task_del
输入参数: prio
参数类型: int
返回类型int
返回值非0 删除失败
函数功能:删除任务
注意事项:如果当前任务使用了信号量,或者其它资源,要首先删除任务,然后再删除资源,否则资源会被一直占用。
低优先级任务删除其它任务删除成功有可能不会立刻返回;删除失败立刻返回。
*/
extern int smart_task_del(int prio);
/*****************************************************************
sem relation
****************************************************************/
/******************************************
函数名称smart_sem_create
输入参数: cnt
参数类型: int
返回值void *
函数功能:创建计数信号量,返回信号量句柄
*****************************************/
extern void *smart_sem_create(int cnt);
/******************************************
函数名称smart_sem_pend
输入参数: void *sem 信号量句柄
参数类型: void *
返回值:无
函数功能:获取信号量,失败休眠
*****************************************/
extern void smart_sem_pend(void *sem);
/******************************************
函数名称smart_sem_post
输入参数: void *sem 信号量句柄
参数类型: void *
返回值: 0 成功小于0 失败
函数功能:释放信号量
*****************************************/
extern int smart_sem_post(void *sem);
/*******************************************
函数名称smart_sem_del
输入参数: void *sem 信号量句柄
参数类型: void *
返回值: 0 成功小于0 失败
函数功能:释放信号量
注意事项: 删除信号量时一定要进行判断,确认信号量删除是否成功
******************************************/
extern int smart_sem_del(void *sem);
extern int smart_get_reg_prio(int *buf);
/*
函数名称smart_reclaim_init_res
输入参数:无
返回类型void
返回值
函数功能:系统初始化任务资源回收
*/
extern void smart_reclaim_init_res();
/*
函数名称smart_irq_debug_init
输入参数debug_base_addr 调试buf 首地址
输入参数len_bytes 调试buf 长度
返回类型int
返回值 小于0 返回失败
返回值: 等于0 返回成功
函数功能:中断调试初始化接口
*/
extern int smart_irq_debug_init(uint32_t debug_base_addr, uint32_t len_bytes);
/*
函数名称smart_irq_get_type_cnt
输入参数num_type
输入参数:参数类型 irq_cnt_type_t
typedef enum
{
all_irq,
fun_s,
fun_e,
clear_cnt_error,
irq_check_error
}irq_cnt_type_t;
返回类型uint32_t
返回值 小于0 返回失败
返回值: 等于0 返回成功
函数功能:获取各类型中断计数
*/
extern uint32_t smart_irq_get_type_cnt(smart_irq_cnt_type_t num_type);
/*
函数名称smart_irq_get_run_cnt
输入参数irqnum
返回类型int
返回值 小于0 返回失败
返回值: 大于0 返回成功
函数功能:获取中断入口统计计数
*/
extern int smart_irq_get_run_cnt(uint32_t irqnum);
/*
函数名称smart_os_debug_init
输入参数debug_base_addr 调试buf 首地址
输入参数len_bytes 调试buf 长度,长度不小于0x40
返回类型int
返回值 小于0 返回失败
返回值: 等于0 返回成功
函数功能:任务切换调试表初始化接口
*/
extern int smart_os_debug_init( uint32_t debug_base_addr, uint32_t len_bytes);
/*
函数名称smart_no_idle_sw_init
输入参数debug_base_addr 调试buf 首地址
输入参数lens 调试buf 长度长度不小于0x40
返回类型int
返回值 小于0 返回失败
返回值: 等于0 返回成功
函数功能:任务切换调试表初始化接口,切换表不记录idle 任务
*/
extern int smart_no_idle_sw_init(uint32_t debug_base_addr, uint32_t lens);
#endif