Data Structures |
struct | rt_object |
struct | rt_object_information |
Defines |
#define | RT_OBJECT_HOOK_CALL(func, argv) do { if ((func) != RT_NULL) func argv; } while (0) |
Enumerations |
enum | rt_object_class_type {
RT_Object_Class_Thread = 0,
RT_Object_Class_Semaphore,
RT_Object_Class_Mutex,
RT_Object_Class_Event,
RT_Object_Class_MailBox,
RT_Object_Class_MessageQueue,
RT_Object_Class_MemPool,
RT_Object_Class_Device,
RT_Object_Class_Timer,
RT_Object_Class_Module,
RT_Object_Class_Unknown,
RT_Object_Class_Static = 0x80
} |
Functions |
struct rt_object_information * | rt_object_get_information (enum rt_object_class_type type) |
void | rt_object_init (struct rt_object *object, enum rt_object_class_type type, const char *name) |
void | rt_object_detach (rt_object_t object) |
rt_object_t | rt_object_allocate (enum rt_object_class_type type, const char *name) |
void | rt_object_delete (rt_object_t object) |
rt_err_t | rt_object_is_systemobject (rt_object_t object) |
rt_object_t | rt_object_find (const char *name, rt_uint8_t type) |
void | rt_system_object_init (void) |
void | 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)) |
void | rt_object_put_sethook (void(*hook)(struct rt_object *object)) |
Detailed Description
The Kernel object system can access and manage all of the kernel objects.
Kernel objects include most of the facilities in the kernel:
- thread
- semaphore and mutex
- event/fast event, mailbox, messagequeue
- memory pool
- timer
Figure 2: Kernel Object
Kernel objects can be static objects, whose memory is allocated in compiling. It can be dynamic objects as well, whose memory is allocated from system heaps in runtime.
Define Documentation
The hook function call macro
Enumeration Type Documentation
The object type can be one of the follows with specific macros enabled:
- Thread
- Semaphore
- Mutex
- Event
- MailBox
- MessageQueue
- MemPool
- Device
- Timer
- Unknown
- Static
- Enumerator:
RT_Object_Class_Thread |
The object is a thread.
|
RT_Object_Class_Semaphore |
The object is a semaphore.
|
RT_Object_Class_Mutex |
The object is a mutex.
|
RT_Object_Class_Event |
The object is a event.
|
RT_Object_Class_MailBox |
The object is a mail box.
|
RT_Object_Class_MessageQueue |
The object is a message queue.
|
RT_Object_Class_MemPool |
The object is a memory pool.
|
RT_Object_Class_Device |
The object is a device
|
RT_Object_Class_Timer |
The object is a timer.
|
RT_Object_Class_Module |
The object is a module.
|
RT_Object_Class_Unknown |
The object is unknown.
|
RT_Object_Class_Static |
The object is a static object.
|
Function Documentation
This function will return the specified type of object information.
- Parameters:
-
- Returns:
- the object type information or RT_NULL
This function will initialize an object and add it to object system management.
- Parameters:
-
object | the specified object to be initialized. |
type | the object type. |
name | the object name. In system, the object's name must be unique. |
This function will detach a static object from object system, and the memory of static object is not freed.
- Parameters:
-
object | the specified object to be detached. |
This function will allocate an object from object system
- Parameters:
-
type | the type of object |
name | the object name. In system, the object's name must be unique. |
- Returns:
- object
This function will delete an object and release object memory.
- Parameters:
-
object | the specified object to be deleted. |
This function will judge the object is system object or not. Normally, the system object is a static object and the type of object set to RT_Object_Class_Static.
- Parameters:
-
object | the specified object to be judged. |
- Returns:
- RT_EOK if a system object, RT_ERROR for others.
This function will find specified name object from object container.
- Parameters:
-
name | the specified name of object. |
type | the type of object |
- Returns:
- the found object or RT_NULL if there is no this object in object container.
- Note:
- this function shall not be invoked in interrupt status.
This function will initialize system object management.
- Deprecated:
- since 0.3.0, this function does not need to be invoked in the system initialization.
This function will set a hook function, which will be invoked when object attaches to kernel object system.
- Parameters:
-
This function will set a hook function, which will be invoked when object detaches from kernel object system.
- Parameters:
-
This function will set a hook function, which will be invoked when object is taken from kernel object system.
The object is taken means: semaphore - semaphore is taken by thread mutex - mutex is taken by thread event - event is received by thread mailbox - mail is received by thread message queue - message is received by thread
- Parameters:
-
This function will set a hook function, which will be invoked when object have been taken from kernel object system.
The object have been taken means: semaphore - semaphore have been taken by thread mutex - mutex have been taken by thread event - event have been received by thread mailbox - mail have been received by thread message queue - message have been received by thread timer - timer is started
- Parameters:
-
This function will set a hook function, which will be invoked when object is put to kernel object system.
- Parameters:
-