ChibiOS/HAL 9.0.0
SIO Driver

Generic SIO Driver. More...

Detailed Description

Generic SIO Driver.

This driver abstracts a generic serial communication channel, usually an UART, this driver is similar to Serial and UART drivers but follows a different concept:

  • Very close to HW.
  • No buffering done in SW, the driver relies on the peripheral internal FIFO, if any.
  • Asynchronous, the API is always non blocking.
  • Callbacks capable, operations completion and other events are notified using callbacks.
  • Very short code paths, especially in ISRs.
Precondition
In order to use the SIO driver the HAL_USE_SIO option must be enabled in halconf.h.

Driver State Machine

The driver implements a state machine internally, not all the driver functionalities can be used in any moment, any transition not explicitly shown in the following diagram has to be considered an error and shall be captured by an assertion (if enabled).

dot_inline_dotgraph_12.png
Collaboration diagram for SIO Driver:

SIO masks offsets

#define SIO_EV_RXNOTEMPY_POS   2 /* CHN_INPUT_AVAILABLE */
#define SIO_EV_TXNOTFULL_POS   3 /* CHN_OUTPUT_EMPTY */
#define SIO_EV_TXDONE_POS   4 /* CHN_TRANSMISSION_END */
#define SIO_EV_ALL_ERRORS_POS   SIO_EV_PARITY_ERR_POS
#define SIO_EV_PARITY_ERR_POS   5 /* CHN_PARITY_ERROR */
#define SIO_EV_FRAMING_ERR_POS   6 /* CHN_FRAMING_ERROR */
#define SIO_EV_NOISE_ERR_POS   7 /* CHN_NOISE_ERROR */
#define SIO_EV_OVERRUN_ERR_POS   8 /* CHN_OVERRUN_ERROR */
#define SIO_EV_RXIDLE_POS   9 /* CHN_IDLE_DETECTED */
#define SIO_EV_RXBREAK_POS   10 /* CHN_BREAK_DETECTED */

Event flags (compatible with channel and serial events)

#define SIO_EV_NONE   0U
#define SIO_EV_RXNOTEMPY   (1U << SIO_EV_RXNOTEMPY_POS)
#define SIO_EV_TXNOTFULL   (1U << SIO_EV_TXNOTFULL_POS)
#define SIO_EV_ALL_DATA   (SIO_EV_RXNOTEMPY | SIO_EV_TXNOTFULL)
#define SIO_EV_TXDONE   (1U << SIO_EV_TXDONE_POS)
#define SIO_EV_PARITY_ERR   (1U << SIO_EV_PARITY_ERR_POS)
#define SIO_EV_FRAMING_ERR   (1U << SIO_EV_FRAMING_ERR_POS)
#define SIO_EV_NOISE_ERR   (1U << SIO_EV_NOISE_ERR_POS)
#define SIO_EV_OVERRUN_ERR   (1U << SIO_EV_OVERRUN_ERR_POS)
#define SIO_EV_RXIDLE   (1U << SIO_EV_RXIDLE_POS)
#define SIO_EV_RXBREAK   (1U << SIO_EV_RXBREAK_POS)
#define SIO_EV_ALL_ERRORS
#define SIO_EV_ALL_EVENTS

Additional messages

#define SIO_MSG_ERRORS   (msg_t)1

SIO configuration options

#define SIO_DEFAULT_BITRATE   38400
 Default bit rate.
#define SIO_USE_SYNCHRONIZATION   TRUE
 Support for thread synchronization API.
#define SIO_USE_STREAMS_INTERFACE   SIO_USE_SYNCHRONIZATION
 Support for streams interfacwe.

Low level driver helper macros

#define __sio_callback(siop)
 SIO callback.
#define __sio_wakeup_errors(siop)
 Wakes up because RX errors.
#define __sio_wakeup_rx(siop)
 Wakes up the RX-waiting thread.
#define __sio_wakeup_rxidle(siop)
 Wakes up the RX-idle-waiting thread.
#define __sio_wakeup_tx(siop)
 Wakes up the TX-waiting thread.
#define __sio_wakeup_txend(siop)
 Wakes up the TXend-waiting thread.

PLATFORM configuration options

#define PLATFORM_SIO_USE_SIO1   FALSE
 SIO driver enable switch.

Data Structures

struct  hal_sio_config
 Driver configuration structure. More...
struct  sio_driver_vmt
 SIODriver virtual methods table. More...
struct  hal_sio_driver
 Structure representing a SIO driver. More...

Macros

#define _sio_driver_methods    _base_channel_methods
 SIODriver specific methods.
#define sioSetCallbackX(siop, f)
 Associates a callback to the SIO instance.
#define sioIsRXEmptyX(siop)
 Determines the state of the RX FIFO.
#define sioIsRXIdleX(siop)
 Determines the activity state of the receiver.
#define sioHasRXErrorsX(siop)
 Determines if RX has pending errors to be read and cleared.
#define sioIsTXFullX(siop)
 Determines the state of the TX FIFO.
#define sioIsTXOngoingX(siop)
 Determines the transmission state.
#define sioWriteEnableFlagsX(siop, mask)
 Writes the enabled events mask.
#define sioSetEnableFlagsX(siop, mask)
 Sets flags into the enabled events flags mask.
#define sioClearEnableFlagsX(siop, mask)
 Clears flags from the enabled events flags mask.
#define sioGetEnableFlagsX(siop)
 Return the enabled condition flags mask.
#define sioGetAndClearErrorsX(siop)
 Get and clears SIO error event flags.
#define sioGetAndClearEventsX(siop)
 Get and clears SIO event flags.
#define sioGetEventsX(siop)
 Returns the pending SIO event flags.
#define sioGetX(siop)
 Returns one frame from the RX FIFO.
#define sioPutX(siop, data)
 Pushes one frame into the TX FIFO.
#define sioAsyncReadX(siop, size, buffer)
 Reads data from the RX FIFO.
#define sioAsyncWriteX(siop, size, buffer)
 Writes data into the TX FIFO.
#define sioControlX(siop, operation, arg)
 Control operation on a serial port.
#define __sio_reloc_field(v, m, s, d)
 Relocates a bit field.
#define sio_lld_driver_fields    uint32_t dummy;
 Low level fields of the SIO driver structure.
#define sio_lld_config_fields    uint32_t dummy;
 Low level fields of the SIO configuration structure.
#define sio_lld_is_rx_empty(siop)
 Determines the state of the RX FIFO.
#define sio_lld_is_rx_idle(siop)
 Determines the activity state of the receiver.
#define sio_lld_has_rx_errors(siop)
 Determines if RX has pending error events to be read and cleared.
#define sio_lld_is_tx_full(siop)
 Determines the state of the TX FIFO.
#define sio_lld_is_tx_ongoing(siop)
 Determines the transmission state.

Typedefs

typedef eventflags_t sioevents_t
 Type of event flags.
typedef struct hal_sio_driver SIODriver
 Type of structure representing a SIO driver.
typedef struct hal_sio_config SIOConfig
 Type of structure representing a SIO configuration.
typedef void(* siocb_t) (SIODriver *siop)
 Generic SIO notification callback type.

Enumerations

enum  siostate_t { SIO_UNINIT = 0 , SIO_STOP = 1 , SIO_READY = 2 }
 Driver state machine possible states. More...

Functions

static size_t sync_write (void *ip, const uint8_t *bp, size_t n, sysinterval_t timeout)
static size_t sync_read (void *ip, uint8_t *bp, size_t n, sysinterval_t timeout)
static size_t __write (void *ip, const uint8_t *bp, size_t n)
static size_t __read (void *ip, uint8_t *bp, size_t n)
static msg_t __put (void *ip, uint8_t b)
static msg_t __get (void *ip)
static msg_t __putt (void *ip, uint8_t b, sysinterval_t timeout)
static msg_t __gett (void *ip, sysinterval_t timeout)
static size_t __writet (void *ip, const uint8_t *bp, size_t n, sysinterval_t timeout)
static size_t __readt (void *ip, uint8_t *bp, size_t n, sysinterval_t timeout)
static msg_t __ctl (void *ip, unsigned int operation, void *arg)
void sioInit (void)
 SIO Driver initialization.
void sioObjectInit (SIODriver *siop)
 Initializes the standard part of a SIODriver structure.
msg_t sioStart (SIODriver *siop, const SIOConfig *config)
 Configures and activates the SIO peripheral.
void sioStop (SIODriver *siop)
 Deactivates the SIO peripheral.
void sioWriteEnableFlags (SIODriver *siop, sioevents_t mask)
 Writes the enabled events flags mask.
void sioSetEnableFlags (SIODriver *siop, sioevents_t mask)
 Sets flags into the enabled events flags mask.
void sioClearEnableFlags (SIODriver *siop, sioevents_t mask)
 Clears flags from the enabled events flags mask.
sioevents_t sioGetAndClearErrors (SIODriver *siop)
 Get and clears SIO error event flags.
sioevents_t sioGetAndClearEvents (SIODriver *siop)
 Get and clears SIO event flags.
sioevents_t sioGetEvents (SIODriver *siop)
 Returns the pending SIO event flags.
size_t sioAsyncRead (SIODriver *siop, uint8_t *buffer, size_t n)
 Reads data from the RX FIFO.
size_t sioAsyncWrite (SIODriver *siop, const uint8_t *buffer, size_t n)
 Writes data into the TX FIFO.
msg_t sioSynchronizeRX (SIODriver *siop, sysinterval_t timeout)
 Synchronizes with RX FIFO data availability.
msg_t sioSynchronizeRXIdle (SIODriver *siop, sysinterval_t timeout)
 Synchronizes with RX going idle.
msg_t sioSynchronizeTX (SIODriver *siop, sysinterval_t timeout)
 Synchronizes with TX FIFO space availability.
msg_t sioSynchronizeTXEnd (SIODriver *siop, sysinterval_t timeout)
 Synchronizes with TX completion.
void sio_lld_init (void)
 Low level SIO driver initialization.
msg_t sio_lld_start (SIODriver *siop)
 Configures and activates the SIO peripheral.
void sio_lld_stop (SIODriver *siop)
 Deactivates the SIO peripheral.
void sio_lld_update_enable_flags (SIODriver *siop)
 Enable flags change notification.
sioevents_t sio_lld_get_and_clear_errors (SIODriver *siop)
 Get and clears SIO error event flags.
sioevents_t sio_lld_get_and_clear_events (SIODriver *siop)
 Get and clears SIO event flags.
sioevents_t sio_lld_get_events (SIODriver *siop)
 Returns the pending SIO event flags.
size_t sio_lld_read (SIODriver *siop, uint8_t *buffer, size_t n)
 Reads data from the RX FIFO.
size_t sio_lld_write (SIODriver *siop, const uint8_t *buffer, size_t n)
 Writes data into the TX FIFO.
msg_t sio_lld_get (SIODriver *siop)
 Returns one frame from the RX FIFO.
void sio_lld_put (SIODriver *siop, uint_fast16_t data)
 Pushes one frame into the TX FIFO.
msg_t sio_lld_control (SIODriver *siop, unsigned int operation, void *arg)
 Control operation on a serial port.
void sio_lld_serve_interrupt (SIODriver *siop)
 Serves an UART interrupt.

Variables

static const struct sio_driver_vmt vmt
SIODriver SIOD1
 SIO1 driver identifier.

Macro Definition Documentation

◆ SIO_EV_RXNOTEMPY_POS

#define SIO_EV_RXNOTEMPY_POS   2 /* CHN_INPUT_AVAILABLE */

Definition at line 38 of file hal_sio.h.

◆ SIO_EV_TXNOTFULL_POS

#define SIO_EV_TXNOTFULL_POS   3 /* CHN_OUTPUT_EMPTY */

Definition at line 39 of file hal_sio.h.

◆ SIO_EV_TXDONE_POS

#define SIO_EV_TXDONE_POS   4 /* CHN_TRANSMISSION_END */

Definition at line 40 of file hal_sio.h.

◆ SIO_EV_ALL_ERRORS_POS

#define SIO_EV_ALL_ERRORS_POS   SIO_EV_PARITY_ERR_POS

Definition at line 41 of file hal_sio.h.

◆ SIO_EV_PARITY_ERR_POS

#define SIO_EV_PARITY_ERR_POS   5 /* CHN_PARITY_ERROR */

Definition at line 42 of file hal_sio.h.

◆ SIO_EV_FRAMING_ERR_POS

#define SIO_EV_FRAMING_ERR_POS   6 /* CHN_FRAMING_ERROR */

Definition at line 43 of file hal_sio.h.

◆ SIO_EV_NOISE_ERR_POS

#define SIO_EV_NOISE_ERR_POS   7 /* CHN_NOISE_ERROR */

Definition at line 44 of file hal_sio.h.

◆ SIO_EV_OVERRUN_ERR_POS

#define SIO_EV_OVERRUN_ERR_POS   8 /* CHN_OVERRUN_ERROR */

Definition at line 45 of file hal_sio.h.

◆ SIO_EV_RXIDLE_POS

#define SIO_EV_RXIDLE_POS   9 /* CHN_IDLE_DETECTED */

Definition at line 46 of file hal_sio.h.

◆ SIO_EV_RXBREAK_POS

#define SIO_EV_RXBREAK_POS   10 /* CHN_BREAK_DETECTED */

Definition at line 47 of file hal_sio.h.

◆ SIO_EV_NONE

#define SIO_EV_NONE   0U

Definition at line 56 of file hal_sio.h.

Referenced by sioStart().

◆ SIO_EV_RXNOTEMPY

#define SIO_EV_RXNOTEMPY   (1U << SIO_EV_RXNOTEMPY_POS)

Definition at line 57 of file hal_sio.h.

Referenced by __bsio_default_cb().

◆ SIO_EV_TXNOTFULL

#define SIO_EV_TXNOTFULL   (1U << SIO_EV_TXNOTFULL_POS)

Definition at line 58 of file hal_sio.h.

Referenced by __bsio_default_cb().

◆ SIO_EV_ALL_DATA

#define SIO_EV_ALL_DATA   (SIO_EV_RXNOTEMPY | SIO_EV_TXNOTFULL)

Definition at line 59 of file hal_sio.h.

Referenced by __bsio_default_cb().

◆ SIO_EV_TXDONE

#define SIO_EV_TXDONE   (1U << SIO_EV_TXDONE_POS)

Definition at line 60 of file hal_sio.h.

◆ SIO_EV_PARITY_ERR

#define SIO_EV_PARITY_ERR   (1U << SIO_EV_PARITY_ERR_POS)

Definition at line 61 of file hal_sio.h.

◆ SIO_EV_FRAMING_ERR

#define SIO_EV_FRAMING_ERR   (1U << SIO_EV_FRAMING_ERR_POS)

Definition at line 62 of file hal_sio.h.

◆ SIO_EV_NOISE_ERR

#define SIO_EV_NOISE_ERR   (1U << SIO_EV_NOISE_ERR_POS)

Definition at line 63 of file hal_sio.h.

◆ SIO_EV_OVERRUN_ERR

#define SIO_EV_OVERRUN_ERR   (1U << SIO_EV_OVERRUN_ERR_POS)

Definition at line 64 of file hal_sio.h.

◆ SIO_EV_RXIDLE

#define SIO_EV_RXIDLE   (1U << SIO_EV_RXIDLE_POS)

Definition at line 65 of file hal_sio.h.

◆ SIO_EV_RXBREAK

#define SIO_EV_RXBREAK   (1U << SIO_EV_RXBREAK_POS)

Definition at line 66 of file hal_sio.h.

◆ SIO_EV_ALL_ERRORS

#define SIO_EV_ALL_ERRORS
Value:
#define SIO_EV_RXBREAK
Definition hal_sio.h:66
#define SIO_EV_OVERRUN_ERR
Definition hal_sio.h:64
#define SIO_EV_NOISE_ERR
Definition hal_sio.h:63
#define SIO_EV_PARITY_ERR
Definition hal_sio.h:61
#define SIO_EV_FRAMING_ERR
Definition hal_sio.h:62

Definition at line 67 of file hal_sio.h.

◆ SIO_EV_ALL_EVENTS

#define SIO_EV_ALL_EVENTS
Value:
#define SIO_EV_ALL_DATA
Definition hal_sio.h:59
#define SIO_EV_RXIDLE
Definition hal_sio.h:65
#define SIO_EV_TXDONE
Definition hal_sio.h:60
#define SIO_EV_ALL_ERRORS
Definition hal_sio.h:67

Definition at line 72 of file hal_sio.h.

Referenced by bsioStart(), and sioStart().

◆ SIO_MSG_ERRORS

#define SIO_MSG_ERRORS   (msg_t)1

Definition at line 83 of file hal_sio.h.

Referenced by sioSynchronizeRX(), and sioSynchronizeRXIdle().

◆ SIO_DEFAULT_BITRATE

#define SIO_DEFAULT_BITRATE   38400

Default bit rate.

Configuration parameter, this is the baud rate selected for the default configuration.

Definition at line 100 of file hal_sio.h.

◆ SIO_USE_SYNCHRONIZATION

#define SIO_USE_SYNCHRONIZATION   TRUE

Support for thread synchronization API.

Definition at line 107 of file hal_sio.h.

◆ SIO_USE_STREAMS_INTERFACE

#define SIO_USE_STREAMS_INTERFACE   SIO_USE_SYNCHRONIZATION

Support for streams interfacwe.

Definition at line 114 of file hal_sio.h.

◆ _sio_driver_methods

#define _sio_driver_methods    _base_channel_methods

SIODriver specific methods.

Definition at line 179 of file hal_sio.h.

◆ sioSetCallbackX

#define sioSetCallbackX ( siop,
f )
Value:
(siop)->cb = (f)

Associates a callback to the SIO instance.

Parameters
[in]sioppointer to the SIODriver object
[in]fcallback to be associated

Definition at line 260 of file hal_sio.h.

Referenced by bsioStart().

◆ sioIsRXEmptyX

#define sioIsRXEmptyX ( siop)
Value:
#define sio_lld_is_rx_empty(siop)
Determines the state of the RX FIFO.
Definition hal_sio_lld.h:87

Determines the state of the RX FIFO.

Parameters
[in]sioppointer to the SIODriver object
Returns
The RX FIFO state.
Return values
falseif RX FIFO is not empty.
trueif RX FIFO is empty.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 272 of file hal_sio.h.

Referenced by __bsio_pop_data(), and sioSynchronizeRX().

◆ sioIsRXIdleX

#define sioIsRXIdleX ( siop)
Value:
#define sio_lld_is_rx_idle(siop)
Determines the activity state of the receiver.

Determines the activity state of the receiver.

Parameters
[in]sioppointer to the SIODriver object
Returns
The RX activity state.
Return values
falseif RX is in active state.
trueif RX is in idle state.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 284 of file hal_sio.h.

Referenced by sioSynchronizeRXIdle().

◆ sioHasRXErrorsX

#define sioHasRXErrorsX ( siop)
Value:
#define sio_lld_has_rx_errors(siop)
Determines if RX has pending error events to be read and cleared.

Determines if RX has pending errors to be read and cleared.

Note
Only errors are handled, data and idle events are not considered.
Parameters
[in]sioppointer to the SIODriver object
Returns
The RX error events.
Return values
falseif RX has no pending events.
trueif RX has pending events.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 297 of file hal_sio.h.

Referenced by sioSynchronizeRX(), and sioSynchronizeRXIdle().

◆ sioIsTXFullX

#define sioIsTXFullX ( siop)
Value:
#define sio_lld_is_tx_full(siop)
Determines the state of the TX FIFO.

Determines the state of the TX FIFO.

Parameters
[in]sioppointer to the SIODriver object
Returns
The TX FIFO state.
Return values
falseif TX FIFO is not full.
trueif TX FIFO is full.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 309 of file hal_sio.h.

Referenced by __bsio_push_data(), and sioSynchronizeTX().

◆ sioIsTXOngoingX

#define sioIsTXOngoingX ( siop)
Value:
#define sio_lld_is_tx_ongoing(siop)
Determines the transmission state.

Determines the transmission state.

Parameters
[in]sioppointer to the SIODriver object
Returns
The TX FIFO state.
Return values
falseif transmission is over.
trueif transmission is ongoing.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 321 of file hal_sio.h.

Referenced by sioSynchronizeTXEnd().

◆ sioWriteEnableFlagsX

#define sioWriteEnableFlagsX ( siop,
mask )
Value:
do { \
(siop)->enabled = (mask); \
sio_lld_update_enable_flags(siop); \
} while (false)

Writes the enabled events mask.

Parameters
[in]sioppointer to the SIODriver object
[in]maskenabled events mask to be written
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 331 of file hal_sio.h.

Referenced by bsioStart(), sioStart(), and sioWriteEnableFlags().

◆ sioSetEnableFlagsX

#define sioSetEnableFlagsX ( siop,
mask )
Value:
do { \
(siop)->enabled |= (mask); \
sio_lld_update_enable_flags(siop); \
} while (false)

Sets flags into the enabled events flags mask.

Parameters
[in]sioppointer to the SIODriver object
[in]maskenabled events mask to be set
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 344 of file hal_sio.h.

Referenced by sioSetEnableFlags().

◆ sioClearEnableFlagsX

#define sioClearEnableFlagsX ( siop,
mask )
Value:
do { \
(siop)->enabled &= ~(mask); \
sio_lld_update_enable_flags(siop); \
} while (false)

Clears flags from the enabled events flags mask.

Parameters
[in]sioppointer to the SIODriver object
[in]maskenabled events mask to be cleared
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 357 of file hal_sio.h.

Referenced by sioClearEnableFlags().

◆ sioGetEnableFlagsX

#define sioGetEnableFlagsX ( siop)
Value:
(siop)->enabled

Return the enabled condition flags mask.

Parameters
[in]sioppointer to the SIODriver object
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 369 of file hal_sio.h.

◆ sioGetAndClearErrorsX

#define sioGetAndClearErrorsX ( siop)
Value:
sioevents_t sio_lld_get_and_clear_errors(SIODriver *siop)
Get and clears SIO error event flags.

Get and clears SIO error event flags.

Parameters
[in]sioppointer to the SIODriver object
Returns
The pending error event flags.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 379 of file hal_sio.h.

Referenced by sioGetAndClearErrors().

◆ sioGetAndClearEventsX

#define sioGetAndClearEventsX ( siop)
Value:
sioevents_t sio_lld_get_and_clear_events(SIODriver *siop)
Get and clears SIO event flags.

Get and clears SIO event flags.

Parameters
[in]sioppointer to the SIODriver object
Returns
The pending event flags.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 389 of file hal_sio.h.

Referenced by __bsio_default_cb(), and sioGetAndClearEvents().

◆ sioGetEventsX

#define sioGetEventsX ( siop)
Value:
sioevents_t sio_lld_get_events(SIODriver *siop)
Returns the pending SIO event flags.

Returns the pending SIO event flags.

Parameters
[in]sioppointer to the SIODriver object
Returns
The pending event flags.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 399 of file hal_sio.h.

Referenced by sioGetEvents().

◆ sioGetX

#define sioGetX ( siop)
Value:
msg_t sio_lld_get(SIODriver *siop)
Returns one frame from the RX FIFO.

Returns one frame from the RX FIFO.

Note
If the FIFO is empty then the returned value is unpredictable.
Parameters
[in]sioppointer to the SIODriver object
Returns
The frame from RX FIFO.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 410 of file hal_sio.h.

Referenced by __bsio_pop_data(), __get(), and __gett().

◆ sioPutX

#define sioPutX ( siop,
data )
Value:
sio_lld_put(siop, data)
void sio_lld_put(SIODriver *siop, uint_fast16_t data)
Pushes one frame into the TX FIFO.

Pushes one frame into the TX FIFO.

Note
If the FIFO is full then the behavior is unpredictable.
Parameters
[in]sioppointer to the SIODriver object
[in]dataframe to be written
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 421 of file hal_sio.h.

Referenced by __bsio_push_data(), __put(), and __putt().

◆ sioAsyncReadX

#define sioAsyncReadX ( siop,
size,
buffer )
Value:
sio_lld_read(siop, size, buffer)
size_t sio_lld_read(SIODriver *siop, uint8_t *buffer, size_t n)
Reads data from the RX FIFO.

Reads data from the RX FIFO.

This function is non-blocking, data is read if present and the effective amount is returned.

Note
This function can be called from any context but it is meant to be called from the rxne_cb callback handler.
Parameters
[in]sioppointer to the SIODriver object
[in]sizemaximum number of frames to read
[in]bufferbuffer for the received data
Returns
The number of received frames.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 437 of file hal_sio.h.

Referenced by sioAsyncRead().

◆ sioAsyncWriteX

#define sioAsyncWriteX ( siop,
size,
buffer )
Value:
sio_lld_write(siop, size, buffer)
size_t sio_lld_write(SIODriver *siop, const uint8_t *buffer, size_t n)
Writes data into the TX FIFO.

Writes data into the TX FIFO.

This function is non-blocking, data is written if there is space in the FIFO and the effective amount is returned.

Note
This function can be called from any context but it is meant to be called from the txnf_cb callback handler.
Parameters
[in]sioppointer to the SIODriver object
[in]sizemaximum number of frames to read
[out]bufferbuffer containing the data to be transmitted
Returns
The number of transmitted frames.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 453 of file hal_sio.h.

Referenced by sioAsyncWrite().

◆ sioControlX

#define sioControlX ( siop,
operation,
arg )
Value:
sio_lld_control(siop, operation, arg)
msg_t sio_lld_control(SIODriver *siop, unsigned int operation, void *arg)
Control operation on a serial port.

Control operation on a serial port.

Parameters
[in]sioppointer to the SIODriver object
[in]operationcontrol operation code
[in,out]argoperation argument
Returns
The control operation status.
Return values
MSG_OKin case of success.
MSG_TIMEOUTin case of operation timeout.
MSG_RESETin case of operation reset.
Function Class:
This is an X-Class API, this function can be invoked from any context.

Definition at line 469 of file hal_sio.h.

Referenced by __bsio_ctl().

◆ __sio_callback

#define __sio_callback ( siop)
Value:
do { \
if ((siop)->cb != NULL) { \
(siop)->cb(siop); \
} \
} while (false)

SIO callback.

Parameters
[in]sioppointer to the SIODriver object
Function Class:
Not an API, this function is for internal use only.

Definition at line 482 of file hal_sio.h.

◆ __sio_wakeup_errors

#define __sio_wakeup_errors ( siop)
Value:
do { \
osalSysLockFromISR(); \
osalThreadResumeI(&(siop)->sync_rx, SIO_MSG_ERRORS); \
osalThreadResumeI(&(siop)->sync_rxidle, SIO_MSG_ERRORS); \
osalSysUnlockFromISR(); \
} while (false)
#define SIO_MSG_ERRORS
Definition hal_sio.h:83

Wakes up because RX errors.

Parameters
[in]sioppointer to the SIODriver object
Function Class:
Not an API, this function is for internal use only.

Definition at line 496 of file hal_sio.h.

◆ __sio_wakeup_rx

#define __sio_wakeup_rx ( siop)
Value:
do { \
osalSysLockFromISR(); \
osalThreadResumeI(&(siop)->sync_rx, MSG_OK); \
osalSysUnlockFromISR(); \
} while (false)
#define MSG_OK
Definition osal.h:56

Wakes up the RX-waiting thread.

Parameters
[in]sioppointer to the SIODriver object
Function Class:
Not an API, this function is for internal use only.

Definition at line 510 of file hal_sio.h.

◆ __sio_wakeup_rxidle

#define __sio_wakeup_rxidle ( siop)
Value:
do { \
osalSysLockFromISR(); \
osalThreadResumeI(&(siop)->sync_rxidle, MSG_OK); \
osalSysUnlockFromISR(); \
} while (false)

Wakes up the RX-idle-waiting thread.

Parameters
[in]sioppointer to the SIODriver object
Function Class:
Not an API, this function is for internal use only.

Definition at line 523 of file hal_sio.h.

◆ __sio_wakeup_tx

#define __sio_wakeup_tx ( siop)
Value:
do { \
osalSysLockFromISR(); \
osalThreadResumeI(&(siop)->sync_tx, MSG_OK); \
osalSysUnlockFromISR(); \
} while (false)

Wakes up the TX-waiting thread.

Parameters
[in]sioppointer to the SIODriver object
Function Class:
Not an API, this function is for internal use only.

Definition at line 536 of file hal_sio.h.

◆ __sio_wakeup_txend

#define __sio_wakeup_txend ( siop)
Value:
do { \
osalSysLockFromISR(); \
osalThreadResumeI(&(siop)->sync_txend, MSG_OK); \
osalSysUnlockFromISR(); \
} while (false)

Wakes up the TXend-waiting thread.

Parameters
[in]sioppointer to the SIODriver object
Function Class:
Not an API, this function is for internal use only.

Definition at line 549 of file hal_sio.h.

◆ __sio_reloc_field

#define __sio_reloc_field ( v,
m,
s,
d )
Value:
((((v) & m) >> (s)) << (d))

Relocates a bit field.

Parameters
[in]vvalue
[in]mmask of the bit field
[in]ssource bit offset
[in]ddestination bit offset

Definition at line 571 of file hal_sio.h.

◆ PLATFORM_SIO_USE_SIO1

#define PLATFORM_SIO_USE_SIO1   FALSE

SIO driver enable switch.

If set to TRUE the support for SIO1 is included.

Note
The default is FALSE.

Definition at line 48 of file hal_sio_lld.h.

◆ sio_lld_driver_fields

#define sio_lld_driver_fields    uint32_t dummy;

Low level fields of the SIO driver structure.

Definition at line 67 of file hal_sio_lld.h.

◆ sio_lld_config_fields

#define sio_lld_config_fields    uint32_t dummy;

Low level fields of the SIO configuration structure.

Definition at line 73 of file hal_sio_lld.h.

◆ sio_lld_is_rx_empty

#define sio_lld_is_rx_empty ( siop)
Value:
false

Determines the state of the RX FIFO.

Parameters
[in]sioppointer to the SIODriver object
Returns
The RX FIFO state.
Return values
falseif RX FIFO is not empty
trueif RX FIFO is empty
Function Class:
Not an API, this function is for internal use only.

Definition at line 87 of file hal_sio_lld.h.

◆ sio_lld_is_rx_idle

#define sio_lld_is_rx_idle ( siop)
Value:
false

Determines the activity state of the receiver.

Parameters
[in]sioppointer to the SIODriver object
Returns
The RX activity state.
Return values
falseif RX is in active state.
trueif RX is in idle state.
Function Class:
Not an API, this function is for internal use only.

Definition at line 100 of file hal_sio_lld.h.

◆ sio_lld_has_rx_errors

#define sio_lld_has_rx_errors ( siop)
Value:
false

Determines if RX has pending error events to be read and cleared.

Note
Only error and protocol errors are handled, data events are not considered.
Parameters
[in]sioppointer to the SIODriver object
Returns
The RX error events.
Return values
falseif RX has no pending events
trueif RX has pending events
Function Class:
Not an API, this function is for internal use only.

Definition at line 115 of file hal_sio_lld.h.

◆ sio_lld_is_tx_full

#define sio_lld_is_tx_full ( siop)
Value:
false

Determines the state of the TX FIFO.

Parameters
[in]sioppointer to the SIODriver object
Returns
The TX FIFO state.
Return values
falseif TX FIFO is not full
trueif TX FIFO is full
Function Class:
Not an API, this function is for internal use only.

Definition at line 128 of file hal_sio_lld.h.

◆ sio_lld_is_tx_ongoing

#define sio_lld_is_tx_ongoing ( siop)
Value:
false

Determines the transmission state.

Parameters
[in]sioppointer to the SIODriver object
Returns
The TX FIFO state.
Return values
falseif transmission is idle
trueif transmission is ongoing
Function Class:
Not an API, this function is for internal use only.

Definition at line 141 of file hal_sio_lld.h.

Typedef Documentation

◆ sioevents_t

Type of event flags.

Definition at line 133 of file hal_sio.h.

◆ SIODriver

typedef struct hal_sio_driver SIODriver

Type of structure representing a SIO driver.

Definition at line 138 of file hal_sio.h.

◆ SIOConfig

typedef struct hal_sio_config SIOConfig

Type of structure representing a SIO configuration.

Definition at line 143 of file hal_sio.h.

◆ siocb_t

typedef void(* siocb_t) (SIODriver *siop)

Generic SIO notification callback type.

Parameters
[in]sioppointer to the SIODriver object

Definition at line 150 of file hal_sio.h.

Enumeration Type Documentation

◆ siostate_t

enum siostate_t

Driver state machine possible states.

Enumerator
SIO_UNINIT 

Not initialized.

SIO_STOP 

Stopped.

SIO_READY 

Ready.

Definition at line 155 of file hal_sio.h.

Function Documentation

◆ sync_write()

size_t sync_write ( void * ip,
const uint8_t * bp,
size_t n,
sysinterval_t timeout )
static

Definition at line 46 of file hal_sio.c.

References MSG_OK, sioAsyncWrite(), and sioSynchronizeTX().

Referenced by __write(), and __writet().

Here is the call graph for this function:

◆ sync_read()

size_t sync_read ( void * ip,
uint8_t * bp,
size_t n,
sysinterval_t timeout )
static

Definition at line 68 of file hal_sio.c.

References MSG_OK, sioAsyncRead(), and sioSynchronizeRX().

Referenced by __read(), and __readt().

Here is the call graph for this function:

◆ __write()

size_t __write ( void * ip,
const uint8_t * bp,
size_t n )
static

Definition at line 95 of file hal_sio.c.

References sync_write(), and TIME_INFINITE.

Here is the call graph for this function:

◆ __read()

size_t __read ( void * ip,
uint8_t * bp,
size_t n )
static

Definition at line 100 of file hal_sio.c.

References sync_read(), and TIME_INFINITE.

Here is the call graph for this function:

◆ __put()

msg_t __put ( void * ip,
uint8_t b )
static

Definition at line 105 of file hal_sio.c.

References MSG_OK, sioPutX, sioSynchronizeTX(), and TIME_INFINITE.

Here is the call graph for this function:

◆ __get()

msg_t __get ( void * ip)
static

Definition at line 118 of file hal_sio.c.

References MSG_OK, sioGetX, sioSynchronizeRX(), and TIME_INFINITE.

Here is the call graph for this function:

◆ __putt()

msg_t __putt ( void * ip,
uint8_t b,
sysinterval_t timeout )
static

Definition at line 130 of file hal_sio.c.

References MSG_OK, sioPutX, and sioSynchronizeTX().

Here is the call graph for this function:

◆ __gett()

msg_t __gett ( void * ip,
sysinterval_t timeout )
static

Definition at line 143 of file hal_sio.c.

References MSG_OK, sioGetX, and sioSynchronizeRX().

Here is the call graph for this function:

◆ __writet()

size_t __writet ( void * ip,
const uint8_t * bp,
size_t n,
sysinterval_t timeout )
static

Definition at line 155 of file hal_sio.c.

References sync_write().

Here is the call graph for this function:

◆ __readt()

size_t __readt ( void * ip,
uint8_t * bp,
size_t n,
sysinterval_t timeout )
static

Definition at line 161 of file hal_sio.c.

References sync_read().

Here is the call graph for this function:

◆ __ctl()

msg_t __ctl ( void * ip,
unsigned int operation,
void * arg )
static

Definition at line 167 of file hal_sio.c.

References CHN_CTL_INVALID, CHN_CTL_NOP, HAL_RET_SUCCESS, HAL_RET_UNKNOWN_CTL, osalDbgCheck, and sio_lld_control().

Here is the call graph for this function:

◆ sioInit()

void sioInit ( void )

SIO Driver 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 204 of file hal_sio.c.

References sio_lld_init().

Referenced by halInit().

Here is the call graph for this function:

◆ sioObjectInit()

void sioObjectInit ( SIODriver * siop)

Initializes the standard part of a SIODriver structure.

Parameters
[out]sioppointer to the SIODriver object
Function Class:
Object or module nitializer function.

Definition at line 216 of file hal_sio.c.

References hal_sio_driver::arg, hal_sio_driver::cb, hal_sio_driver::config, hal_sio_driver::enabled, SIO_STOP, hal_sio_driver::state, hal_sio_driver::sync_rx, hal_sio_driver::sync_rxidle, hal_sio_driver::sync_tx, hal_sio_driver::sync_txend, hal_sio_driver::vmt, and vmt.

Referenced by sio_lld_init().

◆ sioStart()

msg_t sioStart ( SIODriver * siop,
const SIOConfig * config )

Configures and activates the SIO peripheral.

Parameters
[in]sioppointer to the SIODriver object
[in]configpointer to the SIOConfig object, can be NULL if the default configuration is desired
Returns
The operation status.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 249 of file hal_sio.c.

References hal_sio_driver::config, HAL_RET_SUCCESS, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), SIO_EV_ALL_EVENTS, SIO_EV_NONE, sio_lld_start(), SIO_READY, SIO_STOP, sioWriteEnableFlagsX, and hal_sio_driver::state.

Referenced by bsioStart().

Here is the call graph for this function:

◆ sioStop()

void sioStop ( SIODriver * siop)

Deactivates the SIO peripheral.

Parameters
[in]sioppointer to the SIODriver object
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 292 of file hal_sio.c.

References hal_sio_driver::arg, hal_sio_driver::cb, hal_sio_driver::config, MSG_RESET, osalDbgAssert, osalDbgCheck, osalOsRescheduleS(), osalSysLock(), osalSysUnlock(), osalThreadResumeI(), sio_lld_stop(), SIO_READY, SIO_STOP, hal_sio_driver::state, hal_sio_driver::sync_rx, hal_sio_driver::sync_rxidle, hal_sio_driver::sync_tx, and hal_sio_driver::sync_txend.

Referenced by bsioStop().

Here is the call graph for this function:

◆ sioWriteEnableFlags()

void sioWriteEnableFlags ( SIODriver * siop,
sioevents_t mask )

Writes the enabled events flags mask.

Parameters
[in]sioppointer to the SIODriver object
[in]maskenabled events mask to be written
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 327 of file hal_sio.c.

References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), SIO_READY, sioWriteEnableFlagsX, and hal_sio_driver::state.

Here is the call graph for this function:

◆ sioSetEnableFlags()

void sioSetEnableFlags ( SIODriver * siop,
sioevents_t mask )

Sets flags into the enabled events flags mask.

Parameters
[in]sioppointer to the SIODriver object
[in]maskenabled events mask to be set
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 348 of file hal_sio.c.

References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), SIO_READY, sioSetEnableFlagsX, and hal_sio_driver::state.

Here is the call graph for this function:

◆ sioClearEnableFlags()

void sioClearEnableFlags ( SIODriver * siop,
sioevents_t mask )

Clears flags from the enabled events flags mask.

Parameters
[in]sioppointer to the SIODriver object
[in]maskenabled events mask to be cleared
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 369 of file hal_sio.c.

References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), SIO_READY, sioClearEnableFlagsX, and hal_sio_driver::state.

Here is the call graph for this function:

◆ sioGetAndClearErrors()

sioevents_t sioGetAndClearErrors ( SIODriver * siop)

Get and clears SIO error event flags.

Parameters
[in]sioppointer to the SIODriver object
Returns
The pending error event flags.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 390 of file hal_sio.c.

References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), SIO_READY, sioGetAndClearErrorsX, and hal_sio_driver::state.

Here is the call graph for this function:

◆ sioGetAndClearEvents()

sioevents_t sioGetAndClearEvents ( SIODriver * siop)

Get and clears SIO event flags.

Parameters
[in]sioppointer to the SIODriver object
Returns
The pending event flags.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 414 of file hal_sio.c.

References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), SIO_READY, sioGetAndClearEventsX, and hal_sio_driver::state.

Here is the call graph for this function:

◆ sioGetEvents()

sioevents_t sioGetEvents ( SIODriver * siop)

Returns the pending SIO event flags.

Parameters
[in]sioppointer to the SIODriver object
Returns
The pending event flags.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 438 of file hal_sio.c.

References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), SIO_READY, sioGetEventsX, and hal_sio_driver::state.

Here is the call graph for this function:

◆ sioAsyncRead()

size_t sioAsyncRead ( SIODriver * siop,
uint8_t * buffer,
size_t n )

Reads data from the RX FIFO.

This function is non-blocking, data is read if present and the effective amount is returned.

Note
This function can be called from any context but it is meant to be called from the rxne_cb callback handler.
Parameters
[in]sioppointer to the SIODriver object
[in]bufferbuffer for the received data
[in]nmaximum number of frames to read
Returns
The number of received frames.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 468 of file hal_sio.c.

References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), SIO_READY, sioAsyncReadX, and hal_sio_driver::state.

Referenced by sync_read().

Here is the call graph for this function:

◆ sioAsyncWrite()

size_t sioAsyncWrite ( SIODriver * siop,
const uint8_t * buffer,
size_t n )

Writes data into the TX FIFO.

This function is non-blocking, data is written if there is space in the FIFO and the effective amount is returned.

Note
This function can be called from any context but it is meant to be called from the txnf_cb callback handler.
Parameters
[in]sioppointer to the SIODriver object
[out]bufferbuffer containing the data to be transmitted
[in]nmaximum number of frames to read
Returns
The number of transmitted frames.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 497 of file hal_sio.c.

References osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), SIO_READY, sioAsyncWriteX, and hal_sio_driver::state.

Referenced by sync_write().

Here is the call graph for this function:

◆ sioSynchronizeRX()

msg_t sioSynchronizeRX ( SIODriver * siop,
sysinterval_t timeout )

Synchronizes with RX FIFO data availability.

Note
The exact behavior depends on low level FIFO settings such as thresholds, etc.
This function can only be called by a single thread at time.
Parameters
[in]sioppointer to an SIODriver structure
[in]timeoutsynchronization timeout
Returns
The synchronization result.
Return values
MSG_OKif there is data in the RX FIFO.
MSG_TIMEOUTif synchronization timed out.
MSG_RESETit the operation has been stopped while waiting.
SIO_MSG_ERRORSif RX errors occurred before or during wait.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 529 of file hal_sio.c.

References MSG_OK, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), osalThreadSuspendTimeoutS(), SIO_MSG_ERRORS, SIO_READY, sioHasRXErrorsX, sioIsRXEmptyX, hal_sio_driver::state, and hal_sio_driver::sync_rx.

Referenced by __get(), __gett(), and sync_read().

Here is the call graph for this function:

◆ sioSynchronizeRXIdle()

msg_t sioSynchronizeRXIdle ( SIODriver * siop,
sysinterval_t timeout )

Synchronizes with RX going idle.

Note
This function can only be called by a single thread at time.
Parameters
[in]sioppointer to an SIODriver structure
[in]timeoutsynchronization timeout
Returns
The synchronization result.
Return values
MSG_OKif RW went idle.
MSG_TIMEOUTif synchronization timed out.
MSG_RESETit the operation has been stopped while waiting.
SIO_MSG_ERRORSif RX errors occurred before or during wait.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 574 of file hal_sio.c.

References MSG_OK, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), osalThreadSuspendTimeoutS(), SIO_MSG_ERRORS, SIO_READY, sioHasRXErrorsX, sioIsRXIdleX, hal_sio_driver::state, and hal_sio_driver::sync_rxidle.

Here is the call graph for this function:

◆ sioSynchronizeTX()

msg_t sioSynchronizeTX ( SIODriver * siop,
sysinterval_t timeout )

Synchronizes with TX FIFO space availability.

Note
The exact behavior depends on low level FIFO settings such as thresholds, etc.
This function can only be called by a single thread at time.
Parameters
[in]sioppointer to an SIODriver structure
[in]timeoutsynchronization timeout
Returns
The synchronization result.
Return values
MSG_OKif there is space in the TX FIFO.
MSG_TIMEOUTif synchronization timed out.
MSG_RESEToperation has been stopped while waiting.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 621 of file hal_sio.c.

References MSG_OK, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), osalThreadSuspendTimeoutS(), SIO_READY, sioIsTXFullX, hal_sio_driver::state, and hal_sio_driver::sync_tx.

Referenced by __put(), __putt(), and sync_write().

Here is the call graph for this function:

◆ sioSynchronizeTXEnd()

msg_t sioSynchronizeTXEnd ( SIODriver * siop,
sysinterval_t timeout )

Synchronizes with TX completion.

Note
This function can only be called by a single thread at time.
Parameters
[in]sioppointer to an SIODriver structure
[in]timeoutsynchronization timeout
Returns
The synchronization result.
Return values
MSG_OKif TX operation finished.
MSG_TIMEOUTif synchronization timed out.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 659 of file hal_sio.c.

References MSG_OK, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), osalThreadSuspendTimeoutS(), SIO_READY, sioIsTXOngoingX, hal_sio_driver::state, and hal_sio_driver::sync_txend.

Here is the call graph for this function:

◆ sio_lld_init()

void sio_lld_init ( void )

Low level SIO driver initialization.

Function Class:
Not an API, this function is for internal use only.

Definition at line 65 of file hal_sio_lld.c.

References SIOD1, and sioObjectInit().

Referenced by sioInit().

Here is the call graph for this function:

◆ sio_lld_start()

msg_t sio_lld_start ( SIODriver * siop)

Configures and activates the SIO peripheral.

Parameters
[in]sioppointer to the SIODriver object
Returns
The operation status.
Function Class:
Not an API, this function is for internal use only.

Definition at line 81 of file hal_sio_lld.c.

References HAL_RET_IS_INVALID, HAL_RET_SUCCESS, osalDbgAssert, SIO_STOP, SIOD1, and hal_sio_driver::state.

Referenced by sioStart().

◆ sio_lld_stop()

void sio_lld_stop ( SIODriver * siop)

Deactivates the SIO peripheral.

Parameters
[in]sioppointer to the SIODriver object
Function Class:
Not an API, this function is for internal use only.

Definition at line 114 of file hal_sio_lld.c.

References SIO_READY, SIOD1, and hal_sio_driver::state.

Referenced by sioStop().

◆ sio_lld_update_enable_flags()

void sio_lld_update_enable_flags ( SIODriver * siop)

Enable flags change notification.

Parameters
[in]sioppointer to the SIODriver object

Definition at line 133 of file hal_sio_lld.c.

◆ sio_lld_get_and_clear_errors()

sioevents_t sio_lld_get_and_clear_errors ( SIODriver * siop)

Get and clears SIO error event flags.

Parameters
[in]sioppointer to the SIODriver object
Returns
The pending event flags.
Function Class:
Not an API, this function is for internal use only.

Definition at line 146 of file hal_sio_lld.c.

◆ sio_lld_get_and_clear_events()

sioevents_t sio_lld_get_and_clear_events ( SIODriver * siop)

Get and clears SIO event flags.

Parameters
[in]sioppointer to the SIODriver object
Returns
The pending event flags.
Function Class:
Not an API, this function is for internal use only.

Definition at line 162 of file hal_sio_lld.c.

◆ sio_lld_get_events()

sioevents_t sio_lld_get_events ( SIODriver * siop)

Returns the pending SIO event flags.

Parameters
[in]sioppointer to the SIODriver object
Returns
The pending event flags.
Function Class:
Not an API, this function is for internal use only.

Definition at line 178 of file hal_sio_lld.c.

◆ sio_lld_read()

size_t sio_lld_read ( SIODriver * siop,
uint8_t * buffer,
size_t n )

Reads data from the RX FIFO.

The function is not blocking, it writes frames until there is space available without waiting.

Parameters
[in]sioppointer to an SIODriver structure
[in]bufferpointer to the buffer for read frames
[in]nmaximum number of frames to be read
Returns
The number of frames copied from the buffer.
Return values
0if the TX FIFO is full.

Definition at line 197 of file hal_sio_lld.c.

◆ sio_lld_write()

size_t sio_lld_write ( SIODriver * siop,
const uint8_t * buffer,
size_t n )

Writes data into the TX FIFO.

The function is not blocking, it writes frames until there is space available without waiting.

Parameters
[in]sioppointer to an SIODriver structure
[in]bufferpointer to the buffer for read frames
[in]nmaximum number of frames to be written
Returns
The number of frames copied from the buffer.
Return values
0if the TX FIFO is full.

Definition at line 216 of file hal_sio_lld.c.

◆ sio_lld_get()

msg_t sio_lld_get ( SIODriver * siop)

Returns one frame from the RX FIFO.

Note
If the FIFO is empty then the returned value is unpredictable.
Parameters
[in]sioppointer to the SIODriver object
Returns
The frame from RX FIFO.
Function Class:
Not an API, this function is for internal use only.

Definition at line 233 of file hal_sio_lld.c.

◆ sio_lld_put()

void sio_lld_put ( SIODriver * siop,
uint_fast16_t data )

Pushes one frame into the TX FIFO.

Note
If the FIFO is full then the behavior is unpredictable.
Parameters
[in]sioppointer to the SIODriver object
[in]dataframe to be written
Function Class:
Not an API, this function is for internal use only.

Definition at line 250 of file hal_sio_lld.c.

◆ sio_lld_control()

msg_t sio_lld_control ( SIODriver * siop,
unsigned int operation,
void * arg )

Control operation on a serial port.

Parameters
[in]sioppointer to the SIODriver object
[in]operationcontrol operation code
[in,out]argoperation argument
Returns
The control operation status.
Return values
MSG_OKin case of success.
MSG_TIMEOUTin case of operation timeout.
MSG_RESETin case of operation reset.
Function Class:
Not an API, this function is for internal use only.

Definition at line 270 of file hal_sio_lld.c.

References MSG_OK.

Referenced by __ctl().

◆ sio_lld_serve_interrupt()

void sio_lld_serve_interrupt ( SIODriver * siop)

Serves an UART interrupt.

Parameters
[in]sioppointer to the SIODriver object
Function Class:
Not an API, this function is for internal use only.

Definition at line 286 of file hal_sio_lld.c.

Variable Documentation

◆ vmt

const struct sio_driver_vmt vmt
static
Initial value:
= {
(size_t)0,
}
static msg_t __put(void *ip, uint8_t b)
Definition hal_sio.c:105
static size_t __writet(void *ip, const uint8_t *bp, size_t n, sysinterval_t timeout)
Definition hal_sio.c:155
static size_t __read(void *ip, uint8_t *bp, size_t n)
Definition hal_sio.c:100
static msg_t __gett(void *ip, sysinterval_t timeout)
Definition hal_sio.c:143
static size_t __readt(void *ip, uint8_t *bp, size_t n, sysinterval_t timeout)
Definition hal_sio.c:161
static msg_t __ctl(void *ip, unsigned int operation, void *arg)
Definition hal_sio.c:167
static size_t __write(void *ip, const uint8_t *bp, size_t n)
Definition hal_sio.c:95
static msg_t __get(void *ip)
Definition hal_sio.c:118
static msg_t __putt(void *ip, uint8_t b, sysinterval_t timeout)
Definition hal_sio.c:130

Definition at line 185 of file hal_sio.c.

◆ SIOD1

SIODriver SIOD1

SIO1 driver identifier.

Definition at line 41 of file hal_sio_lld.c.

Referenced by sio_lld_init(), sio_lld_start(), and sio_lld_stop().