os_int.c
2016-02-21 19:19
211 查看
uC在处理从中断中post事件有两个模式:Direct、Deferred Post 。配置OS_CFG_ISR_POST_DEFERRED_EN选择两种模式。
个人比较倾向于Direct。
此文件中的函数与Deferred有关。
typedef struct os_int_q OS_INT_Q;
struct os_int_q {
OS_OBJ_TYPE Type; /* Type of object placed in the circular list */
OS_INT_Q *NextPtr; /* Pointer to next OS_INT_Q in circular list */
void *ObjPtr; /* Pointer to object placed in the queue */
void *MsgPtr; /* Pointer to message if posting to a message queue */
OS_MSG_SIZE MsgSize; /* Message Size if posting to a message queue */
OS_FLAGS Flags; /* Value of flags if posting to an event flag group */
OS_OPT Opt; /* Post Options */
CPU_TS TS; /* Timestamp */
};
OS_INT_Q *OSIntQInPtr;
OS_INT_Q *OSIntQOutPtr;
OS_OBJ_QTY OSIntQNbrEntries;
OS_OBJ_QTY OSIntQNbrEntriesMax;
OS_OBJ_QTY OSIntQOvfCtr;
OS_TCB OSIntQTaskTCB;
CPU_TS OSIntQTaskTimeMax;
OS_INT_Q OSCfg_IntQ [OS_CFG_INT_Q_SIZE];
void OS_IntQPost (OS_OBJ_TYPE type,
void *p_obj,
void *p_void,
OS_MSG_SIZE msg_size,
OS_FLAGS flags,
OS_OPT opt,
CPU_TS ts,
OS_ERR *p_err):
此函数在OS***Post()、OSTimeTick()中调用,将参数封装到OSIntQ中添加到Interrupt Queue(OS_IntQTaskInit()中初始化)中,Ready OSIntQTask。
void OS_IntQTaskInit (OS_ERR *p_err):
OS内部函数,OSInit()调用。
根据OSCfg_IntQBasePtr、OSCfg_IntQSize初始化Interrupt Queue(一个循环链表如下图,通过OSIntQNbrEntries、OSIntQInPtr、OSIntQOutPtr操作循环链表),创建OS_IntQTask任务。
void OS_IntQTask (void *p_arg):
将Interrupt Queue中的内容,使用OS_IntQRePost()重新Post到具体的任务中
void OS_IntQRePost (void):
根据OSIntQOutPtr->Type,将对象重新Post到任务。
个人比较倾向于Direct。
此文件中的函数与Deferred有关。
typedef struct os_int_q OS_INT_Q;
struct os_int_q {
OS_OBJ_TYPE Type; /* Type of object placed in the circular list */
OS_INT_Q *NextPtr; /* Pointer to next OS_INT_Q in circular list */
void *ObjPtr; /* Pointer to object placed in the queue */
void *MsgPtr; /* Pointer to message if posting to a message queue */
OS_MSG_SIZE MsgSize; /* Message Size if posting to a message queue */
OS_FLAGS Flags; /* Value of flags if posting to an event flag group */
OS_OPT Opt; /* Post Options */
CPU_TS TS; /* Timestamp */
};
OS_INT_Q *OSIntQInPtr;
OS_INT_Q *OSIntQOutPtr;
OS_OBJ_QTY OSIntQNbrEntries;
OS_OBJ_QTY OSIntQNbrEntriesMax;
OS_OBJ_QTY OSIntQOvfCtr;
OS_TCB OSIntQTaskTCB;
CPU_TS OSIntQTaskTimeMax;
OS_INT_Q OSCfg_IntQ [OS_CFG_INT_Q_SIZE];
void OS_IntQPost (OS_OBJ_TYPE type,
void *p_obj,
void *p_void,
OS_MSG_SIZE msg_size,
OS_FLAGS flags,
OS_OPT opt,
CPU_TS ts,
OS_ERR *p_err):
此函数在OS***Post()、OSTimeTick()中调用,将参数封装到OSIntQ中添加到Interrupt Queue(OS_IntQTaskInit()中初始化)中,Ready OSIntQTask。
void OS_IntQTaskInit (OS_ERR *p_err):
OS内部函数,OSInit()调用。
根据OSCfg_IntQBasePtr、OSCfg_IntQSize初始化Interrupt Queue(一个循环链表如下图,通过OSIntQNbrEntries、OSIntQInPtr、OSIntQOutPtr操作循环链表),创建OS_IntQTask任务。
void OS_IntQTask (void *p_arg):
将Interrupt Queue中的内容,使用OS_IntQRePost()重新Post到具体的任务中
void OS_IntQRePost (void):
根据OSIntQOutPtr->Type,将对象重新Post到任务。
相关文章推荐
- 67. Add Binary
- ajax(六)使用 Jackson
- HttpClient获取网络数据
- 设计制造嵌入式系统
- SWIFT 闭包的简单使用二
- hdu5631
- 生成eps图形
- 新的开始,新的生活
- 生成eps图形
- OpenCV实践之路——矩形图片的对角线分割
- HttpURLConntion
- 自定义view onMeasure方法的重写
- os_flag.c
- HttpClient请求网络
- Toast类
- iOS 常用解析方式(XML、Json)
- AnguarJS 第二天----数据绑定
- 【慕课笔记】第四章 JAVA中的集合框架(上) 第2节 Collection接口&List接口简介
- 【三层架构】三层总结(代码型)
- [Docker]初次接触