MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
SCU EVENT Driver

Overview

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...
 

Data Structure Documentation

struct sc_event_list_t

Data Fields

struct _sc_event_list * prev
 previous list node
 
struct _sc_event_list * next
 next list node
 
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...
 

Field Documentation

sc_event_t sc_event_handler_t::event
sc_event_callback_t sc_event_handler_t::callback
void* sc_event_handler_t::data

Macro Definition Documentation

#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 Documentation

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.

Enumeration Type Documentation

enum sc_event_t
Enumerator
kSCEvent_TempHigh 

Temp alarm interrupt.

kSCEvent_TempCpu0High 

CPU0 temp alarm interrupt.

kSCEvent_TempCpu1High 

CPU1 temp alarm interrupt.

kSCEvent_TempGpu0High 

GPU0 temp alarm interrupt.

kSCEvent_TempGpu1High 

GPU1 temp alarm interrupt.

kSCEvent_TempDrc0High 

DRC0 temp alarm interrupt.

kSCEvent_TempDrc1High 

DRC1 temp alarm interrupt.

kSCEvent_TempVpuHigh 

VPU temp alarm interrupt.

kSCEvent_TempPmic0High 

PMIC0 temp alarm interrupt.

kSCEvent_TempPmic1High 

PMIC1 temp alarm interrupt.

kSCEvent_TempLow 

Temp alarm interrupt.

kSCEvent_TempCpu0Low 

CPU0 temp alarm interrupt.

kSCEvent_TempCpu1Low 

CPU1 temp alarm interrupt.

kSCEvent_TempGpu0Low 

GPU0 temp alarm interrupt.

kSCEvent_TempGpu1Low 

GPU1 temp alarm interrupt.

kSCEvent_TempDrc0Low 

DRC0 temp alarm interrupt.

kSCEvent_TempDrc1Low 

DRC1 temp alarm interrupt.

kSCEvent_TempVpuLow 

VPU temp alarm interrupt.

kSCEvent_TempPmic0Low 

PMIC0 temp alarm interrupt.

kSCEvent_TempPmic1Low 

PMIC1 temp alarm interrupt.

kSCEvent_TempPmic2High 

PMIC2 temp alarm interrupt.

kSCEvent_TempPmic2Low 

PMIC2 temp alarm interrupt.

kSCEvent_Wdog 

Watchdog interrupt.

kSCEvent_Rtc 

RTC interrupt.

kSCEvent_Button 

Button interrupt.

kSCEvent_Pad 

Pad wakeup.

kSCEvent_User1 

User defined 1.

kSCEvent_User2 

User defined 2.

kSCEvent_BcPad 

Pad wakeup (broadcast to all partitions)

kSCEvent_Rebooted 

Partition reboot complete.

kSCEvent_Reboot 

Partition reboot starting.

Function Documentation

void SCEvent_Init ( uint8_t  priority)

This function enable the IPC MU interrupt, setup to listen the event comes from SCU/SCFW.

Parameters
priorityThe SC IRQ interrupt priority. Once any SC IRQ enabled, the SCU will broadcast MU interrupt through the IPC MU to M4 cores.
Return values
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)).

Parameters
eventThe event to be registered with.
callbackThe callback function. This function will be called from SCEvent_process.
userDataUser defined callback function parameter.
Return values
SCEvent handler.
void SCEvent_UnregisterEventHandler ( sc_event_handler_t  handler)

This function unregister and delete the given event handler.

Parameters
handlerThe SC Event handler to unregister.
Return values
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.

Parameters
eventThe event to be configured.
enableEnable the event or not.
ptWhich partition the event comes from. Only applicable for partition reboot event: kSCEvent_Rebooted, kSCEvent_Reboot.
Return values
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.

Parameters
waitSemaphore wait function.
postSemaphore post function.
semSemaphore.
timeouttimeout.
Return values
kStatus_Successif succeed, kStatus_Timeout if timeout.