Go to the documentation of this file.
28 #if (HAL_USE_SIO == TRUE) || defined(__DOXYGEN__)
38 #define SIO_NO_ERROR 0
39 #define SIO_PARITY_ERROR 4
40 #define SIO_FRAMING_ERROR 8
41 #define SIO_OVERRUN_ERROR 16
42 #define SIO_NOISE_ERROR 32
43 #define SIO_BREAK_DETECTED 64
50 #define SIO_MSG_IDLE 1
51 #define SIO_MSG_ERRORS 2
67 #if !defined(SIO_DEFAULT_BITRATE) || defined(__DOXYGEN__)
68 #define SIO_DEFAULT_BITRATE 38400
74 #if !defined(SIO_USE_SYNCHRONIZATION) || defined(__DOXYGEN__)
75 #define SIO_USE_SYNCHRONIZATION TRUE
133 sio_lld_config_fields;
139 #define _sio_driver_methods \
140 _base_channel_methods
157 #if (SIO_USE_SYNCHRONIZATION == TRUE) || defined(__DOXYGEN__)
175 #if (SIO_USE_SYNCHRONIZATION == TRUE) || defined(__DOXYGEN__)
189 #if defined(SIO_DRIVER_EXT_FIELDS)
190 SIO_DRIVER_EXT_FIELDS
234 #define sioGetFlagsX(siop) sio_lld_get_flags(siop)
246 #define sioIsRXEmptyX(siop) sio_lld_is_rx_empty(siop)
258 #define sioIsTXFullX(siop) sio_lld_is_tx_full(siop)
268 #define sioGetAndClearEventsI(siop) sio_lld_get_and_clear_events(siop)
279 #define sioGetX(siop) sio_lld_get(siop)
290 #define sioPutX(siop, data) sio_lld_put(siop, data)
306 #define sioAsyncReadI(siop, size, buffer) sio_lld_read(siop, size, buffer)
322 #define sioAsyncWriteI(siop, size, buffer) sio_lld_write(siop, size, buffer)
338 #define sioControlX(siop, operation, arg) sio_lld_control(siop, operation, arg)
351 #define __sio_callback_rx(siop) { \
352 if ((siop)->operation->rx_cb != NULL) { \
353 (siop)->operation->rx_cb(siop); \
364 #define __sio_callback_rx_idle(siop) { \
365 if ((siop)->operation->rx_idle_cb != NULL) { \
366 (siop)->operation->rx_idle_cb(siop); \
377 #define __sio_callback_tx(siop) { \
378 if ((siop)->operation->tx_cb != NULL) { \
379 (siop)->operation->tx_cb(siop); \
390 #define __sio_callback_tx_end(siop) { \
391 if ((siop)->operation->tx_end_cb != NULL) { \
392 (siop)->operation->tx_end_cb(siop); \
403 #define __sio_callback_rx_evt(siop) { \
404 if ((siop)->operation->rx_evt_cb != NULL) { \
405 (siop)->operation->rx_evt_cb(siop); \
409 #if (SIO_USE_SYNCHRONIZATION == TRUE) || defined(__DOXYGEN__)
418 #define __sio_wakeup_rx(siop, msg) { \
419 osalSysLockFromISR(); \
420 osalThreadResumeI(&(siop)->sync_rx, msg); \
421 osalSysUnlockFromISR(); \
432 #define __sio_wakeup_tx(siop, msg) { \
433 osalSysLockFromISR(); \
434 osalThreadResumeI(&(siop)->sync_tx, msg); \
435 osalSysUnlockFromISR(); \
446 #define __sio_wakeup_txend(siop, msg) { \
447 osalSysLockFromISR(); \
448 osalThreadResumeI(&(siop)->sync_txend, msg); \
449 osalSysUnlockFromISR(); \
452 #define __sio_wakeup_rx(siop, msg)
453 #define __sio_wakeup_tx(siop, msg)
454 #define __sio_wakeup_txend(siop, msg)
474 #if (SIO_USE_SYNCHRONIZATION == TRUE) || defined(__DOXYGEN__)
#define sio_lld_driver_fields
Low level fields of the SIO driver structure.
siocb_t rx_evt_cb
Receive event callback.
thread_reference_t sync_tx
Synchronization point for TX.
void sioStop(SIODriver *siop)
Deactivates the SIO peripheral.
size_t sioAsyncRead(SIODriver *siop, uint8_t *buffer, size_t n)
Reads data from the RX FIFO.
void sioStartOperation(SIODriver *siop, const SIOOperation *operation)
Starts a SIO operation.
siocb_t rx_idle_cb
Receive idle callback.
const SIOOperation * operation
Current configuration data.
#define _sio_driver_methods
SIODriver specific methods.
bool sioStart(SIODriver *siop, const SIOConfig *config)
Configures and activates the SIO peripheral.
msg_t sioSynchronizeRX(SIODriver *siop, sysinterval_t timeout)
Synchronizes with RX FIFO data availability.
const SIOConfig * config
Current configuration data.
Structure representing a SIO operation.
Structure representing a thread.
thread_reference_t sync_txend
Synchronization point for TX-end.
siocb_t tx_end_cb
Physical end of transmission callback.
void sioObjectInit(SIODriver *siop)
Initializes the standard part of a SIODriver structure.
Driver configuration structure.
msg_t sioSynchronizeTX(SIODriver *siop, sysinterval_t timeout)
Synchronizes with TX FIFO space availability.
uint_fast8_t sioflags_t
SIO driver condition flags type.
siostate_t
Driver state machine possible states.
siostate_t state
Driver state.
uint64_t sysinterval_t
Type of time interval.
msg_t sioSynchronizeTXEnd(SIODriver *siop, sysinterval_t timeout)
Synchronizes with TX completion.
void sioStopOperation(SIODriver *siop)
Stops an ongoing SIO operation, if any.
const struct sio_driver_vmt * vmt
Virtual Methods Table.
size_t sioAsyncWrite(SIODriver *siop, const uint8_t *buffer, size_t n)
Writes data into the TX FIFO.
siocb_t tx_cb
Transmission buffer non-full callback.
void sioInit(void)
SIO Driver initialization.
siocb_t rx_cb
Receive non-empty callback.
PLATFORM SIO subsystem low level driver header.
Structure representing a SIO driver.
SIODriver virtual methods table.
thread_reference_t sync_rx
Synchronization point for RX.
sio_events_mask_t sioGetAndClearEvents(SIODriver *siop)
Return the pending SIO events flags.
void(* siocb_t)(SIODriver *siop)
Generic SIO notification callback type.
uint32_t sio_events_mask_t
Type of a SIO events mask.