moved spi to LLD

This commit is contained in:
Stephane D'Alu 2016-07-11 22:42:52 +02:00
parent 89b707fd7c
commit 5923ee5d50
6 changed files with 22 additions and 9 deletions

View File

@ -49,7 +49,7 @@ endif
# If enabled, this option makes the build process faster by not compiling # If enabled, this option makes the build process faster by not compiling
# modules not used in the current configuration. # modules not used in the current configuration.
ifeq ($(USE_SMART_BUILD),) ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = yes USE_SMART_BUILD = no
endif endif
# #

View File

@ -15,8 +15,8 @@
*/ */
/** /**
* @file NRF51822/spi_lld.c * @file NRF5/LLD/hal_spi_lld.c
* @brief NRF51822 low level SPI driver code. * @brief NRF5 low level SPI driver code.
* *
* @addtogroup SPI * @addtogroup SPI
* @{ * @{
@ -76,7 +76,10 @@ static void serve_interrupt(SPIDriver *spip) {
// Clear SPI READY event flag // Clear SPI READY event flag
port->EVENTS_READY = 0; port->EVENTS_READY = 0;
#if CORTEX_MODEL >= 4
(void)port->EVENTS_READY;
#endif
if (spip->rxptr != NULL) { if (spip->rxptr != NULL) {
*(uint8_t *)spip->rxptr++ = port->RXD; *(uint8_t *)spip->rxptr++ = port->RXD;
} }
@ -209,6 +212,9 @@ void spi_lld_start(SPIDriver *spip) {
/* clear events flag */ /* clear events flag */
spip->port->EVENTS_READY = 0; spip->port->EVENTS_READY = 0;
#if CORTEX_MODEL >= 4
(void)spip->port->EVENTS_READY;
#endif
} }
/** /**
@ -366,6 +372,9 @@ uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame) {
while (spip->port->EVENTS_READY == 0) while (spip->port->EVENTS_READY == 0)
; ;
spip->port->EVENTS_READY = 0; spip->port->EVENTS_READY = 0;
#if CORTEX_MODEL >= 4
(void)spip->port->EVENTS_READY;
#endif
return spip->port->RXD; return spip->port->RXD;
} }

View File

@ -15,8 +15,8 @@
*/ */
/** /**
* @file NRF51822/spi_lld.h * @file NRF/LLD/hal_spi_lld.h
* @brief NRF51822 low level SPI driver header. * @brief NRF5 low level SPI driver header.
* *
* @addtogroup SPI * @addtogroup SPI
* @{ * @{

View File

@ -13,7 +13,7 @@ ifneq ($(findstring HAL_USE_SERIAL TRUE,$(HALCONF)),)
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_serial_lld.c PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_serial_lld.c
endif endif
ifneq ($(findstring HAL_USE_SPI TRUE,$(HALCONF)),) ifneq ($(findstring HAL_USE_SPI TRUE,$(HALCONF)),)
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_spi_lld.c PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_spi_lld.c
endif endif
ifneq ($(findstring HAL_USE_EXT TRUE,$(HALCONF)),) ifneq ($(findstring HAL_USE_EXT TRUE,$(HALCONF)),)
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_ext_lld_isr.c \ PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_ext_lld_isr.c \
@ -46,7 +46,7 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/ports/common/ARMCMx/nvic.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_pal_lld.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_pal_lld.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_serial_lld.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_serial_lld.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_st_lld.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_st_lld.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_spi_lld.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_spi_lld.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_ext_lld_isr.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_ext_lld_isr.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_ext_lld.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_ext_lld.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_i2c_lld.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF51822/hal_i2c_lld.c \

View File

@ -27,7 +27,7 @@
inline static void nrf_delay_us(uint32_t volatile number_of_us) __attribute__((always_inline)); inline static void nrf_delay_us(uint32_t volatile number_of_us) __attribute__((always_inline));
inline static void nrf_delay_us(uint32_t volatile number_of_us) inline static void nrf_delay_us(uint32_t volatile number_of_us)
{ {
register uint32_t delay asm ("r0") = number_of_us; register uint32_t delay __asm ("r0") = number_of_us;
__asm volatile ( __asm volatile (
".syntax unified\n" ".syntax unified\n"
"1:\n" "1:\n"

View File

@ -12,6 +12,9 @@ endif
ifneq ($(findstring HAL_USE_SERIAL TRUE,$(HALCONF)),) ifneq ($(findstring HAL_USE_SERIAL TRUE,$(HALCONF)),)
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_serial_lld.c PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_serial_lld.c
endif endif
ifneq ($(findstring HAL_USE_SPI TRUE,$(HALCONF)),)
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_spi_lld.c
endif
ifneq ($(findstring HAL_USE_GPT TRUE,$(HALCONF)),) ifneq ($(findstring HAL_USE_GPT TRUE,$(HALCONF)),)
PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_gpt_lld.c PLATFORMSRC += ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_gpt_lld.c
endif endif
@ -29,6 +32,7 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/ports/common/ARMCMx/nvic.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF52832/hal_lld.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/NRF52832/hal_lld.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_pal_lld.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_pal_lld.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_serial_lld.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_serial_lld.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_spi_lld.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_st_lld.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_st_lld.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_gpt_lld.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_gpt_lld.c \
${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_wdg_lld.c \ ${CHIBIOS_CONTRIB}/os/hal/ports/NRF5/LLD/hal_wdg_lld.c \