Data Structures | Macros | Typedefs | Enumerations | Functions
SwiP.h File Reference

Detailed Description

Software Interrupt module for the RTOS Porting Interface.

============================================================================


#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
Include dependency graph for SwiP.h:
This graph shows which files directly or indirectly include this file:

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

Macro Definition Documentation

§ SwiP_STRUCT_SIZE

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

§ SwiP_Struct

typedef union SwiP_Struct SwiP_Struct

SemaphoreP structure.

Opaque structure that should be large enough to hold any of the RTOS specific SwiP objects.

§ SwiP_Handle

typedef void* SwiP_Handle

Opaque client reference to an instance of a SwiP.

A SwiP_Handle returned from the SwiP_create represents that instance.

§ SwiP_Fxn

typedef void(* SwiP_Fxn) (uintptr_t arg0, uintptr_t arg1)

Prototype for the entry function for a hardware interrupt.

Enumeration Type Documentation

§ SwiP_Status

Status codes for SwiP APIs.

Enumerator
SwiP_OK 
SwiP_FAILURE 

Function Documentation

§ SwiP_construct()

SwiP_Handle SwiP_construct ( SwiP_Struct swiP,
SwiP_Fxn  swiFxn,
SwiP_Params params 
)

Function to construct a software interrupt object.

Parameters
swiPPointer to SwiP_Struct object.
swiFxnentry function of the software interrupt
paramsPointer to the instance configuration parameters. NULL denotes to use the default parameters. The SwiP default parameters are noted in SwiP_Params_init.
Returns
A SwiP_Handle on success or a NULL on an error

§ SwiP_destruct()

void SwiP_destruct ( SwiP_Struct swiP)

Function to destruct a software interrupt object.

Parameters
swiPPointer to a SwiP_Struct object that was passed to SwiP_construct().
Returns

§ SwiP_Params_init()

void SwiP_Params_init ( SwiP_Params params)

Initialize params structure to default values.

The default parameters are:

  • name: NULL
Parameters
paramsPointer to the instance configuration parameters.

§ SwiP_create()

SwiP_Handle SwiP_create ( SwiP_Fxn  swiFxn,
SwiP_Params params 
)

Function to create a software interrupt object.

Parameters
swiFxnentry function of the software interrupt
paramsPointer to the instance configuration parameters. NULL denotes to use the default parameters. The SwiP default parameters are noted in SwiP_Params_init.
Returns
A SwiP_Handle on success or a NULL on an error

§ SwiP_delete()

void SwiP_delete ( SwiP_Handle  handle)

Function to delete a software interrupt object.

Parameters
handlereturned from the SwiP_create call

§ SwiP_disable()

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

uintptr_t key1, key2;
key1 = SwiP_disable();
key2 = SwiP_disable();
Returns
A key that must be passed to SwiP_restore to re-enable interrupts.

§ SwiP_getTrigger()

uint32_t SwiP_getTrigger ( void  )

Function to get the trigger value of the currently running SwiP.

§ SwiP_andn()

void SwiP_andn ( SwiP_Handle  handle,
uint32_t  mask 
)

Clear bits in SwiP's trigger. Post SwiP if trigger becomes 0.

Parameters
handlereturned from the SwiP_create or SwiP_construct call
maskinverse value to be ANDed

§ SwiP_dec()

void SwiP_dec ( SwiP_Handle  handle)

Decrement SwiP's trigger value. Post SwiP if trigger becomes 0.

Parameters
handlereturned from the SwiP_create or SwiP_construct call

§ SwiP_inc()

void SwiP_inc ( SwiP_Handle  handle)

Increment the SwiP's trigger value and post the SwiP.

Parameters
handlereturned from the SwiP_create or SwiP_construct call

§ SwiP_inISR()

bool SwiP_inISR ( void  )

Function to return a status based on whether it is in a software interrupt context.

Returns
A status: indicating whether the function was called in a software interrupt routine (true) or not (false).

§ SwiP_or()

void SwiP_or ( SwiP_Handle  handle,
uint32_t  mask 
)

Or the mask with the SwiP's trigger value and post the SwiP.

Parameters
handlereturned from the SwiP_create or SwiP_construct call
maskvalue to be ORed

§ SwiP_post()

void SwiP_post ( SwiP_Handle  handle)

Unconditionally post a software interrupt.

Parameters
handlereturned from the SwiP_create or SwiP_construct call

§ SwiP_restore()

void SwiP_restore ( uintptr_t  key)

Function to restore software interrupts.

Parameters
keyreturn from SwiP_disable

§ SwiP_setPriority()

void SwiP_setPriority ( SwiP_Handle  handle,
uint32_t  priority 
)

Function to set the priority of a software interrupt.

Parameters
handlereturned from the SwiP_create or SwiP_construct call
prioritynew priority
© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale