ChibiOS/HAL
6.1.0
|
I/O Ports Abstraction Layer macros, types and structures. More...
#include "hal_pal_lld.h"
Go to the source code of this file.
Data Structures | |
struct | palevent_t |
Type of a PAL event record. More... | |
struct | IOBus |
I/O bus descriptor. More... | |
Macros | |
#define | PAL_PORT_BIT(n) ((ioportmask_t)(1U << (n))) |
Port bit helper macro. More... | |
#define | PAL_GROUP_MASK(width) ((ioportmask_t)(1U << (width)) - 1U) |
Bits group mask helper. More... | |
#define | _IOBUS_DATA(name, port, width, offset) {port, PAL_GROUP_MASK(width), offset} |
Data part of a static I/O bus initializer. More... | |
#define | IOBUS_DECL(name, port, width, offset) IOBus name = _IOBUS_DATA(name, port, width, offset) |
Static I/O bus initializer. More... | |
Pads mode constants | |
#define | PAL_MODE_RESET 0U |
After reset state. More... | |
#define | PAL_MODE_UNCONNECTED 1U |
Safe state for unconnected pads. More... | |
#define | PAL_MODE_INPUT 2U |
Regular input high-Z pad. More... | |
#define | PAL_MODE_INPUT_PULLUP 3U |
Input pad with weak pull up resistor. More... | |
#define | PAL_MODE_INPUT_PULLDOWN 4U |
Input pad with weak pull down resistor. More... | |
#define | PAL_MODE_INPUT_ANALOG 5U |
Analog input mode. More... | |
#define | PAL_MODE_OUTPUT_PUSHPULL 6U |
Push-pull output pad. More... | |
#define | PAL_MODE_OUTPUT_OPENDRAIN 7U |
Open-drain output pad. More... | |
Logic level constants | |
#define | PAL_LOW 0U |
Logical low state. More... | |
#define | PAL_HIGH 1U |
Logical high state. More... | |
PAL event modes | |
#define | PAL_EVENT_MODE_EDGES_MASK 3U |
Mask of edges field. More... | |
#define | PAL_EVENT_MODE_DISABLED 0U |
Channel disabled. More... | |
#define | PAL_EVENT_MODE_RISING_EDGE 1U |
Rising edge callback. More... | |
#define | PAL_EVENT_MODE_FALLING_EDGE 2U |
Falling edge callback. More... | |
#define | PAL_EVENT_MODE_BOTH_EDGES 3U |
Both edges callback. More... | |
PAL configuration options | |
#define | PAL_USE_CALLBACKS TRUE |
Enables synchronous APIs. More... | |
#define | PAL_USE_WAIT TRUE |
Enables synchronous APIs. More... | |
Low level driver helper macros | |
#define | _pal_init_event(e) |
Initializes a PAL event object. More... | |
#define | _pal_init_event(e) |
Initializes a PAL event object. More... | |
#define | _pal_init_event(e) |
Initializes a PAL event object. More... | |
#define | _pal_clear_event(e) |
Clears a PAL event object. More... | |
#define | _pal_clear_event(e) |
Clears a PAL event object. More... | |
#define | _pal_clear_event(e) |
Clears a PAL event object. More... | |
#define | _pal_isr_code(e) |
Common ISR code. More... | |
#define | _pal_isr_code(e) |
Common ISR code. More... | |
#define | _pal_isr_code(e) |
Common ISR code. More... | |
Macro Functions | |
#define | palInit() pal_lld_init() |
PAL subsystem initialization. More... | |
#define | palReadPort(port) ((void)(port), 0U) |
Reads the physical I/O port states. More... | |
#define | palReadLatch(port) ((void)(port), 0U) |
Reads the output latch. More... | |
#define | palWritePort(port, bits) ((void)(port), (void)(bits)) |
Writes a bits mask on a I/O port. More... | |
#define | palSetPort(port, bits) palWritePort(port, palReadLatch(port) | (bits)) |
Sets a bits mask on a I/O port. More... | |
#define | palClearPort(port, bits) palWritePort(port, palReadLatch(port) & ~(bits)) |
Clears a bits mask on a I/O port. More... | |
#define | palTogglePort(port, bits) palWritePort(port, palReadLatch(port) ^ (bits)) |
Toggles a bits mask on a I/O port. More... | |
#define | palReadGroup(port, mask, offset) ((palReadPort(port) >> (offset)) & (mask)) |
Reads a group of bits. More... | |
#define | palWriteGroup(port, mask, offset, bits) |
Writes a group of bits. More... | |
#define | palSetGroupMode(port, mask, offset, mode) |
Pads group mode setup. More... | |
#define | palReadPad(port, pad) ((palReadPort(port) >> (pad)) & 1U) |
Reads an input pad logic state. More... | |
#define | palWritePad(port, pad, bit) |
Writes a logic state on an output pad. More... | |
#define | palSetPad(port, pad) palSetPort(port, PAL_PORT_BIT(pad)) |
Sets a pad logic state to PAL_HIGH . More... | |
#define | palClearPad(port, pad) palClearPort(port, PAL_PORT_BIT(pad)) |
Clears a pad logic state to PAL_LOW . More... | |
#define | palTogglePad(port, pad) palTogglePort(port, PAL_PORT_BIT(pad)) |
Toggles a pad logic state. More... | |
#define | palSetPadMode(port, pad, mode) palSetGroupMode(port, PAL_PORT_BIT(pad), 0U, mode) |
Pad mode setup. More... | |
#define | palReadLine(line) palReadPad(PAL_PORT(line), PAL_PAD(line)) |
Reads an input line logic state. More... | |
#define | palWriteLine(line, bit) palWritePad(PAL_PORT(line), PAL_PAD(line), bit) |
Writes a logic state on an output line. More... | |
#define | palSetLine(line) palSetPad(PAL_PORT(line), PAL_PAD(line)) |
Sets a line logic state to PAL_HIGH . More... | |
#define | palClearLine(line) palClearPad(PAL_PORT(line), PAL_PAD(line)) |
Clears a line logic state to PAL_LOW . More... | |
#define | palToggleLine(line) palTogglePad(PAL_PORT(line), PAL_PAD(line)) |
Toggles a line logic state. More... | |
#define | palSetLineMode(line, mode) palSetPadMode(PAL_PORT(line), PAL_PAD(line), mode) |
Line mode setup. More... | |
#define | palEnablePadEventI(port, pad, mode) |
Pad event enable. More... | |
#define | palDisablePadEventI(port, pad) |
Pad event disable. More... | |
#define | palEnablePadEvent(port, pad, mode) |
Pad event enable. More... | |
#define | palDisablePadEvent(port, pad) |
Pad event disable. More... | |
#define | palEnableLineEventI(line, mode) palEnablePadEventI(PAL_PORT(line), PAL_PAD(line), mode) |
Line event enable. More... | |
#define | palDisableLineEventI(line) palDisablePadEventI(PAL_PORT(line), PAL_PAD(line)) |
Line event disable. More... | |
#define | palEnableLineEvent(line, mode) |
Line event enable. More... | |
#define | palDisableLineEvent(line) |
Line event disable. More... | |
#define | palSetPadCallback(port, pad, cb, arg) |
Associates a callback to a pad. More... | |
#define | palSetLineCallback(line, cb, arg) |
Associates a callback to a line. More... | |
Typedefs | |
typedef void(* | palcallback_t) (void *arg) |
Type of a PAL event callback. More... | |
Functions | |
ioportmask_t | palReadBus (const IOBus *bus) |
Read from an I/O bus. More... | |
void | palWriteBus (const IOBus *bus, ioportmask_t bits) |
Write to an I/O bus. More... | |
void | palSetBusMode (const IOBus *bus, iomode_t mode) |
Programs a bus with the specified mode. More... | |
void | palSetPadCallbackI (ioportid_t port, iopadid_t pad, palcallback_t cb, void *arg) |
Associates a callback to a port/pad. More... | |
void | palSetLineCallbackI (ioline_t line, palcallback_t cb, void *arg) |
Associates a callback to a line. More... | |
msg_t | palWaitPadTimeoutS (ioportid_t port, iopadid_t pad, sysinterval_t timeout) |
Waits for an edge on the specified port/pad. More... | |
msg_t | palWaitPadTimeout (ioportid_t port, iopadid_t pad, sysinterval_t timeout) |
Waits for an edge on the specified port/pad. More... | |
msg_t | palWaitLineTimeoutS (ioline_t line, sysinterval_t timeout) |
Waits for an edge on the specified line. More... | |
msg_t | palWaitLineTimeout (ioline_t line, sysinterval_t timeout) |
Waits for an edge on the specified line. More... | |
I/O Ports Abstraction Layer macros, types and structures.
Definition in file hal_pal.h.