From 69f211ae2c3f7a42d65e9f3bdb4e192016a53d94 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 2 Nov 2014 16:38:13 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7462 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/osal/nil/osal.h | 9 +- os/hal/osal/rt/osal.h | 4 +- os/hal/ports/KINETIS/K20x/hal_lld.c | 1 - os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.h | 9 +- os/hal/ports/STM32/LLD/I2Cv2/i2c_lld.c | 2 +- os/hal/ports/STM32/LLD/I2Cv2/i2c_lld.h | 10 +- os/hal/ports/STM32/LLD/mac_lld.c | 8 +- os/hal/src/mmc_spi.c | 11 +- os/hal/src/sdc.c | 4 +- os/hal/templates/adc_lld.c | 5 +- os/hal/templates/adc_lld.h | 4 +- os/hal/templates/can_lld.c | 9 +- os/hal/templates/can_lld.h | 2 +- os/hal/templates/ext_lld.c | 5 +- os/hal/templates/ext_lld.h | 4 +- os/hal/templates/gpt_lld.c | 5 +- os/hal/templates/gpt_lld.h | 4 +- os/hal/templates/hal_lld.c | 2 +- os/hal/templates/hal_lld.h | 3 +- os/hal/templates/i2c_lld.c | 29 +- os/hal/templates/i2c_lld.h | 28 +- os/hal/templates/i2s_lld.c | 2 +- os/hal/templates/icu_lld.c | 10 +- os/hal/templates/icu_lld.h | 2 +- os/hal/templates/mac_lld.c | 8 +- os/hal/templates/mac_lld.h | 4 +- os/hal/templates/osal/osal.c | 58 +-- os/hal/templates/osal/osal.h | 538 ++++++++++++++++++++----- os/hal/templates/pal_lld.c | 5 +- os/hal/templates/pal_lld.h | 4 +- os/hal/templates/pwm_lld.c | 8 +- os/hal/templates/pwm_lld.h | 2 +- os/hal/templates/rtc_lld.c | 4 +- os/hal/templates/rtc_lld.h | 4 +- os/hal/templates/sdc_lld.c | 24 +- os/hal/templates/sdc_lld.h | 2 +- os/hal/templates/serial_lld.c | 5 +- os/hal/templates/serial_lld.h | 4 +- os/hal/templates/spi_lld.c | 2 +- os/hal/templates/spi_lld.h | 2 +- os/hal/templates/st_lld.c | 4 +- os/hal/templates/st_lld.h | 4 +- os/hal/templates/uart_lld.c | 5 +- os/hal/templates/uart_lld.h | 4 +- os/hal/templates/usb_lld.c | 2 +- os/hal/templates/usb_lld.h | 2 +- testhal/common/testbuild/main.c | 1 - 47 files changed, 584 insertions(+), 284 deletions(-) diff --git a/os/hal/osal/nil/osal.h b/os/hal/osal/nil/osal.h index 37838cc88..7e8580776 100644 --- a/os/hal/osal/nil/osal.h +++ b/os/hal/osal/nil/osal.h @@ -265,13 +265,13 @@ typedef struct { * @note Not implemented in this simplified OSAL. */ #define osalDbgCheckClassI() /*chDbgCheckClassI()*/ -/** @} */ /** * @brief S-Class state check. * @note Not implemented in this simplified OSAL. */ #define osalDbgCheckClassS() /*chDbgCheckClassS()*/ +/** @} */ /** * @name IRQ service routines wrappers @@ -325,6 +325,7 @@ typedef struct { * @api */ #define OSAL_MS2ST(msec) MS2ST(msec) + /** * @brief Microseconds to system ticks. * @details Converts from microseconds to system ticks number. @@ -388,8 +389,8 @@ typedef struct { #ifdef __cplusplus extern "C" { #endif - void osalThreadDequeueNextI(threads_queue_t *tqp, msg_t msg); - void osalThreadDequeueAllI(threads_queue_t *tqp, msg_t msg); + void osalThreadDequeueNextI(threads_queue_t *tqp, msg_t msg); + void osalThreadDequeueAllI(threads_queue_t *tqp, msg_t msg); #ifdef __cplusplus } #endif @@ -539,7 +540,7 @@ static inline void osalOsRescheduleS(void) { /** * @brief Current system time. - * @details Returns the number of system ticks since the @p chSysInit() + * @details Returns the number of system ticks since the @p osalInit() * invocation. * @note The counter can reach its maximum and then restart from zero. * @note This function can be called from any context but its atomicity diff --git a/os/hal/osal/rt/osal.h b/os/hal/osal/rt/osal.h index ef2104548..1b5a72d76 100644 --- a/os/hal/osal/rt/osal.h +++ b/os/hal/osal/rt/osal.h @@ -261,13 +261,13 @@ typedef struct { * @note Not implemented in this simplified OSAL. */ #define osalDbgCheckClassI() chDbgCheckClassI() -/** @} */ /** * @brief S-Class state check. * @note Not implemented in this simplified OSAL. */ #define osalDbgCheckClassS() chDbgCheckClassS() +/** @} */ /** * @name IRQ service routines wrappers @@ -535,7 +535,7 @@ static inline void osalOsRescheduleS(void) { /** * @brief Current system time. - * @details Returns the number of system ticks since the @p chSysInit() + * @details Returns the number of system ticks since the @p osalInit() * invocation. * @note The counter can reach its maximum and then restart from zero. * @note This function can be called from any context but its atomicity diff --git a/os/hal/ports/KINETIS/K20x/hal_lld.c b/os/hal/ports/KINETIS/K20x/hal_lld.c index 471e23b80..994332f3f 100644 --- a/os/hal/ports/KINETIS/K20x/hal_lld.c +++ b/os/hal/ports/KINETIS/K20x/hal_lld.c @@ -22,7 +22,6 @@ * @{ */ -#include "ch.h" #include "hal.h" /*===========================================================================*/ diff --git a/os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.h b/os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.h index e2f41d41d..a62efcaa6 100644 --- a/os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.h +++ b/os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.h @@ -357,12 +357,12 @@ /*===========================================================================*/ /** - * @brief Type representing I2C address. + * @brief Type representing an I2C address. */ typedef uint16_t i2caddr_t; /** - * @brief I2C Driver condition flags type. + * @brief Type of I2C driver condition flags. */ typedef uint32_t i2cflags_t; @@ -385,9 +385,10 @@ typedef enum { } i2cdutycycle_t; /** - * @brief Driver configuration structure. + * @brief Type of I2C driver configuration structure. */ typedef struct { + /* End of the mandatory fields.*/ i2copmode_t op_mode; /**< @brief Specifies the I2C mode. */ uint32_t clock_speed; /**< @brief Specifies the clock frequency. @note Must be set to a value lower @@ -402,7 +403,7 @@ typedef struct { typedef struct I2CDriver I2CDriver; /** - * @brief Structure representing an I2C driver. + * @brief Structure representing an I2C driver. */ struct I2CDriver { /** diff --git a/os/hal/ports/STM32/LLD/I2Cv2/i2c_lld.c b/os/hal/ports/STM32/LLD/I2Cv2/i2c_lld.c index 18c5e9abd..7e0624bc3 100644 --- a/os/hal/ports/STM32/LLD/I2Cv2/i2c_lld.c +++ b/os/hal/ports/STM32/LLD/I2Cv2/i2c_lld.c @@ -81,7 +81,7 @@ I2CDriver I2CD2; #endif /*===========================================================================*/ -/* Driver local variables. */ +/* Driver local variables and types. */ /*===========================================================================*/ /*===========================================================================*/ diff --git a/os/hal/ports/STM32/LLD/I2Cv2/i2c_lld.h b/os/hal/ports/STM32/LLD/I2Cv2/i2c_lld.h index 0b9d0cfd3..a95c2c33c 100644 --- a/os/hal/ports/STM32/LLD/I2Cv2/i2c_lld.h +++ b/os/hal/ports/STM32/LLD/I2Cv2/i2c_lld.h @@ -216,17 +216,17 @@ /*===========================================================================*/ /** - * @brief Type representing I2C address. + * @brief Type representing an I2C address. */ typedef uint16_t i2caddr_t; /** - * @brief I2C Driver condition flags type. + * @brief Type of I2C driver condition flags. */ typedef uint32_t i2cflags_t; /** - * @brief Driver configuration structure. + * @brief Type of I2C driver configuration structure. */ typedef struct { /** @@ -253,9 +253,9 @@ typedef struct { typedef struct I2CDriver I2CDriver; /** - * @brief Structure representing an I2C driver. + * @brief Structure representing an I2C driver. */ -struct I2CDriver{ +struct I2CDriver { /** * @brief Driver state. */ diff --git a/os/hal/ports/STM32/LLD/mac_lld.c b/os/hal/ports/STM32/LLD/mac_lld.c index 59742572e..36cdd96ae 100644 --- a/os/hal/ports/STM32/LLD/mac_lld.c +++ b/os/hal/ports/STM32/LLD/mac_lld.c @@ -396,8 +396,8 @@ void mac_lld_stop(MACDriver *macp) { * @param[in] macp pointer to the @p MACDriver object * @param[out] tdp pointer to a @p MACTransmitDescriptor structure * @return The operation status. - * @retval RDY_OK the descriptor has been obtained. - * @retval RDY_TIMEOUT descriptor not available. + * @retval MSG_OK the descriptor has been obtained. + * @retval MSG_TIMEOUT descriptor not available. * * @notapi */ @@ -472,8 +472,8 @@ void mac_lld_release_transmit_descriptor(MACTransmitDescriptor *tdp) { * @param[in] macp pointer to the @p MACDriver object * @param[out] rdp pointer to a @p MACReceiveDescriptor structure * @return The operation status. - * @retval RDY_OK the descriptor has been obtained. - * @retval RDY_TIMEOUT descriptor not available. + * @retval MSG_OK the descriptor has been obtained. + * @retval MSG_TIMEOUT descriptor not available. * * @notapi */ diff --git a/os/hal/src/mmc_spi.c b/os/hal/src/mmc_spi.c index ee33ee618..babbf80ad 100644 --- a/os/hal/src/mmc_spi.c +++ b/os/hal/src/mmc_spi.c @@ -169,7 +169,7 @@ static void wait(MMCDriver *mmcp) { break; #ifdef MMC_NICE_WAITING /* Trying to be nice with the other threads.*/ - chThdSleep(1); + osalThreadSleep(1); #endif } } @@ -348,7 +348,8 @@ static void sync(MMCDriver *mmcp) { if (buf[0] == 0xFF) break; #ifdef MMC_NICE_WAITING - chThdSleep(1); /* Trying to be nice with the other threads.*/ + /* Trying to be nice with the other threads.*/ + osalThreadSleep(1); #endif } spiUnselect(mmcp->config->spip); @@ -460,7 +461,7 @@ bool mmcConnect(MMCDriver *mmcp) { break; if (++i >= MMC_CMD0_RETRY) goto failed; - chThdSleepMilliseconds(10); + osalThreadSleepMilliseconds(10); } /* Try to detect if this is a high capacity card and switch to block @@ -480,7 +481,7 @@ bool mmcConnect(MMCDriver *mmcp) { if (++i >= MMC_ACMD41_RETRY) goto failed; - chThdSleepMilliseconds(10); + osalThreadSleepMilliseconds(10); } /* Execute dedicated read on OCR register */ @@ -501,7 +502,7 @@ bool mmcConnect(MMCDriver *mmcp) { goto failed; if (++i >= MMC_CMD1_RETRY) goto failed; - chThdSleepMilliseconds(10); + osalThreadSleepMilliseconds(10); } /* Initialization complete, full speed.*/ diff --git a/os/hal/src/sdc.c b/os/hal/src/sdc.c index ef96c6a9b..d8e469e82 100644 --- a/os/hal/src/sdc.c +++ b/os/hal/src/sdc.c @@ -86,7 +86,7 @@ bool _sdc_wait_for_transfer_state(SDCDriver *sdcp) { case MMCSD_STS_RCV: case MMCSD_STS_PRG: #if SDC_NICE_WAITING - osalThreadSleep(MS2ST(1)); + osalThreadSleep(OSAL_MS2ST(1)); #endif continue; default: @@ -262,7 +262,7 @@ bool sdcConnect(SDCDriver *sdcp) { } if (++i >= SDC_INIT_RETRY) goto failed; - osalThreadSleep(MS2ST(10)); + osalThreadSleep(OSAL_MS2ST(10)); } } diff --git a/os/hal/templates/adc_lld.c b/os/hal/templates/adc_lld.c index e6826d9ed..d8ab53d7e 100644 --- a/os/hal/templates/adc_lld.c +++ b/os/hal/templates/adc_lld.c @@ -15,14 +15,13 @@ */ /** - * @file templates/adc_lld.c - * @brief ADC Driver subsystem low level driver source template. + * @file adc_lld.c + * @brief PLATFORM ADC subsystem low level driver source. * * @addtogroup ADC * @{ */ -#include "ch.h" #include "hal.h" #if HAL_USE_ADC || defined(__DOXYGEN__) diff --git a/os/hal/templates/adc_lld.h b/os/hal/templates/adc_lld.h index 1ee25bf48..8d02753fd 100644 --- a/os/hal/templates/adc_lld.h +++ b/os/hal/templates/adc_lld.h @@ -15,8 +15,8 @@ */ /** - * @file PLATFORMF/adc_lld.h - * @brief PLATFORMF ADC subsystem low level driver header. + * @file adc_lld.h + * @brief PLATFORM ADC subsystem low level driver header. * * @addtogroup ADC * @{ diff --git a/os/hal/templates/can_lld.c b/os/hal/templates/can_lld.c index d095a645e..2c5e622a3 100644 --- a/os/hal/templates/can_lld.c +++ b/os/hal/templates/can_lld.c @@ -15,14 +15,13 @@ */ /** - * @file templates/can_lld.c - * @brief CAN Driver subsystem low level driver source template. + * @file can_lld.c + * @brief PLATFORM CAN subsystem low level driver source. * * @addtogroup CAN * @{ */ -#include "ch.h" #include "hal.h" #if HAL_USE_CAN || defined(__DOXYGEN__) @@ -125,7 +124,7 @@ void can_lld_stop(CANDriver *canp) { * * @notapi */ -bool_t can_lld_is_tx_empty(CANDriver *canp, canmbx_t mailbox) { +bool can_lld_is_tx_empty(CANDriver *canp, canmbx_t mailbox) { (void)canp; @@ -174,7 +173,7 @@ void can_lld_transmit(CANDriver *canp, * * @notapi */ -bool_t can_lld_is_rx_nonempty(CANDriver *canp, canmbx_t mailbox) { +bool can_lld_is_rx_nonempty(CANDriver *canp, canmbx_t mailbox) { (void)canp; (void)mailbox; diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 1c3eefeb9..c9cc35fc9 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -15,7 +15,7 @@ */ /** - * @file PLATFORM/can_lld.h + * @file can_lld.h * @brief PLATFORM CAN subsystem low level driver header. * * @addtogroup CAN diff --git a/os/hal/templates/ext_lld.c b/os/hal/templates/ext_lld.c index e6e79e952..793f92d69 100644 --- a/os/hal/templates/ext_lld.c +++ b/os/hal/templates/ext_lld.c @@ -15,14 +15,13 @@ */ /** - * @file templates/ext_lld.c - * @brief EXT Driver subsystem low level driver source template. + * @file ext_lld.c + * @brief PLATFORM EXT subsystem low level driver source. * * @addtogroup EXT * @{ */ -#include "ch.h" #include "hal.h" #if HAL_USE_EXT || defined(__DOXYGEN__) diff --git a/os/hal/templates/ext_lld.h b/os/hal/templates/ext_lld.h index ca020a7a6..35caf01c9 100644 --- a/os/hal/templates/ext_lld.h +++ b/os/hal/templates/ext_lld.h @@ -15,8 +15,8 @@ */ /** - * @file templates/ext_lld.h - * @brief EXT Driver subsystem low level driver header template. + * @file ext_lld.h + * @brief PLATFORM EXT subsystem low level driver header. * * @addtogroup EXT * @{ diff --git a/os/hal/templates/gpt_lld.c b/os/hal/templates/gpt_lld.c index 4f16b0239..de2eb4d9f 100644 --- a/os/hal/templates/gpt_lld.c +++ b/os/hal/templates/gpt_lld.c @@ -15,14 +15,13 @@ */ /** - * @file templates/gpt_lld.c - * @brief GPT Driver subsystem low level driver source template. + * @file gpt_lld.c + * @brief PLATFORM GPT subsystem low level driver source. * * @addtogroup GPT * @{ */ -#include "ch.h" #include "hal.h" #if HAL_USE_GPT || defined(__DOXYGEN__) diff --git a/os/hal/templates/gpt_lld.h b/os/hal/templates/gpt_lld.h index 13251eb47..cf6a318a6 100644 --- a/os/hal/templates/gpt_lld.h +++ b/os/hal/templates/gpt_lld.h @@ -15,8 +15,8 @@ */ /** - * @file templates/gpt_lld.h - * @brief GPT Driver subsystem low level driver header template. + * @file gpt_lld.h + * @brief PLATFORM GPT subsystem low level driver header. * * @addtogroup GPT * @{ diff --git a/os/hal/templates/hal_lld.c b/os/hal/templates/hal_lld.c index 7494ee1df..0f9ba47d8 100644 --- a/os/hal/templates/hal_lld.c +++ b/os/hal/templates/hal_lld.c @@ -15,7 +15,7 @@ */ /** - * @file PLATFORM/hal_lld.c + * @file hal_lld.c * @brief PLATFORM HAL subsystem low level driver source. * * @addtogroup HAL diff --git a/os/hal/templates/hal_lld.h b/os/hal/templates/hal_lld.h index 3243aaa55..df4d849e1 100644 --- a/os/hal/templates/hal_lld.h +++ b/os/hal/templates/hal_lld.h @@ -15,7 +15,8 @@ */ /** - * @file PLATFORM/hal_lld.h + * @file hal_lld.h + * @brief PLATFORM HAL subsystem low level driver header. * * @addtogroup HAL * @{ diff --git a/os/hal/templates/i2c_lld.c b/os/hal/templates/i2c_lld.c index 318686b27..7cf8d1adf 100644 --- a/os/hal/templates/i2c_lld.c +++ b/os/hal/templates/i2c_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio + ChibiOS/HAL - Copyright (C) 2006-2014 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,14 +15,13 @@ */ /** - * @file templates/i2c_lld.c - * @brief I2C Driver subsystem low level driver source template. + * @file i2c_lld.c + * @brief PLATFORM I2C subsystem low level driver source. * * @addtogroup I2C * @{ */ -#include "ch.h" #include "hal.h" #if HAL_USE_I2C || defined(__DOXYGEN__) @@ -87,7 +86,6 @@ void i2c_lld_start(I2CDriver *i2cp) { } #endif /* PLATFORM_I2C_USE_I2C1 */ } - /* Configures the peripheral.*/ } @@ -101,7 +99,6 @@ void i2c_lld_start(I2CDriver *i2cp) { void i2c_lld_stop(I2CDriver *i2cp) { if (i2cp->state != I2C_STOP) { - /* Resets the peripheral.*/ /* Disables the peripheral.*/ #if PLATFORM_I2C_USE_I2C1 @@ -114,8 +111,6 @@ void i2c_lld_stop(I2CDriver *i2cp) { /** * @brief Receives data via the I2C bus as master. - * @details Number of receiving bytes must be more than 1 on STM32F1x. This is - * hardware restriction. * * @param[in] i2cp pointer to the @p I2CDriver object * @param[in] addr slave device address @@ -126,10 +121,10 @@ void i2c_lld_stop(I2CDriver *i2cp) { * - @a TIME_INFINITE no timeout. * . * @return The operation status. - * @retval RDY_OK if the function succeeded. - * @retval RDY_RESET if one or more I2C errors occurred, the errors can + * @retval MSG_OK if the function succeeded. + * @retval MSG_RESET if one or more I2C errors occurred, the errors can * be retrieved using @p i2cGetErrors(). - * @retval RDY_TIMEOUT if a timeout occurred before operation end. After a + * @retval MSG_TIMEOUT if a timeout occurred before operation end. After a * timeout the driver must be stopped and restarted * because the bus is in an uncertain state. * @@ -145,13 +140,11 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, (void)rxbytes; (void)timeout; - return RDY_OK; + return MSG_OK; } /** * @brief Transmits data via the I2C bus as master. - * @details Number of receiving bytes must be 0 or more than 1 on STM32F1x. - * This is hardware restriction. * * @param[in] i2cp pointer to the @p I2CDriver object * @param[in] addr slave device address @@ -164,10 +157,10 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, * - @a TIME_INFINITE no timeout. * . * @return The operation status. - * @retval RDY_OK if the function succeeded. - * @retval RDY_RESET if one or more I2C errors occurred, the errors can + * @retval MSG_OK if the function succeeded. + * @retval MSG_RESET if one or more I2C errors occurred, the errors can * be retrieved using @p i2cGetErrors(). - * @retval RDY_TIMEOUT if a timeout occurred before operation end. After a + * @retval MSG_TIMEOUT if a timeout occurred before operation end. After a * timeout the driver must be stopped and restarted * because the bus is in an uncertain state. * @@ -186,7 +179,7 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, (void)rxbytes; (void)timeout; - return RDY_OK; + return MSG_OK; } #endif /* HAL_USE_I2C */ diff --git a/os/hal/templates/i2c_lld.h b/os/hal/templates/i2c_lld.h index 83da65c11..7a33acddd 100644 --- a/os/hal/templates/i2c_lld.h +++ b/os/hal/templates/i2c_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio + ChibiOS/HAL - Copyright (C) 2006-2014 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,8 +15,8 @@ */ /** - * @file templates/i2c_lld.h - * @brief I2C Driver subsystem low level driver header template. + * @file i2c_lld.h + * @brief PLATFORM I2C subsystem low level driver header. * * @addtogroup I2C * @{ @@ -45,7 +45,7 @@ * @note The default is @p FALSE. */ #if !defined(PLATFORM_I2C_USE_I2C1) || defined(__DOXYGEN__) -#define PLATFORM_I2C_USE_I2C1 FALSE +#define PLATFORM_I2C_USE_I2C1 FALSE #endif /** @} */ @@ -58,7 +58,7 @@ /*===========================================================================*/ /** - * @brief Type representing I2C address. + * @brief Type representing an I2C address. */ typedef uint16_t i2caddr_t; @@ -68,15 +68,12 @@ typedef uint16_t i2caddr_t; typedef uint32_t i2cflags_t; /** - * @brief Driver configuration structure. + * @brief Type of I2C driver configuration structure. * @note Implementations may extend this structure to contain more, * architecture dependent, fields. */ - -/** - * @brief Driver configuration structure. - */ typedef struct { + /* End of the mandatory fields.*/ uint32_t dummy; } I2CConfig; @@ -86,7 +83,7 @@ typedef struct { typedef struct I2CDriver I2CDriver; /** - * @brief Structure representing an I2C driver. + * @brief Structure representing an I2C driver. */ struct I2CDriver { /** @@ -102,14 +99,7 @@ struct I2CDriver { */ i2cflags_t errors; #if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) -#if CH_USE_MUTEXES || defined(__DOXYGEN__) - /** - * @brief Mutex protecting the bus. - */ - Mutex mutex; -#elif CH_USE_SEMAPHORES - Semaphore semaphore; -#endif + mutex_t mutex; #endif /* I2C_USE_MUTUAL_EXCLUSION */ #if defined(I2C_DRIVER_EXT_FIELDS) I2C_DRIVER_EXT_FIELDS diff --git a/os/hal/templates/i2s_lld.c b/os/hal/templates/i2s_lld.c index 3b218cc8d..72122a7f9 100644 --- a/os/hal/templates/i2s_lld.c +++ b/os/hal/templates/i2s_lld.c @@ -15,7 +15,7 @@ */ /** - * @file PLATFORM/i2s_lld.c + * @file i2s_lld.c * @brief PLATFORM I2S subsystem low level driver source. * * @addtogroup I2S diff --git a/os/hal/templates/icu_lld.c b/os/hal/templates/icu_lld.c index 9ec44cd40..35d8b7d64 100644 --- a/os/hal/templates/icu_lld.c +++ b/os/hal/templates/icu_lld.c @@ -13,14 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -/* - Concepts and parts of this file have been contributed by Fabio Utzig and - Xo Wang. - */ /** - * @file PLATFORM/icu_lld.c - * @brief PLATFORM ICU subsystem low level driver header. + * @file icu_lld.c + * @brief PLATFORM ADC subsystem low level driver source. * * @addtogroup ICU * @{ @@ -91,6 +87,7 @@ void icu_lld_start(ICUDriver *icup) { } #endif + } } /** @@ -109,6 +106,7 @@ void icu_lld_stop(ICUDriver *icup) { } #endif + } } /** diff --git a/os/hal/templates/icu_lld.h b/os/hal/templates/icu_lld.h index db1e9e5c1..2ca15d55b 100644 --- a/os/hal/templates/icu_lld.h +++ b/os/hal/templates/icu_lld.h @@ -15,7 +15,7 @@ */ /** - * @file PLATFORM/icu_lld.h + * @file icu_lld.h * @brief PLATFORM ICU subsystem low level driver header. * * @addtogroup ICU diff --git a/os/hal/templates/mac_lld.c b/os/hal/templates/mac_lld.c index 7eb327e7b..036c3a0f5 100644 --- a/os/hal/templates/mac_lld.c +++ b/os/hal/templates/mac_lld.c @@ -15,8 +15,8 @@ */ /** - * @file PLATFORM/mac_lld.c - * @brief PLATFORM low level MAC driver code. + * @file mac_lld.c + * @brief PLATFORM MAC subsystem low level driver source. * * @addtogroup MAC * @{ @@ -169,7 +169,7 @@ msg_t mac_lld_get_receive_descriptor(MACDriver *macp, (void)macp; (void)rdp; - return RDY_OK; + return MSG_OK; } /** @@ -197,7 +197,7 @@ void mac_lld_release_receive_descriptor(MACReceiveDescriptor *rdp) { * * @notapi */ -bool_t mac_lld_poll_link_status(MACDriver *macp) { +bool mac_lld_poll_link_status(MACDriver *macp) { (void)macp; diff --git a/os/hal/templates/mac_lld.h b/os/hal/templates/mac_lld.h index 9a536543b..5d523554f 100644 --- a/os/hal/templates/mac_lld.h +++ b/os/hal/templates/mac_lld.h @@ -15,8 +15,8 @@ */ /** - * @file PLATFORM/mac_lld.h - * @brief PLATFORM low level MAC driver header. + * @file mac_lld.h + * @brief PLATFORM MAC subsystem low level driver header. * * @addtogroup MAC * @{ diff --git a/os/hal/templates/osal/osal.c b/os/hal/templates/osal/osal.c index 091489ba6..94e166027 100644 --- a/os/hal/templates/osal/osal.c +++ b/os/hal/templates/osal/osal.c @@ -76,58 +76,38 @@ __attribute__((weak, noreturn)) #endif void osalSysHalt(const char *reason) { - osalIsrDisable(); + osalSysDisable(); osal_halt_msg = reason; while (1) ; } /** - * @brief Enqueues the caller thread. - * @details The caller thread is enqueued and put to sleep until it is - * dequeued or the specified timeouts expires. + * @brief Dequeues and wakes up one thread from the queue, if any. * * @param[in] tqp pointer to the threads queue object - * @param[in] time the timeout in system ticks, the special values are - * handled as follow: - * - @a TIME_INFINITE the thread enters an infinite sleep - * state. - * - @a TIME_IMMEDIATE the thread is not enqueued and - * the function returns @p MSG_TIMEOUT as if a timeout - * occurred. - * . - * @return The message from @p osalQueueWakeupOneI() or - * @p osalQueueWakeupAllI() functions. - * @retval RDY_TIMEOUT if the thread has not been dequeued within the - * specified timeout or if the function has been - * invoked with @p TIME_IMMEDIATE as timeout - * specification. + * @param[in] msg the message code * - * @sclass + * @iclass */ -msg_t osalQueueGoSleepTimeoutS(threads_queue_t *tqp, systime_t time) { - msg_t msg; - virtual_timer_t vt; +void osalThreadDequeueNextI(threads_queue_t *tqp, msg_t msg) { - void wakeup(void *p) { - osalSysLockFromISR(); - osalThreadResumeI((thread_reference_t *)p, MSG_TIMEOUT); - osalSysUnlockFromISR(); - } + (void)tqp; + (void)msg; +} - if (TIME_IMMEDIATE == time) - return MSG_TIMEOUT; +/** + * @brief Dequeues and wakes up all threads from the queue. + * + * @param[in] tqp pointer to the threads queue object + * @param[in] msg the message code + * + * @iclass + */ +void osalThreadDequeueAllI(threads_queue_t *tqp, msg_t msg) { - tqp->tr = NULL; - - if (TIME_INFINITE == time) - return osalThreadSuspendS(&tqp->tr); - - osalVTSetI(&vt, time, wakeup, (void *)&tqp->tr); - msg = osalThreadSuspendS(&tqp->tr); - if (osalVTIsArmedI(&vt)) - osalVTResetI(&vt); - return msg; + (void)tqp; + (void)msg; } /** @} */ diff --git a/os/hal/templates/osal/osal.h b/os/hal/templates/osal/osal.h index fdad4dcbb..d1df76826 100644 --- a/os/hal/templates/osal/osal.h +++ b/os/hal/templates/osal/osal.h @@ -53,17 +53,47 @@ * @name Messages * @{ */ -#define MSG_OK 0 -#define MSG_RESET -1 -#define MSG_TIMEOUT -2 +#define MSG_OK 0 +#define MSG_RESET -1 +#define MSG_TIMEOUT -2 /** @} */ + /** * @name Special time constants * @{ */ -#define TIME_IMMEDIATE ((systime_t)0) -#define TIME_INFINITE ((systime_t)-1) +#define TIME_IMMEDIATE ((systime_t)0) +#define TIME_INFINITE ((systime_t)-1) +/** @} */ + +/** + * @name Systick modes. + * @{ + */ +#define OSAL_ST_MODE_NONE 0 +#define OSAL_ST_MODE_PERIODIC 1 +#define OSAL_ST_MODE_FREERUNNING 2 +/** @} */ + +/** + * @name Systick parameters. + * @{ + */ +/** + * @brief Size in bits of the @p systick_t type. + */ +#define OSAL_ST_RESOLUTION 32 + +/** + * @brief Required systick frequency or resolution. + */ +#define OSAL_ST_FREQUENCY 1000 + +/** + * @brief Systick mode required by the underlying OS. + */ +#define OSAL_ST_MODE OSAL_ST_MODE_PERIODIC /** @} */ /*===========================================================================*/ @@ -79,9 +109,9 @@ /*===========================================================================*/ /** - * @brief Type of a machine status register. + * @brief Type of a system status word. */ -typedef uint32_t osal_sts_t; +typedef uint32_t syssts_t; /** * @brief Type of a message. @@ -93,16 +123,16 @@ typedef int32_t msg_t; */ typedef uint32_t systime_t; +/** + * @brief Type of realtime counter. + */ +typedef uint32_t rtcnt_t; + /** * @brief Type of a thread reference. */ typedef void * thread_reference_t; -/** - * @brief Type of an event flags mask. - */ -typedef uint32_t eventflags_t; - /** * @brief Type of an event flags object. * @note The content of this structure is not part of the API and should @@ -111,10 +141,33 @@ typedef uint32_t eventflags_t; * @note Retrieval and clearing of the flags are not defined in this * API and are implementation-dependent. */ -typedef struct { - volatile eventflags_t flags; /**< @brief Flags stored into the - object. */ -} event_source_t; +typedef struct event_source event_source_t; + +/** + * @brief Type of an event source callback. + * @note This type is not part of the OSAL API and is provided + * exclusively as an example and for convenience. + */ +typedef void (*eventcallback_t)(event_source_t *); + +/** + * @brief Type of an event flags mask. + */ +typedef uint32_t eventflags_t; + +/** + * @brief Events source object. + * @note The content of this structure is not part of the API and should + * not be relied upon. Implementers may define this structure in + * an entirely different way. + * @note Retrieval and clearing of the flags are not defined in this + * API and are implementation-dependent. + */ +struct event_source { + volatile eventflags_t flags; /**< @brief Stored event flags. */ + eventcallback_t cb; /**< @brief Event source callback. */ + void *param; /**< @brief User defined field. */ +}; /** * @brief Type of a mutex. @@ -127,8 +180,8 @@ typedef uint32_t mutex_t; * @brief Type of a thread queue. * @details A thread queue is a queue of sleeping threads, queued threads * can be dequeued one at time or all together. - * @note In this implementation it is implemented as a single reference - * because there are no real threads. + * @note If the OSAL is implemented on a bare metal machine withou RTOS + * then the queue can be implemented as a single thread reference. */ typedef struct { thread_reference_t tr; @@ -138,24 +191,25 @@ typedef struct { /* Module macros. */ /*===========================================================================*/ +/** + * @name Debug related macros + * @{ + */ /** * @brief Condition assertion. - * @details If the condition check fails then the OSAL panics with the - * specified message and halts. + * @details If the condition check fails then the OSAL panics with a + * message and halts. * @note The condition is tested only if the @p OSAL_ENABLE_ASSERTIONS * switch is enabled. - * @note The convention for the message is the following:
- * @(), #@ * @note The remark string is not currently used except for putting a * comment in the code about the assertion. * * @param[in] c the condition to be verified to be true - * @param[in] msg the text message * @param[in] remark a remark string * * @api */ -#define osalDbgAssert(c, msg, remark) +#define osalDbgAssert(c, remark) /** * @brief Function parameters check. @@ -171,16 +225,21 @@ typedef struct { /** * @brief I-Class state check. - * @note Not implemented in this simplified OSAL. + * @note Implementation is optional. */ #define osalDbgCheckClassI() /** * @brief S-Class state check. - * @note Not implemented in this simplified OSAL. + * @note Implementation is optional. */ #define osalDbgCheckClassS() +/** @} */ +/** + * @name IRQ service routines wrappers + * @{ + */ /** * @brief IRQ prologue code. * @details This macro must be inserted at the start of all IRQ handlers. @@ -200,6 +259,96 @@ typedef struct { * @param[in] id a vector name as defined in @p vectors.s */ #define OSAL_IRQ_HANDLER(id) void id(void) +/** @} */ + +/** + * @name Time conversion utilities + * @{ + */ +/** + * @brief Seconds to system ticks. + * @details Converts from seconds to system ticks number. + * @note The result is rounded upward to the next tick boundary. + * + * @param[in] sec number of seconds + * @return The number of ticks. + * + * @api + */ +#define OSAL_S2ST(sec) \ + ((systime_t)((sec) * OSAL_ST_FREQUENCY)) + +/** + * @brief Milliseconds to system ticks. + * @details Converts from milliseconds to system ticks number. + * @note The result is rounded upward to the next tick boundary. + * + * @param[in] msec number of milliseconds + * @return The number of ticks. + * + * @api + */ +#define OSAL_MS2ST(msec) \ + ((systime_t)(((((uint32_t)(msec)) * ((uint32_t)OSAL_ST_FREQUENCY) - 1UL) /\ + 1000UL) + 1UL)) + +/** + * @brief Microseconds to system ticks. + * @details Converts from microseconds to system ticks number. + * @note The result is rounded upward to the next tick boundary. + * + * @param[in] usec number of microseconds + * @return The number of ticks. + * + * @api + */ +#define OSAL_US2ST(usec) \ + ((systime_t)(((((uint32_t)(usec)) * ((uint32_t)OSAL_ST_FREQUENCY) - 1UL) /\ + 1000000UL) + 1UL)) +/** @} */ + +/** + * @name Sleep macros using absolute time + * @{ + */ +/** + * @brief Delays the invoking thread for the specified number of seconds. + * @note The specified time is rounded up to a value allowed by the real + * system tick clock. + * @note The maximum specifiable value is implementation dependent. + * + * @param[in] sec time in seconds, must be different from zero + * + * @api + */ +#define osalThreadSleepSeconds(sec) osalThreadSleep(OSAL_S2ST(sec)) + +/** + * @brief Delays the invoking thread for the specified number of + * milliseconds. + * @note The specified time is rounded up to a value allowed by the real + * system tick clock. + * @note The maximum specifiable value is implementation dependent. + * + * @param[in] msec time in milliseconds, must be different from zero + * + * @api + */ +#define osalThreadSleepMilliseconds(msec) osalThreadSleep(OSAL_MS2ST(msec)) + +/** + * @brief Delays the invoking thread for the specified number of + * microseconds. + * @note The specified time is rounded up to a value allowed by the real + * system tick clock. + * @note The maximum specifiable value is implementation dependent. + * + * @param[in] usec time in microseconds, must be different from zero + * + * @api + */ +#define osalThreadSleepMicroseconds(usec) osalThreadSleep(OSAL_US2ST(usec)) +/** @} */ /*===========================================================================*/ /* External declarations. */ @@ -210,7 +359,8 @@ extern "C" { #endif void osalInit(void); void osalSysHalt(const char *reason); - msg_t osalQueueGoSleepTimeoutS(threads_queue_t *tqp, systime_t time); + void osalThreadDequeueNextI(threads_queue_t *tqp, msg_t msg); + void osalThreadDequeueAllI(threads_queue_t *tqp, msg_t msg); #ifdef __cplusplus } #endif @@ -219,6 +369,33 @@ extern "C" { /* Module inline functions. */ /*===========================================================================*/ +/** + * @brief Globally enables interrupts. + * + * @special + */ +static inline void osalSysEnable(void) { + +} + +/** + * @brief Globally disables interrupts. + * + * @special + */ +static inline void osalSysDisable(void) { + +} + +/** + * @brief Waits for an interrupt to occur. + * + * @special + */ +static inline void osalSysWait(void) { + +} + /** * @brief Enters a critical zone from thread context. * @note This function cannot be used for reentrant critical zones. @@ -260,31 +437,62 @@ static inline void osalSysUnlockFromISR(void) { } /** - * @brief Enters a critical zone returning the previous machine status. + * @brief Returns the execution status and enters a critical zone. + * @details This functions enters into a critical zone and can be called + * from any context. Because its flexibility it is less efficient + * than @p chSysLock() which is preferable when the calling context + * is known. + * @post The system is in a critical zone. * - * @return The previous status. + * @return The previous system status, the encoding of this + * status word is architecture-dependent and opaque. * - * @special + * @xclass */ -static inline osal_sts_t osalSysGetStatusAndLock(void) { +static inline syssts_t osalSysGetStatusAndLockX(void) { return 0; } /** - * @brief Restores a machine status. + * @brief Restores the specified execution status and leaves a critical zone. + * @note A call to @p chSchRescheduleS() is automatically performed + * if exiting the critical zone and if not in ISR context. * - * @param[in] sts the previous status. This value must be something - * returned by the function @p osalSysGetStatusAndLock(). - * Arbitrary values are not allowed. + * @param[in] sts the system status to be restored. * - * @special + * @xclass */ -static inline void osalSysSetStatus(osal_sts_t sts) { +static inline void osalSysRestoreStatusX(syssts_t sts) { (void)sts; } +/** + * @brief Polled delay. + * @note The real delay is always few cycles in excess of the specified + * value. + * + * @param[in] cycles number of cycles + * + * @xclass + */ +static inline void osalSysPolledDelayX(rtcnt_t cycles) { + + (void)cycles; +} + +/** + * @brief Systick callback for the underlying OS. + * @note This callback is only defined if the OSAL requires such a + * service from the HAL. + */ +#if (OSAL_ST_MODE != OSAL_ST_MODE_NONE) || defined(__DOXYGEN__) +static inline void osalOsTimerHandlerI(void) { + +} +#endif + /** * @brief Checks if a reschedule is required and performs it. * @note I-Class functions invoked from thread context must not reschedule @@ -298,6 +506,45 @@ static inline void osalOsRescheduleS(void) { } +/** + * @brief Current system time. + * @details Returns the number of system ticks since the @p osalInit() + * invocation. + * @note The counter can reach its maximum and then restart from zero. + * @note This function can be called from any context but its atomicity + * is not guaranteed on architectures whose word size is less than + * @systime_t size. + * + * @return The system time in ticks. + * + * @xclass + */ +static inline systime_t osalOsGetSystemTimeX(void) { + + return 0; +} + +/** + * @brief Checks if the specified time is within the specified time window. + * @note When start==end then the function returns always true because the + * whole time range is specified. + * @note This function can be called from any context. + * + * @param[in] time the time to be verified + * @param[in] start the start of the time window (inclusive) + * @param[in] end the end of the time window (non inclusive) + * @retval true current time within the specified time window. + * @retval false current time not within the specified time window. + * + * @xclass + */ +static inline bool osalOsIsTimeWithinX(systime_t time, + systime_t start, + systime_t end) { + + return (bool)(time - start < end - start); +} + /** * @brief Suspends the invoking thread for the specified time. * @@ -310,7 +557,7 @@ static inline void osalOsRescheduleS(void) { * * @sclass */ -inline void osalThreadSleepS(systime_t time) { +static inline void osalThreadSleepS(systime_t time) { (void)time; } @@ -327,11 +574,132 @@ inline void osalThreadSleepS(systime_t time) { * * @api */ -void osalThreadSleep(systime_t time) { +static inline void osalThreadSleep(systime_t time) { (void)time; } +/** + * @brief Sends the current thread sleeping and sets a reference variable. + * @note This function must reschedule, it can only be called from thread + * context. + * + * @param[in] trp a pointer to a thread reference object + * @return The wake up message. + * + * @sclass + */ +static inline msg_t osalThreadSuspendS(thread_reference_t *trp) { + + (void)trp; + + return MSG_OK; +} + +/** + * @brief Sends the current thread sleeping and sets a reference variable. + * @note This function must reschedule, it can only be called from thread + * context. + * + * @param[in] trp a pointer to a thread reference object + * @param[in] timeout the timeout in system ticks, the special values are + * handled as follow: + * - @a TIME_INFINITE the thread enters an infinite sleep + * state. + * - @a TIME_IMMEDIATE the thread is not enqueued and + * the function returns @p MSG_TIMEOUT as if a timeout + * occurred. + * . + * @return The wake up message. + * @retval MSG_TIMEOUT if the operation timed out. + * + * @sclass + */ +static inline msg_t osalThreadSuspendTimeoutS(thread_reference_t *trp, + systime_t timeout) { + + (void)trp; + (void)timeout; + + return MSG_OK; +} + +/** + * @brief Wakes up a thread waiting on a thread reference object. + * @note This function must not reschedule because it can be called from + * ISR context. + * + * @param[in] trp a pointer to a thread reference object + * @param[in] msg the message code + * + * @iclass + */ +static inline void osalThreadResumeI(thread_reference_t *trp, msg_t msg) { + + (void)trp; + (void)msg; +} + +/** + * @brief Wakes up a thread waiting on a thread reference object. + * @note This function must reschedule, it can only be called from thread + * context. + * + * @param[in] trp a pointer to a thread reference object + * @param[in] msg the message code + * + * @iclass + */ +static inline void osalThreadResumeS(thread_reference_t *trp, msg_t msg) { + + (void)trp; + (void)msg; +} + +/** + * @brief Initializes a threads queue object. + * + * @param[out] tqp pointer to the threads queue object + * + * @init + */ +static inline void osalThreadQueueObjectInit(threads_queue_t *tqp) { + + (void)tqp; +} + +/** + * @brief Enqueues the caller thread. + * @details The caller thread is enqueued and put to sleep until it is + * dequeued or the specified timeouts expires. + * + * @param[in] tqp pointer to the threads queue object + * @param[in] time the timeout in system ticks, the special values are + * handled as follow: + * - @a TIME_INFINITE the thread enters an infinite sleep + * state. + * - @a TIME_IMMEDIATE the thread is not enqueued and + * the function returns @p MSG_TIMEOUT as if a timeout + * occurred. + * . + * @return The message from @p osalQueueWakeupOneI() or + * @p osalQueueWakeupAllI() functions. + * @retval RDY_TIMEOUT if the thread has not been dequeued within the + * specified timeout or if the function has been + * invoked with @p TIME_IMMEDIATE as timeout + * specification. + * + * @sclass + */ +static inline msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp, + systime_t time) { + + (void)tqp; + (void)time; + + return MSG_OK; +} + /** * @brief Initializes an event flags object. * @@ -339,11 +707,13 @@ void osalThreadSleep(systime_t time) { * * @init */ -static inline void osalEventInit(event_source_t *esp) { +static inline void osalEventObjectInit(event_source_t *esp) { osalDbgCheck(esp != NULL); esp->flags = 0; + esp->cb = NULL; + esp->param = NULL; } /** @@ -360,6 +730,8 @@ static inline void osalEventBroadcastFlagsI(event_source_t *esp, osalDbgCheck(esp != NULL); esp->flags |= flags; + if (esp->cb != NULL) + esp->cb(esp); } /** @@ -376,47 +748,33 @@ static inline void osalEventBroadcastFlags(event_source_t *esp, osalDbgCheck(esp != NULL); osalSysLock(); - esp->flags |= flags; + osalEventBroadcastFlagsI(esp, flags); osalSysUnlock(); } /** - * @brief Returns the flags associated to the event object then clears them. + * @brief Event callback setup. + * @note The callback is invoked from ISR context and can + * only invoke I-Class functions. The callback is meant + * to wakeup the task that will handle the event by + * calling @p osalEventGetAndClearFlagsI(). * @note This function is not part of the OSAL API and is provided * exclusively as an example and for convenience. * * @param[in] esp pointer to the event flags object - * @return The flags. - * - * @iclass - */ -static inline eventflags_t osalEventGetAndClearFlagsI(event_source_t *esp) { - eventflags_t flags; - - osalDbgCheck(esp != NULL); - - flags = esp->flags; - esp->flags = 0; - return flags; -} - -/** - * @brief Returns the flags associated to the event object and clears them. - * @note This function is not part of the OSAL API and is provided - * exclusively as an example and for convenience. - * - * @param[in] esp pointer to the event flags object - * @return The flags. + * @param[in] cb pointer to the callback function + * @param[in] param parameter to be passed to the callback function * * @api */ -static inline eventflags_t osalEventGetAndClearFlags(event_source_t *esp) { - eventflags_t flags; +static inline void osalEventSetCallback(event_source_t *esp, + eventcallback_t cb, + void *param) { - osalSysLock(); - flags = osalEventGetAndClearFlagsI(esp); - osalSysUnlock(); - return flags; + osalDbgCheck(esp != NULL); + + esp->cb = cb; + esp->param = param; } /** @@ -426,7 +784,7 @@ static inline eventflags_t osalEventGetAndClearFlags(event_source_t *esp) { * * @init */ -static inline void osalMutexInit(mutex_t *mp) { +static inline void osalMutexObjectInit(mutex_t *mp) { *mp = 0; } @@ -463,46 +821,6 @@ static inline void osalMutexUnlock(mutex_t *mp) { *mp = 0; } -/** - * @brief Initializes a threads queue object. - * - * @param[out] tqp pointer to the threads queue object - * - * @init - */ -static inline void osalQueueInit(threads_queue_t *tqp) { - - (void)tqp; -} - -/** - * @brief Dequeues and wakes up one thread from the queue, if any. - * - * @param[in] tqp pointer to the threads queue object - * @param[in] msg the message code - * - * @iclass - */ -static inline void osalQueueWakeupOneI(threads_queue_t *tqp, msg_t msg) { - - (void)tqp; - (void)msg; -} - -/** - * @brief Dequeues and wakes up all threads from the queue. - * - * @param[in] tqp pointer to the threads queue object - * @param[in] msg the message code - * - * @iclass - */ -static inline void osalQueueWakeupAllI(threads_queue_t *tqp, msg_t msg) { - - (void)tqp; - (void)msg; -} - #endif /* _OSAL_H_ */ /** @} */ diff --git a/os/hal/templates/pal_lld.c b/os/hal/templates/pal_lld.c index ac0bdca44..306850409 100644 --- a/os/hal/templates/pal_lld.c +++ b/os/hal/templates/pal_lld.c @@ -15,14 +15,13 @@ */ /** - * @file templates/pal_lld.c - * @brief PAL subsystem low level driver template. + * @file pal_lld.c + * @brief PLATFORM PAL subsystem low level driver source. * * @addtogroup PAL * @{ */ -#include "ch.h" #include "hal.h" #if HAL_USE_PAL || defined(__DOXYGEN__) diff --git a/os/hal/templates/pal_lld.h b/os/hal/templates/pal_lld.h index e69c2ca2e..b1baeafa5 100644 --- a/os/hal/templates/pal_lld.h +++ b/os/hal/templates/pal_lld.h @@ -15,8 +15,8 @@ */ /** - * @file templates/pal_lld.h - * @brief PAL subsystem low level driver header template. + * @file pal_lld.h + * @brief PLATFORM PAL subsystem low level driver header. * * @addtogroup PAL * @{ diff --git a/os/hal/templates/pwm_lld.c b/os/hal/templates/pwm_lld.c index c33fc0d4b..2c855dfe2 100644 --- a/os/hal/templates/pwm_lld.c +++ b/os/hal/templates/pwm_lld.c @@ -15,8 +15,8 @@ */ /** - * @file PLATFORM/pwm_lld.c - * @brief PLATFORM PWM subsystem low level driver header. + * @file pwm_lld.c + * @brief PLATFORM PWM subsystem low level driver source. * * @addtogroup PWM * @{ @@ -108,6 +108,7 @@ void pwm_lld_stop(PWMDriver *pwmp) { } #endif + } } /** @@ -128,6 +129,8 @@ void pwm_lld_enable_channel(PWMDriver *pwmp, pwmcnt_t width) { (void)pwmp; + (void)channel; + (void)width; } /** @@ -145,6 +148,7 @@ void pwm_lld_enable_channel(PWMDriver *pwmp, void pwm_lld_disable_channel(PWMDriver *pwmp, pwmchannel_t channel) { (void)pwmp; + (void)channel; } /** diff --git a/os/hal/templates/pwm_lld.h b/os/hal/templates/pwm_lld.h index 5b0789b4e..30a7811f1 100644 --- a/os/hal/templates/pwm_lld.h +++ b/os/hal/templates/pwm_lld.h @@ -15,7 +15,7 @@ */ /** - * @file PLATFORM/pwm_lld.h + * @file pwm_lld.h * @brief PLATFORM PWM subsystem low level driver header. * * @addtogroup PWM diff --git a/os/hal/templates/rtc_lld.c b/os/hal/templates/rtc_lld.c index 762f55e24..11ca5d4e4 100644 --- a/os/hal/templates/rtc_lld.c +++ b/os/hal/templates/rtc_lld.c @@ -19,8 +19,8 @@ */ /** - * @file PLATFORM/RTCv2/rtc_lld.c - * @brief PLATFORML1xx/PLATFORMF2xx/PLATFORMF4xx RTC low level driver. + * @file rtc_lld.c + * @brief PLATFORM RTC subsystem low level driver source. * * @addtogroup RTC * @{ diff --git a/os/hal/templates/rtc_lld.h b/os/hal/templates/rtc_lld.h index a07756923..4b00cc72a 100644 --- a/os/hal/templates/rtc_lld.h +++ b/os/hal/templates/rtc_lld.h @@ -19,8 +19,8 @@ */ /** - * @file PLATFORM/rtc_lld.h - * @brief PLATFORML RTC low level driver header. + * @file rtc_lld.h + * @brief PLATFORM RTC subsystem low level driver header. * * @addtogroup RTC * @{ diff --git a/os/hal/templates/sdc_lld.c b/os/hal/templates/sdc_lld.c index 77a339fd9..b6a98df10 100644 --- a/os/hal/templates/sdc_lld.c +++ b/os/hal/templates/sdc_lld.c @@ -15,7 +15,7 @@ */ /** - * @file PLATFORM/sdc_lld.c + * @file sdc_lld.c * @brief PLATFORM SDC subsystem low level driver source. * * @addtogroup SDC @@ -191,6 +191,9 @@ bool sdc_lld_send_cmd_short(SDCDriver *sdcp, uint8_t cmd, uint32_t arg, uint32_t *resp) { (void)sdcp; + (void)cmd; + (void)arg; + (void)resp; return HAL_SUCCESS; } @@ -213,6 +216,9 @@ bool sdc_lld_send_cmd_short_crc(SDCDriver *sdcp, uint8_t cmd, uint32_t arg, uint32_t *resp) { (void)sdcp; + (void)cmd; + (void)arg; + (void)resp; return HAL_SUCCESS; } @@ -235,6 +241,9 @@ bool sdc_lld_send_cmd_long_crc(SDCDriver *sdcp, uint8_t cmd, uint32_t arg, uint32_t *resp) { (void)sdcp; + (void)cmd; + (void)arg; + (void)resp; return HAL_SUCCESS; } @@ -306,6 +315,12 @@ bool sdc_lld_write_aligned(SDCDriver *sdcp, uint32_t startblk, bool sdc_lld_read(SDCDriver *sdcp, uint32_t startblk, uint8_t *buf, uint32_t n) { + (void)sdcp; + (void)startblk; + (void)buf; + (void)n; + + return HAL_SUCCESS; } /** @@ -325,6 +340,12 @@ bool sdc_lld_read(SDCDriver *sdcp, uint32_t startblk, bool sdc_lld_write(SDCDriver *sdcp, uint32_t startblk, const uint8_t *buf, uint32_t n) { + (void)sdcp; + (void)startblk; + (void)buf; + (void)n; + + return HAL_SUCCESS; } /** @@ -341,6 +362,7 @@ bool sdc_lld_write(SDCDriver *sdcp, uint32_t startblk, bool sdc_lld_sync(SDCDriver *sdcp) { (void)sdcp; + return HAL_SUCCESS; } diff --git a/os/hal/templates/sdc_lld.h b/os/hal/templates/sdc_lld.h index 4611fe783..376f8bb1a 100644 --- a/os/hal/templates/sdc_lld.h +++ b/os/hal/templates/sdc_lld.h @@ -15,7 +15,7 @@ */ /** - * @file PLATFORM/sdc_lld.h + * @file sdc_lld.h * @brief PLATFORM SDC subsystem low level driver header. * * @addtogroup SDC diff --git a/os/hal/templates/serial_lld.c b/os/hal/templates/serial_lld.c index 8747e4452..325cf4497 100644 --- a/os/hal/templates/serial_lld.c +++ b/os/hal/templates/serial_lld.c @@ -15,8 +15,8 @@ */ /** - * @file PLATFORM/USARTv2/serial_lld.c - * @brief PLATFORM low level serial driver code. + * @file serial_lld.c + * @brief PLATFORM serial subsystem low level driver source. * * @addtogroup SERIAL * @{ @@ -112,7 +112,6 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) { void sd_lld_stop(SerialDriver *sdp) { if (sdp->state == SD_READY) { - usart_deinit(sdp->usart); #if PLATFORM_SERIAL_USE_USART1 if (&SD1 == sdp) { diff --git a/os/hal/templates/serial_lld.h b/os/hal/templates/serial_lld.h index 62121eb96..5cbdac539 100644 --- a/os/hal/templates/serial_lld.h +++ b/os/hal/templates/serial_lld.h @@ -15,8 +15,8 @@ */ /** - * @file PLATFORM/serial_lld.h - * @brief PLATFORM low level serial driver header. + * @file serial_lld.h + * @brief PLATFORM serial subsystem low level driver header. * * @addtogroup SERIAL * @{ diff --git a/os/hal/templates/spi_lld.c b/os/hal/templates/spi_lld.c index e4987fc7c..8320c7425 100644 --- a/os/hal/templates/spi_lld.c +++ b/os/hal/templates/spi_lld.c @@ -15,7 +15,7 @@ */ /** - * @file PLATFORM/SPIv2/spi_lld.c + * @file spi_lld.c * @brief PLATFORM SPI subsystem low level driver source. * * @addtogroup SPI diff --git a/os/hal/templates/spi_lld.h b/os/hal/templates/spi_lld.h index c5c69d3fc..cfab88eba 100644 --- a/os/hal/templates/spi_lld.h +++ b/os/hal/templates/spi_lld.h @@ -15,7 +15,7 @@ */ /** - * @file PLATFORM/spi_lld.h + * @file spi_lld.h * @brief PLATFORM SPI subsystem low level driver header. * * @addtogroup SPI diff --git a/os/hal/templates/st_lld.c b/os/hal/templates/st_lld.c index b7a309d21..d6768ddf9 100644 --- a/os/hal/templates/st_lld.c +++ b/os/hal/templates/st_lld.c @@ -15,8 +15,8 @@ */ /** - * @file PLATFORM/st_lld.c - * @brief ST Driver subsystem low level driver code. + * @file st_lld.c + * @brief PLATFORM ST subsystem low level driver source. * * @addtogroup ST * @{ diff --git a/os/hal/templates/st_lld.h b/os/hal/templates/st_lld.h index 622bf7fdc..b5de30a6d 100644 --- a/os/hal/templates/st_lld.h +++ b/os/hal/templates/st_lld.h @@ -15,8 +15,8 @@ */ /** - * @file PLATFORM/st_lld.h - * @brief ST Driver subsystem low level driver header. + * @file st_lld.h + * @brief PLATFORM ST subsystem low level driver header. * @details This header is designed to be include-able without having to * include other files from the HAL. * diff --git a/os/hal/templates/uart_lld.c b/os/hal/templates/uart_lld.c index cc6fc27d4..526b498f4 100644 --- a/os/hal/templates/uart_lld.c +++ b/os/hal/templates/uart_lld.c @@ -15,14 +15,13 @@ */ /** - * @file templates/uart_lld.c - * @brief UART Driver subsystem low level driver source template. + * @file uart_lld.c + * @brief PLATFORM UART subsystem low level driver source. * * @addtogroup UART * @{ */ -#include "ch.h" #include "hal.h" #if HAL_USE_UART || defined(__DOXYGEN__) diff --git a/os/hal/templates/uart_lld.h b/os/hal/templates/uart_lld.h index 6e34fa108..7d93a3833 100644 --- a/os/hal/templates/uart_lld.h +++ b/os/hal/templates/uart_lld.h @@ -15,8 +15,8 @@ */ /** - * @file templates/uart_lld.h - * @brief UART Driver subsystem low level driver header template. + * @file uart_lld.h + * @brief PLATFORM UART subsystem low level driver header. * * @addtogroup UART * @{ diff --git a/os/hal/templates/usb_lld.c b/os/hal/templates/usb_lld.c index e48413353..8d74e5002 100644 --- a/os/hal/templates/usb_lld.c +++ b/os/hal/templates/usb_lld.c @@ -15,7 +15,7 @@ */ /** - * @file PLATFORM/usb_lld.c + * @file usb_lld.c * @brief PLATFORM USB subsystem low level driver source. * * @addtogroup USB diff --git a/os/hal/templates/usb_lld.h b/os/hal/templates/usb_lld.h index 40970043a..3ea39368c 100644 --- a/os/hal/templates/usb_lld.h +++ b/os/hal/templates/usb_lld.h @@ -15,7 +15,7 @@ */ /** - * @file PLATFORM/usb_lld.h + * @file usb_lld.h * @brief PLATFORM USB subsystem low level driver header. * * @addtogroup USB diff --git a/testhal/common/testbuild/main.c b/testhal/common/testbuild/main.c index e295c1e84..f36b7c691 100644 --- a/testhal/common/testbuild/main.c +++ b/testhal/common/testbuild/main.c @@ -14,7 +14,6 @@ limitations under the License. */ -#include "ch.h" #include "hal.h" /*