ChibiOS 21.11.4
hal_pal.h File Reference

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)
 Port bit helper macro.
#define PAL_GROUP_MASK(width)
 Bits group mask helper.
#define _IOBUS_DATA(name, port, width, offset)
 Data part of a static I/O bus initializer.
#define IOBUS_DECL(name, port, width, offset)
 Static I/O bus initializer.
Pads mode constants
#define PAL_MODE_RESET   0U
 After reset state.
#define PAL_MODE_UNCONNECTED   1U
 Safe state for unconnected pads.
#define PAL_MODE_INPUT   2U
 Regular input high-Z pad.
#define PAL_MODE_INPUT_PULLUP   3U
 Input pad with weak pull up resistor.
#define PAL_MODE_INPUT_PULLDOWN   4U
 Input pad with weak pull down resistor.
#define PAL_MODE_INPUT_ANALOG   5U
 Analog input mode.
#define PAL_MODE_OUTPUT_PUSHPULL   6U
 Push-pull output pad.
#define PAL_MODE_OUTPUT_OPENDRAIN   7U
 Open-drain output pad.
Logic level constants
#define PAL_LOW   0U
 Logical low state.
#define PAL_HIGH   1U
 Logical high state.
PAL event modes
#define PAL_EVENT_MODE_EDGES_MASK   3U
 Mask of edges field.
#define PAL_EVENT_MODE_DISABLED   0U
 Channel disabled.
#define PAL_EVENT_MODE_RISING_EDGE   1U
 Rising edge callback.
#define PAL_EVENT_MODE_FALLING_EDGE   2U
 Falling edge callback.
#define PAL_EVENT_MODE_BOTH_EDGES   3U
 Both edges callback.
PAL configuration options
#define PAL_USE_CALLBACKS   TRUE
 Enables synchronous APIs.
#define PAL_USE_WAIT   TRUE
 Enables synchronous APIs.
Low level driver helper macros
#define _pal_init_event(e)
 Initializes a PAL event object.
#define _pal_init_event(e)
 Initializes a PAL event object.
#define _pal_init_event(e)
 Initializes a PAL event object.
#define _pal_clear_event(e)
 Clears a PAL event object.
#define _pal_clear_event(e)
 Clears a PAL event object.
#define _pal_clear_event(e)
 Clears a PAL event object.
#define _pal_isr_code(e)
 Common ISR code.
#define _pal_isr_code(e)
 Common ISR code.
#define _pal_isr_code(e)
 Common ISR code.
Macro Functions
#define palInit()
 PAL subsystem initialization.
#define palReadPort(port)
 Reads the physical I/O port states.
#define palReadLatch(port)
 Reads the output latch.
#define palWritePort(port, bits)
 Writes a bits mask on a I/O port.
#define palSetPort(port, bits)
 Sets a bits mask on a I/O port.
#define palClearPort(port, bits)
 Clears a bits mask on a I/O port.
#define palTogglePort(port, bits)
 Toggles a bits mask on a I/O port.
#define palReadGroup(port, mask, offset)
 Reads a group of bits.
#define palReadGroupLatch(port, mask, offset)
 Reads the group latch.
#define palWriteGroup(port, mask, offset, bits)
 Writes a group of bits.
#define palSetGroupMode(port, mask, offset, mode)
 Pads group mode setup.
#define palReadPad(port, pad)
 Reads an input pad logic state.
#define palWritePad(port, pad, bit)
 Writes a logic state on an output pad.
#define palSetPad(port, pad)
 Sets a pad logic state to PAL_HIGH.
#define palClearPad(port, pad)
 Clears a pad logic state to PAL_LOW.
#define palTogglePad(port, pad)
 Toggles a pad logic state.
#define palSetPadMode(port, pad, mode)
 Pad mode setup.
#define palReadLine(line)
 Reads an input line logic state.
#define palWriteLine(line, bit)
 Writes a logic state on an output line.
#define palSetLine(line)
 Sets a line logic state to PAL_HIGH.
#define palClearLine(line)
 Clears a line logic state to PAL_LOW.
#define palToggleLine(line)
 Toggles a line logic state.
#define palSetLineMode(line, mode)
 Line mode setup.
#define palEnablePadEventI(port, pad, mode)
 Pad event enable.
#define palDisablePadEventI(port, pad)
 Pad event disable.
#define palEnablePadEvent(port, pad, mode)
 Pad event enable.
#define palDisablePadEvent(port, pad)
 Pad event disable.
#define palEnableLineEventI(line, mode)
 Line event enable.
#define palDisableLineEventI(line)
 Line event disable.
#define palEnableLineEvent(line, mode)
 Line event enable.
#define palDisableLineEvent(line)
 Line event disable.
#define palIsPadEventEnabledX(port, pad)
 Pad event enable check.
#define palIsLineEventEnabledX(line)
 Line event enable check.
#define palSetPadCallback(port, pad, cb, arg)
 Associates a callback to a pad.
#define palSetLineCallback(line, cb, arg)
 Associates a callback to a line.

Typedefs

typedef void(* palcallback_t) (void *arg)
 Type of a PAL event callback.

Functions

ioportmask_t palReadBus (const IOBus *bus)
 Read from an I/O bus.
void palWriteBus (const IOBus *bus, ioportmask_t bits)
 Write to an I/O bus.
void palSetBusMode (const IOBus *bus, iomode_t mode)
 Programs a bus with the specified mode.
void palSetPadCallbackI (ioportid_t port, iopadid_t pad, palcallback_t cb, void *arg)
 Associates a callback to a port/pad.
void palSetLineCallbackI (ioline_t line, palcallback_t cb, void *arg)
 Associates a callback to a line.
msg_t palWaitPadTimeoutS (ioportid_t port, iopadid_t pad, sysinterval_t timeout)
 Waits for an edge on the specified port/pad.
msg_t palWaitPadTimeout (ioportid_t port, iopadid_t pad, sysinterval_t timeout)
 Waits for an edge on the specified port/pad.
msg_t palWaitLineTimeoutS (ioline_t line, sysinterval_t timeout)
 Waits for an edge on the specified line.
msg_t palWaitLineTimeout (ioline_t line, sysinterval_t timeout)
 Waits for an edge on the specified line.

Detailed Description

I/O Ports Abstraction Layer macros, types and structures.

Definition in file hal_pal.h.