Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
kobject_internal.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_SYS_INTERNAL_KOBJECT_INTERNAL_H
7#define ZEPHYR_INCLUDE_SYS_INTERNAL_KOBJECT_INTERNAL_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
18
19#if defined(CONFIG_USERSPACE) || defined(__DOXYGEN__)
20#if defined(CONFIG_GEN_PRIV_STACKS) || defined(__DOXYGEN__)
21/* Metadata struct for K_OBJ_THREAD_STACK_ELEMENT */
22struct z_stack_data {
23 /* Size of the entire stack object, including reserved areas */
24 size_t size;
25
26 /* Stack buffer for privilege mode elevations */
27 uint8_t *priv;
28};
29#endif /* CONFIG_GEN_PRIV_STACKS */
30
31/* Object extra data. Only some objects use this, determined by object type */
33#ifdef CONFIG_SYS_MUTEX_IMPL_K_MUTEX
34 /* Backing mutex for K_OBJ_SYS_MUTEX */
35 struct k_mutex *mutex;
36#endif /* CONFIG_SYS_MUTEX_IMPL_K_MUTEX*/
37
38 /* Numerical thread ID for K_OBJ_THREAD */
39 unsigned int thread_id;
40
41#if defined(CONFIG_GEN_PRIV_STACKS) || defined(__DOXYGEN__)
42 /* Metadata for K_OBJ_THREAD_STACK_ELEMENT */
43 const struct z_stack_data *stack_data;
44#else
45 /* Stack buffer size for K_OBJ_THREAD_STACK_ELEMENT */
46 size_t stack_size;
47#endif /* CONFIG_GEN_PRIV_STACKS */
48
49 /* All other objects */
50 int unused;
51};
52
60struct k_object {
61 void *name;
62 uint8_t perms[CONFIG_MAX_THREAD_BYTES];
66} __packed __aligned(4);
67
70 void * const *objects;
71};
72
73
86void k_object_init(const void *obj);
87
88
89#else
90/* LCOV_EXCL_START */
91static inline void k_object_init(const void *obj)
92{
93 ARG_UNUSED(obj);
94}
95/* LCOV_EXCL_STOP */
96#endif /* !CONFIG_USERSPACE */
97
98#ifdef CONFIG_DYNAMIC_OBJECTS
122struct k_object *k_object_create_dynamic_aligned(size_t align, size_t size);
123
146static inline struct k_object *k_object_create_dynamic(size_t size)
147{
148 return k_object_create_dynamic_aligned(0, size);
149}
150
151#else
152
153/* LCOV_EXCL_START */
154static inline struct k_object *k_object_create_dynamic_aligned(size_t align,
155 size_t size)
156{
157 ARG_UNUSED(align);
158 ARG_UNUSED(size);
159
160 return NULL;
161}
162
163static inline struct k_object *k_object_create_dynamic(size_t size)
164{
165 ARG_UNUSED(size);
166
167 return NULL;
168}
169
170/* LCOV_EXCL_STOP */
171#endif /* CONFIG_DYNAMIC_OBJECTS */
172
174
175#ifdef __cplusplus
176}
177#endif
178
179#endif
static struct k_object * k_object_create_dynamic(size_t size)
Definition kobject_internal.h:163
void k_object_init(const void *obj)
Lookup a kernel object and init its metadata if it exists.
static struct k_object * k_object_create_dynamic_aligned(size_t align, size_t size)
Definition kobject_internal.h:154
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Kernel mutex structure.
Definition kernel.h:3514
Definition kobject_internal.h:68
struct k_thread * thread
Definition kobject_internal.h:69
void *const * objects
Definition kobject_internal.h:70
Table generated by gperf, these objects are retrieved via k_object_find().
Definition kobject_internal.h:60
uint8_t flags
Definition kobject_internal.h:64
uint8_t type
Definition kobject_internal.h:63
uint8_t perms[CONFIG_MAX_THREAD_BYTES]
Definition kobject_internal.h:62
void * name
Definition kobject_internal.h:61
union k_object_data data
Definition kobject_internal.h:65
Thread Structure.
Definition thread.h:258
Definition kobject_internal.h:32
int unused
Definition kobject_internal.h:50
const struct z_stack_data * stack_data
Definition kobject_internal.h:43
unsigned int thread_id
Definition kobject_internal.h:39