ChibiOS/RT
2.5.1
PAL Driver
Collaboration diagram for PAL Driver:

Detailed Description

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 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:

  1. The written value is not actually output but latched, should the pads be reprogrammed as outputs the value would be in effect.
  2. The write operation is ignored.
  3. 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:

  1. The actual pads states are read (not the output latch).
  2. The output latch value is read (regardless of the actual pads states).
  3. 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.

Data Structures

struct  IOBus
 I/O bus descriptor. More...
struct  PALConfig
 Generic I/O ports static initializer. More...

Functions

ioportmask_t palReadBus (IOBus *bus)
 Read from an I/O bus.
void palWriteBus (IOBus *bus, ioportmask_t bits)
 Write to an I/O bus.
void palSetBusMode (IOBus *bus, iomode_t mode)
 Programs a bus with the specified mode.
void _pal_lld_setgroupmode (ioportid_t port, ioportmask_t mask, iomode_t mode)
 Pads mode setup.

Pads mode constants

#define PAL_MODE_RESET   0
 After reset state.
#define PAL_MODE_UNCONNECTED   1
 Safe state for unconnected pads.
#define PAL_MODE_INPUT   2
 Regular input high-Z pad.
#define PAL_MODE_INPUT_PULLUP   3
 Input pad with weak pull up resistor.
#define PAL_MODE_INPUT_PULLDOWN   4
 Input pad with weak pull down resistor.
#define PAL_MODE_INPUT_ANALOG   5
 Analog input mode.
#define PAL_MODE_OUTPUT_PUSHPULL   6
 Push-pull output pad.
#define PAL_MODE_OUTPUT_OPENDRAIN   7
 Open-drain output pad.

Logic level constants

#define PAL_LOW   0
 Logical low state.
#define PAL_HIGH   1
 Logical high state.

Macro Functions

#define palInit(config)   pal_lld_init(config)
 PAL subsystem initialization.
#define palReadPort(port)   ((void)(port), 0)
 Reads the physical I/O port states.
#define palReadLatch(port)   ((void)(port), 0)
 Reads the output latch.
#define palWritePort(port, bits)   ((void)(port), (void)(bits))
 Writes a bits mask on a I/O port.
#define palSetPort(port, bits)   palWritePort(port, palReadLatch(port) | (bits))
 Sets a bits mask on a I/O port.
#define palClearPort(port, bits)   palWritePort(port, palReadLatch(port) & ~(bits))
 Clears a bits mask on a I/O port.
#define palTogglePort(port, bits)   palWritePort(port, palReadLatch(port) ^ (bits))
 Toggles a bits mask on a I/O port.
#define palReadGroup(port, mask, offset)   ((palReadPort(port) >> (offset)) & (mask))
 Reads a group of bits.
#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)   ((palReadPort(port) >> (pad)) & 1)
 Reads an input pad logical state.
#define palWritePad(port, pad, bit)
 Writes a logical state on an output pad.
#define palSetPad(port, pad)   palSetPort(port, PAL_PORT_BIT(pad))
 Sets a pad logical state to PAL_HIGH.
#define palClearPad(port, pad)   palClearPort(port, PAL_PORT_BIT(pad))
 Clears a pad logical state to PAL_LOW.
#define palTogglePad(port, pad)   palTogglePort(port, PAL_PORT_BIT(pad))
 Toggles a pad logical state.
#define palSetPadMode(port, pad, mode)   palSetGroupMode(port, PAL_PORT_BIT(pad), 0, mode)
 Pad mode setup.

Defines

#define PAL_PORT_BIT(n)   ((ioportmask_t)(1 << (n)))
 Port bit helper macro.
#define PAL_GROUP_MASK(width)   ((ioportmask_t)(1 << (width)) - 1)
 Bits group mask helper.
#define _IOBUS_DATA(name, port, width, offset)   {port, PAL_GROUP_MASK(width), offset}
 Data part of a static I/O bus initializer.
#define IOBUS_DECL(name, port, width, offset)   IOBus name = _IOBUS_DATA(name, port, width, offset)
 Static I/O bus initializer.
#define PAL_MODE_OUTPUT_PUSHPULL_SLOW   16
 STM8S specific alternate push-pull slow output mode.
#define PAL_MODE_OUTPUT_OPENDRAIN_SLOW   17
 STM8S specific alternate open-drain slow output mode.
#define PAL_IOPORTS_WIDTH   8
 Width, in bits, of an I/O port.
#define PAL_WHOLE_PORT   ((ioportmask_t)0xFF)
 Whole port mask.
#define IOPORTS   ((PALConfig *)0x5000)
 GPIO ports as a whole.
#define IOPORT1   GPIOA
 GPIO port A identifier.
#define IOPORT2   GPIOB
 GPIO port B identifier.
#define IOPORT3   GPIOC
 GPIO port C identifier.
#define IOPORT4   GPIOD
 GPIO port D identifier.
#define IOPORT5   GPIOE
 GPIO port E identifier.
#define IOPORT6   GPIOF
 GPIO port F identifier.
#define IOPORT7   GPIOG
 GPIO port G identifier.
#define IOPORT8   GPIOH
 GPIO port H identifier.
#define IOPORT9   GPIOI
 GPIO port I identifier.
#define pal_lld_init(config)   (*IOPORTS = *(config))
 Low level PAL subsystem initialization.
#define pal_lld_readport(port)   ((port)->IDR)
 Reads the physical I/O port states.
#define pal_lld_readlatch(port)   ((port)->ODR)
 Reads the output latch.
#define pal_lld_writeport(port, bits)   ((port)->ODR = (bits))
 Writes a bits mask on a I/O port.
#define pal_lld_setgroupmode(port, mask, offset, mode)   _pal_lld_setgroupmode(port, mask << offset, mode)
 Pads group mode setup.

Typedefs

typedef uint8_t ioportmask_t
 Digital I/O port sized unsigned type.
typedef uint8_t iomode_t
 Digital I/O modes.
typedef GPIO_TypeDef * ioportid_t
 Port Identifier.

Function Documentation

ioportmask_t palReadBus ( IOBus bus)

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 chSysLock() and chSysUnlock().
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.
Parameters:
[in]busthe I/O bus, pointer to a IOBus structure
Returns:
The bus logical states.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 69 of file pal.c.

References IOBus::mask, IOBus::offset, PAL_IOPORTS_WIDTH, palReadGroup, and IOBus::portid.

void palWriteBus ( IOBus bus,
ioportmask_t  bits 
)

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 chSysLock() and chSysUnlock().
The default implementation is non atomic and not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
Parameters:
[in]busthe I/O bus, pointer to a IOBus structure
[in]bitsthe bits to be written on the I/O bus. Values exceeding the bus width are masked so most significant bits are lost.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 94 of file pal.c.

References IOBus::mask, IOBus::offset, PAL_IOPORTS_WIDTH, palWriteGroup, and IOBus::portid.

void palSetBusMode ( IOBus bus,
iomode_t  mode 
)

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 chSysLock() and chSysUnlock().
The default implementation is non atomic and not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
Parameters:
[in]busthe I/O bus, pointer to a IOBus structure
[in]modethe mode
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 117 of file pal.c.

References IOBus::mask, IOBus::offset, PAL_IOPORTS_WIDTH, palSetGroupMode, and IOBus::portid.

void _pal_lld_setgroupmode ( ioportid_t  port,
ioportmask_t  mask,
iomode_t  mode 
)

Pads mode setup.

This function programs a pads group belonging to the same port with the specified mode.

Note:
PAL_MODE_UNCONNECTED is implemented as push pull output at 2MHz.
Parameters:
[in]portthe port identifier
[in]maskthe group mask
[in]modethe mode
Function Class:
Not an API, this function is for internal use only.

Definition at line 66 of file pal_lld.c.

References PAL_MODE_INPUT, PAL_MODE_INPUT_ANALOG, PAL_MODE_INPUT_PULLUP, PAL_MODE_OUTPUT_OPENDRAIN, PAL_MODE_OUTPUT_OPENDRAIN_SLOW, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL_SLOW, PAL_MODE_RESET, and PAL_MODE_UNCONNECTED.


Define Documentation

#define PAL_MODE_RESET   0

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 48 of file pal.h.

Referenced by _pal_lld_setgroupmode().

#define PAL_MODE_UNCONNECTED   1

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 as example.

Definition at line 57 of file pal.h.

Referenced by _pal_lld_setgroupmode().

#define PAL_MODE_INPUT   2

Regular input high-Z pad.

Definition at line 62 of file pal.h.

Referenced by _pal_lld_setgroupmode().

#define PAL_MODE_INPUT_PULLUP   3

Input pad with weak pull up resistor.

Definition at line 67 of file pal.h.

Referenced by _pal_lld_setgroupmode().

#define PAL_MODE_INPUT_PULLDOWN   4

Input pad with weak pull down resistor.

Definition at line 72 of file pal.h.

#define PAL_MODE_INPUT_ANALOG   5

Analog input mode.

Definition at line 77 of file pal.h.

Referenced by _pal_lld_setgroupmode().

#define PAL_MODE_OUTPUT_PUSHPULL   6

Push-pull output pad.

Definition at line 82 of file pal.h.

Referenced by _pal_lld_setgroupmode().

#define PAL_MODE_OUTPUT_OPENDRAIN   7

Open-drain output pad.

Definition at line 87 of file pal.h.

Referenced by _pal_lld_setgroupmode().

#define PAL_LOW   0

Logical low state.

Definition at line 97 of file pal.h.

#define PAL_HIGH   1

Logical high state.

Definition at line 102 of file pal.h.

#define PAL_PORT_BIT (   n)    ((ioportmask_t)(1 << (n)))

Port bit helper macro.

This macro calculates the mask of a bit within a port.

Parameters:
[in]nbit position within the port
Returns:
The bit mask.

Definition at line 155 of file pal.h.

#define PAL_GROUP_MASK (   width)    ((ioportmask_t)(1 << (width)) - 1)

Bits group mask helper.

This macro calculates the mask of a bits group.

Parameters:
[in]widthgroup width
Returns:
The group mask.

Definition at line 166 of file pal.h.

#define _IOBUS_DATA (   name,
  port,
  width,
  offset 
)    {port, PAL_GROUP_MASK(width), offset}

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]namename of the IOBus variable
[in]portI/O port descriptor
[in]widthbus width in bits
[in]offsetbus bit offset within the port

Definition at line 179 of file pal.h.

#define IOBUS_DECL (   name,
  port,
  width,
  offset 
)    IOBus name = _IOBUS_DATA(name, port, width, offset)

Static I/O bus initializer.

Parameters:
[in]namename of the IOBus variable
[in]portI/O port descriptor
[in]widthbus width in bits
[in]offsetbus bit offset within the port

Definition at line 190 of file pal.h.

#define palInit (   config)    pal_lld_init(config)

PAL subsystem initialization.

Note:
This function is implicitly invoked by halInit(), there is no need to explicitly initialize the driver.
Parameters:
[in]configpointer to an architecture specific configuration structure. This structure is defined in the low level driver header.
Function Class:
Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 208 of file pal.h.

Referenced by halInit().

#define palReadPort (   port)    ((void)(port), 0)

Reads the physical I/O port states.

Note:
The default implementation always return zero and computes the parameter eventual side effects.
Parameters:
[in]portport identifier
Returns:
The port logical states.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 221 of file pal.h.

#define palReadLatch (   port)    ((void)(port), 0)

Reads the output latch.

The purpose of this function is to read back the latched output value.

Note:
The default implementation always return zero and computes the parameter eventual side effects.
Parameters:
[in]portport identifier
Returns:
The latched logical states.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 239 of file pal.h.

#define palWritePort (   port,
  bits 
)    ((void)(port), (void)(bits))

Writes a bits mask on a I/O port.

Note:
The default implementation does nothing except computing the parameters eventual side effects.
Parameters:
[in]portport identifier
[in]bitsbits to be written on the specified port
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 255 of file pal.h.

#define palSetPort (   port,
  bits 
)    palWritePort(port, palReadLatch(port) | (bits))

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 chSysLock() and chSysUnlock().
The default implementation is non atomic and not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
Parameters:
[in]portport identifier
[in]bitsbits to be ORed on the specified port
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 276 of file pal.h.

#define palClearPort (   port,
  bits 
)    palWritePort(port, palReadLatch(port) & ~(bits))

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 chSysLock() and chSysUnlock().
The default implementation is non atomic and not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
Parameters:
[in]portport identifier
[in]bitsbits to be cleared on the specified port
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 298 of file pal.h.

#define palTogglePort (   port,
  bits 
)    palWritePort(port, palReadLatch(port) ^ (bits))

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 chSysLock() and chSysUnlock().
The default implementation is non atomic and not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
Parameters:
[in]portport identifier
[in]bitsbits to be XORed on the specified port
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 320 of file pal.h.

#define palReadGroup (   port,
  mask,
  offset 
)    ((palReadPort(port) >> (offset)) & (mask))

Reads a group of bits.

Parameters:
[in]portport identifier
[in]maskgroup mask, a logical AND is performed on the input data
[in]offsetgroup bit offset within the port
Returns:
The group logical states.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 338 of file pal.h.

Referenced by palReadBus().

#define palWriteGroup (   port,
  mask,
  offset,
  bits 
)
Value:
palWritePort(port, (palReadLatch(port) & ~((mask) << (offset))) |         \
                     (((bits) & (mask)) << (offset)))

Writes a group of bits.

Parameters:
[in]portport identifier
[in]maskgroup mask, a logical AND is performed on the output data
[in]offsetgroup bit offset within the port
[in]bitsbits to be written. Values exceeding the group width are masked.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 357 of file pal.h.

Referenced by palWriteBus().

#define palSetGroupMode (   port,
  mask,
  offset,
  mode 
)

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]portport identifier
[in]maskgroup mask
[in]offsetgroup bit offset within the port
[in]modegroup mode
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 380 of file pal.h.

Referenced by palSetBusMode().

#define palReadPad (   port,
  pad 
)    ((palReadPort(port) >> (pad)) & 1)

Reads an input pad logical state.

Note:
The default implementation not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
The default implementation internally uses the palReadPort().
Parameters:
[in]portport identifier
[in]padpad number within the port
Returns:
The logical state.
Return values:
PAL_LOWlow logical state.
PAL_HIGHhigh logical state.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 402 of file pal.h.

#define palWritePad (   port,
  pad,
  bit 
)
Value:
palWritePort(port, (palReadLatch(port) & ~PAL_PORT_BIT(pad)) |            \
                     (((bit) & 1) << pad))

Writes a logical 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 chSysLock() and chSysUnlock().
The default implementation is non atomic and not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
The default implementation internally uses the palReadLatch() and palWritePort().
Parameters:
[in]portport identifier
[in]padpad number within the port
[in]bitlogical value, the value must be PAL_LOW or PAL_HIGH
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 427 of file pal.h.

#define palSetPad (   port,
  pad 
)    palSetPort(port, PAL_PORT_BIT(pad))

Sets a pad logical 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 chSysLock() and chSysUnlock().
The default implementation is non atomic and not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
The default implementation internally uses the palSetPort().
Parameters:
[in]portport identifier
[in]padpad 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 451 of file pal.h.

Referenced by spi_lld_unselect().

#define palClearPad (   port,
  pad 
)    palClearPort(port, PAL_PORT_BIT(pad))

Clears a pad logical 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 chSysLock() and chSysUnlock().
The default implementation is non atomic and not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
The default implementation internally uses the palClearPort().
Parameters:
[in]portport identifier
[in]padpad 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 473 of file pal.h.

Referenced by spi_lld_select().

#define palTogglePad (   port,
  pad 
)    palTogglePort(port, PAL_PORT_BIT(pad))

Toggles a pad logical 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 chSysLock() and chSysUnlock().
The default implementation is non atomic and not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
The default implementation internally uses the palTogglePort().
Parameters:
[in]portport identifier
[in]padpad 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 495 of file pal.h.

#define palSetPadMode (   port,
  pad,
  mode 
)    palSetGroupMode(port, PAL_PORT_BIT(pad), 0, mode)

Pad mode setup.

This function programs a pad with the specified mode.

Note:
The default implementation not necessarily optimal. Low level drivers may optimize the function by using specific hardware or coding.
Programming an unknown or unsupported mode is silently ignored.
Parameters:
[in]portport identifier
[in]padpad number within the port
[in]modepad mode
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 515 of file pal.h.

#define PAL_MODE_OUTPUT_PUSHPULL_SLOW   16

STM8S specific alternate push-pull slow output mode.

Definition at line 43 of file pal_lld.h.

Referenced by _pal_lld_setgroupmode().

#define PAL_MODE_OUTPUT_OPENDRAIN_SLOW   17

STM8S specific alternate open-drain slow output mode.

Definition at line 48 of file pal_lld.h.

Referenced by _pal_lld_setgroupmode().

#define PAL_IOPORTS_WIDTH   8

Width, in bits, of an I/O port.

Definition at line 74 of file pal_lld.h.

Referenced by palReadBus(), palSetBusMode(), and palWriteBus().

#define PAL_WHOLE_PORT   ((ioportmask_t)0xFF)

Whole port mask.

This macro specifies all the valid bits into a port.

Definition at line 80 of file pal_lld.h.

#define IOPORTS   ((PALConfig *)0x5000)

GPIO ports as a whole.

Definition at line 104 of file pal_lld.h.

#define IOPORT1   GPIOA

GPIO port A identifier.

Definition at line 109 of file pal_lld.h.

#define IOPORT2   GPIOB

GPIO port B identifier.

Definition at line 114 of file pal_lld.h.

#define IOPORT3   GPIOC

GPIO port C identifier.

Definition at line 119 of file pal_lld.h.

#define IOPORT4   GPIOD

GPIO port D identifier.

Definition at line 124 of file pal_lld.h.

#define IOPORT5   GPIOE

GPIO port E identifier.

Definition at line 129 of file pal_lld.h.

#define IOPORT6   GPIOF

GPIO port F identifier.

Definition at line 134 of file pal_lld.h.

#define IOPORT7   GPIOG

GPIO port G identifier.

Definition at line 141 of file pal_lld.h.

#define IOPORT8   GPIOH

GPIO port H identifier.

Definition at line 148 of file pal_lld.h.

#define IOPORT9   GPIOI

GPIO port I identifier.

Definition at line 153 of file pal_lld.h.

#define pal_lld_init (   config)    (*IOPORTS = *(config))

Low level PAL subsystem initialization.

Parameters:
[in]configarchitecture-dependent ports configuration
Function Class:
Not an API, this function is for internal use only.

Definition at line 168 of file pal_lld.h.

#define pal_lld_readport (   port)    ((port)->IDR)

Reads the physical I/O port states.

Parameters:
[in]portport identifier
Returns:
The port bits.
Function Class:
Not an API, this function is for internal use only.

Definition at line 178 of file pal_lld.h.

#define pal_lld_readlatch (   port)    ((port)->ODR)

Reads the output latch.

The purpose of this function is to read back the latched output value.

Parameters:
[in]portport identifier
Returns:
The latched logical states.
Function Class:
Not an API, this function is for internal use only.

Definition at line 190 of file pal_lld.h.

#define pal_lld_writeport (   port,
  bits 
)    ((port)->ODR = (bits))

Writes a bits mask on a I/O port.

Parameters:
[in]portport identifier
[in]bitsbits to be written on the specified port
Function Class:
Not an API, this function is for internal use only.

Definition at line 200 of file pal_lld.h.

#define pal_lld_setgroupmode (   port,
  mask,
  offset,
  mode 
)    _pal_lld_setgroupmode(port, mask << offset, mode)

Pads group mode setup.

This function programs a pads group belonging to the same port with the specified mode.

Parameters:
[in]portport identifier
[in]maskgroup mask
[in]offsetgroup bit offset within the port
[in]modegroup mode
Function Class:
Not an API, this function is for internal use only.

Definition at line 214 of file pal_lld.h.


Typedef Documentation

typedef uint8_t ioportmask_t

Digital I/O port sized unsigned type.

Definition at line 85 of file pal_lld.h.

typedef uint8_t iomode_t

Digital I/O modes.

Definition at line 90 of file pal_lld.h.

typedef GPIO_TypeDef* ioportid_t

Port Identifier.

Definition at line 95 of file pal_lld.h.