Description
Initializes µC/OS-III and it must be called prior to calling any other µC/OS-III function. Including OSStart()
which will start multitasking. OSInit()
returns as soon as an error is detected.
Files
os.h/os_core.c
Prototype
Arguments
p_cfg
is a pointer to a OS_CFG
structure. See Note #3 below for a description of OS_CFG
. To support the old os_cfg_app.h
scheme, p_cfg
can be DEF_NULL
if OS_CFG_COMPAT_INIT_EN
is equal to DEF_ENABLED
.
p_mem_seg
is a pointer to a MEM_SEG
structure. This segment will be used to allocate the kernel objects. Can be DEF_NULL
to allocate objects on the heap.
p_err
is a pointer to an error code. Some of the error codes below are issued only if the associated feature is enabled.
RTOS_ERR_NONE
initialization was successful.
*NEED TO COMPLETE*
Returned Values
None
Required Configuration
None
Callers
Application.
Notes/Warnings
OSInit()
must be called beforeOSStart()
.OSInit()
returns as soon as it detects an error in any of the sub-functions it calls. For example, ifOSInit()
encounters a problem initializing the task manager, an appropriate error code will be returned andOSInit()
will not go any further. It is therefore important that the user checks the error code before starting multitasking.The listing below shows the
OS_CFG
andOS_TASK_CFG
structures. TheOS_APP_CFG_???_DFLT
defines inos.h
contain the default values for everyOS_CFG
field.