28#if (HAL_USE_SIO == TRUE) || defined(__DOXYGEN__)
38#define SIO_EV_RXNOTEMPY_POS 2
39#define SIO_EV_TXNOTFULL_POS 3
40#define SIO_EV_TXDONE_POS 4
41#define SIO_EV_ALL_ERRORS_POS SIO_EV_PARITY_ERR_POS
42#define SIO_EV_PARITY_ERR_POS 5
43#define SIO_EV_FRAMING_ERR_POS 6
44#define SIO_EV_NOISE_ERR_POS 7
45#define SIO_EV_OVERRUN_ERR_POS 8
46#define SIO_EV_RXIDLE_POS 9
47#define SIO_EV_RXBREAK_POS 10
57#define SIO_EV_RXNOTEMPY (1U << SIO_EV_RXNOTEMPY_POS)
58#define SIO_EV_TXNOTFULL (1U << SIO_EV_TXNOTFULL_POS)
59#define SIO_EV_ALL_DATA (SIO_EV_RXNOTEMPY | SIO_EV_TXNOTFULL)
60#define SIO_EV_TXDONE (1U << SIO_EV_TXDONE_POS)
61#define SIO_EV_PARITY_ERR (1U << SIO_EV_PARITY_ERR_POS)
62#define SIO_EV_FRAMING_ERR (1U << SIO_EV_FRAMING_ERR_POS)
63#define SIO_EV_NOISE_ERR (1U << SIO_EV_NOISE_ERR_POS)
64#define SIO_EV_OVERRUN_ERR (1U << SIO_EV_OVERRUN_ERR_POS)
65#define SIO_EV_RXIDLE (1U << SIO_EV_RXIDLE_POS)
66#define SIO_EV_RXBREAK (1U << SIO_EV_RXBREAK_POS)
67#define SIO_EV_ALL_ERRORS (SIO_EV_PARITY_ERR | \
68 SIO_EV_FRAMING_ERR | \
69 SIO_EV_OVERRUN_ERR | \
72#define SIO_EV_ALL_EVENTS (SIO_EV_ALL_DATA | \
83#define SIO_MSG_ERRORS (msg_t)1
99#if !defined(SIO_DEFAULT_BITRATE) || defined(__DOXYGEN__)
100#define SIO_DEFAULT_BITRATE 38400
106#if !defined(SIO_USE_SYNCHRONIZATION) || defined(__DOXYGEN__)
107#define SIO_USE_SYNCHRONIZATION TRUE
113#if !defined(SIO_USE_STREAMS_INTERFACE) || defined(__DOXYGEN__)
114#define SIO_USE_STREAMS_INTERFACE SIO_USE_SYNCHRONIZATION
122#if (SIO_USE_STREAMS_INTERFACE == TRUE) && (SIO_USE_SYNCHRONIZATION == FALSE)
123#error "SIO_USE_STREAMS_INTERFACE requires SIO_USE_SYNCHRONIZATION"
171#if defined(SIO_CONFIG_EXT_FIELS)
172 SIO_CONFIG_EXT_FIELDS
179#define _sio_driver_methods \
180 _base_channel_methods
197#if (SIO_USE_STREAMS_INTERFACE == TRUE) || defined(__DOXYGEN__)
225#if (SIO_USE_SYNCHRONIZATION == TRUE) || defined(__DOXYGEN__)
243#if defined(SIO_DRIVER_EXT_FIELS)
244 SIO_DRIVER_EXT_FIELDS
260#define sioSetCallbackX(siop, f) (siop)->cb = (f)
272#define sioIsRXEmptyX(siop) sio_lld_is_rx_empty(siop)
284#define sioIsRXIdleX(siop) sio_lld_is_rx_idle(siop)
297#define sioHasRXErrorsX(siop) sio_lld_has_rx_errors(siop)
309#define sioIsTXFullX(siop) sio_lld_is_tx_full(siop)
321#define sioIsTXOngoingX(siop) sio_lld_is_tx_ongoing(siop)
331#define sioWriteEnableFlagsX(siop, mask) do { \
332 (siop)->enabled = (mask); \
333 sio_lld_update_enable_flags(siop); \
344#define sioSetEnableFlagsX(siop, mask) do { \
345 (siop)->enabled |= (mask); \
346 sio_lld_update_enable_flags(siop); \
357#define sioClearEnableFlagsX(siop, mask) do { \
358 (siop)->enabled &= ~(mask); \
359 sio_lld_update_enable_flags(siop); \
369#define sioGetEnableFlagsX(siop) (siop)->enabled
379#define sioGetAndClearErrorsX(siop) sio_lld_get_and_clear_errors(siop)
389#define sioGetAndClearEventsX(siop) sio_lld_get_and_clear_events(siop)
399#define sioGetEventsX(siop) sio_lld_get_events(siop)
410#define sioGetX(siop) sio_lld_get(siop)
421#define sioPutX(siop, data) sio_lld_put(siop, data)
437#define sioAsyncReadX(siop, size, buffer) sio_lld_read(siop, size, buffer)
453#define sioAsyncWriteX(siop, size, buffer) sio_lld_write(siop, size, buffer)
469#define sioControlX(siop, operation, arg) sio_lld_control(siop, operation, arg)
482#define __sio_callback(siop) do { \
483 if ((siop)->cb != NULL) { \
488#if (SIO_USE_SYNCHRONIZATION == TRUE) || defined(__DOXYGEN__)
496#define __sio_wakeup_errors(siop) do { \
497 osalSysLockFromISR(); \
498 osalThreadResumeI(&(siop)->sync_rx, SIO_MSG_ERRORS); \
499 osalThreadResumeI(&(siop)->sync_rxidle, SIO_MSG_ERRORS); \
500 osalSysUnlockFromISR(); \
510#define __sio_wakeup_rx(siop) do { \
511 osalSysLockFromISR(); \
512 osalThreadResumeI(&(siop)->sync_rx, MSG_OK); \
513 osalSysUnlockFromISR(); \
523#define __sio_wakeup_rxidle(siop) do { \
524 osalSysLockFromISR(); \
525 osalThreadResumeI(&(siop)->sync_rxidle, MSG_OK); \
526 osalSysUnlockFromISR(); \
536#define __sio_wakeup_tx(siop) do { \
537 osalSysLockFromISR(); \
538 osalThreadResumeI(&(siop)->sync_tx, MSG_OK); \
539 osalSysUnlockFromISR(); \
549#define __sio_wakeup_txend(siop) do { \
550 osalSysLockFromISR(); \
551 osalThreadResumeI(&(siop)->sync_txend, MSG_OK); \
552 osalSysUnlockFromISR(); \
555#define __sio_wakeup_errors(siop)
556#define __sio_wakeup_rx(siop)
557#define __sio_wakeup_rxidle(siop)
558#define __sio_wakeup_tx(siop)
559#define __sio_wakeup_txend(siop)
571#define __sio_reloc_field(v, m, s, d) ((((v) & m) >> (s)) << (d))
592#if (SIO_USE_SYNCHRONIZATION == TRUE) || defined(__DOXYGEN__)
uint32_t eventflags_t
Type of an event flags mask.
int32_t msg_t
Type of a message.
uint32_t sysinterval_t
Type of system time interval.
void * thread_reference_t
Type of a thread reference.
struct hal_sio_config SIOConfig
Type of structure representing a SIO configuration.
void(* siocb_t)(SIODriver *siop)
Generic SIO notification callback type.
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 sioSynchronizeTXEnd(SIODriver *siop, sysinterval_t timeout)
Synchronizes with TX completion.
msg_t sioSynchronizeTX(SIODriver *siop, sysinterval_t timeout)
Synchronizes with TX FIFO space availability.
void sioWriteEnableFlags(SIODriver *siop, sioevents_t mask)
Writes the enabled events flags mask.
sioevents_t sioGetAndClearErrors(SIODriver *siop)
Get and clears SIO error event flags.
struct hal_sio_driver SIODriver
Type of structure representing a SIO driver.
void sioInit(void)
SIO Driver initialization.
size_t sioAsyncRead(SIODriver *siop, uint8_t *buffer, size_t n)
Reads data from the RX FIFO.
#define _sio_driver_methods
SIODriver specific methods.
size_t sioAsyncWrite(SIODriver *siop, const uint8_t *buffer, size_t n)
Writes data into the TX FIFO.
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.
sioevents_t sioGetAndClearEvents(SIODriver *siop)
Get and clears SIO event flags.
void sioSetEnableFlags(SIODriver *siop, sioevents_t mask)
Sets flags into the enabled events flags mask.
eventflags_t sioevents_t
Type of event flags.
void sioStop(SIODriver *siop)
Deactivates the SIO peripheral.
#define sio_lld_driver_fields
Low level fields of the SIO driver structure.
siostate_t
Driver state machine possible states.
sioevents_t sioGetEvents(SIODriver *siop)
Returns the pending SIO event flags.
#define sio_lld_config_fields
Low level fields of the SIO configuration structure.
void sioClearEnableFlags(SIODriver *siop, sioevents_t mask)
Clears flags from the enabled events flags mask.
PLATFORM SIO subsystem low level driver header.
Driver configuration structure.
Structure representing a SIO driver.
thread_reference_t sync_rxidle
Synchronization point for RX idle.
siostate_t state
Driver state.
sioevents_t enabled
Enabled event flags.
siocb_t cb
Events callback.
thread_reference_t sync_rx
Synchronization point for RX.
thread_reference_t sync_txend
Synchronization point for TX-end.
const struct sio_driver_vmt * vmt
Virtual Methods Table.
thread_reference_t sync_tx
Synchronization point for TX.
const SIOConfig * config
Current configuration data.
SIODriver virtual methods table.