os_int.c

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到任务。
这段代码是用来加载一个名为 Octree_python_lib.so 的动态链接库,并定义了一些函数接口和函数参数的类型。下面是对每个定义的函数接口和参数类型的解释: - c_double_p: 定义了一个指向 double 类型的指针。 - c_uint16_p: 定义了一个指向 uint16 类型的指针。 - lib = cdll.LoadLibrary(os.path.dirname(os.path.abspath(__file__))+'/Octree_python_lib.so'): 加载 Octree_python_lib.so 动态链接库,并将其赋值给 lib 变量。 - lib.new_vector: 函数接口,返回类型为 c_void_p,无参数。 - lib.delete_vector: 函数接口,返回类型为 None,参数为 c_void_p。 - lib.vector_size: 函数接口,返回类型为 c_int,参数为 c_void_p。 - lib.vector_get: 函数接口,返回类型为 c_void_p,参数为 c_void_p 和 c_int。 - lib.vector_push_back: 函数接口,返回类型为 None,参数为 c_void_p 和 c_int。 - lib.genOctreeInterface: 函数接口,返回类型为 c_void_p,参数为 c_void_p、c_double_p 和 c_int。 - lib.Nodes_get: 函数接口,返回类型为指向 Node 类型的指针 (POINTER(Node)),参数为 c_void_p 和 c_int。 - lib.Nodes_size: 函数接口,返回类型为 c_int,参数为 c_void_p。 - lib.int_size: 函数接口,返回类型为 c_int,参数为 c_void_p。 - lib.int_get: 函数接口,返回类型为 c_int,参数为 c_void_p 和 c_int。 这些函数接口的具体功能需要根据实际的动态链接库 Octree_python_lib.so 来确定。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值