I/O Ports Abstraction Layer.
More...
I/O Ports Abstraction Layer.
This module defines an abstract interface for digital I/O ports. Note that most I/O ports functions are just macros. The macros have default software implementations that can be redefined in a PAL Low Level Driver if the target hardware supports special features like, for example, atomic bit set/reset/masking. Please refer to the ports specific documentation for details.
The PAL Driver driver has the advantage to make the access to the I/O ports platform independent and still be optimized for the specific architectures.
Note that the PAL Low Level Driver may also offer non standard macro and functions in order to support specific features but, of course, the use of such interfaces would not be portable. Such interfaces shall be marked with the architecture name inside the function names.
- Precondition
- In order to use the PAL driver the
HAL_USE_PAL option must be enabled in halconf.h.
Implementation Rules
In implementing a PAL Low Level Driver there are some rules/behaviors that should be respected.
Writing on input pads
The behavior is not specified but there are implementations better than others, this is the list of possible implementations, preferred options are on top:
- The written value is not actually output but latched, should the pads be reprogrammed as outputs the value would be in effect.
- The write operation is ignored.
- The write operation has side effects, as example disabling/enabling pull up/down resistors or changing the pad direction. This scenario is discouraged, please try to avoid this scenario.
Reading from output pads
The behavior is not specified but there are implementations better than others, this is the list of possible implementations, preferred options are on top:
- The actual pads states are read (not the output latch).
- The output latch value is read (regardless of the actual pads states).
- Unspecified, please try to avoid this scenario.
Writing unused or unimplemented port bits
The behavior is not specified.
Reading from unused or unimplemented port bits
The behavior is not specified.
Reading or writing on pins associated to other functionalities
The behavior is not specified.
|
| #define | PAL_LOW 0U |
| | Logical low state.
|
| #define | PAL_HIGH 1U |
| | Logical high state.
|
|
| #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.
|
|
| #define | PAL_LINE(port, pad) |
| | Forms a line identifier.
|
| #define | PAL_PORT(line) |
| | Decodes a port identifier from a line identifier.
|
| #define | PAL_PAD(line) |
| | Decodes a pad identifier from a line identifier.
|
| #define | PAL_NOLINE 0U |
| | Value identifying an invalid line.
|
|
| #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.
|
| #define | PAL_NEW_INIT |
| #define | IOPORT1 0 |
| | First I/O port identifier.
|
| #define | pal_lld_init() |
| | Low level PAL subsystem initialization.
|
| #define | pal_lld_readport(port) |
| | Reads the physical I/O port states.
|
| #define | pal_lld_readlatch(port) |
| | Reads the output latch.
|
| #define | pal_lld_writeport(port, bits) |
| | Writes a bits mask on a I/O port.
|
| #define | pal_lld_setport(port, bits) |
| | Sets a bits mask on a I/O port.
|
| #define | pal_lld_clearport(port, bits) |
| | Clears a bits mask on a I/O port.
|
| #define | pal_lld_toggleport(port, bits) |
| | Toggles a bits mask on a I/O port.
|
| #define | pal_lld_readgroup(port, mask, offset) |
| | Reads a group of bits.
|
| #define | pal_lld_writegroup(port, mask, offset, bits) |
| | Writes a group of bits.
|
| #define | pal_lld_setgroupmode(port, mask, offset, mode) |
| | Pads group mode setup.
|
| #define | pal_lld_readpad(port, pad) |
| | Reads a logical state from an I/O pad.
|
| #define | pal_lld_writepad(port, pad, bit) |
| | Writes a logical state on an output pad.
|
| #define | pal_lld_setpad(port, pad) |
| | Sets a pad logical state to PAL_HIGH.
|
| #define | pal_lld_clearpad(port, pad) |
| | Clears a pad logical state to PAL_LOW.
|
| #define | pal_lld_togglepad(port, pad) |
| | Toggles a pad logical state.
|
| #define | pal_lld_setpadmode(port, pad, mode) |
| | Pad mode setup.
|
| #define | pal_lld_get_pad_event(port, pad) |
| | Returns a PAL event structure associated to a pad.
|
| #define | pal_lld_get_line_event(line) |
| | Returns a PAL event structure associated to a line.
|
|
| typedef void(* | palcallback_t) (void *arg) |
| | Type of a PAL event callback.
|
| typedef uint32_t | ioportmask_t |
| | Digital I/O port sized unsigned type.
|
| typedef uint32_t | iomode_t |
| | Digital I/O modes.
|
| typedef uint32_t | ioline_t |
| | Type of an I/O line.
|
| typedef uint32_t | ioportid_t |
| | Port Identifier.
|
| typedef uint32_t | iopadid_t |
| | Type of an pad identifier.
|
|
| 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.
|
| void | _pal_lld_init (void) |
| | STM32 I/O ports configuration.
|
| void | _pal_lld_setgroupmode (ioportid_t port, ioportmask_t mask, iomode_t mode) |
| | Pads mode setup.
|
◆ PAL_MODE_RESET
| #define PAL_MODE_RESET 0U |
After reset state.
The state itself is not specified and is architecture dependent, it is guaranteed to be equal to the after-reset state. It is usually an input state.
Definition at line 44 of file hal_pal.h.
◆ PAL_MODE_UNCONNECTED
| #define PAL_MODE_UNCONNECTED 1U |
Safe state for unconnected pads.
The state itself is not specified and is architecture dependent, it may be mapped on PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLDOWN or PAL_MODE_OUTPUT_PUSHPULL for example.
Definition at line 53 of file hal_pal.h.
◆ PAL_MODE_INPUT
| #define PAL_MODE_INPUT 2U |
Regular input high-Z pad.
Definition at line 58 of file hal_pal.h.
◆ PAL_MODE_INPUT_PULLUP
| #define PAL_MODE_INPUT_PULLUP 3U |
Input pad with weak pull up resistor.
Definition at line 63 of file hal_pal.h.
◆ PAL_MODE_INPUT_PULLDOWN
| #define PAL_MODE_INPUT_PULLDOWN 4U |
Input pad with weak pull down resistor.
Definition at line 68 of file hal_pal.h.
◆ PAL_MODE_INPUT_ANALOG
| #define PAL_MODE_INPUT_ANALOG 5U |
Analog input mode.
Definition at line 73 of file hal_pal.h.
◆ PAL_MODE_OUTPUT_PUSHPULL
| #define PAL_MODE_OUTPUT_PUSHPULL 6U |
Push-pull output pad.
Definition at line 78 of file hal_pal.h.
◆ PAL_MODE_OUTPUT_OPENDRAIN
| #define PAL_MODE_OUTPUT_OPENDRAIN 7U |
Open-drain output pad.
Definition at line 83 of file hal_pal.h.
◆ PAL_LOW
Logical low state.
Definition at line 93 of file hal_pal.h.
◆ PAL_HIGH
Logical high state.
Definition at line 98 of file hal_pal.h.
◆ PAL_EVENT_MODE_EDGES_MASK
| #define PAL_EVENT_MODE_EDGES_MASK 3U |
Mask of edges field.
Definition at line 105 of file hal_pal.h.
◆ PAL_EVENT_MODE_DISABLED
| #define PAL_EVENT_MODE_DISABLED 0U |
◆ PAL_EVENT_MODE_RISING_EDGE
| #define PAL_EVENT_MODE_RISING_EDGE 1U |
Rising edge callback.
Definition at line 107 of file hal_pal.h.
◆ PAL_EVENT_MODE_FALLING_EDGE
| #define PAL_EVENT_MODE_FALLING_EDGE 2U |
Falling edge callback.
Definition at line 108 of file hal_pal.h.
◆ PAL_EVENT_MODE_BOTH_EDGES
| #define PAL_EVENT_MODE_BOTH_EDGES 3U |
Both edges callback.
Definition at line 109 of file hal_pal.h.
◆ PAL_USE_CALLBACKS
| #define PAL_USE_CALLBACKS TRUE |
Enables synchronous APIs.
- Note
- Disabling this option saves both code and data space.
Definition at line 125 of file hal_pal.h.
◆ PAL_USE_WAIT
| #define PAL_USE_WAIT TRUE |
Enables synchronous APIs.
- Note
- Disabling this option saves both code and data space.
Definition at line 133 of file hal_pal.h.
◆ PAL_PORT_BIT
| #define PAL_PORT_BIT |
( |
| n | ) |
|
Value:
uint32_t ioportmask_t
Digital I/O port sized unsigned type.
Port bit helper macro.
This macro calculates the mask of a bit within a port.
- Parameters
-
| [in] | n | bit position within the port |
- Returns
- The bit mask.
Definition at line 212 of file hal_pal.h.
◆ PAL_GROUP_MASK
| #define PAL_GROUP_MASK |
( |
| width | ) |
|
Value:
Bits group mask helper.
This macro calculates the mask of a bits group.
- Parameters
-
- Returns
- The group mask.
Definition at line 223 of file hal_pal.h.
◆ _IOBUS_DATA
| #define _IOBUS_DATA |
( |
| name, |
|
|
| port, |
|
|
| width, |
|
|
| offset ) |
Value:
#define PAL_GROUP_MASK(width)
Bits group mask helper.
Data part of a static I/O bus initializer.
This macro should be used when statically initializing an I/O bus that is part of a bigger structure.
- Parameters
-
| [in] | name | name of the IOBus variable |
| [in] | port | I/O port descriptor |
| [in] | width | bus width in bits |
| [in] | offset | bus bit offset within the port |
Definition at line 236 of file hal_pal.h.
◆ IOBUS_DECL
| #define IOBUS_DECL |
( |
| name, |
|
|
| port, |
|
|
| width, |
|
|
| offset ) |
Value:
#define _IOBUS_DATA(name, port, width, offset)
Data part of a static I/O bus initializer.
Static I/O bus initializer.
- Parameters
-
| [in] | name | name of the IOBus variable |
| [in] | port | I/O port descriptor |
| [in] | width | bus width in bits |
| [in] | offset | bus bit offset within the port |
Definition at line 247 of file hal_pal.h.
◆ _pal_init_event [1/3]
| #define _pal_init_event |
( |
| e | ) |
|
Value: do { \
osalThreadQueueObjectInit(&_pal_events[e].threads); \
_pal_events[e].cb = NULL; \
_pal_events[e].arg = NULL; \
} while (false)
Initializes a PAL event object.
- Parameters
-
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 265 of file hal_pal.h.
◆ _pal_init_event [2/3]
| #define _pal_init_event |
( |
| e | ) |
|
Value: do { \
_pal_events[e].cb = NULL; \
_pal_events[e].arg = NULL; \
} while (false)
Initializes a PAL event object.
- Parameters
-
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 265 of file hal_pal.h.
◆ _pal_init_event [3/3]
| #define _pal_init_event |
( |
| e | ) |
|
Value: do { \
osalThreadQueueObjectInit(&_pal_events[e].threads); \
} while (false)
Initializes a PAL event object.
- Parameters
-
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 265 of file hal_pal.h.
◆ _pal_clear_event [1/3]
| #define _pal_clear_event |
( |
| e | ) |
|
Value: do { \
osalThreadDequeueAllI(&_pal_events[pad].threads,
MSG_RESET); \
_pal_events[e].cb = NULL; \
_pal_events[e].arg = NULL; \
} while (false)
#define MSG_RESET
Wakeup caused by a reset condition.
Clears a PAL event object.
- Parameters
-
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 296 of file hal_pal.h.
◆ _pal_clear_event [2/3]
| #define _pal_clear_event |
( |
| e | ) |
|
Value: do { \
_pal_events[e].cb = NULL; \
_pal_events[e].arg = NULL; \
} while (false)
Clears a PAL event object.
- Parameters
-
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 296 of file hal_pal.h.
◆ _pal_clear_event [3/3]
| #define _pal_clear_event |
( |
| e | ) |
|
Value: do { \
osalThreadDequeueAllI(&_pal_events[pad].threads,
MSG_RESET); \
} while (false)
Clears a PAL event object.
- Parameters
-
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 296 of file hal_pal.h.
◆ _pal_isr_code [1/3]
| #define _pal_isr_code |
( |
| e | ) |
|
Value: do { \
if (_pal_events[e].cb != NULL) { \
_pal_events[e].cb(_pal_events[e].arg); \
} \
osalSysLockFromISR(); \
osalThreadDequeueAllI(&_pal_events[e].threads,
MSG_OK); \
osalSysUnlockFromISR(); \
} while (false)
#define MSG_OK
Normal wakeup message.
Common ISR code.
- Note
- This macro is meant to be used in the low level drivers implementation only.
- Parameters
-
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 330 of file hal_pal.h.
◆ _pal_isr_code [2/3]
| #define _pal_isr_code |
( |
| e | ) |
|
Value: do { \
if (_pal_events[e].cb != NULL) { \
_pal_events[e].cb(_pal_events[e].arg); \
} \
} while (false)
Common ISR code.
- Note
- This macro is meant to be used in the low level drivers implementation only.
- Parameters
-
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 330 of file hal_pal.h.
◆ _pal_isr_code [3/3]
| #define _pal_isr_code |
( |
| e | ) |
|
Value: do { \
osalSysLockFromISR(); \
osalThreadDequeueAllI(&_pal_events[e].threads,
MSG_OK); \
osalSysUnlockFromISR(); \
} while (false)
Common ISR code.
- Note
- This macro is meant to be used in the low level drivers implementation only.
- Parameters
-
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 330 of file hal_pal.h.
◆ palInit
Value:
#define pal_lld_init()
Low level PAL subsystem initialization.
PAL subsystem initialization.
- Note
- This function is implicitly invoked by
halInit(), there is no need to explicitly initialize the driver.
- Function Class:
- Object or module nitializer function.
Definition at line 375 of file hal_pal.h.
Referenced by halInit().
◆ palReadPort
| #define palReadPort |
( |
| port | ) |
|
Value:
Reads the physical I/O port states.
- Note
- The function can be called from any context.
- Parameters
-
- Returns
- The port logic states.
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 390 of file hal_pal.h.
◆ palReadLatch
| #define palReadLatch |
( |
| port | ) |
|
Value:
Reads the output latch.
The purpose of this function is to read back the latched output value.
- Note
- The function can be called from any context.
- Parameters
-
- Returns
- The latched logic states.
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 407 of file hal_pal.h.
◆ palWritePort
| #define palWritePort |
( |
| port, |
|
|
| bits ) |
Value:((void)(port), (void)(bits))
Writes a bits mask on a I/O port.
- Note
- The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | bits | bits to be written on the specified port |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 422 of file hal_pal.h.
◆ palSetPort
| #define palSetPort |
( |
| port, |
|
|
| bits ) |
Value:
#define palReadLatch(port)
Reads the output latch.
#define palWritePort(port, bits)
Writes a bits mask on a I/O port.
Sets a bits mask on a I/O port.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | bits | bits to be ORed on the specified port |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 441 of file hal_pal.h.
◆ palClearPort
| #define palClearPort |
( |
| port, |
|
|
| bits ) |
Value:
Clears a bits mask on a I/O port.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | bits | bits to be cleared on the specified port |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 461 of file hal_pal.h.
◆ palTogglePort
| #define palTogglePort |
( |
| port, |
|
|
| bits ) |
Value:
Toggles a bits mask on a I/O port.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | bits | bits to be XORed on the specified port |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 481 of file hal_pal.h.
◆ palReadGroup
| #define palReadGroup |
( |
| port, |
|
|
| mask, |
|
|
| offset ) |
Value:
#define palReadPort(port)
Reads the physical I/O port states.
Reads a group of bits.
- Note
- The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | mask | group mask, a logic AND is performed on the input data |
| [in] | offset | group bit offset within the port |
- Returns
- The group logic states.
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 500 of file hal_pal.h.
Referenced by palReadBus().
◆ palReadGroupLatch
| #define palReadGroupLatch |
( |
| port, |
|
|
| mask, |
|
|
| offset ) |
Value:
Reads the group latch.
- Note
- The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | mask | group mask, a logic AND is performed on the input data |
| [in] | offset | group bit offset within the port |
- Returns
- The group logic states.
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 519 of file hal_pal.h.
◆ palWriteGroup
| #define palWriteGroup |
( |
| port, |
|
|
| mask, |
|
|
| offset, |
|
|
| bits ) |
Value:
(((bits) & (mask)) << (offset)))
Writes a group of bits.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | mask | group mask, a logic AND is performed on the output data |
| [in] | offset | group bit offset within the port |
| [in] | bits | bits to be written. Values exceeding the group width are masked. |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 543 of file hal_pal.h.
Referenced by palWriteBus().
◆ palSetGroupMode
| #define palSetGroupMode |
( |
| port, |
|
|
| mask, |
|
|
| offset, |
|
|
| mode ) |
Value: do { \
(void)(port); \
(void)(mask); \
(void)(offset); \
(void)(port); \
} while (mode)
Pads group mode setup.
This function programs a pads group belonging to the same port with the specified mode.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
Programming an unknown or unsupported mode is silently ignored.
-
The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | mask | group mask |
| [in] | offset | group bit offset within the port |
| [in] | mode | group mode |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 570 of file hal_pal.h.
Referenced by palSetBusMode().
◆ palReadPad
| #define palReadPad |
( |
| port, |
|
|
| pad ) |
Value:
Reads an input pad logic state.
- Note
- The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
- Returns
- The logic state.
- Return values
-
| PAL_LOW | low logic state. |
| PAL_HIGH | high logic state. |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 595 of file hal_pal.h.
◆ palWritePad
| #define palWritePad |
( |
| port, |
|
|
| pad, |
|
|
| bit ) |
Value:
(((bit) & 1U) << pad))
#define PAL_PORT_BIT(n)
Port bit helper macro.
Writes a logic state on an output pad.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
| [in] | bit | logic value, the value must be PAL_LOW or PAL_HIGH |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 616 of file hal_pal.h.
◆ palSetPad
| #define palSetPad |
( |
| port, |
|
|
| pad ) |
Value:
#define palSetPort(port, bits)
Sets a bits mask on a I/O port.
Sets a pad logic state to PAL_HIGH.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 637 of file hal_pal.h.
◆ palClearPad
| #define palClearPad |
( |
| port, |
|
|
| pad ) |
Value:
#define palClearPort(port, bits)
Clears a bits mask on a I/O port.
Clears a pad logic state to PAL_LOW.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 656 of file hal_pal.h.
◆ palTogglePad
| #define palTogglePad |
( |
| port, |
|
|
| pad ) |
Value:
#define palTogglePort(port, bits)
Toggles a bits mask on a I/O port.
Toggles a pad logic state.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 675 of file hal_pal.h.
◆ palSetPadMode
| #define palSetPadMode |
( |
| port, |
|
|
| pad, |
|
|
| mode ) |
Value:
#define palSetGroupMode(port, mask, offset, mode)
Pads group mode setup.
Pad mode setup.
This function programs a pad with the specified mode.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
Programming an unknown or unsupported mode is silently ignored.
-
The function can be called from any context.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
| [in] | mode | pad mode |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 697 of file hal_pal.h.
◆ palReadLine
| #define palReadLine |
( |
| line | ) |
|
Value:
#define palReadPad(port, pad)
Reads an input pad logic state.
#define PAL_PORT(line)
Decodes a port identifier from a line identifier.
#define PAL_PAD(line)
Decodes a pad identifier from a line identifier.
Reads an input line logic state.
- Note
- The function can be called from any context.
- Parameters
-
- Returns
- The logic state.
- Return values
-
| PAL_LOW | low logic state. |
| PAL_HIGH | high logic state. |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 715 of file hal_pal.h.
◆ palWriteLine
| #define palWriteLine |
( |
| line, |
|
|
| bit ) |
Value:
#define palWritePad(port, pad, bit)
Writes a logic state on an output pad.
Writes a logic state on an output line.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
| [in] | line | line identifier |
| [in] | bit | logic value, the value must be PAL_LOW or PAL_HIGH |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 735 of file hal_pal.h.
◆ palSetLine
| #define palSetLine |
( |
| line | ) |
|
Value:
#define palSetPad(port, pad)
Sets a pad logic state to PAL_HIGH.
Sets a line logic state to PAL_HIGH.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 753 of file hal_pal.h.
◆ palClearLine
| #define palClearLine |
( |
| line | ) |
|
Value:
#define palClearPad(port, pad)
Clears a pad logic state to PAL_LOW.
Clears a line logic state to PAL_LOW.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 771 of file hal_pal.h.
◆ palToggleLine
| #define palToggleLine |
( |
| line | ) |
|
Value:
#define palTogglePad(port, pad)
Toggles a pad logic state.
Toggles a line logic state.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 789 of file hal_pal.h.
◆ palSetLineMode
| #define palSetLineMode |
( |
| line, |
|
|
| mode ) |
Value:
#define palSetPadMode(port, pad, mode)
Pad mode setup.
Line mode setup.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function can be called from any context.
- Parameters
-
| [in] | line | line identifier |
| [in] | mode | pad mode |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 808 of file hal_pal.h.
◆ palEnablePadEventI
| #define palEnablePadEventI |
( |
| port, |
|
|
| pad, |
|
|
| mode ) |
Pad event enable.
- Note
- Programming an unknown or unsupported mode is silently ignored.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
| [in] | mode | pad event mode |
- Function Class:
- This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.
Definition at line 827 of file hal_pal.h.
◆ palDisablePadEventI
| #define palDisablePadEventI |
( |
| port, |
|
|
| pad ) |
Pad event disable.
This function also disables previously programmed event callbacks.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
- Function Class:
- This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.
Definition at line 843 of file hal_pal.h.
◆ palEnablePadEvent
| #define palEnablePadEvent |
( |
| port, |
|
|
| pad, |
|
|
| mode ) |
Value: do { \
osalSysLock(); \
palEnablePadEventI(port, pad, mode); \
osalSysUnlock(); \
} while (false)
Pad event enable.
- Note
- Programming an unknown or unsupported mode is silently ignored.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
| [in] | mode | pad event mode |
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 859 of file hal_pal.h.
◆ palDisablePadEvent
| #define palDisablePadEvent |
( |
| port, |
|
|
| pad ) |
Value: do { \
osalSysLock(); \
palDisablePadEventI(port, pad); \
osalSysUnlock(); \
} while (false)
Pad event disable.
This function also disables previously programmed event callbacks.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 875 of file hal_pal.h.
◆ palEnableLineEventI
| #define palEnableLineEventI |
( |
| line, |
|
|
| mode ) |
Value:
#define palEnablePadEventI(port, pad, mode)
Pad event enable.
Line event enable.
- Note
- Programming an unknown or unsupported mode is silently ignored.
- Parameters
-
| [in] | line | line identifier |
| [in] | mode | line event mode |
- Function Class:
- This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.
Definition at line 892 of file hal_pal.h.
◆ palDisableLineEventI
| #define palDisableLineEventI |
( |
| line | ) |
|
Value:
#define palDisablePadEventI(port, pad)
Pad event disable.
Line event disable.
This function also disables previously programmed event callbacks.
- Parameters
-
- Function Class:
- This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.
Definition at line 908 of file hal_pal.h.
◆ palEnableLineEvent
| #define palEnableLineEvent |
( |
| line, |
|
|
| mode ) |
Value: do { \
osalSysLock(); \
palEnableLineEventI(line, mode); \
osalSysUnlock(); \
} while (false)
Line event enable.
- Note
- Programming an unknown or unsupported mode is silently ignored.
- Parameters
-
| [in] | line | line identifier |
| [in] | mode | line event mode |
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 923 of file hal_pal.h.
◆ palDisableLineEvent
| #define palDisableLineEvent |
( |
| line | ) |
|
Value: do { \
osalSysLock(); \
palDisableLineEventI(line); \
osalSysUnlock(); \
} while (false)
Line event disable.
This function also disables previously programmed event callbacks.
- Parameters
-
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 938 of file hal_pal.h.
◆ palIsPadEventEnabledX
| #define palIsPadEventEnabledX |
( |
| port, |
|
|
| pad ) |
Value:
Pad event enable check.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
- Returns
- Pad event status.
- Return values
-
| false | if the pad event is disabled. |
| true | if the pad event is enabled. |
- Function Class:
- This is an X-Class API, this function can be invoked from any context.
Definition at line 957 of file hal_pal.h.
◆ palIsLineEventEnabledX
| #define palIsLineEventEnabledX |
( |
| line | ) |
|
Value:
Line event enable check.
- Parameters
-
- Returns
- Line event status.
- Return values
-
| false | if the line event is disabled. |
| true | if the line event is enabled. |
- Function Class:
- This is an X-Class API, this function can be invoked from any context.
Definition at line 974 of file hal_pal.h.
◆ palSetPadCallback
| #define palSetPadCallback |
( |
| port, |
|
|
| pad, |
|
|
| cb, |
|
|
| arg ) |
Value: do { \
osalSysLock(); \
palSetPadCallbackI(port, pad, cb, arg); \
osalSysUnlock(); \
} while (false)
Associates a callback to a pad.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
| [in] | cb | event callback function |
| [in] | arg | callback argument |
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 994 of file hal_pal.h.
◆ palSetLineCallback
| #define palSetLineCallback |
( |
| line, |
|
|
| cb, |
|
|
| arg ) |
Value: do { \
osalSysLock(); \
palSetLineCallbackI(line, cb, arg); \
osalSysUnlock(); \
} while (false)
Associates a callback to a line.
- Parameters
-
| [in] | line | line identifier |
| [in] | cb | event callback function |
| [in] | arg | callback argument |
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 1010 of file hal_pal.h.
◆ PAL_NEW_INIT
◆ PAL_IOPORTS_WIDTH
| #define PAL_IOPORTS_WIDTH 16U |
◆ PAL_WHOLE_PORT
Whole port mask.
This macro specifies all the valid bits into a port.
Definition at line 55 of file hal_pal_lld.h.
◆ PAL_LINE
| #define PAL_LINE |
( |
| port, |
|
|
| pad ) |
Value: ((
ioline_t)((uint32_t)(port)) | ((uint32_t)(pad)))
uint32_t ioline_t
Type of an I/O line.
Forms a line identifier.
A port/pad pair are encoded into an ioline_t type. The encoding of this type is platform-dependent.
Definition at line 67 of file hal_pal_lld.h.
◆ PAL_PORT
Value: ((stm32_gpio_t *)(((uint32_t)(line)) & 0xFFFFFFF0U))
Decodes a port identifier from a line identifier.
Definition at line 73 of file hal_pal_lld.h.
◆ PAL_PAD
Value: ((uint32_t)((uint32_t)(line) & 0x0000000FU))
Decodes a pad identifier from a line identifier.
Definition at line 79 of file hal_pal_lld.h.
◆ PAL_NOLINE
Value identifying an invalid line.
Definition at line 85 of file hal_pal_lld.h.
◆ IOPORT1
First I/O port identifier.
Low level drivers can define multiple ports, it is suggested to use this naming convention.
Definition at line 138 of file hal_pal_lld.h.
◆ pal_lld_init
Value:
void _pal_lld_init(void)
STM32 I/O ports configuration.
Low level PAL subsystem initialization.
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 150 of file hal_pal_lld.h.
◆ pal_lld_readport
| #define pal_lld_readport |
( |
| port | ) |
|
Value:
Reads the physical I/O port states.
- Parameters
-
- Returns
- The port bits.
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 160 of file hal_pal_lld.h.
◆ pal_lld_readlatch
| #define pal_lld_readlatch |
( |
| port | ) |
|
Value:
Reads the output latch.
The purpose of this function is to read back the latched output value.
- Parameters
-
- Returns
- The latched logical states.
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 172 of file hal_pal_lld.h.
◆ pal_lld_writeport
| #define pal_lld_writeport |
( |
| port, |
|
|
| bits ) |
Value: do { \
(void)port; \
(void)bits; \
} while (false)
Writes a bits mask on a I/O port.
- Parameters
-
| [in] | port | port identifier |
| [in] | bits | bits to be written on the specified port |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 182 of file hal_pal_lld.h.
◆ pal_lld_setport
| #define pal_lld_setport |
( |
| port, |
|
|
| bits ) |
Value: do { \
(void)port; \
(void)bits; \
} while (false)
Sets a bits mask on a I/O port.
- Note
- The PAL Driver provides a default software implementation of this functionality, implement this function if can optimize it by using special hardware functionalities or special coding.
- Parameters
-
| [in] | port | port identifier |
| [in] | bits | bits to be ORed on the specified port |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 199 of file hal_pal_lld.h.
◆ pal_lld_clearport
| #define pal_lld_clearport |
( |
| port, |
|
|
| bits ) |
Value: do { \
(void)port; \
(void)bits; \
} while (false)
Clears a bits mask on a I/O port.
- Note
- The PAL Driver provides a default software implementation of this functionality, implement this function if can optimize it by using special hardware functionalities or special coding.
- Parameters
-
| [in] | port | port identifier |
| [in] | bits | bits to be cleared on the specified port |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 216 of file hal_pal_lld.h.
◆ pal_lld_toggleport
| #define pal_lld_toggleport |
( |
| port, |
|
|
| bits ) |
Value: do { \
(void)port; \
(void)bits; \
} while (false)
Toggles a bits mask on a I/O port.
- Note
- The PAL Driver provides a default software implementation of this functionality, implement this function if can optimize it by using special hardware functionalities or special coding.
- Parameters
-
| [in] | port | port identifier |
| [in] | bits | bits to be XORed on the specified port |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 233 of file hal_pal_lld.h.
◆ pal_lld_readgroup
| #define pal_lld_readgroup |
( |
| port, |
|
|
| mask, |
|
|
| offset ) |
Value:
Reads a group of bits.
- Note
- The PAL Driver provides a default software implementation of this functionality, implement this function if can optimize it by using special hardware functionalities or special coding.
- Parameters
-
| [in] | port | port identifier |
| [in] | mask | group mask |
| [in] | offset | group bit offset within the port |
- Returns
- The group logical states.
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 252 of file hal_pal_lld.h.
◆ pal_lld_writegroup
| #define pal_lld_writegroup |
( |
| port, |
|
|
| mask, |
|
|
| offset, |
|
|
| bits ) |
Value: do { \
(void)port; \
(void)mask; \
(void)offset; \
(void)bits; \
} while (false)
Writes a group of bits.
- Note
- The PAL Driver provides a default software implementation of this functionality, implement this function if can optimize it by using special hardware functionalities or special coding.
- Parameters
-
| [in] | port | port identifier |
| [in] | mask | group mask |
| [in] | offset | group bit offset within the port |
| [in] | bits | bits to be written. Values exceeding the group width are masked. |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 268 of file hal_pal_lld.h.
◆ pal_lld_setgroupmode
| #define pal_lld_setgroupmode |
( |
| port, |
|
|
| mask, |
|
|
| offset, |
|
|
| mode ) |
Value:
void _pal_lld_setgroupmode(ioportid_t port, ioportmask_t mask, iomode_t mode)
Pads mode setup.
Pads group mode setup.
This function programs a pads group belonging to the same port with the specified mode.
- Note
- Programming an unknown or unsupported mode is silently ignored.
- Parameters
-
| [in] | port | port identifier |
| [in] | mask | group mask |
| [in] | offset | group bit offset within the port |
| [in] | mode | group mode |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 289 of file hal_pal_lld.h.
◆ pal_lld_readpad
| #define pal_lld_readpad |
( |
| port, |
|
|
| pad ) |
Value:
#define PAL_LOW
Logical low state.
Reads a logical state from an I/O pad.
- Note
- The PAL Driver provides a default software implementation of this functionality, implement this function if can optimize it by using special hardware functionalities or special coding.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
- Returns
- The logical state.
- Return values
-
| PAL_LOW | low logical state. |
| PAL_HIGH | high logical state. |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 306 of file hal_pal_lld.h.
◆ pal_lld_writepad
| #define pal_lld_writepad |
( |
| port, |
|
|
| pad, |
|
|
| bit ) |
Value: do { \
(void)port; \
(void)pad; \
(void)bit; \
} while (false)
Writes a logical state on an output pad.
- Note
- This function is not meant to be invoked directly by the application code.
-
The PAL Driver provides a default software implementation of this functionality, implement this function if can optimize it by using special hardware functionalities or special coding.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
| [in] | bit | logical value, the value must be PAL_LOW or PAL_HIGH |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 323 of file hal_pal_lld.h.
◆ pal_lld_setpad
| #define pal_lld_setpad |
( |
| port, |
|
|
| pad ) |
Value: do { \
(void)port; \
(void)pad; \
} while (false)
Sets a pad logical state to PAL_HIGH.
- Note
- The PAL Driver provides a default software implementation of this functionality, implement this function if can optimize it by using special hardware functionalities or special coding.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 341 of file hal_pal_lld.h.
◆ pal_lld_clearpad
| #define pal_lld_clearpad |
( |
| port, |
|
|
| pad ) |
Value: do { \
(void)port; \
(void)pad; \
} while (false)
Clears a pad logical state to PAL_LOW.
- Note
- The PAL Driver provides a default software implementation of this functionality, implement this function if can optimize it by using special hardware functionalities or special coding.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 358 of file hal_pal_lld.h.
◆ pal_lld_togglepad
| #define pal_lld_togglepad |
( |
| port, |
|
|
| pad ) |
Value: do { \
(void)port; \
(void)pad; \
} while (false)
Toggles a pad logical state.
- Note
- The PAL Driver provides a default software implementation of this functionality, implement this function if can optimize it by using special hardware functionalities or special coding.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 375 of file hal_pal_lld.h.
◆ pal_lld_setpadmode
| #define pal_lld_setpadmode |
( |
| port, |
|
|
| pad, |
|
|
| mode ) |
Value: do { \
(void)port; \
(void)pad; \
(void)mode; \
} while (false)
Pad mode setup.
This function programs a pad with the specified mode.
- Note
- The PAL Driver provides a default software implementation of this functionality, implement this function if can optimize it by using special hardware functionalities or special coding.
-
Programming an unknown or unsupported mode is silently ignored.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
| [in] | mode | pad mode |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 395 of file hal_pal_lld.h.
◆ pal_lld_get_pad_event
| #define pal_lld_get_pad_event |
( |
| port, |
|
|
| pad ) |
Value: &_pal_events[0]; (void)(port); (void)pad
Returns a PAL event structure associated to a pad.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 410 of file hal_pal_lld.h.
Referenced by palSetPadCallbackI(), and palWaitPadTimeoutS().
◆ pal_lld_get_line_event
| #define pal_lld_get_line_event |
( |
| line | ) |
|
◆ palcallback_t
| typedef void(* palcallback_t) (void *arg) |
Type of a PAL event callback.
Definition at line 148 of file hal_pal.h.
◆ ioportmask_t
Digital I/O port sized unsigned type.
Definition at line 104 of file hal_pal_lld.h.
◆ iomode_t
◆ ioline_t
◆ ioportid_t
Port Identifier.
This type can be a scalar or some kind of pointer, do not make any assumption about it, use the provided macros when populating variables of this type.
Definition at line 122 of file hal_pal_lld.h.
◆ iopadid_t
◆ palReadBus()
Read from an I/O bus.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The function internally uses the
palReadGroup() macro. The use of this function is preferred when you value code size, readability and error checking over speed.
-
The function can be called from any context.
- Parameters
-
| [in] | bus | the I/O bus, pointer to a IOBus structure |
- Returns
- The bus logical states.
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 65 of file hal_pal.c.
References IOBus::mask, IOBus::offset, osalDbgCheck, PAL_IOPORTS_WIDTH, palReadGroup, and IOBus::portid.
◆ palWriteBus()
Write to an I/O bus.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The default implementation is non atomic and not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
-
The function can be called from any context.
- Parameters
-
| [in] | bus | the I/O bus, pointer to a IOBus structure |
| [in] | bits | the bits to be written on the I/O bus. Values exceeding the bus width are masked so most significant bits are lost. |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 90 of file hal_pal.c.
References IOBus::mask, IOBus::offset, osalDbgCheck, PAL_IOPORTS_WIDTH, palWriteGroup, and IOBus::portid.
◆ palSetBusMode()
Programs a bus with the specified mode.
- Note
- The operation is not guaranteed to be atomic on all the architectures, for atomicity and/or portability reasons you may need to enclose port I/O operations between
osalSysLock() and osalSysUnlock().
-
The default implementation is non atomic and not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
-
The function can be called from any context.
- Parameters
-
| [in] | bus | the I/O bus, pointer to a IOBus structure |
| [in] | mode | the mode |
- Function Class:
- Special function, this function has special requirements see the notes.
Definition at line 113 of file hal_pal.c.
References IOBus::mask, IOBus::offset, osalDbgCheck, PAL_IOPORTS_WIDTH, palSetGroupMode, and IOBus::portid.
◆ palSetPadCallbackI()
Associates a callback to a port/pad.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
| [in] | cb | event callback function |
| [in] | arg | callback argument |
- Function Class:
- This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.
Definition at line 131 of file hal_pal.c.
References palevent_t::arg, palevent_t::cb, and pal_lld_get_pad_event.
◆ palSetLineCallbackI()
Associates a callback to a line.
- Parameters
-
| [in] | line | line identifier |
| [in] | cb | event callback function |
| [in] | arg | callback argument |
- Function Class:
- This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.
Definition at line 148 of file hal_pal.c.
References palevent_t::arg, palevent_t::cb, and pal_lld_get_line_event.
◆ palWaitPadTimeoutS()
Waits for an edge on the specified port/pad.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
| [in] | timeout | the number of ticks before the operation timeouts, the following special values are allowed:
- TIME_IMMEDIATE immediate timeout.
- TIME_INFINITE no timeout.
|
- Returns
- The operation state.
- Return values
-
| MSG_OK | if an edge has been detected. |
| MSG_TIMEOUT | if a timeout occurred before an edge could be detected. |
| MSG_RESET | if the event has been disabled while the thread was waiting for an edge. |
- Function Class:
- This is an S-Class API, this function can be invoked from within a system lock zone by threads only.
Definition at line 174 of file hal_pal.c.
References osalThreadEnqueueTimeoutS(), pal_lld_get_pad_event, and palevent_t::threads.
Referenced by palWaitPadTimeout().
◆ palWaitPadTimeout()
Waits for an edge on the specified port/pad.
- Parameters
-
| [in] | port | port identifier |
| [in] | pad | pad number within the port |
| [in] | timeout | the number of ticks before the operation timeouts, the following special values are allowed:
- TIME_IMMEDIATE immediate timeout.
- TIME_INFINITE no timeout.
|
- Returns
- The operation state.
- Return values
-
| MSG_OK | if an edge has been detected. |
| MSG_TIMEOUT | if a timeout occurred before an edge cound be detected. |
| MSG_RESET | if the event has been disabled while the thread was waiting for an edge. |
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 199 of file hal_pal.c.
References osalSysLock(), osalSysUnlock(), and palWaitPadTimeoutS().
◆ palWaitLineTimeoutS()
Waits for an edge on the specified line.
- Parameters
-
| [in] | line | line identifier |
| [in] | timeout | operation timeout |
- Returns
- The operation state.
- Return values
-
| MSG_OK | if an edge has been detected. |
| MSG_TIMEOUT | if a timeout occurred before an edge could be detected. |
| MSG_RESET | if the event has been disabled while the thread was waiting for an edge. |
- Function Class:
- This is an S-Class API, this function can be invoked from within a system lock zone by threads only.
Definition at line 223 of file hal_pal.c.
References osalThreadEnqueueTimeoutS(), pal_lld_get_line_event, and palevent_t::threads.
Referenced by palWaitLineTimeout().
◆ palWaitLineTimeout()
Waits for an edge on the specified line.
- Parameters
-
| [in] | line | line identifier |
| [in] | timeout | operation timeout |
- Returns
- The operation state.
- Return values
-
| MSG_OK | if an edge has been detected. |
| MSG_TIMEOUT | if a timeout occurred before an edge cound be detected. |
| MSG_RESET | if the event has been disabled while the thread was waiting for an edge. |
- Function Class:
- Normal API, this function can be invoked by regular system threads but not from within a lock zone.
Definition at line 243 of file hal_pal.c.
References osalSysLock(), osalSysUnlock(), and palWaitLineTimeoutS().
◆ _pal_lld_init()
| void _pal_lld_init |
( |
void | | ) |
|
STM32 I/O ports configuration.
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 58 of file hal_pal_lld.c.
◆ _pal_lld_setgroupmode()
Pads mode setup.
This function programs a pads group belonging to the same port with the specified mode.
- Parameters
-
| [in] | port | the port identifier |
| [in] | mask | the group mask |
| [in] | mode | the mode |
- Function Class:
- Not an API, this function is for internal use only.
Definition at line 73 of file hal_pal_lld.c.