#include "extio.h"
#include "tll_common.h"
#include "tll_config.h"
#include "queue.h"
#include "isrDisp.h"
#include <fpga_loader.h>
#include <eventManager.h>
Include dependency graph for extio.c:
Defines | |
#define | OUTPUT_BITS (0xFF) |
LEDs are mapped to lower 8 bits of the register, push bottons and switches are mapped to higher 8 bits of the register. | |
#define | INPUT_BITS (0xFF00) |
#define | MAP_LED_TO_BIT(LED) (0x1<<LED) |
convert from LED number to bit in the bit pattern | |
#define | MAP_INPUT_TO_BIT(INP) (0x1 << 8) << ((INP - 1) >> 1) |
convert from Input Event number to bit mask | |
#define | BIT_CLEAR(REGISER, MASK) REGISTER = REGISTER & ~(MASK) |
clear bit(s) defined by mask | |
#define | BIT_SET(REGISER, MASK) REGISTER = REGISTER | MASK |
set bit(s) defined by mask | |
Functions | |
int | extio_eventPut (extio_input event) |
Put an external io event to a queue
| |
void | extio_isr (void) |
extio isr (to be called from dispatcher) | |
int | extio_init (isrDisp_t *pIsrDisp) |
Initialize external i/o
| |
int | extio_startup (void) |
startup external i/o
| |
int | extio_ledConfig (extio_output iotype) |
Configure LED as an output. | |
int | extio_swConfig (extio_input itype) |
Configure switch as an input. | |
int | extio_ledOn (extio_output led) |
Turn on one led
| |
int | extio_ledOff (extio_output led) |
Turn off one led
| |
int | extio_ledToggle (extio_output led) |
Toggle one led
| |
iostatus | extio_ledStatus (extio_output led) |
Check led status
| |
int | extio_ledGroupOn (unsigned char ledMask) |
Turn on group of leds
| |
int | extio_ledGroupOff (unsigned char ledMask) |
Turn off group of leds
| |
int | extio_ledGroupToggle (unsigned char ledMask) |
Toggle group of leds
| |
unsigned char | extio_ledGroupStatus (unsigned char ledMask) |
Check the status of a group of leds
| |
unsigned char | extio_switchGroupStatusGet (unsigned char switchMask) |
Query the current status of switch. | |
int | extio_eventSubscribe (extio_input IOInput) |
Subscribe an external io event to the callback table
| |
int | extio_eventUnsubscribe (extio_input IOInput) |
Unsubscribe an external io event to the callback table
| |
int | extio_callbackRegister (extio_input IOInput, tFuncPtr pFunc, void *pArg) |
Register call back function to the callback table
| |
int | extio_callbackUnregister (extio_input IOInput, tFuncPtr pFunc, void *pArg) |
Unregister call back function to the callback table
| |
int | extio_eventGet (extio_input *pEvent) |
Get an external io event from a queue
| |
iostatus | extio_switchStatusGet (extio_input IOInput) |
Query the current status of a switch. | |
Variables | |
extio_t | extio_global |
extio global variable, EXTIO is a singleton only a single instance hence using a global one global variable is sufficient |
Target TLL6527v1-0 Compiler: VDSP++ Output format: VDSP++ "*.dxe"
#define BIT_CLEAR | ( | REGISER, | |||
MASK | ) | REGISTER = REGISTER & ~(MASK) |
clear bit(s) defined by mask
#define BIT_SET | ( | REGISER, | |||
MASK | ) | REGISTER = REGISTER | MASK |
set bit(s) defined by mask
#define INPUT_BITS (0xFF00) |
#define MAP_INPUT_TO_BIT | ( | INP | ) | (0x1 << 8) << ((INP - 1) >> 1) |
convert from Input Event number to bit mask
#define MAP_LED_TO_BIT | ( | LED | ) | (0x1<<LED) |
convert from LED number to bit in the bit pattern
#define OUTPUT_BITS (0xFF) |
LEDs are mapped to lower 8 bits of the register, push bottons and switches are mapped to higher 8 bits of the register.
int extio_callbackRegister | ( | extio_input | IOInput, | |
tFuncPtr | pFunc, | |||
void * | pArg | |||
) |
Register call back function to the callback table
Parameters:
IOInput | the event id | |
pFunc | callback function pointer | |
pArg | callback function parameter |
return error if GPIO is used in a different function
register only if nothing is registered yet
int extio_callbackUnregister | ( | extio_input | IOInput, | |
tFuncPtr | pFunc, | |||
void * | pArg | |||
) |
Unregister call back function to the callback table
Parameters:
IOInput | the event id | |
pFunc | callback function pointer | |
pArg | callback function parameter |
int extio_eventGet | ( | extio_input * | pEvent | ) |
Get an external io event from a queue
Parameters:
pEvent | the pointer to the io event |
int extio_eventPut | ( | extio_input | event | ) |
Put an external io event to a queue
Parameters:
event | the event id |
int extio_eventSubscribe | ( | extio_input | IOInput | ) |
Subscribe an external io event to the callback table
Parameters:
IOInput | the event id |
register event put as a call back, it will place the according event in queue
int extio_eventUnsubscribe | ( | extio_input | IOInput | ) |
Unsubscribe an external io event to the callback table
Parameters:
IOInput | the event id |
int extio_init | ( | isrDisp_t * | pIsrDisp | ) |
Initialize external i/o
Parameters:
pIsrDisp | pointer to ISR Dispatcher |
initialize event queue
register own ISR with isr dispatcher
initialize the event table
return error if GPIO is used in a different function
Default initialization Set 0-7 as OUTPUT 8-15 as input
void extio_isr | ( | void | ) |
extio isr (to be called from dispatcher)
Parameters:
pThis | pointer to own object |
lowest button input
int extio_ledConfig | ( | extio_output | iotype | ) |
Configure LED as an output.
Parameters:
iotype | LED to configure |
return error if GPIO is used in a different function
int extio_ledGroupOff | ( | unsigned char | ledMask | ) |
Turn off group of leds
Parameters:
ledMask | led mask |
int extio_ledGroupOn | ( | unsigned char | ledMask | ) |
Turn on group of leds
Parameters:
ledMask | led mask |
unsigned char extio_ledGroupStatus | ( | unsigned char | ledMask | ) |
Check the status of a group of leds
Parameters:
ledMask | led mask |
int extio_ledGroupToggle | ( | unsigned char | ledMask | ) |
Toggle group of leds
Parameters:
ledMask | led mask |
int extio_ledOff | ( | extio_output | led | ) |
Turn off one led
Parameters:
iotype | led number |
int extio_ledOn | ( | extio_output | led | ) |
Turn on one led
Parameters:
iotype | led number |
iostatus extio_ledStatus | ( | extio_output | led | ) |
Check led status
Parameters:
iotype | led number |
int extio_ledToggle | ( | extio_output | led | ) |
Toggle one led
Parameters:
iotype | led number |
int extio_startup | ( | void | ) |
startup external i/o
Parameters:
int extio_swConfig | ( | extio_input | itype | ) |
Configure switch as an input.
Parameters:
iotype | switch to configure |
return error if GPIO is used in a different function
unsigned char extio_switchGroupStatusGet | ( | unsigned char | switchMask | ) |
Query the current status of switch.
Parameters:
IOInput | switch to query (could be pushed or released) |
iostatus extio_switchStatusGet | ( | extio_input | IOInput | ) |
Query the current status of a switch.
Parameters:
IOInput | switch to query (could be pushed or released) |
extio global variable, EXTIO is a singleton only a single instance hence using a global one global variable is sufficient