1.2.4.4.1 SYS_CONSOLE_Initialize Function
C
SYS_MODULE_OBJ SYS_CONSOLE_Initialize(
const SYS_MODULE_INDEX index,
const SYS_MODULE_INIT* const init
)
Summary
Initializes the console instance module and opens or initializes the specific module instance to which it is associated.
Description
This function initializes the internal data structures used by the console module. It also initializes the associated I/O driver/PLIB.
Precondition
None.
Parameters
Param | Description |
---|---|
index | Index for the instance to be initialized |
init | Pointer to a data structure containing any data necessary to initialize the Console System service. This pointer may be null if no data is required because static overrides have been provided. |
Returns
If successful, returns a valid handle to the console instance. Otherwise, it returns SYS_MODULE_OBJ_INVALID.
The returned object must be passed as argument to SYS_CONSOLE_Tasks and SYS_CONSOLE_Status routines.
Example
SYS_MODULE_OBJ objectHandle; // Populate the console initialization structure const SYS_CONSOLE_INIT sysConsole0Init = { .deviceInitData = (void*)&sysConsole0UARTInitData, .consDevDesc = &sysConsoleUARTDevDesc, .deviceIndex = 0, }; objectHandle = SYS_CONSOLE_Initialize(SYS_CONSOLE_INDEX_0, (SYS_MODULE_INIT *)&sysConsole0Init); if (objectHandle == SYS_MODULE_OBJ_INVALID) { // Handle error }
Remarks
This routine should only be called once during system initialization.