mirror of https://github.com/rusefi/ChibiOS.git
Introduced HAL error codes, SIO driver updated.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14824 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
301e1a68a4
commit
c8814018b2
|
@ -77,14 +77,45 @@
|
|||
*/
|
||||
/**
|
||||
* @brief HAL operation success.
|
||||
* @deprecated
|
||||
*/
|
||||
#define HAL_SUCCESS false
|
||||
/**
|
||||
* @brief HAL operation failed.
|
||||
* @deprecated
|
||||
*/
|
||||
#define HAL_FAILED true
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Error codes for start functions
|
||||
* @{
|
||||
*/
|
||||
#define HAL_START_SUCCESS MSG_OK
|
||||
/**
|
||||
* @brief Configuration error.
|
||||
* @details An error has been detected in the driver configuration structure.
|
||||
*/
|
||||
#define HAL_START_CONFIG_ERROR (msg_t)-16
|
||||
/**
|
||||
* @brief A required resource is not available.
|
||||
* @details One of the resources required for driver operations is not
|
||||
* available.
|
||||
*/
|
||||
#define HAL_START_NO_RESOURCE (msg_t)-17
|
||||
/**
|
||||
* @brief The peripheral is busy.
|
||||
* @details The peripheral is not available or taken by some other system
|
||||
* actor.
|
||||
*/
|
||||
#define HAL_START_HW_BUSY (msg_t)-18
|
||||
/**
|
||||
* @brief Peripheral failure.
|
||||
* @details Peripheral failed during initialization, for example HW timeouts.
|
||||
*/
|
||||
#define HAL_START_HW_FAILURE (msg_t)-19
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -464,7 +464,7 @@ extern "C" {
|
|||
#endif
|
||||
void sioInit(void);
|
||||
void sioObjectInit(SIODriver *siop);
|
||||
bool sioStart(SIODriver *siop, const SIOConfig *config);
|
||||
msg_t sioStart(SIODriver *siop, const SIOConfig *config);
|
||||
void sioStop(SIODriver *siop);
|
||||
void sioStartOperation(SIODriver *siop, const SIOOperation *operation);
|
||||
void sioStopOperation(SIODriver *siop);
|
||||
|
|
|
@ -288,12 +288,10 @@ void sio_lld_init(void) {
|
|||
*
|
||||
* @param[in] siop pointer to the @p SIODriver object
|
||||
* @return The operation status.
|
||||
* @retval false if the driver has been correctly started.
|
||||
* @retval true if an error occurred.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
bool sio_lld_start(SIODriver *siop) {
|
||||
msg_t sio_lld_start(SIODriver *siop) {
|
||||
uint32_t clock = 0U;
|
||||
|
||||
/* Using the default configuration if the application passed a
|
||||
|
@ -386,7 +384,7 @@ bool sio_lld_start(SIODriver *siop) {
|
|||
/* Configures the peripheral.*/
|
||||
usart_init(siop, clock);
|
||||
|
||||
return false;
|
||||
return HAL_START_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ extern SIODriver LPSIOD1;
|
|||
extern "C" {
|
||||
#endif
|
||||
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_start_operation(SIODriver *siop);
|
||||
void sio_lld_stop_operation(SIODriver *siop);
|
||||
|
|
|
@ -296,12 +296,10 @@ void sio_lld_init(void) {
|
|||
*
|
||||
* @param[in] siop pointer to the @p SIODriver object
|
||||
* @return The operation status.
|
||||
* @retval false if the driver has been correctly started.
|
||||
* @retval true if an error occurred.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
bool sio_lld_start(SIODriver *siop) {
|
||||
msg_t sio_lld_start(SIODriver *siop) {
|
||||
uint32_t clock = 0U;
|
||||
|
||||
/* Using the default configuration if the application passed a
|
||||
|
@ -394,7 +392,7 @@ bool sio_lld_start(SIODriver *siop) {
|
|||
/* Configures the peripheral.*/
|
||||
usart_init(siop, clock);
|
||||
|
||||
return false;
|
||||
return HAL_START_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -366,7 +366,7 @@ extern SIODriver LPSIOD1;
|
|||
extern "C" {
|
||||
#endif
|
||||
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_start_operation(SIODriver *siop);
|
||||
void sio_lld_stop_operation(SIODriver *siop);
|
||||
|
|
|
@ -243,13 +243,11 @@ void sioObjectInit(SIODriver *siop) {
|
|||
* @param[in] config pointer to the @p SIOConfig object, can be @p NULL
|
||||
* if the default configuration is desired
|
||||
* @return The operation status.
|
||||
* @retval false if the driver has been correctly started.
|
||||
* @retval true if an error occurred.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
bool sioStart(SIODriver *siop, const SIOConfig *config) {
|
||||
bool result;
|
||||
msg_t sioStart(SIODriver *siop, const SIOConfig *config) {
|
||||
msg_t msg;
|
||||
|
||||
osalDbgCheck(siop != NULL);
|
||||
|
||||
|
@ -259,12 +257,12 @@ bool sioStart(SIODriver *siop, const SIOConfig *config) {
|
|||
"invalid state");
|
||||
|
||||
siop->config = config;
|
||||
result = sio_lld_start(siop);
|
||||
msg = sio_lld_start(siop);
|
||||
siop->state = SIO_READY;
|
||||
|
||||
osalSysUnlock();
|
||||
|
||||
return result;
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -75,12 +75,10 @@ void sio_lld_init(void) {
|
|||
*
|
||||
* @param[in] siop pointer to the @p SIODriver object
|
||||
* @return The operation status.
|
||||
* @retval false if the driver has been correctly started.
|
||||
* @retval true if an error occurred.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
bool sio_lld_start(SIODriver *siop) {
|
||||
msg_t sio_lld_start(SIODriver *siop) {
|
||||
|
||||
if (siop->state == SIO_STOP) {
|
||||
/* Enables the peripheral.*/
|
||||
|
|
|
@ -128,7 +128,7 @@ extern "C" {
|
|||
void sio_lld_init(void);
|
||||
bool sio_lld_start(SIODriver *siop);
|
||||
void sio_lld_stop(SIODriver *siop);
|
||||
void sio_lld_start_operation(SIODriver *siop);
|
||||
msg_t 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);
|
||||
|
|
Loading…
Reference in New Issue