Zephyr Project API 4.4.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 /* Backing mutex for K_OBJ_SYS_MUTEX */
34 struct k_mutex *mutex;
35
36 /* Numerical thread ID for K_OBJ_THREAD */
37 unsigned int thread_id;
38
39#if defined(CONFIG_GEN_PRIV_STACKS) || defined(__DOXYGEN__)
40 /* Metadata for K_OBJ_THREAD_STACK_ELEMENT */
41 const struct z_stack_data *stack_data;
42#else
43 /* Stack buffer size for K_OBJ_THREAD_STACK_ELEMENT */
44 size_t stack_size;
45#endif /* CONFIG_GEN_PRIV_STACKS */
46
47 /* All other objects */
48 int unused;
49};
50
58struct k_object {
59 void *name;
60 uint8_t perms[CONFIG_MAX_THREAD_BYTES];
64} __packed __aligned(4);
65
68 void * const *objects;
69};
70
71
84void k_object_init(const void *obj);
85
86
87#else
88/* LCOV_EXCL_START */
89static inline void k_object_init(const void *obj)
90{
91 ARG_UNUSED(obj);
92}
93/* LCOV_EXCL_STOP */
94#endif /* !CONFIG_USERSPACE */
95
96#ifdef CONFIG_DYNAMIC_OBJECTS
120struct k_object *k_object_create_dynamic_aligned(size_t align, size_t size);
121
144static inline struct k_object *k_object_create_dynamic(size_t size)
145{
146 return k_object_create_dynamic_aligned(0, size);
147}
148
149#else
150
151/* LCOV_EXCL_START */
152static inline struct k_object *k_object_create_dynamic_aligned(size_t align,
153 size_t size)
154{
155 ARG_UNUSED(align);
156 ARG_UNUSED(size);
157
158 return NULL;
159}
160
161static inline struct k_object *k_object_create_dynamic(size_t size)
162{
163 ARG_UNUSED(size);
164
165 return NULL;
166}
167
168/* LCOV_EXCL_STOP */
169#endif /* CONFIG_DYNAMIC_OBJECTS */
170
172
173#ifdef __cplusplus
174}
175#endif
176
177#endif
static struct k_object * k_object_create_dynamic(size_t size)
Definition kobject_internal.h:161
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:152
#define NULL
Definition iar_missing_defs.h:20
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Kernel mutex structure.
Definition kernel.h:3492
Definition kobject_internal.h:66
struct k_thread * thread
Definition kobject_internal.h:67
void *const * objects
Definition kobject_internal.h:68
Table generated by gperf, these objects are retrieved via k_object_find().
Definition kobject_internal.h:58
uint8_t flags
Definition kobject_internal.h:62
uint8_t type
Definition kobject_internal.h:61
uint8_t perms[CONFIG_MAX_THREAD_BYTES]
Definition kobject_internal.h:60
void * name
Definition kobject_internal.h:59
union k_object_data data
Definition kobject_internal.h:63
Thread Structure.
Definition thread.h:259
Definition kobject_internal.h:32
int unused
Definition kobject_internal.h:48
struct k_mutex * mutex
Definition kobject_internal.h:34
const struct z_stack_data * stack_data
Definition kobject_internal.h:41
unsigned int thread_id
Definition kobject_internal.h:37