From f6f0c15421ae27eecf4b93d80b6d857ca730e5b8 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 2 Mar 2018 19:29:46 +0000 Subject: [PATCH] Rename macro and move to HAL --- .../srf06-cc26xx/launchpad/cc1310/board.h | 2 +- .../srf06-cc26xx/launchpad/cc1350/board.h | 2 +- .../srf06-cc26xx/launchpad/cc2650/board.h | 2 +- .../srf06-cc26xx/sensortag/cc1350/board.h | 2 +- .../srf06-cc26xx/sensortag/cc2650/board.h | 2 +- os/dev/spi-hal.h | 15 +++++++++++++-- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/arch/platform/srf06-cc26xx/launchpad/cc1310/board.h b/arch/platform/srf06-cc26xx/launchpad/cc1310/board.h index 81f820a13..41e929571 100644 --- a/arch/platform/srf06-cc26xx/launchpad/cc1310/board.h +++ b/arch/platform/srf06-cc26xx/launchpad/cc1310/board.h @@ -109,7 +109,7 @@ * Those values are not meant to be modified by the user * @{ */ -#define EXT_FLASH_SPI_CONTROLLER BOARD_SPI_CONTROLLER_SPI0 +#define EXT_FLASH_SPI_CONTROLLER SPI_CONTROLLER_SPI0 #define BOARD_IOID_FLASH_SCK IOID_10 #define BOARD_IOID_FLASH_MOSI IOID_9 diff --git a/arch/platform/srf06-cc26xx/launchpad/cc1350/board.h b/arch/platform/srf06-cc26xx/launchpad/cc1350/board.h index 5831221bc..643d69e0b 100644 --- a/arch/platform/srf06-cc26xx/launchpad/cc1350/board.h +++ b/arch/platform/srf06-cc26xx/launchpad/cc1350/board.h @@ -109,7 +109,7 @@ * Those values are not meant to be modified by the user * @{ */ -#define EXT_FLASH_SPI_CONTROLLER BOARD_SPI_CONTROLLER_SPI0 +#define EXT_FLASH_SPI_CONTROLLER SPI_CONTROLLER_SPI0 #define BOARD_IOID_FLASH_SCK IOID_10 #define BOARD_IOID_FLASH_MOSI IOID_9 diff --git a/arch/platform/srf06-cc26xx/launchpad/cc2650/board.h b/arch/platform/srf06-cc26xx/launchpad/cc2650/board.h index 7b2c40403..822e776b8 100644 --- a/arch/platform/srf06-cc26xx/launchpad/cc2650/board.h +++ b/arch/platform/srf06-cc26xx/launchpad/cc2650/board.h @@ -109,7 +109,7 @@ * Those values are not meant to be modified by the user * @{ */ -#define EXT_FLASH_SPI_CONTROLLER BOARD_SPI_CONTROLLER_SPI0 +#define EXT_FLASH_SPI_CONTROLLER SPI_CONTROLLER_SPI0 #define BOARD_IOID_FLASH_SCK IOID_10 #define BOARD_IOID_FLASH_MOSI IOID_9 diff --git a/arch/platform/srf06-cc26xx/sensortag/cc1350/board.h b/arch/platform/srf06-cc26xx/sensortag/cc1350/board.h index bd1de7416..6fdab1295 100644 --- a/arch/platform/srf06-cc26xx/sensortag/cc1350/board.h +++ b/arch/platform/srf06-cc26xx/sensortag/cc1350/board.h @@ -135,7 +135,7 @@ * Those values are not meant to be modified by the user * @{ */ -#define EXT_FLASH_SPI_CONTROLLER BOARD_SPI_CONTROLLER_SPI0 +#define EXT_FLASH_SPI_CONTROLLER SPI_CONTROLLER_SPI0 #define BOARD_IOID_FLASH_SCK IOID_17 #define BOARD_IOID_FLASH_MOSI IOID_19 diff --git a/arch/platform/srf06-cc26xx/sensortag/cc2650/board.h b/arch/platform/srf06-cc26xx/sensortag/cc2650/board.h index 7db109ece..7da0e9458 100644 --- a/arch/platform/srf06-cc26xx/sensortag/cc2650/board.h +++ b/arch/platform/srf06-cc26xx/sensortag/cc2650/board.h @@ -137,7 +137,7 @@ * Those values are not meant to be modified by the user * @{ */ -#define EXT_FLASH_SPI_CONTROLLER BOARD_SPI_CONTROLLER_SPI0 +#define EXT_FLASH_SPI_CONTROLLER SPI_CONTROLLER_SPI0 #define BOARD_IOID_FLASH_SCK IOID_17 #define BOARD_IOID_FLASH_MOSI IOID_19 diff --git a/os/dev/spi-hal.h b/os/dev/spi-hal.h index 7bc5f20ee..b8172bd57 100644 --- a/os/dev/spi-hal.h +++ b/os/dev/spi-hal.h @@ -57,10 +57,21 @@ /* Include Arch-Specific conf */ #ifdef SPI_HAL_CONF_ARCH_HDR_PATH #include SPI_HAL_CONF_ARCH_HDR_PATH -#else /* PLATFORM_IMPLEMENTS_SPI_HAL */ -#define BOARD_SPI_CONTROLLERS 0 #endif /* SPI_HAL_CONF_ARCH_HDR_PATH */ /*---------------------------------------------------------------------------*/ +#ifdef SPI_CONF_CONTROLLER_COUNT +/** + * \brief Number of SPI module instances on a chip + */ +#define SPI_CONTROLLER_COUNT SPI_CONF_CONTROLLER_COUNT +#else +#define SPI_CONTROLLER_COUNT 0 +#endif +/*---------------------------------------------------------------------------*/ +/* Convenience macros to enumerate SPI module instances on a chip */ +#define SPI_CONTROLLER_SPI0 0 +#define SPI_CONTROLLER_SPI1 1 +/*---------------------------------------------------------------------------*/ /** * \brief SPI return codes *