git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13826 27425a3e-05d8-49a3-a47f-9c15f0e5edd8

This commit is contained in:
Giovanni Di Sirio 2020-09-01 12:58:25 +00:00
parent 4ccbff905a
commit 8a03162059
4 changed files with 53 additions and 1 deletions

View File

@ -255,6 +255,16 @@ struct hal_sio_operation {
*/
#define sioIsTXFullX(siop) sio_lld_is_tx_full(siop)
/**
* @brief Return the pending SIO events flags.
*
* @param[in] siop pointer to the @p SIODriver object
* @return The pending event flags.
*
* @iclass
*/
#define sioGetAndClearEventsI(siop) sio_lld_get_and_clear_events(siop)
/**
* @brief Returns one frame from the RX FIFO.
* @note If the FIFO is empty then the returned value is unpredictable.

View File

@ -501,6 +501,20 @@ void sio_lld_stop_operation(SIODriver *siop) {
siop->usart->CR3 &= USART_CR3_CFG_FORBIDDEN;
}
/**
* @brief Return the pending SIO events flags.
*
* @param[in] siop pointer to the @p SIODriver object
* @return The pending event flags.
*
* @notapi
*/
sio_events_mask_t sio_lld_get_and_clear_events(SIODriver *siop) {
sio_events_mask_t evtmask = 0U;
return evtmask;
}
/**
* @brief Reads data from the RX FIFO.
* @details The function is not blocking, it writes frames until there

View File

@ -224,6 +224,11 @@
/* Driver macros. */
/*===========================================================================*/
/**
* @brief Type of a SIO events mask.
*/
typedef uint32_t sio_events_mask_t;
/**
* @brief Low level fields of the SIO driver structure.
*/
@ -335,6 +340,7 @@ extern "C" {
void sio_lld_stop(SIODriver *siop);
void sio_lld_start_operation(SIODriver *siop);
void sio_lld_stop_operation(SIODriver *siop);
sio_events_mask_t sio_lld_get_and_clear_events(SIODriver *siop);
size_t sio_lld_read(SIODriver *siop, uint8_t *buffer, size_t n);
size_t sio_lld_write(SIODriver *siop, const uint8_t *buffer, size_t n);
msg_t sio_lld_get(SIODriver *siop);

View File

@ -335,6 +335,28 @@ void sioStopOperation(SIODriver *siop) {
osalSysUnlock();
}
/**
* @brief Return the pending SIO events flags.
*
* @param[in] siop pointer to the @p SIODriver object
* @return The pending event flags.
*
* @api
*/
sio_events_mask_t sioGetAndClearEvents(SIODriver *siop) {
sio_events_mask_t evtmask;
osalDbgCheck(siop != NULL);
osalSysLock();
evtmask = sioGetAndClearEventsI(siop);
osalSysUnlock();
return evtmask;
}
/**
* @brief Reads data from the RX FIFO.
* @details This function is non-blocking, data is read if present and the
@ -351,7 +373,7 @@ void sioStopOperation(SIODriver *siop) {
*/
size_t sioAsyncRead(SIODriver *siop, uint8_t *buffer, size_t n) {
osalDbgCheck((siop != NULL) && (buffer));
osalDbgCheck((siop != NULL) && (buffer != NULL));
osalSysLock();