4、调用rt_object_attach_hook钩子函数 5、将object加入对应type的container双向链表中 有一点区别需要提出,在voidrt_object_init();中,没有对object的flag成员进行赋值。 rt_object_trt_object_allocate(enumrt_object_class_typetype,constchar*name){structrt_object*object;registerrt_base_ttemp;structrt_object_...
object->type = type | RT_Object_Class_Static; /* copy name */ // 复制名字,字符串,并且规定字符串长度 rt_strncpy(object->name, name, RT_NAME_MAX); RT_OBJECT_HOOK_CALL(rt_object_attach_hook, (object)); /* lock interrupt */ // 禁中断 temp = rt_hw_interrupt_disable(); /* inser...
RT_ASSERT(obj != object); } }/* 离开临界区 */rt_exit_critical();/* 初始化对象参数,并置为静态标记 */object->type=type| RT_Object_Class_Static; rt_strncpy(object->name, name, RT_NAME_MAX); RT_OBJECT_HOOK_CALL(rt_object_attach_hook, (object));/* 禁止硬件中断 */temp = rt_hw...
RT_ASSERT(obj != object); } } /* 离开临界区 */ rt_exit_critical; /* 初始化对象参数,并置为静态标记 */ object->type = type | RT_Object_Class_Static; rt_strncpy(object->name, name, RT_NAME_MAX); RT_OBJECT_HOOK_CALL(rt_object_attach_hook, (object)); /* 禁止硬件中断 */ temp...
RT_ASSERT(obj != object); } } /* 离开临界区 */ rt_exit_critical(); /* 初始化对象参数,并置为静态标记 */ object->type = type | RT_Object_Class_Static; rt_strncpy(object->name, name, RT_NAME_MAX); RT_OBJECT_HOOK_CALL(rt_object_attach_hook, (object)); ...
rt_object类型的所有字段就是rt_thread类型最前面的字段。这就好比rt_thread是rt_object子类扩展一样。在抽象类rt_object中抽象出公共的接口(例如分配object和释放object),子类实现自己具体的特殊应用(例如线程的object区别于IPC的object)。 任务栈初始化 回到rt_thread_create中,此时以经分配了TCB并接着分配了stack空...
RT_ASSERT(obj != object); } } /* 离开临界区 */ rt_exit_critical(); /* 初始化对象参数,并置为静态标记 */ object->type = type | RT_Object_Class_Static; rt_strncpy(object->name, name, RT_NAME_MAX); RT_OBJECT_HOOK_CALL(rt_object_attach_hook, (object)); /* 禁止硬件中断 */ ...
rt_object_attach_sethook(void (*hook)(struct rt_object *object)); void rt_object_detach_sethook(void (*hook)(struct rt_object *object)); void rt_object_trytake_sethook(void (*hook)(struct rt_object *object)); void rt_object_take_sethook(void (*hook)(struct rt_object *object));...
struct rt_device { struct rt_object parent; /* 内核对象基类 */ enum rt_device_class_type type; /* 设备类型 */ rt_uint16_t flag; /* 设备参数 */ rt_uint16_t open_flag; /* 设备打开标志 */ rt_uint8_t ref_count; /* 设备被引用次数 */ rt_uint8_t device_id; /* 设备 ID,0...
4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed ...