3
3
//!
4
4
//! # General Structure
5
5
//!
6
- //! TODO
6
+ //! This module includes the traits for a kernel-specific low-level configurator
7
+ //! type, which is used by [the kernel static configuration process][1] to
8
+ //! receive the specificiations of defined kernel objects and assign their IDs.
9
+ //! [`CfgBase`][] is the supertrait of all these traits and must be implemented
10
+ //! by the configurator type. It can optionally can implement other traits as
11
+ //! well if they can be supported.
7
12
//!
8
- //! The `Cfg${TY }` traits extend [`CfgBase`] by providing a
9
- //! method to define a kernel object of the corresponding type (`${TY}`). The
10
- //! method takes two parameters: `${TY }Descriptor` containing mandatory
11
- //! properties and `impl `[`Bag`] containing additional, implementation-specific
12
- //! properties.
13
+ //! The `Cfg${Ty }` traits extend [`CfgBase`] by providing a
14
+ //! method named `${ty}_define` to define a kernel object of the corresponding
15
+ //! type (`${Ty}`). The method takes two parameters: `${Ty }Descriptor`
16
+ //! containing mandatory properties and `impl `[`Bag`] containing additional,
17
+ //! implementation-specific properties.
13
18
//!
14
- //! The `${TY }Descriptor` types contain mandatory (both for the consumers and
19
+ //! The `${Ty }Descriptor` types contain mandatory (both for the consumers and
15
20
//! the implementors) properties of a kernel object to be created. They all
16
21
//! contain a `phantom: `[`PhantomInvariant`]`<System>` field to ensure they are
17
22
//! always parameterized and invariant over `System`.
21
26
//! Most traits in this method are `unsafe trait` because they have to be
22
27
//! trustworthy to be able to build sound memory-safe abstractions on top of
23
28
//! them.
29
+ //!
30
+ //! # Stability
31
+ //!
32
+ //! This module is covered by the kernel-side API stability guarantee.
33
+ //!
34
+ //! The trait paths in this module are covered by the application-side API
35
+ //! stability guarantee. Application code should only use these traits in trait
36
+ //! bounds and, to access the provided functionalities, should use the the
37
+ //! stable wrapper [outside this module](../index.html) instead.
38
+ //!
39
+ //! [1]: crate::kernel::cfg::KernelStatic
24
40
use crate :: { bag:: Bag , closure:: Closure , kernel:: raw, time:: Duration , utils:: PhantomInvariant } ;
25
41
42
+ /// The trait for all kernel-specific low-level configurator types, used by
43
+ /// [the kernel static configuration process][2].
44
+ ///
45
+ /// # Safety
46
+ ///
47
+ /// See [the module documentation][4].
48
+ ///
49
+ /// # Stability
50
+ ///
51
+ /// See [the module documentation][3].
52
+ ///
53
+ /// [2]: crate::kernel::cfg::KernelStatic
54
+ /// [3]: self#stability
55
+ /// [4]: self#safety
26
56
pub unsafe trait CfgBase {
27
57
type System : raw:: KernelBase ;
28
58
fn num_task_priority_levels ( & mut self , new_value : usize ) ;
@@ -35,6 +65,21 @@ pub unsafe trait CfgBase {
35
65
fn startup_hook_define ( & mut self , func : fn ( ) ) ;
36
66
}
37
67
68
+ /// A low-level configurator trait providing a method to define a
69
+ /// [task][1] in [the kernel static configuration process][2].
70
+ ///
71
+ /// # Safety
72
+ ///
73
+ /// See [the module documentation][4].
74
+ ///
75
+ /// # Stability
76
+ ///
77
+ /// See [the module documentation][3].
78
+ ///
79
+ /// [1]: crate::kernel::StaticTask
80
+ /// [2]: crate::kernel::cfg::KernelStatic
81
+ /// [3]: self#stability
82
+ /// [4]: self#safety
38
83
// The supertrait can't be `~const` due to [ref:const_supertraits]
39
84
pub unsafe trait CfgTask : CfgBase {
40
85
fn task_define < Properties : ~const Bag > (
@@ -54,6 +99,21 @@ pub struct TaskDescriptor<System> {
54
99
pub stack_size : Option < usize > ,
55
100
}
56
101
102
+ /// A low-level configurator trait providing a method to define an
103
+ /// [event group][2] in [the kernel static configuration process][1].
104
+ ///
105
+ /// # Safety
106
+ ///
107
+ /// See [the module documentation][4].
108
+ ///
109
+ /// # Stability
110
+ ///
111
+ /// See [the module documentation][3].
112
+ ///
113
+ /// [1]: crate::kernel::StaticEventGroup
114
+ /// [2]: crate::kernel::cfg::KernelStatic
115
+ /// [3]: self#stability
116
+ /// [4]: self#safety
57
117
// The supertrait can't be `~const` due to [ref:const_supertraits]
58
118
pub unsafe trait CfgEventGroup : CfgBase
59
119
where
@@ -74,6 +134,21 @@ pub struct EventGroupDescriptor<System> {
74
134
pub queue_order : raw:: QueueOrder ,
75
135
}
76
136
137
+ /// A low-level configurator trait providing a method to define a
138
+ /// [mutex][2] in [the kernel static configuration process][1].
139
+ ///
140
+ /// # Safety
141
+ ///
142
+ /// See [the module documentation][4].
143
+ ///
144
+ /// # Stability
145
+ ///
146
+ /// See [the module documentation][3].
147
+ ///
148
+ /// [1]: crate::kernel::StaticMutex
149
+ /// [2]: crate::kernel::cfg::KernelStatic
150
+ /// [3]: self#stability
151
+ /// [4]: self#safety
77
152
// The supertrait can't be `~const` due to [ref:const_supertraits]
78
153
pub unsafe trait CfgMutex : CfgBase
79
154
where
@@ -93,6 +168,21 @@ pub struct MutexDescriptor<System> {
93
168
pub protocol : raw:: MutexProtocol ,
94
169
}
95
170
171
+ /// A low-level configurator trait providing a method to define a
172
+ /// [semaphore][2] in [the kernel static configuration process][1].
173
+ ///
174
+ /// # Safety
175
+ ///
176
+ /// See [the module documentation][4].
177
+ ///
178
+ /// # Stability
179
+ ///
180
+ /// See [the module documentation][3].
181
+ ///
182
+ /// [1]: crate::kernel::StaticSemaphore
183
+ /// [2]: crate::kernel::cfg::KernelStatic
184
+ /// [3]: self#stability
185
+ /// [4]: self#safety
96
186
// The supertrait can't be `~const` due to [ref:const_supertraits]
97
187
pub unsafe trait CfgSemaphore : CfgBase
98
188
where
@@ -114,6 +204,21 @@ pub struct SemaphoreDescriptor<System> {
114
204
pub queue_order : raw:: QueueOrder ,
115
205
}
116
206
207
+ /// A low-level configurator trait providing a method to define a
208
+ /// [timwer][2] in [the kernel static configuration process][1].
209
+ ///
210
+ /// # Safety
211
+ ///
212
+ /// See [the module documentation][4].
213
+ ///
214
+ /// # Stability
215
+ ///
216
+ /// See [the module documentation][3].
217
+ ///
218
+ /// [1]: crate::kernel::StaticTimer
219
+ /// [2]: crate::kernel::cfg::KernelStatic
220
+ /// [3]: self#stability
221
+ /// [4]: self#safety
117
222
// The supertrait can't be `~const` due to [ref:const_supertraits]
118
223
pub unsafe trait CfgTimer : CfgBase
119
224
where
@@ -136,6 +241,21 @@ pub struct TimerDescriptor<System> {
136
241
pub period : Option < Duration > ,
137
242
}
138
243
244
+ /// A low-level configurator trait providing a method to define an
245
+ /// [interrupt line][2] in [the kernel static configuration process][1].
246
+ ///
247
+ /// # Safety
248
+ ///
249
+ /// See [the module documentation][4].
250
+ ///
251
+ /// # Stability
252
+ ///
253
+ /// See [the module documentation][3].
254
+ ///
255
+ /// [1]: crate::kernel::InterruptLine
256
+ /// [2]: crate::kernel::cfg::KernelStatic
257
+ /// [3]: self#stability
258
+ /// [4]: self#safety
139
259
// The supertrait can't be `~const` due to [ref:const_supertraits]
140
260
pub unsafe trait CfgInterruptLine : CfgBase
141
261
where
0 commit comments