ChibiOS  21.6.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...
 
struct  hal_sio_operation
 Structure representing a SIO operation. More...
 

Macros

#define _sio_driver_methods   _base_channel_methods
 SIODriver specific methods. More...
 
#define sioGetFlagsX(siop)   sio_lld_get_flags(siop)
 Returns the current set of flags and clears it. More...
 
#define sioIsRXEmptyX(siop)   sio_lld_is_rx_empty(siop)
 Determines the state of the RX FIFO. More...
 
#define sioIsTXFullX(siop)   sio_lld_is_tx_full(siop)
 Determines the state of the TX FIFO. More...
 
#define sioGetAndClearEventsI(siop)   sio_lld_get_and_clear_events(siop)
 Return the pending SIO events flags. More...
 
#define sioGetX(siop)   sio_lld_get(siop)
 Returns one frame from the RX FIFO. More...
 
#define sioPutX(siop, data)   sio_lld_put(siop, data)
 Pushes one frame into the TX FIFO. More...
 
#define sioAsyncReadI(siop, size, buffer)   sio_lld_read(siop, size, buffer)
 Reads data from the RX FIFO. More...
 
#define sioAsyncWriteI(siop, size, buffer)   sio_lld_write(siop, size, buffer)
 Writes data into the TX FIFO. More...
 
#define sioControlX(siop, operation, arg)   sio_lld_control(siop, operation, arg)
 Control operation on a serial port. More...
 
SIO status flags
#define SIO_NO_ERROR   0
 No pending conditions.
More...
 
#define SIO_PARITY_ERROR   4
 Parity error happened.
More...
 
#define SIO_FRAMING_ERROR   8
 Framing error happened.
More...
 
#define SIO_OVERRUN_ERROR   16
 Overflow happened.
More...
 
#define SIO_NOISE_ERROR   32
 Noise on the line.
More...
 
#define SIO_BREAK_DETECTED   64
 Break detected.
More...
 
SIO additional messages
#define SIO_MSG_IDLE   1
 
#define SIO_MSG_ERRORS   2
 
SIO configuration options
#define SIO_DEFAULT_BITRATE   38400
 Default bit rate. More...
 
#define SIO_USE_SYNCHRONIZATION   TRUE
 Support for thread synchronization API. More...
 
Low level driver helper macros
#define __sio_callback_rx(siop)
 RX callback. More...
 
#define __sio_callback_rx_idle(siop)
 RX idle callback. More...
 
#define __sio_callback_tx(siop)
 TX callback. More...
 
#define __sio_callback_tx_end(siop)
 TX end callback. More...
 
#define __sio_callback_rx_evt(siop)
 RX event callback. More...
 
#define __sio_wakeup_rx(siop, msg)
 Wakes up the RX-waiting thread. More...
 
#define __sio_wakeup_tx(siop, msg)
 Wakes up the TX-waiting thread. More...
 
#define __sio_wakeup_txend(siop, msg)
 Wakes up the TXend-waiting thread. More...
 

Typedefs

typedef uint_fast8_t sioflags_t
 SIO driver condition flags type. More...
 
typedef struct hal_sio_driver SIODriver
 Type of structure representing a SIO driver. More...
 
typedef struct hal_sio_config SIOConfig
 Type of structure representing a SIO configuration. More...
 
typedef struct hal_sio_operation SIOOperation
 Type of structure representing a SIO operation. More...
 
typedef void(* siocb_t) (SIODriver *siop)
 Generic SIO notification callback type. More...
 

Enumerations

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

Functions

void sioInit (void)
 SIO Driver initialization. More...
 
void sioObjectInit (SIODriver *siop)
 Initializes the standard part of a SIODriver structure. More...
 
bool sioStart (SIODriver *siop, const SIOConfig *config)
 Configures and activates the SIO peripheral. More...
 
void sioStop (SIODriver *siop)
 Deactivates the SIO peripheral. More...
 
void sioStartOperation (SIODriver *siop, const SIOOperation *operation)
 Starts a SIO operation. More...
 
void sioStopOperation (SIODriver *siop)
 Stops an ongoing SIO operation, if any. More...
 
sio_events_mask_t sioGetAndClearEvents (SIODriver *siop)
 Return the pending SIO events flags. More...
 
size_t sioAsyncRead (SIODriver *siop, uint8_t *buffer, size_t n)
 Reads data from the RX FIFO. More...
 
size_t sioAsyncWrite (SIODriver *siop, const uint8_t *buffer, size_t n)
 Writes data into the TX FIFO. More...
 
msg_t sioSynchronizeRX (SIODriver *siop, sysinterval_t timeout)
 Synchronizes with RX FIFO data availability. More...
 
msg_t sioSynchronizeTX (SIODriver *siop, sysinterval_t timeout)
 Synchronizes with TX FIFO space availability. More...
 
msg_t sioSynchronizeTXEnd (SIODriver *siop, sysinterval_t timeout)
 Synchronizes with TX completion. More...
 

Detailed Description

SIO Driver macros and structures.

Definition in file hal_sio.h.