SYS/BIOS
7.00
|
Software Interrupt Gate.
GateSwi uses Swi_disable() and Swi_restore() as the resource locking mechanism. This gate can be used whenever the resource is being shared by Tasks or Swis.
The duration between the enter and leave should be as short as possible to minimize Swi latency.
Function | Hwi | Swi | Task | Main | Startup |
---|---|---|---|---|---|
Params_init | Y | Y | Y | Y | Y |
query | Y | Y | Y | Y | Y |
construct | Y | Y | Y | Y | N |
create | N* | N* | Y | Y | N |
delete | N* | N* | Y | Y | N |
destruct | Y | Y | Y | Y | N |
enter | N | Y | Y | Y** | Y** |
leave | N | Y | Y | Y** | Y** |
Definitions:
|
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <ti/sysbios/knl/Swi.h>
#include <ti/sysbios/runtime/Error.h>
Go to the source code of this file.
Data Structures | |
struct | GateSwi_Params |
struct | GateSwi_Struct |
Typedefs | |
typedef struct GateSwi_Params | GateSwi_Params |
typedef struct GateSwi_Struct | GateSwi_Struct |
typedef struct GateSwi_Struct | GateSwi_Object |
typedef GateSwi_Object * | GateSwi_Handle |
Functions | |
bool | GateSwi_canBePreempted (void) |
query Gate 'preempt' characteristics More... | |
bool | GateSwi_canBlock (void) |
query Gate 'blocking' characteristics More... | |
GateSwi_Handle | GateSwi_create (const GateSwi_Params *prms, Error_Block *eb) |
Create a GateSwi gate. More... | |
GateSwi_Handle | GateSwi_construct (GateSwi_Struct *obj, const GateSwi_Params *prms) |
Construct a GateSwi gate. More... | |
void | GateSwi_delete (GateSwi_Handle *gate) |
Delete a GateSwi gate. More... | |
void | GateSwi_destruct (GateSwi_Struct *obj) |
Destruct a GateSwi gate. More... | |
void | GateSwi_Params_init (GateSwi_Params *prms) |
Initialize the GateSwi_Params structure with default values. More... | |
intptr_t | GateSwi_enter (GateSwi_Handle gate) |
enter the GateSwi gate More... | |
void | GateSwi_leave (GateSwi_Handle gate, intptr_t key) |
leave the GateSwi gate More... | |
typedef struct GateSwi_Params GateSwi_Params |
typedef struct GateSwi_Struct GateSwi_Struct |
typedef struct GateSwi_Struct GateSwi_Object |
typedef GateSwi_Object* GateSwi_Handle |
bool GateSwi_canBePreempted | ( | void | ) |
query Gate 'preempt' characteristics
GateSwi can be preempted by an hardware interrupt. Always returns true
.
true |
bool GateSwi_canBlock | ( | void | ) |
query Gate 'blocking' characteristics
GateSwi enter will never block. This API always returns false
.
false |
GateSwi_Handle GateSwi_create | ( | const GateSwi_Params * | prms, |
Error_Block * | eb | ||
) |
Create a GateSwi
gate.
prms | optional parameters |
eb | error block |
GateSwi | handle (NULL on failure) |
GateSwi_Handle GateSwi_construct | ( | GateSwi_Struct * | obj, |
const GateSwi_Params * | prms | ||
) |
Construct a GateSwi
gate.
GateSwi_construct is equivalent to GateHwi_create except that the GateSwi_Struct is pre-allocated.
obj | pointer to a GateSwi object |
prms | optional parameters |
GateSwi | handle (NULL on failure) |
void GateSwi_delete | ( | GateSwi_Handle * | gate | ) |
Delete a GateSwi
gate.
Note that GateSwi_delete takes a pointer to a GateHwi_Handle which enables GateSwi_delete to set the GateHwi handle to NULL.
gate | pointer to a GateSwi handle |
void GateSwi_destruct | ( | GateSwi_Struct * | obj | ) |
Destruct a GateSwi
gate.
obj | pointer to a GateSwi objects |
void GateSwi_Params_init | ( | GateSwi_Params * | prms | ) |
Initialize the GateSwi_Params structure with default values.
GateSwi_Params_init initializes the GateHwi_Params structure with default values. GateSwi_Params_init should always be called before setting individual parameter fields. This allows new fields to be added in the future with compatible defaults – existing source code does not need to change when new fields are added.
prms | pointer to uninitialized params structure |
intptr_t GateSwi_enter | ( | GateSwi_Handle | gate | ) |
enter the GateSwi gate
GateSwi_enter enters the GateHwi gate and returns a key for use by GateSwi_enter. GateHwi_enter calls can be nested and the key is used to unlock the gate on the final call to GateSwi_leave.
gate | GateSwi handle |
opaque | key to be passed to GateSwi_leave() |
void GateSwi_leave | ( | GateSwi_Handle | gate, |
intptr_t | key | ||
) |
leave the GateSwi gate
GateSwi_leave exits the GateHwi gate if key matches the outermost call to GateSwi_enter. If GateHwi_enter calls are nested, the key will keep the nested calls from leaving the gate.
gate | GateSwi handle |
key | opaque key to unlock the gate |