![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
This driver is used for SCU firmware event monitoring and management.
Data Structures | |
struct | sc_event_list_t |
SC Event list fields. More... | |
struct | sc_event_handler_t |
SC Event handler structure. More... | |
Macros | |
#define | SC_EVENT_HANDLER_MEM_POOL_SIZE (200U) |
The SC Event handler memory pool size in bytes. More... | |
#define | SC_EVENT_USE_SYSCTR (0) |
The SYSCTR SC Event maybe used as wakeup source in low power applications. More... | |
#define | SC_EVENT_LIST_OBJ(type, field, list) (type)((uint32_t)(list) - (uint32_t)(&((type)0)->field)) |
Get SC Event list object structure pointer. | |
Typedefs | |
typedef void(* | sc_event_callback_t )(uint32_t status, void *userData) |
SC Event callback function. More... | |
typedef status_t(* | sc_event_sema4_wait_t )(void *sem, uint32_t timeout) |
SC Event Semaphore Wait function. More... | |
typedef void(* | sc_event_sema4_post_t )(void *sem) |
SC Event Semaphore Post function. More... | |
Enumerations | |
enum | sc_event_t { kSCEvent_TempHigh = SC_EVENT_TYPE_TUPLE(SC_IRQ_GROUP_TEMP, SC_IRQ_TEMP_HIGH), kSCEvent_TempCpu0High, kSCEvent_TempCpu1High, kSCEvent_TempGpu0High, kSCEvent_TempGpu1High, kSCEvent_TempDrc0High, kSCEvent_TempDrc1High, kSCEvent_TempVpuHigh, kSCEvent_TempPmic0High, kSCEvent_TempPmic1High, kSCEvent_TempLow = SC_EVENT_TYPE_TUPLE(SC_IRQ_GROUP_TEMP, SC_IRQ_TEMP_LOW), kSCEvent_TempCpu0Low, kSCEvent_TempCpu1Low, kSCEvent_TempGpu0Low, kSCEvent_TempGpu1Low, kSCEvent_TempDrc0Low, kSCEvent_TempDrc1Low, kSCEvent_TempVpuLow = SC_EVENT_TYPE_TUPLE(SC_IRQ_GROUP_TEMP, SC_IRQ_TEMP_VPU_LOW), kSCEvent_TempPmic0Low, kSCEvent_TempPmic1Low, kSCEvent_TempPmic2High, kSCEvent_TempPmic2Low, kSCEvent_Wdog = SC_EVENT_TYPE_TUPLE(SC_IRQ_GROUP_WDOG, SC_IRQ_WDOG), kSCEvent_Rtc = SC_EVENT_TYPE_TUPLE(SC_IRQ_GROUP_RTC, SC_IRQ_RTC), kSCEvent_Button = SC_EVENT_TYPE_TUPLE(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON), kSCEvent_Pad = SC_EVENT_TYPE_TUPLE(SC_IRQ_GROUP_WAKE, SC_IRQ_PAD), kSCEvent_User1 = SC_EVENT_TYPE_TUPLE(SC_IRQ_GROUP_WAKE, SC_IRQ_USR1), kSCEvent_User2 = SC_EVENT_TYPE_TUPLE(SC_IRQ_GROUP_WAKE, SC_IRQ_USR2), kSCEvent_BcPad, kSCEvent_Rebooted, kSCEvent_Reboot = SC_EVENT_TYPE_TUPLE(SC_IRQ_GROUP_REBOOT, SC_EVENT_IRQ_DUMMY) } |
SC Event type. More... | |
Functions | |
void | SCEvent_Init (uint8_t priority) |
Initialize SC Event module. More... | |
void | SCEvent_Deinit (void) |
Deinitialize SC Event. More... | |
sc_event_handler_t | SCEvent_RegisterEventHandler (sc_event_t event, sc_event_callback_t callback, void *userData) |
Register SC Event handler. More... | |
void | SCEvent_UnregisterEventHandler (sc_event_handler_t handler) |
Unregister SC Event handler. More... | |
status_t | SCEvent_Config (sc_event_t event, bool enable, uint32_t pt) |
Configure SC Event. More... | |
void | SCEvent_Process (void) |
SCEvent Process function. More... | |
status_t | SCEvent_WaitEvent (sc_event_sema4_wait_t wait, sc_event_sema4_post_t post, void *sem, uint32_t timeout) |
Set Semaphore and Semaphore wait/post funciton in RTOS environment. More... | |
Driver version | |
#define | FSL_SC_EVENT_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
Group interrupt driver version for SDK. More... | |
struct sc_event_list_t |
struct _sc_event_handler |
SC Event handler is a pointer to the SC Event handler instance.
Data Fields | |
sc_event_t | event |
Event type. More... | |
sc_event_callback_t | callback |
Event callback. More... | |
void * | data |
User data. More... | |
sc_event_t sc_event_handler_t::event |
sc_event_callback_t sc_event_handler_t::callback |
void* sc_event_handler_t::data |
#define FSL_SC_EVENT_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
Version 2.0.1.
#define SC_EVENT_HANDLER_MEM_POOL_SIZE (200U) |
#define SC_EVENT_USE_SYSCTR (0) |
Such as in LPM module(lpm.c), the SYSCTR is used as wakeup source in tickless idle.
typedef void(* sc_event_callback_t)(uint32_t status, void *userData) |
The SC Event callback returns a status from the underlying layer. The status reflects the SC IRQ status got by sc_irq_status SCFW API. It's the bitmask of enabled IRQ in a group. Such as for kSCEvent_Reboot/kSCEvent_Rebooted event, if more than one partition reboot event is enabled, this status flag can be used to identify which partition the event comes from. Refer to SCFW API sc_irq_status for more details.
typedef status_t(* sc_event_sema4_wait_t)(void *sem, uint32_t timeout) |
The Semaphore Wait/Post function is used in RTOS envirnoment to pass Semaphore Wait/Post function into SC Event driver. Unused in baremetal envirnonment. The task can wait the event by calling SCEvent_WaitEvent function.
typedef void(* sc_event_sema4_post_t)(void *sem) |
The Semaphore Wait/Post function is used in RTOS envirnoment to pass Semaphore Wait/Post function into SC Event driver. Unused in baremetal envirnonment. The post function is called to give semaphore if event triggered in IRQ.
enum sc_event_t |
void SCEvent_Init | ( | uint8_t | priority | ) |
This function enable the IPC MU interrupt, setup to listen the event comes from SCU/SCFW.
priority | The SC IRQ interrupt priority. Once any SC IRQ enabled, the SCU will broadcast MU interrupt through the IPC MU to M4 cores. |
None. |
void SCEvent_Deinit | ( | void | ) |
This function disable the IPC MU interrupt.
sc_event_handler_t SCEvent_RegisterEventHandler | ( | sc_event_t | event, |
sc_event_callback_t | callback, | ||
void * | userData | ||
) |
This function register the handler for the specified event. When the event is enabled by SCEvent_Config and happens, the callback will be called from SCEvent_process. More than one callback can be added for an event. But the total registered events are limited to SC_EVENT_HANDLER_MEM_POOL_SIZE/(sizeof(struct _sc_event_handler)).
event | The event to be registered with. |
callback | The callback function. This function will be called from SCEvent_process. |
userData | User defined callback function parameter. |
SC | Event handler. |
void SCEvent_UnregisterEventHandler | ( | sc_event_handler_t | handler | ) |
This function unregister and delete the given event handler.
handler | The SC Event handler to unregister. |
none. |
status_t SCEvent_Config | ( | sc_event_t | event, |
bool | enable, | ||
uint32_t | pt | ||
) |
This function enables/disables response for the event comes from SCU/SCFW.
event | The event to be configured. |
enable | Enable the event or not. |
pt | Which partition the event comes from. Only applicable for partition reboot event: kSCEvent_Rebooted, kSCEvent_Reboot. |
kStatus_Success | - Configure SC Event Successfully. |
kStatus_Fail | - Failed to configure SC Event. |
void SCEvent_Process | ( | void | ) |
This function is used to check SC event status and handle all the registered event handlers. The SCFW API call is a blocking call and used to check SC IRQ status, so this function should be executed in task context to make sure other event(interrupt) handled in time. In RTOS enviroment, application creats a task and wait for some events came using SCEvent_WaitEvent to run this function to handle the events. In baremetal enviroment, application need preiodically call this function to make sure the pending events handled.
status_t SCEvent_WaitEvent | ( | sc_event_sema4_wait_t | wait, |
sc_event_sema4_post_t | post, | ||
void * | sem, | ||
uint32_t | timeout | ||
) |
The Semaphore Wait/Post function is used in RTOS envirnoment to pass Semaphore Wait/Post function into SC Event driver. Unused in baremetal envirnonment. The SCEvent_process will wait the Semaphore registered by SCEvent_SetWaitPostFunc until the event comes, and give the Semaphore, then it will handle the event and call the event handler's callback.
wait | Semaphore wait function. |
post | Semaphore post function. |
sem | Semaphore. |
timeout | timeout. |
kStatus_Success | if succeed, kStatus_Timeout if timeout. |