From 9483bacf8847278d5a32b0dafeb32c416b676df4 Mon Sep 17 00:00:00 2001 From: Fabien Poussin Date: Tue, 17 Sep 2019 13:51:40 +0200 Subject: Adding devices for STM32L4 --- os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.h | 6 +++--- os/hal/ports/STM32/STM32L4xx/platform.mk | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'os') diff --git a/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.h b/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.h index bb40327..e3cae4e 100644 --- a/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.h +++ b/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.h @@ -201,9 +201,9 @@ #define STM32_HAS_COMP6 TRUE #define STM32_HAS_COMP7 TRUE -#elif defined(STM32F373xx) || defined(STM32F378xx) || defined(STM32L0XX) || defined(STM32L1XX) \ - || defined(STM32F051x8) || defined(STM32F048xx) || defined(STM32F058xx) || defined(STM32F078xx) \ - || defined(STM32F072xb) || defined(STM32F071xb) +#elif defined(STM32F373xx) || defined(STM32F378xx) || defined(STM32L0XX) || defined(STM32L1XX) \ + || defined(STM32F051x8) || defined(STM32F048xx) || defined(STM32F058xx) || defined(STM32F078xx) \ + || defined(STM32F072xb) || defined(STM32F071xb) || defined(STM32L4XX) #define STM32_HAS_COMP1 TRUE #define STM32_HAS_COMP2 TRUE #define STM32_HAS_COMP3 FALSE diff --git a/os/hal/ports/STM32/STM32L4xx/platform.mk b/os/hal/ports/STM32/STM32L4xx/platform.mk index 096fd59..a734871 100644 --- a/os/hal/ports/STM32/STM32L4xx/platform.mk +++ b/os/hal/ports/STM32/STM32L4xx/platform.mk @@ -13,12 +13,15 @@ else endif include ${CHIBIOS_CONTRIB}/os/hal/ports/STM32/LLD/CRCv1/driver.mk +include ${CHIBIOS_CONTRIB}/os/hal/ports/STM32/LLD/COMPv1/driver.mk include ${CHIBIOS_CONTRIB}/os/hal/ports/STM32/LLD/DMA2Dv1/driver.mk include ${CHIBIOS_CONTRIB}/os/hal/ports/STM32/LLD/FSMCv1/driver.mk include ${CHIBIOS_CONTRIB}/os/hal/ports/STM32/LLD/LTDCv1/driver.mk +include ${CHIBIOS_CONTRIB}/os/hal/ports/STM32/LLD/OPAMPv1/driver.mk include ${CHIBIOS_CONTRIB}/os/hal/ports/STM32/LLD/TIMv1/driver.mk include ${CHIBIOS_CONTRIB}/os/hal/ports/STM32/LLD/USBHv1/driver.mk + # Shared variables ALLCSRC += $(PLATFORMSRC_CONTRIB) ALLINC += $(PLATFORMINC_CONTRIB) -- cgit v1.2.3 From a8bd0ca9da23f75897fe466db179c3da34a8a946 Mon Sep 17 00:00:00 2001 From: Fabien Poussin Date: Tue, 17 Sep 2019 14:57:16 +0200 Subject: Fixed COMP1 peripheral name --- os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os') diff --git a/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c b/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c index 62d9f14..49bc6a7 100644 --- a/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c +++ b/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c @@ -122,7 +122,7 @@ void comp_lld_init(void) { #if STM32_COMP_USE_COMP1 /* Driver initialization.*/ compObjectInit(&COMPD1); - COMPD1.reg = COMP; + COMPD1.reg = COMP1; COMPD1.reg->CSR = 0; #if STM32_COMP_USE_INTERRUPTS nvicEnableVector(COMP1_2_3_IRQn, STM32_COMP_1_2_3_IRQ_PRIORITY); -- cgit v1.2.3 From 6736a9099b184ba3fed01fb36e915d86ffa4f0da Mon Sep 17 00:00:00 2001 From: Fabien Poussin Date: Tue, 17 Sep 2019 19:43:24 +0200 Subject: Fixes for STM32L4, Comp and eeprom. --- os/hal/include/hal_eeprom.h | 2 +- os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c | 20 ++++++++++++++++---- os/hal/src/hal_ee24xx.c | 4 +++- 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'os') diff --git a/os/hal/include/hal_eeprom.h b/os/hal/include/hal_eeprom.h index 25e03bd..c4af268 100644 --- a/os/hal/include/hal_eeprom.h +++ b/os/hal/include/hal_eeprom.h @@ -68,7 +68,7 @@ uint16_t pagesize; \ /* Time needed by IC for single byte/page writing. */ \ systime_t write_time; - + typedef uint32_t fileoffset_t; typedef struct { diff --git a/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c b/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c index 49bc6a7..b1dde2f 100644 --- a/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c +++ b/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c @@ -34,6 +34,14 @@ /* Driver local definitions. */ /*===========================================================================*/ +#ifndef COMP_CSR_EN +#define COMP_CSR_EN COMP_CSR_COMPxEN +#endif + +#ifndef COMP_CSR_POLARITY +#define COMP_CSR_POLARITY COMP_CSR_COMPxPOL +#endif + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ @@ -191,6 +199,8 @@ void comp_lld_init(void) { } +#if STM32_COMP_USE_INTERRUPTS + /** * @brief COMP1, COMP2, COMP3 interrupt handler. * @@ -369,6 +379,8 @@ void comp_ext_lld_channel_disable(COMPDriver *compp, uint32_t channel) { #endif } +#endif + /** * @brief Configures and activates the COMP peripheral. * @@ -379,11 +391,11 @@ void comp_ext_lld_channel_disable(COMPDriver *compp, uint32_t channel) { void comp_lld_start(COMPDriver *compp) { // Apply CSR Execpt the enable bit. - compp->reg->CSR = compp->config->csr & ~COMP_CSR_COMPxEN; + compp->reg->CSR = compp->config->csr & ~COMP_CSR_EN; // Inverted output if (compp->config->output_mode == COMP_OUTPUT_INVERTED) - compp->reg->CSR |= COMP_CSR_COMPxPOL; + compp->reg->CSR |= COMP_CSR_POLARITY; #if STM32_COMP_USE_INTERRUPTS #if STM32_COMP_USE_COMP1 @@ -500,7 +512,7 @@ void comp_lld_stop(COMPDriver *compp) { */ void comp_lld_enable(COMPDriver *compp) { - compp->reg->CSR |= COMP_CSR_COMPxEN; /* Enable */ + compp->reg->CSR |= COMP_CSR_EN; /* Enable */ } /** @@ -512,7 +524,7 @@ void comp_lld_enable(COMPDriver *compp) { */ void comp_lld_disable(COMPDriver *compp) { - compp->reg->CSR &= ~COMP_CSR_COMPxEN; /* Disable */ + compp->reg->CSR &= ~COMP_CSR_EN; /* Disable */ } #endif /* HAL_USE_COMP */ diff --git a/os/hal/src/hal_ee24xx.c b/os/hal/src/hal_ee24xx.c index 1df1b9f..a415f2d 100644 --- a/os/hal/src/hal_ee24xx.c +++ b/os/hal/src/hal_ee24xx.c @@ -198,7 +198,7 @@ static size_t __clamp_size(void *ip, size_t n) { /** * @brief Write data that can be fitted in one page boundary */ -static void __fitted_write(void *ip, const uint8_t *data, size_t len, uint32_t *written) { +static msg_t __fitted_write(void *ip, const uint8_t *data, size_t len, uint32_t *written) { msg_t status = MSG_RESET; @@ -210,6 +210,8 @@ static void __fitted_write(void *ip, const uint8_t *data, size_t len, uint32_t * *written += len; eepfs_lseek(ip, eepfs_getposition(ip) + len); } + + return status; } /** -- cgit v1.2.3