SIO Driver macros and structures. hal_cb_driver.xml hal_channels.xml hal_buffered_serial.xml Default bit rate.
Configuration parameter, this is the baud rate selected for the default configuration.
Support for thread synchronization API. Support for streams interface. Support for buffering wrapper class.
Determines the state of the RX FIFO. pointer to the @p hal_sio_driver_c object The RX FIFO state. Determines the activity state of the receiver. pointer to the @p hal_sio_driver_c object The RX activity state. Determines if RX has pending errors to be read and cleared. Only error flags are handled, data and idle flags are not considered. pointer to the @p hal_sio_driver_c object The RX error events. Determines the state of the TX FIFO. pointer to the @p hal_sio_driver_c object The TX FIFO state. Determines the transmission state. pointer to the @p hal_sio_driver_c object The transmission state. Writes the enabled events mask. pointer to the @p hal_sio_driver_c object enabled events mask to be written enabled = (mask); sio_lld_update_enable_flags(siop); } while (false)]]> Sets flags into the enabled events flags mask. pointer to the @p hal_sio_driver_c object enabled events mask to be set enabled |= (mask); sio_lld_update_enable_flags(siop); } while (false)]]> Clears flags from the enabled events flags mask. pointer to the @p hal_sio_driver_c object enabled events mask to be cleared enabled &= ~(mask); sio_lld_update_enable_flags(siop); } while (false)]]> Gets the enabled condition flags mask. pointer to the @p hal_sio_driver_c object The enabled event flags. enabled]]> Gets and clears SIO error flags. pointer to the @p hal_sio_driver_c object The pending error flags. Gets and clears SIO event flags. pointer to the @p hal_sio_driver_c object Mask of events to be returned and cleared. The pending event flags. Returns all SIO event flags. pointer to the @p hal_sio_driver_c object The pending event flags. Returns one frame from the RX FIFO. If the FIFO is empty then the returned value is unpredictable. pointer to the @p hal_sio_driver_c object The frame from RX FIFO. Pushes one frame into the TX FIFO. If the FIFO is full then the behavior is unpredictable. pointer to the @p hal_sio_driver_c object frame to be written Reads data from the RX FIFO.
This function is non-blocking, data is read if present and the effective amount is returned.
This function can be called from any context but it is meant to be called from the @p cb callback handler. pointer to the @p hal_sio_driver_c object maximum number of frames to read buffer for the received data The number of received frames. RX FIFO is empty.
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.
This function can be called from any context but it is meant to be called from the @p cb callback handler. pointer to the @p hal_sio_driver_c object maximum number of frames to read buffer containing the data to be transmitted The number of transmitted frames. TX FIFO is full.
Control operation on a serial port. pointer to the @p hal_sio_driver_c object control operation code operation argument The control operation status. SIO callback. pointer to the @p hal_sio_driver_c object The control operation status. cb != NULL) { (siop)->cb(siop); } } while (false)]]> Wakes up because RX errors. pointer to the @p hal_sio_driver_c object sync_rx, SIO_MSG_ERRORS); osalThreadResumeI(&(siop)->sync_rxidle, SIO_MSG_ERRORS); osalSysUnlockFromISR(); } while (false)]]> Wakes up the RX-waiting thread. pointer to the @p hal_sio_driver_c object sync_rx, MSG_OK); osalSysUnlockFromISR(); } while (false)]]> Wakes up the RX-idle-waiting thread. pointer to the @p hal_sio_driver_c object sync_rxidle, MSG_OK); osalSysUnlockFromISR(); } while (false)]]> Wakes up the TX-waiting thread. pointer to the @p hal_sio_driver_c object sync_tx, MSG_OK); osalSysUnlockFromISR(); } while (false)]]> Wakes up the TXend-waiting thread. pointer to the @p hal_sio_driver_c object sync_txend, MSG_OK); osalSysUnlockFromISR(); } while (false)]]> Relocates a bit field. value mask of the bit field source bit offset destination bit offset > (s)) << (d))]]>
Type of SIO event flags. Type of structure representing a SIO driver. Type of structure representing a SIO configuration. Type of structure representing a SIO configuration (legacy). Type of structure representing a SIO driver (legacy). Driver configuration structure. Implementations may extend this structure to contain more, architecture dependent, fields. Class of a SIO (Serial I/O) driver. Enabled event flags. Synchronization point for RX. Synchronization point for RX idle. Synchronization point for TX. Synchronization point for TX-end. enabled = (sioevents_t)0; self->cb = NULL; #if SIO_USE_SYNCHRONIZATION == TRUE self->sync_rx = NULL; self->sync_rxidle = NULL; self->sync_tx = NULL; self->sync_txend = NULL; #endif /* Optional, user-defined initializer.*/ #if defined(SIO_DRIVER_EXT_INIT_HOOK) SIO_DRIVER_EXT_INIT_HOOK(self); #endif]]> Writes the enabled events flags mask. enabled events mask to be written state == HAL_DRV_STATE_READY, "invalid state"); sioWriteEnableFlagsX(self, mask); osalSysUnlock();]]> Sets flags into the enabled events flags mask. enabled events mask to be set state == HAL_DRV_STATE_READY, "invalid state"); sioSetEnableFlagsX(self, mask); osalSysUnlock();]]> Clears flags from the enabled events flags mask. enabled events mask to be cleared state == HAL_DRV_STATE_READY, "invalid state"); sioClearEnableFlagsX(self, mask); osalSysUnlock();]]> Get and clears SIO error event flags. The pending error event flags. state == HAL_DRV_STATE_READY, "invalid state"); errors = sioGetAndClearErrorsX(self); osalSysUnlock(); return errors;]]> Get and clears SIO event flags. Mask of events to be returned and cleared. The pending event flags. state == HAL_DRV_STATE_READY, "invalid state"); events = sioGetAndClearEventsX(self, mask); osalSysUnlock(); return events;]]> Returns the pending SIO event flags. The pending event flags. state == HAL_DRV_STATE_READY, "invalid state"); events = sioGetEventsX(self); osalSysUnlock(); return events;]]> Synchronizes with RX FIFO data availability. 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. synchronization timeout The synchronization result. If there is data in the RX FIFO. If synchronization timed out. It the driver has been stopped while waiting. It RX errors occurred before or during wait. state == HAL_DRV_STATE_READY, "invalid state"); /* Checking for errors before going to sleep.*/ if (sioHasRXErrorsX(self)) { osalSysUnlock(); return SIO_MSG_ERRORS; } msg = MSG_OK; /*lint -save -e506 -e681 [2.1] Silencing this error because it is tested with a template implementation of sio_lld_is_rx_empty() which is constant.*/ while (sioIsRXEmptyX(self)) { /*lint -restore*/ msg = osalThreadSuspendTimeoutS(&self->sync_rx, timeout); if (msg != MSG_OK) { break; } } osalSysUnlock(); return msg;]]> Synchronizes with RX going idle. This function can only be called by a single thread at time. synchronization timeout The synchronization result. If there is data in the RX FIFO. If synchronization timed out. It the driver has been stopped while waiting. It RX errors occurred before or during wait. state == HAL_DRV_STATE_READY, "invalid state"); /* Checking for errors before going to sleep.*/ if (sioHasRXErrorsX(self)) { osalSysUnlock(); return SIO_MSG_ERRORS; } msg = MSG_OK; /*lint -save -e506 -e681 [2.1] Silencing this error because it is tested with a template implementation of sio_lld_is_rx_empty() which is constant.*/ while (!sioIsRXIdleX(self)) { /*lint -restore*/ msg = osalThreadSuspendTimeoutS(&self->sync_rxidle, timeout); if (msg != MSG_OK) { break; } } osalSysUnlock(); return msg;]]> Synchronizes with TX FIFO space availability. 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. synchronization timeout The synchronization result. If there is space in the TX FIFO. If synchronization timed out. It the driver has been stopped while waiting. state == HAL_DRV_STATE_READY, "invalid state"); msg = MSG_OK; /*lint -save -e506 -e681 [2.1] Silencing this error because it is tested with a template implementation of sio_lld_is_tx_full() which is constant.*/ while (sioIsTXFullX(self)) { /*lint -restore*/ msg = osalThreadSuspendTimeoutS(&self->sync_tx, timeout); if (msg != MSG_OK) { break; } } osalSysUnlock(); return msg;]]> Synchronizes with TX completion. This function can only be called by a single thread at time. synchronization timeout The synchronization result. If there is space in the TX FIFO. If synchronization timed out. It the driver has been stopped while waiting. state == HAL_DRV_STATE_READY, "invalid state"); /*lint -save -e506 -e774 [2.1, 14.3] Silencing this error because it is tested with a template implementation of sio_lld_is_tx_ongoing() which is constant.*/ if (sioIsTXOngoingX(self)) { /*lint -restore*/ msg = osalThreadSuspendTimeoutS(&self->sync_txend, timeout); } else { msg = MSG_OK; } osalSysUnlock(); return msg;]]> cb = NULL; self->enabled = (sioevents_t)0; #if SIO_USE_SYNCHRONIZATION == TRUE /* Informing waiting threads, if any.*/ osalThreadResumeI(&self->sync_rx, MSG_RESET); osalThreadResumeI(&self->sync_rxidle, MSG_RESET); osalThreadResumeI(&self->sync_tx, MSG_RESET); osalThreadResumeI(&self->sync_txend, MSG_RESET); osalOsRescheduleS(); #endif]]> This class implements a buffered channel interface on top of SIO. Pointer to the associated @p hal_sio_driver_c instance. Pointer to the @p hal_sio_driver_c object. Pointer to the input buffer. Size of the input buffer. Pointer to the output buffer. Size of the output buffer. siop = siop;]]> state = HAL_DRV_STATE_STARTING; osalSysUnlock(); /* Starting the undelying SIO driver.*/ msg = drvStart(self->siop); if (msg == HAL_RET_SUCCESS) { drvSetCallbackX(self->siop, &__bsio_default_cb); sioWriteEnableFlagsX(self->siop, SIO_EV_ALL_EVENTS); } /* Back into the critical section and return.*/ osalSysLock(); return msg;]]> state = HAL_DRV_STATE_STOPPING; osalSysUnlock(); drvStop(self->siop); /* Back into the critical section and return.*/ osalSysLock();]]> siop, config);]]> SIO Driver initialization. This function is implicitly invoked by @p halInit(), there is no need to explicitly initialize the driver.
hal.h siop)) { msg_t msg; msg = oqGetI(&bsiop->oqueue); if (msg < MSG_OK) { bsAddFlagsI(bsiop, CHN_FL_TX_NOTFULL); return; } sioPutX(bsiop->siop, (uint_fast16_t)msg); }]]> siop)) { bsIncomingDataI(bsiop, sioGetX(bsiop->siop)); }]]> arg; sioevents_t events; osalSysLockFromISR(); /* Posting the non-data SIO events as channel event flags, the masks are made to match.*/ events = sioGetAndClearEventsX(siop, SIO_EV_ALL_EVENTS); bsAddFlagsI(bsiop, (eventflags_t)(events & ~SIO_EV_ALL_DATA)); /* RX FIFO event.*/ if ((events & SIO_EV_RX_NOTEMPTY) != (sioevents_t)0) { __bsio_pop_data(bsiop); } /* TX FIFO event.*/ if ((events & SIO_EV_TX_NOTFULL) != (sioevents_t)0) { __bsio_push_data(bsiop); } osalSysUnlockFromISR();]]> q_link);]]>