Functions are used in the driver.
Functions | |
| cy_en_ipcsema_status_t | Cy_IPC_Sema_Init (uint32_t ipcChannel, uint32_t count, uint32_t memPtr[]) |
| This function initializes the semaphores subsystem. More... | |
| cy_en_ipcsema_status_t | Cy_IPC_Sema_InitExt (uint32_t ipcChannel, cy_stc_ipc_sema_t *ipcSema) |
| This function initializes the semaphores subsystem. More... | |
| cy_en_ipcsema_status_t | Cy_IPC_Sema_Set (uint32_t semaNumber, bool preemptable) |
| This function tries to acquire a semaphore. More... | |
| cy_en_ipcsema_status_t | Cy_IPC_Sema_Clear (uint32_t semaNumber, bool preemptable) |
| This functions tries to releases a semaphore. More... | |
| cy_en_ipcsema_status_t | Cy_IPC_Sema_Status (uint32_t semaNumber) |
| This function returns the status of the semaphore. More... | |
| uint32_t | Cy_IPC_Sema_GetMaxSems (void) |
| This function returns the number of semaphores in the semaphores subsystem. More... | |
| cy_en_ipcsema_status_t Cy_IPC_Sema_Init | ( | uint32_t | ipcChannel, |
| uint32_t | count, | ||
| uint32_t | memPtr[] | ||
| ) |
This function initializes the semaphores subsystem.
The user must create an array of unsigned 32-bit words to hold the semaphore bits. The number of semaphores will be the size of the array * 32. The total semaphores count will always be a multiple of 32.
Either this function or Cy_IPC_Sema_InitExt must be called from each core that will use IPC semaphores.
If semaphores will be used from within a secure processing environment, the secure processing environment must call either this function or Cy_IPC_Sema_InitExt with non-0 / NULL arguments, and it must do so before launching any other processing environment.
On cores that support DCache, user needs to make sure that the memPtr pointer passed to the Cy_IPC_Sema_Init function points to 32 byte aligned array of words that contain the semaphore data. User can use CY_ALIGN(32) macro for 32 byte alignment.
If semaphores will be used from within a secure processing environment, the secure processing environment must Cy_IPC_Sema_InitExt with non-0 / NULL arguments. This must be done even if this function or Cy_IPC_Sema_InitExt was previously called from another (non-secure) processing environment.
| ipcChannel | The IPC channel number used for semaphores |
| count | The maximum number of semaphores to be supported (multiple of 32). |
| memPtr | This points to the array of (count/32) words that contain the semaphore data. This must be located in memory which is accessible to all processing environments which will interact with semaphores |
| CY_IPC_SEMA_SUCCESS | Successfully initialized |
| CY_IPC_SEMA_BAD_PARAM | Memory pointer is NULL and count is not zero, or count not multiple of 32 |
| CY_IPC_SEMA_ERROR_LOCKED | Could not acquire semaphores IPC channel |
| cy_en_ipcsema_status_t Cy_IPC_Sema_InitExt | ( | uint32_t | ipcChannel, |
| cy_stc_ipc_sema_t * | ipcSema | ||
| ) |
This function initializes the semaphores subsystem.
The user must create an array of unsigned 32-bit words to hold the semaphore bits. The number of semaphores will be the size of the array * 32. The total semaphores count will always be a multiple of 32.
Either this function or Cy_IPC_Sema_Init must be called from each core that will use IPC semaphores.
If semaphores will be used from within a secure processing environment, the secure processing environment must this function with non-0 / NULL arguments. This must be done even if this function or Cy_IPC_Sema_Init was previously called from another (non-secure) processing environment.
| ipcChannel | The IPC channel number used for semaphores |
| ipcSema | This is configuration structure of the IPC semaphore. This struct must be located in memory which is accessible to all processing environments which will interact with semaphores. See cy_stc_ipc_sema_t. |
| CY_IPC_SEMA_SUCCESS | Successfully initialized |
| CY_IPC_SEMA_BAD_PARAM | Memory pointer is NULL and count is not zero, or count not multiple of 32 |
| CY_IPC_SEMA_ERROR_LOCKED | Could not acquire semaphores IPC channel |
| cy_en_ipcsema_status_t Cy_IPC_Sema_Set | ( | uint32_t | semaNumber, |
| bool | preemptable | ||
| ) |
This function tries to acquire a semaphore.
If the semaphore is not available, this function returns immediately with CY_IPC_SEMA_LOCKED.
It first acquires the IPC channel that is used for all the semaphores, sets the semaphore if it is cleared, then releases the IPC channel used for the semaphore.
| semaNumber | The semaphore number to acquire. |
| preemptable | When this parameter is enabled the function can be preempted by another task or other forms of context switching in an RTOS environment. |
| CY_IPC_SEMA_SUCCESS | The semaphore was set successfully |
| CY_IPC_SEMA_LOCKED | The semaphore channel is busy or locked by another process |
| CY_IPC_SEMA_NOT_ACQUIRED | Semaphore was already set |
| CY_IPC_SEMA_OUT_OF_RANGE | The semaphore number is not valid |
| cy_en_ipcsema_status_t Cy_IPC_Sema_Clear | ( | uint32_t | semaNumber, |
| bool | preemptable | ||
| ) |
This functions tries to releases a semaphore.
It first acquires the IPC channel that is used for all the semaphores, clears the semaphore if it is set, then releases the IPC channel used for the semaphores.
| semaNumber | The index of the semaphore to release. |
| preemptable | When this parameter is enabled the function can be preempted by another task or other forms of context switching in an RTOS environment. |
| CY_IPC_SEMA_SUCCESS | The semaphore was cleared successfully |
| CY_IPC_SEMA_NOT_ACQUIRED | The semaphore was already cleared |
| CY_IPC_SEMA_LOCKED | The semaphore channel was semaphored or busy |
| CY_IPC_SEMA_OUT_OF_RANGE | The semaphore number is not valid |
| cy_en_ipcsema_status_t Cy_IPC_Sema_Status | ( | uint32_t | semaNumber | ) |
This function returns the status of the semaphore.
| semaNumber | The index of the semaphore to return status. |
| CY_IPC_SEMA_STATUS_LOCKED | The semaphore is in the set state. |
| CY_IPC_SEMA_STATUS_UNLOCKED | The semaphore is in the cleared state. |
| CY_IPC_SEMA_OUT_OF_RANGE | The semaphore number is not valid |
| uint32_t Cy_IPC_Sema_GetMaxSems | ( | void | ) |
This function returns the number of semaphores in the semaphores subsystem.