Go to the documentation of this file.
24#ifndef __VSF_KERNAL_CFG_H__
25#define __VSF_KERNAL_CFG_H__
27#if VSF_USE_KERNEL == ENABLED
31#ifndef VSF_KERNEL_ASSERT
32# define VSF_KERNEL_ASSERT VSF_ASSERT
35#ifdef VSF_ARCH_ENTRY_NO_PENDING
36# ifdef VSF_KERNEL_CFG_ENTRY_IS_MAIN
37# if VSF_KERNEL_CFG_ENTRY_IS_MAIN != ENABLED
38# error VSF_KERNEL_CFG_ENTRY_IS_MAIN MUST be enabled for VSF_ARCH_ENTRY_NO_PENDING
41# define VSF_KERNEL_CFG_ENTRY_IS_MAIN ENABLED
45#ifndef VSF_KERNEL_CFG_SUPPORT_SYNC
46# define VSF_KERNEL_CFG_SUPPORT_SYNC ENABLED
48#if VSF_KERNEL_CFG_SUPPORT_SYNC == ENABLED
49# ifndef VSF_SYNC_CFG_SUPPORT_ISR
50# define VSF_SYNC_CFG_SUPPORT_ISR ENABLED
52# ifndef VSF_KERNEL_CFG_SUPPORT_BITMAP_EVENT
53# define VSF_KERNEL_CFG_SUPPORT_BITMAP_EVENT ENABLED
55# ifndef VSF_KERNEL_CFG_SUPPORT_SLIST_QUEUE
56# define VSF_KERNEL_CFG_SUPPORT_SLIST_QUEUE ENABLED
59# ifndef VSF_KERNEL_CFG_SUPPORT_BITMAP_EVENT
60# define VSF_KERNEL_CFG_SUPPORT_BITMAP_EVENT DISABLED
62# ifndef VSF_SYNC_CFG_SUPPORT_ISR
63# define VSF_SYNC_CFG_SUPPORT_ISR DISABLED
65# ifndef VSF_KERNEL_CFG_SUPPORT_SLIST_QUEUE
66# define VSF_KERNEL_CFG_SUPPORT_SLIST_QUEUE DISABLED
71#define VSF_KERNEL_CFG_TIMER_MODE_TICK 0
72#define VSF_KERNEL_CFG_TIMER_MODE_TICKLESS 1
74#ifndef VSF_KERNEL_CFG_EDA_SUPPORT_TIMER
75# if VSF_SYSTIMER_CFG_IMPL_MODE != VSF_SYSTIMER_IMPL_NONE
76# define VSF_KERNEL_CFG_EDA_SUPPORT_TIMER ENABLED
78# define VSF_KERNEL_CFG_EDA_SUPPORT_TIMER DISABLED
81#if VSF_KERNEL_CFG_EDA_SUPPORT_TIMER == ENABLED
82# ifndef VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER
83# define VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER ENABLED
85# ifndef VSF_KERNEL_CFG_TIMER_MODE
86# if (VSF_SYSTIMER_CFG_IMPL_MODE != VSF_SYSTIMER_IMPL_NONE) && (VSF_SYSTIMER_CFG_IMPL_MODE == VSF_SYSTIMER_IMPL_TICK_MODE)
87# define VSF_KERNEL_CFG_TIMER_MODE VSF_KERNEL_CFG_TIMER_MODE_TICK
89# define VSF_KERNEL_CFG_TIMER_MODE VSF_KERNEL_CFG_TIMER_MODE_TICKLESS
93# ifndef VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER
94# define VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER DISABLED
96# if VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER == ENABLED
97# warning "VSF_KERNEL_CFG_EDA_SUPPORT_TIMER MUST be enabled to use callback_timer"
98# undef VSF_KERNEL_CFG_EDA_SUPPORT_TIMER
99# define VSF_KERNEL_CFG_EDA_SUPPORT_TIMER ENABLED
105#ifndef VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL
106# define VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL ENABLED
110#ifndef VSF_KERNEL_CFG_EDA_SUBCALL_HAS_RETURN_VALUE
111# define VSF_KERNEL_CFG_EDA_SUBCALL_HAS_RETURN_VALUE VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL
114#if VSF_KERNEL_CFG_EDA_SUBCALL_HAS_RETURN_VALUE == ENABLED
115# if VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL != ENABLED
116# warning "Since VSF_KERNEL_CFG_EDA_SUBCALL_HAS_RETURN_VALUE is ENABLED \
117and it requires VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL also be set to \
118ENABLED, to allow the compilation continue, \
119VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL is forced to ENABLED. If this is \
120not what you want, please disable VSF_KERNEL_CFG_EDA_SUBCALL_HAS_RETURN_VALUE."
121# undef VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL
122# define VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL ENABLED
126#if VSF_KERNEL_CFG_EDA_SUPPORT_SUB_CALL == ENABLED
129# if (defined(VSF_OS_CFG_EDA_FRAME_POOL_SIZE) && !defined(VSF_OS_CFG_EDA_FRAME_POOL_EXTRA_SIZE))\
130 || (!defined(VSF_OS_CFG_EDA_FRAME_POOL_SIZE) && defined(VSF_OS_CFG_EDA_FRAME_POOL_EXTRA_SIZE))
131# warning both VSF_OS_CFG_EDA_FRAME_POOL_SIZE and VSF_OS_CFG_EDA_FRAME_POOL_EXTRA_SIZE MUST\
132 be defined to enable frame pool.
134# if defined(VSF_OS_CFG_EDA_FRAME_POOL_SIZE) && defined(VSF_OS_CFG_EDA_FRAME_POOL_EXTRA_SIZE)
135# define __VSF_KERNEL_CFG_EDA_FRAME_POOL ENABLED
137# ifndef VSF_KERNEL_CFG_EDA_FAST_SUB_CALL
138# define VSF_KERNEL_CFG_EDA_FAST_SUB_CALL DISABLED
142#ifndef VSF_KERNEL_CFG_EDA_SUPPORT_ON_TERMINATE
143# define VSF_KERNEL_CFG_EDA_SUPPORT_ON_TERMINATE ENABLED
146#ifndef VSF_KERNEL_CFG_SUPPORT_THREAD
147# define VSF_KERNEL_CFG_SUPPORT_THREAD ENABLED
149#if VSF_KERNEL_CFG_SUPPORT_THREAD == ENABLED
150# ifndef VSF_KERNEL_CFG_THREAD_SIGNAL
151# define VSF_KERNEL_CFG_THREAD_SIGNAL ENABLED
153# if VSF_KERNEL_CFG_THREAD_SIGNAL == ENABLED
154# ifndef VSF_KERNEL_CFG_THREAD_SIGNAL_MASK_T
155# define VSF_KERNEL_CFG_THREAD_SIGNAL_MASK_T uint64_t
160#ifndef VSF_KERNEL_USE_SIMPLE_SHELL
161# define VSF_KERNEL_USE_SIMPLE_SHELL ENABLED
164#ifndef VSF_KERNEL_CFG_EDA_SUPPORT_TASK
165# define VSF_KERNEL_CFG_EDA_SUPPORT_TASK DISABLED
168#ifndef VSF_KERNEL_CFG_EDA_SUPPORT_PT
169# define VSF_KERNEL_CFG_EDA_SUPPORT_PT DISABLED
172#ifndef VSF_KERNEL_CFG_EDA_SUPPORT_SIMPLE_FSM
173# define VSF_KERNEL_CFG_EDA_SUPPORT_SIMPLE_FSM DISABLED
176#ifndef VSF_KERNEL_OPT_AVOID_UNNECESSARY_YIELD_EVT
177# define VSF_KERNEL_OPT_AVOID_UNNECESSARY_YIELD_EVT (VSF_KERNEL_CFG_EDA_SUPPORT_PT == ENABLED) || (VSF_KERNEL_CFG_EDA_SUPPORT_SIMPLE_FSM == ENABLED)
182#define VSF_OS_CFG_MAIN_MODE_NONE 0
183#define VSF_OS_CFG_MAIN_MODE_THREAD 1
184#define VSF_OS_CFG_MAIN_MODE_EDA 2
185#define VSF_OS_CFG_MAIN_MODE_IDLE 3
187#ifndef VSF_OS_CFG_MAIN_MODE
188# if VSF_KERNEL_CFG_SUPPORT_THREAD == ENABLED
189# define VSF_OS_CFG_MAIN_MODE VSF_OS_CFG_MAIN_MODE_THREAD
191# define VSF_OS_CFG_MAIN_MODE VSF_OS_CFG_MAIN_MODE_IDLE
197#if VSF_KERNEL_CFG_SUPPORT_SLIST_QUEUE == ENABLED
198# if defined(VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE) && VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE != ENABLED
199# warning VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE MSUT be enabled for VSF_KERNEL_CFG_SUPPORT_SLIST_QUEUE
200# undef VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE
201# define VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE ENABLED
204#ifndef VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE
205# define VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE VSF_KERNEL_CFG_SUPPORT_SYNC
209#ifndef VSF_USR_SWI_NUM
210# define VSF_USR_SWI_NUM 0
212#if !defined(VSF_OS_CFG_PRIORITY_NUM) && !defined(__VSF_OS_SWI_NUM)
213# if (VSF_SWI_NUM + VSF_USR_SWI_NUM) > VSF_ARCH_PRI_NUM
214# define __VSF_OS_SWI_NUM VSF_ARCH_PRI_NUM
216# define __VSF_OS_SWI_NUM (VSF_SWI_NUM + VSF_USR_SWI_NUM)
218# ifndef VSF_OS_CFG_ADD_EVTQ_TO_IDLE
219# if __VSF_OS_SWI_NUM > 0
220# define VSF_OS_CFG_ADD_EVTQ_TO_IDLE DISABLED
222# define VSF_OS_CFG_ADD_EVTQ_TO_IDLE ENABLED
225# if VSF_OS_CFG_ADD_EVTQ_TO_IDLE == ENABLED
226# define VSF_OS_CFG_PRIORITY_NUM (__VSF_OS_SWI_NUM + 1)
228# define VSF_OS_CFG_PRIORITY_NUM __VSF_OS_SWI_NUM
230#elif !defined(__VSF_OS_SWI_NUM)
231# warning "VSF_OS_CFG_PRIORITY_NUM is defined while __VSF_OS_SWI_NUM is not \
232automatically calculated based on VSF_OS_CFG_PRIORITY_NUM in vsf_cfg.h. This \
234# ifndef VSF_OS_CFG_ADD_EVTQ_TO_IDLE
235# define VSF_OS_CFG_ADD_EVTQ_TO_IDLE DISABLED
237# if VSF_OS_CFG_ADD_EVTQ_TO_IDLE == ENABLED
238# define __VSF_OS_SWI_NUM (VSF_OS_CFG_PRIORITY_NUM - 1)
240# define __VSF_OS_SWI_NUM VSF_OS_CFG_PRIORITY_NUM
242#elif !defined(VSF_OS_CFG_PRIORITY_NUM)
243# warning "User should never define __VSF_OS_SWI_NUM which is ought to be \
244calculated from macro VSF_OS_CFG_PRIORITY_NUM. Please define \
245VSF_OS_CFG_PRIORITY_NUM in your vsf_usr_cfg.h (or any configuration header file \
246included by vsf_usr_cfg.h)"
247# ifndef VSF_OS_CFG_ADD_EVTQ_TO_IDLE
248# define VSF_OS_CFG_ADD_EVTQ_TO_IDLE DISABLED
250# if VSF_OS_CFG_ADD_EVTQ_TO_IDLE == ENABLED
251# define VSF_OS_CFG_PRIORITY_NUM (__VSF_OS_SWI_NUM + 1)
253# define VSF_OS_CFG_PRIORITY_NUM __VSF_OS_SWI_NUM
258#ifndef VSF_KERNEL_CFG_ALLOW_KERNEL_BEING_PREEMPTED
259# define VSF_KERNEL_CFG_ALLOW_KERNEL_BEING_PREEMPTED ENABLED
262#if __VSF_OS_SWI_NUM > (VSF_USR_SWI_NUM + VSF_SWI_NUM) \
263 || VSF_OS_CFG_PRIORITY_NUM > (VSF_ARCH_PRI_NUM + 1)
264# error "too many VSF_OS_CFG_PRIORITY_NUM!!!"
266#if VSF_OS_CFG_PRIORITY_NUM <= 0
267# error "VSF_OS_CFG_PRIORITY_NUM MUST > 0"
270#if __VSF_OS_SWI_NUM > 1 && VSF_KERNEL_CFG_ALLOW_KERNEL_BEING_PREEMPTED != ENABLED
271# warning "VSF_KERNEL_CFG_ALLOW_KERNEL_BEING_PREEMPTED MUST be enabled to support \
272VSF_OS_CFG_PRIORITY_NUM > 1"
273# undef VSF_KERNEL_CFG_ALLOW_KERNEL_BEING_PREEMPTED
274# define VSF_KERNEL_CFG_ALLOW_KERNEL_BEING_PREEMPTED ENABLED
277#if VSF_OS_CFG_ADD_EVTQ_TO_IDLE == ENABLED
278# if VSF_KERNEL_CFG_ALLOW_KERNEL_BEING_PREEMPTED != ENABLED \
279 && VSF_OS_CFG_PRIORITY_NUM > 1
280# warning "VSF_KERNEL_CFG_ALLOW_KERNEL_BEING_PREEMPTED MUST be enabled to support \
281VSF_OS_CFG_ADD_EVTQ_TO_IDLE"
282# undef VSF_KERNEL_CFG_ALLOW_KERNEL_BEING_PREEMPTED
283# define VSF_KERNEL_CFG_ALLOW_KERNEL_BEING_PREEMPTED ENABLED
289# if VSF_OS_CFG_PRIORITY_NUM > 1
290# define __VSF_OS_SWI_PRIORITY_BEGIN vsf_prio_1
293# define __VSF_OS_SWI_PRIORITY_BEGIN vsf_prio_0
296#if VSF_KERNEL_CFG_ALLOW_KERNEL_BEING_PREEMPTED == ENABLED
297# define __VSF_KERNEL_CFG_EVTQ_EN ENABLED
299# ifndef VSF_KERNEL_CFG_SUPPORT_DYNAMIC_PRIOTIRY
300# define VSF_KERNEL_CFG_SUPPORT_DYNAMIC_PRIOTIRY ENABLED
303# if VSF_KERNEL_CFG_SUPPORT_DYNAMIC_PRIOTIRY == ENABLED
304# define __VSF_OS_CFG_EVTQ_LIST
306# define __VSF_OS_CFG_EVTQ_ARRAY
307# ifndef VSF_OS_CFG_EVTQ_BITSIZE
308# define VSF_OS_CFG_EVTQ_BITSIZE 4
312# undef VSF_KERNEL_CFG_SUPPORT_DYNAMIC_PRIOTIRY
313# define VSF_KERNEL_CFG_SUPPORT_DYNAMIC_PRIOTIRY DISABLED
316#if __VSF_KERNEL_CFG_EVTQ_EN == ENABLED
317# if VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER == ENABLED
318# ifndef VSF_CALLBACK_TIMER_CFG_SUPPORT_ISR
319# define VSF_CALLBACK_TIMER_CFG_SUPPORT_ISR ENABLED
322# if VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE == ENABLED
323# ifndef VSF_EDA_QUEUE_CFG_SUPPORT_ISR
324# define VSF_EDA_QUEUE_CFG_SUPPORT_ISR ENABLED
327# ifndef VSF_KERNEL_CFG_SUPPORT_EVT_MESSAGE
328# define VSF_KERNEL_CFG_SUPPORT_EVT_MESSAGE ENABLED
331# if VSF_KERNEL_CFG_SUPPORT_EVT_MESSAGE == ENABLED
332# error "VSF_KERNEL_CFG_SUPPORT_EVT_MESSAGE requires __VSF_KERNEL_CFG_EVTQ_EN"
335#if VSF_KERNEL_CFG_SUPPORT_EVT_MESSAGE != ENABLED \
336 && ( ( VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER == ENABLED \
337 && VSF_CALLBACK_TIMER_CFG_SUPPORT_ISR == ENABLED) \
338 || ( VSF_KERNEL_CFG_SUPPORT_EDA_QUEUE == ENABLED \
339 && VSF_EDA_QUEUE_CFG_SUPPORT_ISR == ENABLED))
340# error VSF_KERNEL_CFG_SUPPORT_EVT_MESSAGE MUST be enabled for callback_timer and/or queue isr APIs
344#if !defined(VSF_KERNEL_CFG_THREAD_STACK_PAGE_SIZE) \
345 && defined(VSF_ARCH_STACK_PAGE_SIZE)
346# define VSF_KERNEL_CFG_THREAD_STACK_PAGE_SIZE VSF_ARCH_STACK_PAGE_SIZE
350#if !defined(VSF_KERNEL_CFG_THREAD_STACK_GUARDIAN_SIZE) \
351 && defined(VSF_ARCH_STACK_GUARDIAN_SIZE)
352# define VSF_KERNEL_CFG_THREAD_STACK_GUARDIAN_SIZE VSF_ARCH_STACK_GUARDIAN_SIZE
355#if !defined(VSF_KERNEL_CFG_THREAD_STACK_CHECK)
356# define VSF_KERNEL_CFG_THREAD_STACK_CHECK DISABLED
360#if !defined(VSF_KERNEL_CFG_THREAD_STACK_LARGE)
361# define VSF_KERNEL_CFG_THREAD_STACK_LARGE DISABLED
368#if !defined(VSF_KERNEL_CFG_CPU_USAGE)
369# define VSF_KERNEL_CFG_CPU_USAGE DISABLED
371#if VSF_KERNEL_CFG_CPU_USAGE == ENABLED && VSF_KERNEL_CFG_EDA_SUPPORT_TIMER != ENABLED
372# error VSF_KERNEL_CFG_CPU_USAGE needs VSF_KERNEL_CFG_EDA_SUPPORT_TIMER
375#if !defined(VSF_KERNEL_CFG_EDA_CPU_USAGE)
376# define VSF_KERNEL_CFG_EDA_CPU_USAGE VSF_KERNEL_CFG_EDA_SUPPORT_TIMER
378#if VSF_KERNEL_CFG_EDA_CPU_USAGE == ENABLED && VSF_KERNEL_CFG_EDA_SUPPORT_TIMER != ENABLED
379# error VSF_KERNEL_CFG_EDA_CPU_USAGE needs VSF_KERNEL_CFG_EDA_SUPPORT_TIMER