Software Interrupt module for the RTOS Porting Interface.
============================================================================
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
union | SwiP_Struct |
SemaphoreP structure. More... | |
struct | SwiP_Params |
Basic SwiP Parameters. More... | |
Macros | |
#define | SwiP_STRUCT_SIZE (60) |
Number of bytes greater than or equal to the size of any RTOS SwiP object. More... | |
Typedefs | |
typedef union SwiP_Struct | SwiP_Struct |
SemaphoreP structure. More... | |
typedef void * | SwiP_Handle |
Opaque client reference to an instance of a SwiP. More... | |
typedef void(* | SwiP_Fxn) (uintptr_t arg0, uintptr_t arg1) |
Prototype for the entry function for a hardware interrupt. More... | |
Enumerations | |
enum | SwiP_Status { SwiP_OK = 0, SwiP_FAILURE = -1 } |
Status codes for SwiP APIs. More... | |
Functions | |
SwiP_Handle | SwiP_construct (SwiP_Struct *swiP, SwiP_Fxn swiFxn, SwiP_Params *params) |
Function to construct a software interrupt object. More... | |
void | SwiP_destruct (SwiP_Struct *swiP) |
Function to destruct a software interrupt object. More... | |
void | SwiP_Params_init (SwiP_Params *params) |
Initialize params structure to default values. More... | |
SwiP_Handle | SwiP_create (SwiP_Fxn swiFxn, SwiP_Params *params) |
Function to create a software interrupt object. More... | |
void | SwiP_delete (SwiP_Handle handle) |
Function to delete a software interrupt object. More... | |
uintptr_t | SwiP_disable (void) |
Function to disable software interrupts. More... | |
uint32_t | SwiP_getTrigger (void) |
Function to get the trigger value of the currently running SwiP. More... | |
void | SwiP_andn (SwiP_Handle handle, uint32_t mask) |
Clear bits in SwiP's trigger. Post SwiP if trigger becomes 0. More... | |
void | SwiP_dec (SwiP_Handle handle) |
Decrement SwiP's trigger value. Post SwiP if trigger becomes 0. More... | |
void | SwiP_inc (SwiP_Handle handle) |
Increment the SwiP's trigger value and post the SwiP. More... | |
bool | SwiP_inISR (void) |
Function to return a status based on whether it is in a software interrupt context. More... | |
void | SwiP_or (SwiP_Handle handle, uint32_t mask) |
Or the mask with the SwiP's trigger value and post the SwiP. More... | |
void | SwiP_post (SwiP_Handle handle) |
Unconditionally post a software interrupt. More... | |
void | SwiP_restore (uintptr_t key) |
Function to restore software interrupts. More... | |
void | SwiP_setPriority (SwiP_Handle handle, uint32_t priority) |
Function to set the priority of a software interrupt. More... | |
#define SwiP_STRUCT_SIZE (60) |
Number of bytes greater than or equal to the size of any RTOS SwiP object.
NoRTOS: 40 FreeRTOS: ?? (should same as NoRTOS) BIOS 6.x: 52 BIOS 7.x: 60
typedef union SwiP_Struct SwiP_Struct |
SemaphoreP structure.
Opaque structure that should be large enough to hold any of the RTOS specific SwiP objects.
typedef void* SwiP_Handle |
Opaque client reference to an instance of a SwiP.
A SwiP_Handle returned from the SwiP_create represents that instance.
typedef void(* SwiP_Fxn) (uintptr_t arg0, uintptr_t arg1) |
Prototype for the entry function for a hardware interrupt.
enum SwiP_Status |
SwiP_Handle SwiP_construct | ( | SwiP_Struct * | swiP, |
SwiP_Fxn | swiFxn, | ||
SwiP_Params * | params | ||
) |
Function to construct a software interrupt object.
swiP | Pointer to SwiP_Struct object. |
swiFxn | entry function of the software interrupt |
params | Pointer to the instance configuration parameters. NULL denotes to use the default parameters. The SwiP default parameters are noted in SwiP_Params_init. |
void SwiP_destruct | ( | SwiP_Struct * | swiP | ) |
Function to destruct a software interrupt object.
swiP | Pointer to a SwiP_Struct object that was passed to SwiP_construct(). |
void SwiP_Params_init | ( | SwiP_Params * | params | ) |
Initialize params structure to default values.
The default parameters are:
params | Pointer to the instance configuration parameters. |
SwiP_Handle SwiP_create | ( | SwiP_Fxn | swiFxn, |
SwiP_Params * | params | ||
) |
Function to create a software interrupt object.
swiFxn | entry function of the software interrupt |
params | Pointer to the instance configuration parameters. NULL denotes to use the default parameters. The SwiP default parameters are noted in SwiP_Params_init. |
void SwiP_delete | ( | SwiP_Handle | handle | ) |
Function to delete a software interrupt object.
handle | returned from the SwiP_create call |
uintptr_t SwiP_disable | ( | void | ) |
Function to disable software interrupts.
This function can be called multiple times, but must unwound in the reverse order. For example
uint32_t SwiP_getTrigger | ( | void | ) |
Function to get the trigger value of the currently running SwiP.
void SwiP_andn | ( | SwiP_Handle | handle, |
uint32_t | mask | ||
) |
Clear bits in SwiP's trigger. Post SwiP if trigger becomes 0.
handle | returned from the SwiP_create or SwiP_construct call |
mask | inverse value to be ANDed |
void SwiP_dec | ( | SwiP_Handle | handle | ) |
Decrement SwiP's trigger value. Post SwiP if trigger becomes 0.
handle | returned from the SwiP_create or SwiP_construct call |
void SwiP_inc | ( | SwiP_Handle | handle | ) |
Increment the SwiP's trigger value and post the SwiP.
handle | returned from the SwiP_create or SwiP_construct call |
bool SwiP_inISR | ( | void | ) |
Function to return a status based on whether it is in a software interrupt context.
void SwiP_or | ( | SwiP_Handle | handle, |
uint32_t | mask | ||
) |
Or the mask with the SwiP's trigger value and post the SwiP.
handle | returned from the SwiP_create or SwiP_construct call |
mask | value to be ORed |
void SwiP_post | ( | SwiP_Handle | handle | ) |
Unconditionally post a software interrupt.
handle | returned from the SwiP_create or SwiP_construct call |
void SwiP_restore | ( | uintptr_t | key | ) |
Function to restore software interrupts.
key | return from SwiP_disable |
void SwiP_setPriority | ( | SwiP_Handle | handle, |
uint32_t | priority | ||
) |
Function to set the priority of a software interrupt.
handle | returned from the SwiP_create or SwiP_construct call |
priority | new priority |