Serial driver updated, fixed SIO template.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14825 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-09-24 09:57:55 +00:00
parent c8814018b2
commit e884447d14
4 changed files with 16 additions and 5 deletions

View File

@ -294,7 +294,7 @@ extern "C" {
#else #else
void sdObjectInit(SerialDriver *sdp); void sdObjectInit(SerialDriver *sdp);
#endif #endif
void sdStart(SerialDriver *sdp, const SerialConfig *config); msg_t sdStart(SerialDriver *sdp, const SerialConfig *config);
void sdStop(SerialDriver *sdp); void sdStop(SerialDriver *sdp);
void sdIncomingDataI(SerialDriver *sdp, uint8_t b); void sdIncomingDataI(SerialDriver *sdp, uint8_t b);
msg_t sdRequestDataI(SerialDriver *sdp); msg_t sdRequestDataI(SerialDriver *sdp);

View File

@ -179,19 +179,30 @@ void sdObjectInit(SerialDriver *sdp) {
* @param[in] config the architecture-dependent serial driver configuration. * @param[in] config the architecture-dependent serial driver configuration.
* If this parameter is set to @p NULL then a default * If this parameter is set to @p NULL then a default
* configuration is used. * configuration is used.
* @return The operation status.
* *
* @api * @api
*/ */
void sdStart(SerialDriver *sdp, const SerialConfig *config) { msg_t sdStart(SerialDriver *sdp, const SerialConfig *config) {
msg_t msg;
osalDbgCheck(sdp != NULL); osalDbgCheck(sdp != NULL);
osalSysLock(); osalSysLock();
osalDbgAssert((sdp->state == SD_STOP) || (sdp->state == SD_READY), osalDbgAssert((sdp->state == SD_STOP) || (sdp->state == SD_READY),
"invalid state"); "invalid state");
#if defined(SD_LLD_ENHANCED_API)
msg = sd_lld_start(sdp, config);
#else
sd_lld_start(sdp, config); sd_lld_start(sdp, config);
msg = HAL_START_SUCCESS;
#endif
sdp->state = SD_READY; sdp->state = SD_READY;
osalSysUnlock(); osalSysUnlock();
return msg;
} }
/** /**

View File

@ -90,7 +90,7 @@ msg_t sio_lld_start(SIODriver *siop) {
} }
/* Configures the peripheral.*/ /* Configures the peripheral.*/
return false; return HAL_START_SUCCESS;
} }
/** /**

View File

@ -126,9 +126,9 @@ extern SIODriver SIOD1;
extern "C" { extern "C" {
#endif #endif
void sio_lld_init(void); void sio_lld_init(void);
bool sio_lld_start(SIODriver *siop); msg_t sio_lld_start(SIODriver *siop);
void sio_lld_stop(SIODriver *siop); void sio_lld_stop(SIODriver *siop);
msg_t sio_lld_start_operation(SIODriver *siop); void sio_lld_start_operation(SIODriver *siop);
void sio_lld_stop_operation(SIODriver *siop); void sio_lld_stop_operation(SIODriver *siop);
sio_events_mask_t sio_lld_get_and_clear_events(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_read(SIODriver *siop, uint8_t *buffer, size_t n);