Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
Data Structures | |
struct | k_obj_core_stats_desc |
Object core statistics descriptor. More... | |
struct | k_obj_type |
Object type structure. More... | |
struct | k_obj_core |
Object core structure. More... | |
Macros | |
#define | K_OBJ_CORE(kobj) (&((kobj)->obj_core)) |
Convert kernel object pointer into its object core pointer. | |
#define | K_OBJ_TYPE_ID_GEN(s) ((s[0] << 24) | (s[1] << 16) | (s[2] << 8) | (s[3])) |
Generate new object type IDs based on a 4 letter string. | |
#define | K_OBJ_TYPE_CONDVAR_ID K_OBJ_TYPE_ID_GEN("COND") |
Condition variable object type. | |
#define | K_OBJ_TYPE_CPU_ID K_OBJ_TYPE_ID_GEN("CPU_") |
CPU object type. | |
#define | K_OBJ_TYPE_EVENT_ID K_OBJ_TYPE_ID_GEN("EVNT") |
Event object type. | |
#define | K_OBJ_TYPE_FIFO_ID K_OBJ_TYPE_ID_GEN("FIFO") |
FIFO object type. | |
#define | K_OBJ_TYPE_KERNEL_ID K_OBJ_TYPE_ID_GEN("KRNL") |
Kernel object type. | |
#define | K_OBJ_TYPE_LIFO_ID K_OBJ_TYPE_ID_GEN("LIFO") |
LIFO object type. | |
#define | K_OBJ_TYPE_MEM_BLOCK_ID K_OBJ_TYPE_ID_GEN("MBLK") |
Memory block object type. | |
#define | K_OBJ_TYPE_MBOX_ID K_OBJ_TYPE_ID_GEN("MBOX") |
Mailbox object type. | |
#define | K_OBJ_TYPE_MEM_SLAB_ID K_OBJ_TYPE_ID_GEN("SLAB") |
Memory slab object type. | |
#define | K_OBJ_TYPE_MSGQ_ID K_OBJ_TYPE_ID_GEN("MSGQ") |
Message queue object type. | |
#define | K_OBJ_TYPE_MUTEX_ID K_OBJ_TYPE_ID_GEN("MUTX") |
Mutex object type. | |
#define | K_OBJ_TYPE_PIPE_ID K_OBJ_TYPE_ID_GEN("PIPE") |
Pipe object type. | |
#define | K_OBJ_TYPE_SEM_ID K_OBJ_TYPE_ID_GEN("SEM4") |
Semaphore object type. | |
#define | K_OBJ_TYPE_STACK_ID K_OBJ_TYPE_ID_GEN("STCK") |
Stack object type. | |
#define | K_OBJ_TYPE_THREAD_ID K_OBJ_TYPE_ID_GEN("THRD") |
Thread object type. | |
#define | K_OBJ_TYPE_TIMER_ID K_OBJ_TYPE_ID_GEN("TIMR") |
Timer object type. | |
Functions | |
struct k_obj_type * | k_obj_type_find (uint32_t type_id) |
Find a specific object type by ID. | |
int | k_obj_type_walk_locked (struct k_obj_type *type, int(*func)(struct k_obj_core *, void *), void *data) |
Walk the object type's list of object cores. | |
int | k_obj_type_walk_unlocked (struct k_obj_type *type, int(*func)(struct k_obj_core *, void *), void *data) |
Walk the object type's list of object cores. | |
void | k_obj_core_init (struct k_obj_core *obj_core, struct k_obj_type *type) |
Initialize the core of the kernel object. | |
void | k_obj_core_link (struct k_obj_core *obj_core) |
Link the kernel object to the kernel object type list. | |
void | k_obj_core_init_and_link (struct k_obj_core *obj_core, struct k_obj_type *type) |
Automatically link the kernel object after initializing it. | |
void | k_obj_core_unlink (struct k_obj_core *obj_core) |
Unlink the kernel object from the kernel object type list. | |
#define K_OBJ_CORE | ( | kobj | ) | (&((kobj)->obj_core)) |
#include <zephyr/kernel/obj_core.h>
Convert kernel object pointer into its object core pointer.
#define K_OBJ_TYPE_CONDVAR_ID K_OBJ_TYPE_ID_GEN("COND") |
#include <zephyr/kernel/obj_core.h>
Condition variable object type.
#define K_OBJ_TYPE_CPU_ID K_OBJ_TYPE_ID_GEN("CPU_") |
#include <zephyr/kernel/obj_core.h>
CPU object type.
#define K_OBJ_TYPE_EVENT_ID K_OBJ_TYPE_ID_GEN("EVNT") |
#include <zephyr/kernel/obj_core.h>
Event object type.
#define K_OBJ_TYPE_FIFO_ID K_OBJ_TYPE_ID_GEN("FIFO") |
#include <zephyr/kernel/obj_core.h>
FIFO object type.
#include <zephyr/kernel/obj_core.h>
Generate new object type IDs based on a 4 letter string.
#define K_OBJ_TYPE_KERNEL_ID K_OBJ_TYPE_ID_GEN("KRNL") |
#include <zephyr/kernel/obj_core.h>
Kernel object type.
#define K_OBJ_TYPE_LIFO_ID K_OBJ_TYPE_ID_GEN("LIFO") |
#include <zephyr/kernel/obj_core.h>
LIFO object type.
#define K_OBJ_TYPE_MBOX_ID K_OBJ_TYPE_ID_GEN("MBOX") |
#include <zephyr/kernel/obj_core.h>
Mailbox object type.
#define K_OBJ_TYPE_MEM_BLOCK_ID K_OBJ_TYPE_ID_GEN("MBLK") |
#include <zephyr/kernel/obj_core.h>
Memory block object type.
#define K_OBJ_TYPE_MEM_SLAB_ID K_OBJ_TYPE_ID_GEN("SLAB") |
#include <zephyr/kernel/obj_core.h>
Memory slab object type.
#define K_OBJ_TYPE_MSGQ_ID K_OBJ_TYPE_ID_GEN("MSGQ") |
#include <zephyr/kernel/obj_core.h>
Message queue object type.
#define K_OBJ_TYPE_MUTEX_ID K_OBJ_TYPE_ID_GEN("MUTX") |
#include <zephyr/kernel/obj_core.h>
Mutex object type.
#define K_OBJ_TYPE_PIPE_ID K_OBJ_TYPE_ID_GEN("PIPE") |
#include <zephyr/kernel/obj_core.h>
Pipe object type.
#define K_OBJ_TYPE_SEM_ID K_OBJ_TYPE_ID_GEN("SEM4") |
#include <zephyr/kernel/obj_core.h>
Semaphore object type.
#define K_OBJ_TYPE_STACK_ID K_OBJ_TYPE_ID_GEN("STCK") |
#include <zephyr/kernel/obj_core.h>
Stack object type.
#define K_OBJ_TYPE_THREAD_ID K_OBJ_TYPE_ID_GEN("THRD") |
#include <zephyr/kernel/obj_core.h>
Thread object type.
#define K_OBJ_TYPE_TIMER_ID K_OBJ_TYPE_ID_GEN("TIMR") |
#include <zephyr/kernel/obj_core.h>
Timer object type.
void k_obj_core_init | ( | struct k_obj_core * | obj_core, |
struct k_obj_type * | type | ||
) |
#include <zephyr/kernel/obj_core.h>
Initialize the core of the kernel object.
Initializing the kernel object core associates it with the specified kernel object type.
obj_core | Pointer to the kernel object to initialize |
type | Pointer to the kernel object type |
void k_obj_core_init_and_link | ( | struct k_obj_core * | obj_core, |
struct k_obj_type * | type | ||
) |
#include <zephyr/kernel/obj_core.h>
Automatically link the kernel object after initializing it.
A useful wrapper to both initialize the core of the kernel object and automatically link it into the kernel object type's list of objects.
obj_core | Pointer to the kernel object to initialize |
type | Pointer to the kernel object type |
void k_obj_core_link | ( | struct k_obj_core * | obj_core | ) |
#include <zephyr/kernel/obj_core.h>
Link the kernel object to the kernel object type list.
A kernel object can be optionally linked into the kernel object type's list of objects. A kernel object must have been initialized before it can be linked. Linked kernel objects can be traversed and have information extracted from them by system tools.
obj_core | Pointer to the kernel object |
void k_obj_core_unlink | ( | struct k_obj_core * | obj_core | ) |
#include <zephyr/kernel/obj_core.h>
Unlink the kernel object from the kernel object type list.
Kernel objects can be unlinked from their respective kernel object type lists. If on a list, it must be done at the end of the kernel object's life cycle.
obj_core | Pointer to the kernel object |
struct k_obj_type * k_obj_type_find | ( | uint32_t | type_id | ) |
#include <zephyr/kernel/obj_core.h>
Find a specific object type by ID.
Given an object type ID, this function searches for the object type that is associated with the specified type ID type_id.
type_id | Type ID associated with object type |
NULL | if object type not found |
Pointer | to object type if found |
int k_obj_type_walk_locked | ( | struct k_obj_type * | type, |
int(*)(struct k_obj_core *, void *) | func, | ||
void * | data | ||
) |
#include <zephyr/kernel/obj_core.h>
Walk the object type's list of object cores.
This function takes a global spinlock and walks the object type's list of object cores and invokes the callback function on each element while holding that lock. Although this will ensure that the list is not modified, one can expect a significant penalty in terms of performance and latency.
The callback function shall either return non-zero to stop further walking, or it shall return 0 to continue walking.
type | Pointer to the object type |
func | Callback to invoke on each object core of the object type |
data | Custom data passed to the callback |
non-zero | if walk is terminated by the callback; otherwise 0 |
int k_obj_type_walk_unlocked | ( | struct k_obj_type * | type, |
int(*)(struct k_obj_core *, void *) | func, | ||
void * | data | ||
) |
#include <zephyr/kernel/obj_core.h>
Walk the object type's list of object cores.
This function is similar to k_obj_type_walk_locked() except that it walks the list without obtaining the global spinlock. No synchronization is provided here. Mutation of the list of objects while this function is in progress must be prevented at the application layer, otherwise undefined/unreliable behavior, corruption and/or crashes may result.
The callback function shall either return non-zero to stop further walking, or it shall return 0 to continue walking.
type | Pointer to the object type |
func | Callback to invoke on each object core of the object type |
data | Custom data passed to the callback |
non-zero | if walk is terminated by the callback; otherwise 0 |