From ac598a7b1c4227cbffbbb1af449f2be21e6976a5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 25 Feb 2013 13:10:39 +0000 Subject: [PATCH] LLD templates fixed. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5319 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/USARTv1/serial_lld.h | 1 + os/hal/platforms/STM32/USARTv2/serial_lld.h | 1 + os/hal/templates/adc_lld.h | 2 +- os/hal/templates/can_lld.h | 2 +- os/hal/templates/ext_lld.h | 2 +- os/hal/templates/icu_lld.h | 2 +- os/hal/templates/mac_lld.h | 4 +- os/hal/templates/pwm_lld.c | 41 +++++++++- os/hal/templates/pwm_lld.h | 21 ++++- os/hal/templates/serial_lld.c | 32 ++++++++ os/hal/templates/serial_lld.h | 23 +++++- os/hal/templates/spi_lld.c | 55 ++++++++++++- os/hal/templates/spi_lld.h | 17 ++++ os/hal/templates/uart_lld.c | 47 ++++++++++- os/hal/templates/uart_lld.h | 17 ++++ os/hal/templates/usb_lld.c | 88 +++++++++++++++------ os/hal/templates/usb_lld.h | 12 ++- readme.txt | 1 + testhal/testbuild/.project | 5 -- testhal/testbuild/Makefile | 2 +- testhal/testbuild/board.h | 44 +++++++++++ 21 files changed, 366 insertions(+), 53 deletions(-) create mode 100644 testhal/testbuild/board.h diff --git a/os/hal/platforms/STM32/USARTv1/serial_lld.h b/os/hal/platforms/STM32/USARTv1/serial_lld.h index f99115353..d5edb25b8 100644 --- a/os/hal/platforms/STM32/USARTv1/serial_lld.h +++ b/os/hal/platforms/STM32/USARTv1/serial_lld.h @@ -221,6 +221,7 @@ typedef struct { * @brief Bit rate. */ uint32_t sc_speed; + /* End of the mandatory fields.*/ /** * @brief Initialization value for the CR1 register. */ diff --git a/os/hal/platforms/STM32/USARTv2/serial_lld.h b/os/hal/platforms/STM32/USARTv2/serial_lld.h index af1af8de9..286091b86 100644 --- a/os/hal/platforms/STM32/USARTv2/serial_lld.h +++ b/os/hal/platforms/STM32/USARTv2/serial_lld.h @@ -221,6 +221,7 @@ typedef struct { * @brief Bit rate. */ uint32_t sc_speed; + /* End of the mandatory fields.*/ /** * @brief Initialization value for the CR1 register. */ diff --git a/os/hal/templates/adc_lld.h b/os/hal/templates/adc_lld.h index 582f4dbaa..f67295a97 100644 --- a/os/hal/templates/adc_lld.h +++ b/os/hal/templates/adc_lld.h @@ -49,7 +49,7 @@ * @note The default is @p FALSE. */ #if !defined(PLATFORM_ADC_USE_ADC1) || defined(__DOXYGEN__) -#define PLATFORM_ADC_USE_ADC1 FALSE +#define PLATFORM_ADC_USE_ADC1 FALSE #endif /** @} */ diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 85db551e8..97cc4f00f 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -64,7 +64,7 @@ * @details If set to @p TRUE the support for CAN1 is included. */ #if !defined(PLATFORM_CAN_USE_CAN1) || defined(__DOXYGEN__) -#define PLATFORM_CAN_USE_CAN1 FALSE +#define PLATFORM_CAN_USE_CAN1 FALSE #endif /** @} */ diff --git a/os/hal/templates/ext_lld.h b/os/hal/templates/ext_lld.h index d1f971713..981253d8f 100644 --- a/os/hal/templates/ext_lld.h +++ b/os/hal/templates/ext_lld.h @@ -53,7 +53,7 @@ * @details If set to @p TRUE the support for EXT1 is included. */ #if !defined(PLATFORM_EXT_USE_EXT1) || defined(__DOXYGEN__) -#define PLATFORM_EXT_USE_EXT1 FALSE +#define PLATFORM_EXT_USE_EXT1 FALSE #endif /** @} */ diff --git a/os/hal/templates/icu_lld.h b/os/hal/templates/icu_lld.h index b30733a43..0c3b58ba2 100644 --- a/os/hal/templates/icu_lld.h +++ b/os/hal/templates/icu_lld.h @@ -52,7 +52,7 @@ * @details If set to @p TRUE the support for ICU1 is included. */ #if !defined(PLATFORM_ICU_USE_ICU1) || defined(__DOXYGEN__) -#define PLATFORM_ICU_USE_ICU1 FALSE +#define PLATFORM_ICU_USE_ICU1 FALSE #endif /** @} */ diff --git a/os/hal/templates/mac_lld.h b/os/hal/templates/mac_lld.h index cd5854e80..9004d0c87 100644 --- a/os/hal/templates/mac_lld.h +++ b/os/hal/templates/mac_lld.h @@ -38,7 +38,7 @@ /** * @brief This implementation supports the zero-copy mode API. */ -#define MAC_SUPPORTS_ZERO_COPY TRUE +#define MAC_SUPPORTS_ZERO_COPY TRUE /*===========================================================================*/ /* Driver pre-compile time settings. */ @@ -53,7 +53,7 @@ * @details If set to @p TRUE the support for MAC1 is included. */ #if !defined(PLATFORM_MAC_USE_MAC1) || defined(__DOXYGEN__) -#define PLATFORM_MAC_USE_MAC1 FALSE +#define PLATFORM_MAC_USE_MAC1 FALSE #endif /** @} */ diff --git a/os/hal/templates/pwm_lld.c b/os/hal/templates/pwm_lld.c index a849bf774..f8744e478 100644 --- a/os/hal/templates/pwm_lld.c +++ b/os/hal/templates/pwm_lld.c @@ -39,6 +39,13 @@ /* Driver exported variables. */ /*===========================================================================*/ +/** + * @brief PWM1 driver identifier. + */ +#if PLATFORM_PWM_USE_PWM1 || defined(__DOXYGEN__) +PWMDriver PWMD1; +#endif + /*===========================================================================*/ /* Driver local variables. */ /*===========================================================================*/ @@ -62,6 +69,10 @@ */ void pwm_lld_init(void) { +#if PLATFORM_PWM_USE_PWM1 + /* Driver initialization.*/ + pwmObjectInit(&PWMD1); +#endif /* PLATFORM_PWM_USE_PWM1 */ } /** @@ -74,9 +85,15 @@ void pwm_lld_init(void) { void pwm_lld_start(PWMDriver *pwmp) { if (pwmp->state == PWM_STOP) { - /* Clock activation.*/ + /* Enables the pehipheral.*/ +#if PLATFORM_PWM_USE_PWM1 + if (&PWMD1 == pwmp) { + + } +#endif /* PLATFORM_PWM_USE_PWM1 */ } - /* Configuration.*/ + /* Configures the peripheral.*/ + } /** @@ -88,6 +105,16 @@ void pwm_lld_start(PWMDriver *pwmp) { */ void pwm_lld_stop(PWMDriver *pwmp) { + if (pwmp->state == PWM_READY) { + /* Resets the peripheral.*/ + + /* Disables the peripheral.*/ +#if PLATFORM_PWM_USE_PWM1 + if (&PWMD1 == pwmp) { + + } +#endif /* PLATFORM_PWM_USE_PWM1 */ + } } /** @@ -108,6 +135,9 @@ void pwm_lld_stop(PWMDriver *pwmp) { */ void pwm_lld_change_period(PWMDriver *pwmp, pwmcnt_t period) { + (void)pwmp; + (void)period; + } /** @@ -128,6 +158,10 @@ void pwm_lld_enable_channel(PWMDriver *pwmp, pwmchannel_t channel, pwmcnt_t width) { + (void)pwmp; + (void)channel; + (void)width; + } /** @@ -146,6 +180,9 @@ void pwm_lld_enable_channel(PWMDriver *pwmp, */ void pwm_lld_disable_channel(PWMDriver *pwmp, pwmchannel_t channel) { + (void)pwmp; + (void)channel; + } #endif /* HAL_USE_PWM */ diff --git a/os/hal/templates/pwm_lld.h b/os/hal/templates/pwm_lld.h index b1a202248..e9c630128 100644 --- a/os/hal/templates/pwm_lld.h +++ b/os/hal/templates/pwm_lld.h @@ -35,16 +35,27 @@ /* Driver constants. */ /*===========================================================================*/ +/** + * @brief Number of PWM channels per PWM driver. + */ +#define PWM_CHANNELS 4 + /*===========================================================================*/ /* Driver pre-compile time settings. */ /*===========================================================================*/ /** - * @brief Number of PWM channels per PWM driver. + * @name Configuration options + * @{ */ -#if !defined(PWM_CHANNELS) || defined(__DOXYGEN__) -#define PWM_CHANNELS 1 +/** + * @brief XXX driver enable switch. + * @details If set to @p TRUE the support for XXX1 is included. + */ +#if !defined(PLATFORM_XXX_USE_XXX1) || defined(__DOXYGEN__) +#define PLATFORM_XXX_USE_XXX1 FALSE #endif +/** @} */ /*===========================================================================*/ /* Derived constants and error checks. */ @@ -151,6 +162,10 @@ struct PWMDriver { /* External declarations. */ /*===========================================================================*/ +#if PLATFORM_XXX_USE_XXX1 && !defined(__DOXYGEN__) +extern XXXDriver XXXD1; +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/os/hal/templates/serial_lld.c b/os/hal/templates/serial_lld.c index c48a89e46..79cf9229e 100644 --- a/os/hal/templates/serial_lld.c +++ b/os/hal/templates/serial_lld.c @@ -39,6 +39,13 @@ /* Driver exported variables. */ /*===========================================================================*/ +/** + * @brief SD1 driver identifier. + */ +#if PLATFORM_SERIAL_USE_SD1 || defined(__DOXYGEN__) +SerialDriver SD1; +#endif + /*===========================================================================*/ /* Driver local variables. */ /*===========================================================================*/ @@ -47,6 +54,7 @@ * @brief Driver default configuration. */ static const SerialConfig default_config = { + 38400 }; /*===========================================================================*/ @@ -68,6 +76,10 @@ static const SerialConfig default_config = { */ void sd_lld_init(void) { +#if PLATFORM_SERIAL_USE_SD1 + /* Driver initialization.*/ + sdObjectInit(&SD1); +#endif /* PLATFORM_SERIAL_USE_SD1 */ } /** @@ -85,6 +97,16 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) { if (config == NULL) config = &default_config; + if (sdp->state == SD_STOP) { + /* Enables the pehipheral.*/ +#if PLATFORM_SERIAL_USE_SD1 + if (&SD1 == sdp) { + + } +#endif /* PLATFORM_SD_USE_SD1 */ + } + /* Configures the peripheral.*/ + } /** @@ -98,6 +120,16 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) { */ void sd_lld_stop(SerialDriver *sdp) { + if (sdp->state == SD_READY) { + /* Resets the peripheral.*/ + + /* Disables the peripheral.*/ +#if PLATFORM_SERIAL_USE_SD1 + if (&SD1 == sdp) { + + } +#endif /* PLATFORM_SERIAL_USE_SD1 */ + } } #endif /* HAL_USE_SERIAL */ diff --git a/os/hal/templates/serial_lld.h b/os/hal/templates/serial_lld.h index 532352223..0c28b28be 100644 --- a/os/hal/templates/serial_lld.h +++ b/os/hal/templates/serial_lld.h @@ -39,6 +39,19 @@ /* Driver pre-compile time settings. */ /*===========================================================================*/ +/** + * @name Configuration options + * @{ + */ +/** + * @brief SD1 driver enable switch. + * @details If set to @p TRUE the support for SD1 is included. + */ +#if !defined(PLATFORM_SERIAL_USE_SD1) || defined(__DOXYGEN__) +#define PLATFORM_SERIAL_USE_SD1 FALSE +#endif +/** @} */ + /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ @@ -55,7 +68,11 @@ * architecture dependent, fields. */ typedef struct { - + /** + * @brief Bit rate. + */ + uint32_t sc_speed; + /* End of the mandatory fields.*/ } SerialConfig; /** @@ -83,6 +100,10 @@ typedef struct { /* External declarations. */ /*===========================================================================*/ +#if PLATFORM_SERIAL_USE_SD1 && !defined(__DOXYGEN__) +extern SerialDriver SD1; +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/os/hal/templates/spi_lld.c b/os/hal/templates/spi_lld.c index 71014ebc9..d25a91ae4 100644 --- a/os/hal/templates/spi_lld.c +++ b/os/hal/templates/spi_lld.c @@ -39,6 +39,13 @@ /* Driver exported variables. */ /*===========================================================================*/ +/** + * @brief SPI1 driver identifier. + */ +#if PLATFORM_SPI_USE_SPI1 || defined(__DOXYGEN__) +SPIDriver SPID1; +#endif + /*===========================================================================*/ /* Driver local variables. */ /*===========================================================================*/ @@ -62,6 +69,10 @@ */ void spi_lld_init(void) { +#if PLATFORM_SPI_USE_SPI1 + /* Driver initialization.*/ + spiObjectInit(&SPID1); +#endif /* PLATFORM_SPI_USE_SPI1 */ } /** @@ -74,9 +85,15 @@ void spi_lld_init(void) { void spi_lld_start(SPIDriver *spip) { if (spip->state == SPI_STOP) { - /* Clock activation.*/ + /* Enables the pehipheral.*/ +#if PLATFORM_SPI_USE_SPI1 + if (&SPID1 == spip) { + + } +#endif /* PLATFORM_SPI_USE_SPI1 */ } - /* Configuration.*/ + /* Configures the peripheral.*/ + } /** @@ -88,6 +105,16 @@ void spi_lld_start(SPIDriver *spip) { */ void spi_lld_stop(SPIDriver *spip) { + if (spip->state == SPI_READY) { + /* Resets the peripheral.*/ + + /* Disables the peripheral.*/ +#if PLATFORM_SPI_USE_SPI1 + if (&SPID1 == spip) { + + } +#endif /* PLATFORM_SPI_USE_SPI1 */ + } } /** @@ -99,6 +126,8 @@ void spi_lld_stop(SPIDriver *spip) { */ void spi_lld_select(SPIDriver *spip) { + (void)spip; + } /** @@ -111,6 +140,8 @@ void spi_lld_select(SPIDriver *spip) { */ void spi_lld_unselect(SPIDriver *spip) { + (void)spip; + } /** @@ -126,6 +157,9 @@ void spi_lld_unselect(SPIDriver *spip) { */ void spi_lld_ignore(SPIDriver *spip, size_t n) { + (void)spip; + (void)n; + } /** @@ -146,6 +180,11 @@ void spi_lld_ignore(SPIDriver *spip, size_t n) { void spi_lld_exchange(SPIDriver *spip, size_t n, const void *txbuf, void *rxbuf) { + (void)spip; + (void)n; + (void)txbuf; + (void)rxbuf; + } /** @@ -163,6 +202,10 @@ void spi_lld_exchange(SPIDriver *spip, size_t n, */ void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf) { + (void)spip; + (void)n; + (void)txbuf; + } /** @@ -180,6 +223,10 @@ void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf) { */ void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) { + (void)spip; + (void)n; + (void)rxbuf; + } /** @@ -196,6 +243,10 @@ void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) { */ uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame) { + (void)spip; + (void)frame; + + return 0; } #endif /* HAL_USE_SPI */ diff --git a/os/hal/templates/spi_lld.h b/os/hal/templates/spi_lld.h index e32a0b23e..11aa446ec 100644 --- a/os/hal/templates/spi_lld.h +++ b/os/hal/templates/spi_lld.h @@ -39,6 +39,19 @@ /* Driver pre-compile time settings. */ /*===========================================================================*/ +/** + * @name Configuration options + * @{ + */ +/** + * @brief SPI driver enable switch. + * @details If set to @p TRUE the support for SPI1 is included. + */ +#if !defined(PLATFORM_SPI_USE_SPI1) || defined(__DOXYGEN__) +#define PLATFORM_SPI_USE_SPI1 FALSE +#endif +/** @} */ + /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ @@ -117,6 +130,10 @@ struct SPIDriver { /* External declarations. */ /*===========================================================================*/ +#if PLATFORM_SPI_USE_SPI1 && !defined(__DOXYGEN__) +extern SPIDriver SPID1; +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/os/hal/templates/uart_lld.c b/os/hal/templates/uart_lld.c index a3f9cfd1c..40c88b5a2 100644 --- a/os/hal/templates/uart_lld.c +++ b/os/hal/templates/uart_lld.c @@ -39,6 +39,13 @@ /* Driver exported variables. */ /*===========================================================================*/ +/** + * @brief UART1 driver identifier. + */ +#if PLATFORM_UART_USE_UART1 || defined(__DOXYGEN__) +UARTDriver UARTD1; +#endif + /*===========================================================================*/ /* Driver local variables. */ /*===========================================================================*/ @@ -62,6 +69,10 @@ */ void uart_lld_init(void) { +#if PLATFORM_UART_USE_UART1 + /* Driver initialization.*/ + uartObjectInit(&UARTD1); +#endif /* PLATFORM_UART_USE_UART1 */ } /** @@ -73,10 +84,16 @@ void uart_lld_init(void) { */ void uart_lld_start(UARTDriver *uartp) { - if (uartp->uart_state == UART_STOP) { - /* Clock activation.*/ + if (uartp->state == UART_STOP) { + /* Enables the pehipheral.*/ +#if PLATFORM_UART_USE_UART1 + if (&UARTD1 == uartp) { + + } +#endif /* PLATFORM_UART_USE_UART1 */ } - /* Configuration.*/ + /* Configures the peripheral.*/ + } /** @@ -88,6 +105,16 @@ void uart_lld_start(UARTDriver *uartp) { */ void uart_lld_stop(UARTDriver *uartp) { + if (uartp->state == UART_READY) { + /* Resets the peripheral.*/ + + /* Disables the peripheral.*/ +#if PLATFORM_UART_USE_UART1 + if (&UARTD1 == uartp) { + + } +#endif /* PLATFORM_UART_USE_UART1 */ + } } /** @@ -103,6 +130,10 @@ void uart_lld_stop(UARTDriver *uartp) { */ void uart_lld_start_send(UARTDriver *uartp, size_t n, const void *txbuf) { + (void)uartp; + (void)n; + (void)txbuf; + } /** @@ -118,6 +149,9 @@ void uart_lld_start_send(UARTDriver *uartp, size_t n, const void *txbuf) { */ size_t uart_lld_stop_send(UARTDriver *uartp) { + (void)uartp; + + return 0; } /** @@ -133,6 +167,10 @@ size_t uart_lld_stop_send(UARTDriver *uartp) { */ void uart_lld_start_receive(UARTDriver *uartp, size_t n, void *rxbuf) { + (void)uartp; + (void)n; + (void)rxbuf; + } /** @@ -148,6 +186,9 @@ void uart_lld_start_receive(UARTDriver *uartp, size_t n, void *rxbuf) { */ size_t uart_lld_stop_receive(UARTDriver *uartp) { + (void)uartp; + + return 0; } #endif /* HAL_USE_UART */ diff --git a/os/hal/templates/uart_lld.h b/os/hal/templates/uart_lld.h index 7cf2c17df..9f2d3c7ab 100644 --- a/os/hal/templates/uart_lld.h +++ b/os/hal/templates/uart_lld.h @@ -39,6 +39,19 @@ /* Driver pre-compile time settings. */ /*===========================================================================*/ +/** + * @name Configuration options + * @{ + */ +/** + * @brief UART driver enable switch. + * @details If set to @p TRUE the support for UART1 is included. + */ +#if !defined(PLATFORM_UART_USE_UART1) || defined(__DOXYGEN__) +#define PLATFORM_UART_USE_UART1 FALSE +#endif +/** @} */ + /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ @@ -147,6 +160,10 @@ struct UARTDriver { /* External declarations. */ /*===========================================================================*/ +#if PLATFORM_UART_USE_UART1 && !defined(__DOXYGEN__) +extern UARTDriver UARTD1; +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/os/hal/templates/usb_lld.c b/os/hal/templates/usb_lld.c index 7c6a25060..c5138e497 100644 --- a/os/hal/templates/usb_lld.c +++ b/os/hal/templates/usb_lld.c @@ -39,7 +39,9 @@ /* Driver exported variables. */ /*===========================================================================*/ -/** @brief OTG_FS driver identifier.*/ +/** + * @brief USB1 driver identifier. + */ #if PLATFORM_USB_USE_USB1 || defined(__DOXYGEN__) USBDriver USBD1; #endif @@ -64,11 +66,6 @@ static union { USBOutEndpointState out; } ep0_state; -/** - * @brief Buffer for the EP0 setup packets. - */ -static uint8_t ep0setup_buffer[8]; - /** * @brief EP0 initialization structure. */ @@ -80,9 +77,7 @@ static const USBEndpointConfig ep0config = { 0x40, 0x40, &ep0_state.in, - &ep0_state.out, - 1, - ep0setup_buffer + &ep0_state.out }; /*===========================================================================*/ @@ -108,10 +103,10 @@ static const USBEndpointConfig ep0config = { */ void usb_lld_init(void) { - /* Driver initialization.*/ #if PLATFORM_USB_USE_USB1 + /* Driver initialization.*/ usbObjectInit(&USBD1); -#endif +#endif /* PLATFORM_USB_USE_USB1 */ } /** @@ -122,16 +117,17 @@ void usb_lld_init(void) { * @notapi */ void usb_lld_start(USBDriver *usbp) { - stm32_otg_t *otgp = usbp->otg; if (usbp->state == USB_STOP) { - /* Clock activation.*/ -#if STM32_USB_USE_OTG1 + /* Enables the pehipheral.*/ +#if PLATFORM_USB_USE_USB1 if (&USBD1 == usbp) { - /* Reset procedure enforced on driver start.*/ - _usb_reset(usbp); + } +#endif /* PLATFORM_USB_USE_USB1 */ } + /* Configures the peripheral.*/ + } /** @@ -143,9 +139,15 @@ void usb_lld_start(USBDriver *usbp) { */ void usb_lld_stop(USBDriver *usbp) { - /* If in ready state then disables the USB clock.*/ - if (usbp->state != USB_STOP) { + if (usbp->state == USB_READY) { + /* Resets the peripheral.*/ + /* Disables the peripheral.*/ +#if PLATFORM_USB_USE_USB1 + if (&USBD1 == usbp) { + + } +#endif /* PLATFORM_USB_USE_USB1 */ } } @@ -174,6 +176,8 @@ void usb_lld_reset(USBDriver *usbp) { */ void usb_lld_set_address(USBDriver *usbp) { + (void)usbp; + } /** @@ -186,6 +190,9 @@ void usb_lld_set_address(USBDriver *usbp) { */ void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) { + (void)usbp; + (void)ep; + } /** @@ -197,6 +204,8 @@ void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) { */ void usb_lld_disable_endpoints(USBDriver *usbp) { + (void)usbp; + } /** @@ -213,6 +222,10 @@ void usb_lld_disable_endpoints(USBDriver *usbp) { */ usbepstatus_t usb_lld_get_status_out(USBDriver *usbp, usbep_t ep) { + (void)usbp; + (void)ep; + + return EP_STATUS_DISABLED; } /** @@ -229,6 +242,10 @@ usbepstatus_t usb_lld_get_status_out(USBDriver *usbp, usbep_t ep) { */ usbepstatus_t usb_lld_get_status_in(USBDriver *usbp, usbep_t ep) { + (void)usbp; + (void)ep; + + return EP_STATUS_DISABLED; } /** @@ -247,6 +264,10 @@ usbepstatus_t usb_lld_get_status_in(USBDriver *usbp, usbep_t ep) { */ void usb_lld_read_setup(USBDriver *usbp, usbep_t ep, uint8_t *buf) { + (void)usbp; + (void)ep; + (void)buf; + } /** @@ -258,14 +279,9 @@ void usb_lld_read_setup(USBDriver *usbp, usbep_t ep, uint8_t *buf) { * @notapi */ void usb_lld_prepare_receive(USBDriver *usbp, usbep_t ep) { - uint32_t pcnt; - USBOutEndpointState *osp = usbp->epc[ep]->out_state; - /* Transfer initialization.*/ - pcnt = (osp->rxsize + usbp->epc[ep]->out_maxsize - 1) / - usbp->epc[ep]->out_maxsize; - usbp->otg->oe[ep].DOEPTSIZ = DOEPTSIZ_STUPCNT(3) | DOEPTSIZ_PKTCNT(pcnt) | - DOEPTSIZ_XFRSIZ(usbp->epc[ep]->out_maxsize); + (void)usbp; + (void)ep; } @@ -278,7 +294,9 @@ void usb_lld_prepare_receive(USBDriver *usbp, usbep_t ep) { * @notapi */ void usb_lld_prepare_transmit(USBDriver *usbp, usbep_t ep) { - USBInEndpointState *isp = usbp->epc[ep]->in_state; + + (void)usbp; + (void)ep; } @@ -292,6 +310,9 @@ void usb_lld_prepare_transmit(USBDriver *usbp, usbep_t ep) { */ void usb_lld_start_out(USBDriver *usbp, usbep_t ep) { + (void)usbp; + (void)ep; + } /** @@ -304,6 +325,9 @@ void usb_lld_start_out(USBDriver *usbp, usbep_t ep) { */ void usb_lld_start_in(USBDriver *usbp, usbep_t ep) { + (void)usbp; + (void)ep; + } /** @@ -316,6 +340,9 @@ void usb_lld_start_in(USBDriver *usbp, usbep_t ep) { */ void usb_lld_stall_out(USBDriver *usbp, usbep_t ep) { + (void)usbp; + (void)ep; + } /** @@ -328,6 +355,9 @@ void usb_lld_stall_out(USBDriver *usbp, usbep_t ep) { */ void usb_lld_stall_in(USBDriver *usbp, usbep_t ep) { + (void)usbp; + (void)ep; + } /** @@ -340,6 +370,9 @@ void usb_lld_stall_in(USBDriver *usbp, usbep_t ep) { */ void usb_lld_clear_out(USBDriver *usbp, usbep_t ep) { + (void)usbp; + (void)ep; + } /** @@ -352,6 +385,9 @@ void usb_lld_clear_out(USBDriver *usbp, usbep_t ep) { */ void usb_lld_clear_in(USBDriver *usbp, usbep_t ep) { + (void)usbp; + (void)ep; + } #endif /* HAL_USE_USB */ diff --git a/os/hal/templates/usb_lld.h b/os/hal/templates/usb_lld.h index 479e6ba40..4a3d7b89b 100644 --- a/os/hal/templates/usb_lld.h +++ b/os/hal/templates/usb_lld.h @@ -50,13 +50,17 @@ /*===========================================================================*/ /** - * @brief OTG1 driver enable switch. - * @details If set to @p TRUE the support for OTG_FS is included. - * @note The default is @p TRUE. + * @name Configuration options + * @{ + */ +/** + * @brief USB driver enable switch. + * @details If set to @p TRUE the support for USB1 is included. */ #if !defined(PLATFORM_USB_USE_USB1) || defined(__DOXYGEN__) -#define PLATFORM_USB_USE_USB1 TRUE +#define PLATFORM_USB_USE_USB1 FALSE #endif +/** @} */ /*===========================================================================*/ /* Derived constants and error checks. */ diff --git a/readme.txt b/readme.txt index 482945cb4..5f17a28ec 100644 --- a/readme.txt +++ b/readme.txt @@ -119,6 +119,7 @@ (backported to 2.4.3). - FIX: Fixed wrong SPI path in platform_f105_f107.mk (bug 3598151). - FIX: Fixed PHY powerdown issues not fixed (bug 3596911). +- NEW: Added a build test project for low level device driver templates. - NEW: Enhanced CAN driver model, support for mailboxes has been added. STM32 driver implementation upgraded. - NEW: Added ADC and PWM drivers for the AT91SAM7 platform, both donated diff --git a/testhal/testbuild/.project b/testhal/testbuild/.project index 177c31184..2fd707444 100644 --- a/testhal/testbuild/.project +++ b/testhal/testbuild/.project @@ -24,11 +24,6 @@ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - board - 2 - CHIBIOS/boards/ST_STM32F4_DISCOVERY - os 2 diff --git a/testhal/testbuild/Makefile b/testhal/testbuild/Makefile index a94cf67ac..5d8134d70 100644 --- a/testhal/testbuild/Makefile +++ b/testhal/testbuild/Makefile @@ -65,7 +65,7 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../.. -include $(CHIBIOS)/boards/ST_STM32F4_DISCOVERY/board.mk +#include $(CHIBIOS)/boards/ST_STM32F4_DISCOVERY/board.mk include $(CHIBIOS)/os/hal/templates/platform.mk include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F4xx/port.mk diff --git a/testhal/testbuild/board.h b/testhal/testbuild/board.h new file mode 100644 index 000000000..972c66453 --- /dev/null +++ b/testhal/testbuild/board.h @@ -0,0 +1,44 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +/* + * Setup for a generic board. + */ + +/* + * Board identifier. + */ +#define BOARD_GENERIC +#define BOARD_NAME "Generic Board" + +#if !defined(_FROM_ASM_) +#ifdef __cplusplus +extern "C" { +#endif + void boardInit(void); +#ifdef __cplusplus +} +#endif +#endif /* _FROM_ASM_ */ + +#endif /* _BOARD_H_ */