ChibiOS/HAL 9.0.0
hal_sio.h File Reference

SIO Driver macros and structures. More...

#include "hal_sio_lld.h"

Go to the source code of this file.

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

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

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.

Detailed Description

SIO Driver macros and structures.

Definition in file hal_sio.h.