Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
653 changes: 370 additions & 283 deletions docs/getting_started.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/block/sdhc_spi_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
#define whal_SdhcSpi_Erase whal_Block_Erase
#endif /* WHAL_CFG_SDHC_SPI_BLOCK_DIRECT_API_MAPPING */

#ifdef WHAL_CFG_SDHC_SPI_SINGLE_INSTANCE
const whal_Block whal_SdhcSpi_Dev = WHAL_CFG_SDHC_SPI_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

static whal_Error SdhcSpi_CsAssert(whal_SdhcSpi_Cfg *cfg)
{
uint8_t dummy = DUMMY;
Expand Down
4 changes: 4 additions & 0 deletions src/dma/stm32wb_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@
#define whal_Stm32wb_Dma_Stop whal_Dma_Stop
#endif /* WHAL_CFG_STM32WB_DMA_DIRECT_API_MAPPING */

#ifdef WHAL_CFG_STM32WB_DMA_SINGLE_INSTANCE
const whal_Dma whal_Stm32wb_Dma_Dev = WHAL_CFG_STM32WB_DMA_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

whal_Error whal_Stm32wb_Dma_Init(whal_Dma *dmaDev)
{
#ifdef WHAL_CFG_STM32WB_DMA_SINGLE_INSTANCE
Expand Down
5 changes: 5 additions & 0 deletions src/dma/stm32wba_gpdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@
#define whal_Stm32wba_Gpdma_Stop whal_Dma_Stop
#endif

#if defined(WHAL_CFG_STM32WBA_GPDMA_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32N6_GPDMA_SINGLE_INSTANCE)
const whal_Dma whal_Stm32wba_Gpdma_Dev = WHAL_CFG_STM32WBA_GPDMA_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

whal_Error whal_Stm32wba_Gpdma_Init(whal_Dma *dmaDev)
{
#if defined(WHAL_CFG_STM32WBA_GPDMA_SINGLE_INSTANCE) || \
Expand Down
3 changes: 3 additions & 0 deletions src/flash/spi_nor_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@

#define DUMMY 0xFF

#ifdef WHAL_CFG_SPI_NOR_SINGLE_INSTANCE
const whal_Flash whal_SpiNor_Dev = WHAL_CFG_SPI_NOR_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

static whal_Error SpiNor_CsAssert(whal_SpiNor_Cfg *cfg)
{
Expand Down
4 changes: 4 additions & 0 deletions src/i2c/stm32l1_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
#define whal_Stm32l1_I2c_Transfer whal_I2c_Transfer
#endif

#ifdef WHAL_CFG_STM32L1_I2C_SINGLE_INSTANCE
const whal_I2c whal_Stm32l1_I2c_Dev = WHAL_CFG_STM32L1_I2C_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

static whal_Error Stm32l1_I2c_WaitSR1(size_t base, uint32_t flag,
whal_Timeout *timeout)
{
Expand Down
7 changes: 7 additions & 0 deletions src/i2c/stm32wb_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@
#define whal_Stm32wb_I2c_Transfer whal_I2c_Transfer
#endif /* WHAL_CFG_I2C_API_MAPPING */

#if defined(WHAL_CFG_STM32WB_I2C_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32F0_I2C_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32F3_I2C_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32N6_I2C_SINGLE_INSTANCE)
const whal_I2c whal_Stm32wb_I2c_Dev = WHAL_CFG_STM32WB_I2C_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

static uint32_t Stm32wb_I2c_CalcTimingr(uint32_t pclk, uint32_t freq)
{
uint32_t tLowNs, tHighNs;
Expand Down
4 changes: 4 additions & 0 deletions src/sensor/imu/bmi270_sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
#define whal_Bmi270_Read whal_Sensor_Read
#endif /* WHAL_CFG_BMI270_SENSOR_DIRECT_API_MAPPING */

#ifdef WHAL_CFG_BMI270_SINGLE_INSTANCE
const whal_Sensor whal_Bmi270_Dev = WHAL_CFG_BMI270_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

whal_Error whal_Bmi270_Init(whal_Sensor *dev)
{
whal_Bmi270_Cfg *cfg;
Expand Down
5 changes: 5 additions & 0 deletions src/spi/stm32f4_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@
#define whal_Stm32f4_Spi_SendRecv whal_Spi_SendRecv
#endif /* WHAL_CFG_STM32F4_SPI_DIRECT_API_MAPPING */

#if defined(WHAL_CFG_STM32F4_SPI_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32L1_SPI_SINGLE_INSTANCE)
const whal_Spi whal_Stm32f4_Spi_Dev = WHAL_CFG_STM32F4_SPI_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

/*
* Calculate the baud rate prescaler index for a target baud rate.
*
Expand Down
6 changes: 6 additions & 0 deletions src/spi/stm32h5_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@
#define whal_Stm32h5_Spi_SendRecv whal_Spi_SendRecv
#endif /* WHAL_CFG_STM32H5_SPI_DIRECT_API_MAPPING */

#if defined(WHAL_CFG_STM32H5_SPI_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32N6_SPI_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32WBA_SPI_SINGLE_INSTANCE)
const whal_Spi whal_Stm32h5_Spi_Dev = WHAL_CFG_STM32H5_SPI_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

/*
* Calculate the baud rate prescaler index for a target baud rate.
* SPI baud rate = fPCLK / (2 ^ (MBR + 1))
Expand Down
7 changes: 7 additions & 0 deletions src/spi/stm32wb_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@
#define whal_Stm32wb_Spi_SendRecv whal_Spi_SendRecv
#endif /* WHAL_CFG_SPI_API_MAPPING */

#if defined(WHAL_CFG_STM32WB_SPI_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32C0_SPI_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32F0_SPI_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32F3_SPI_SINGLE_INSTANCE)
const whal_Spi whal_Stm32wb_Spi_Dev = WHAL_CFG_STM32WB_SPI_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

/*
* Calculate the baud rate prescaler index for a target baud rate.
*
Expand Down
4 changes: 4 additions & 0 deletions src/uart/pic32cz_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@
#define whal_Pic32cz_Uart_RecvAsync whal_Uart_RecvAsync
#endif /* WHAL_CFG_PIC32CZ_UART_DIRECT_API_MAPPING */

#ifdef WHAL_CFG_PIC32CZ_UART_SINGLE_INSTANCE
const whal_Uart whal_Pic32cz_Uart_Dev = WHAL_CFG_PIC32CZ_UART_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

whal_Error whal_Pic32cz_Uart_Init(whal_Uart *uartDev)
{
whal_Error err;
Expand Down
5 changes: 5 additions & 0 deletions src/uart/stm32f0_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
#define whal_Stm32f0_Uart_RecvAsync whal_Uart_RecvAsync
#endif

#if defined(WHAL_CFG_STM32F0_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32F3_UART_SINGLE_INSTANCE)
const whal_Uart whal_Stm32f0_Uart_Dev = WHAL_CFG_STM32F0_UART_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

whal_Error whal_Stm32f0_Uart_Init(whal_Uart *uartDev)
{
#if defined(WHAL_CFG_STM32F0_UART_SINGLE_INSTANCE) || \
Expand Down
5 changes: 5 additions & 0 deletions src/uart/stm32f4_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
#define whal_Stm32f4_Uart_RecvAsync whal_Uart_RecvAsync
#endif /* WHAL_CFG_STM32F4_UART_DIRECT_API_MAPPING */

#if defined(WHAL_CFG_STM32F4_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32L1_UART_SINGLE_INSTANCE)
const whal_Uart whal_Stm32f4_Uart_Dev = WHAL_CFG_STM32F4_UART_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

whal_Error whal_Stm32f4_Uart_Init(whal_Uart *uartDev)
{
uint32_t brr;
Expand Down
29 changes: 22 additions & 7 deletions src/uart/stm32wb_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
#if defined(WHAL_CFG_STM32WB_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32H5_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32C0_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32N6_UART_SINGLE_INSTANCE)
defined(WHAL_CFG_STM32N6_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32WBA_UART_SINGLE_INSTANCE)
#include "board.h" /* provides whal_Stm32wb_Uart_Dev singleton (possibly via platform alias macro) */
#endif
#include <wolfHAL/uart/stm32wb_uart.h>
Expand Down Expand Up @@ -71,7 +72,8 @@
#if defined(WHAL_CFG_STM32WB_UART_DIRECT_API_MAPPING) || \
defined(WHAL_CFG_STM32H5_UART_DIRECT_API_MAPPING) || \
defined(WHAL_CFG_STM32C0_UART_DIRECT_API_MAPPING) || \
defined(WHAL_CFG_STM32N6_UART_DIRECT_API_MAPPING)
defined(WHAL_CFG_STM32N6_UART_DIRECT_API_MAPPING) || \
defined(WHAL_CFG_STM32WBA_UART_DIRECT_API_MAPPING)
#define whal_Stm32wb_Uart_Init whal_Uart_Init
#define whal_Stm32wb_Uart_Deinit whal_Uart_Deinit
#define whal_Stm32wb_Uart_Send whal_Uart_Send
Expand All @@ -85,13 +87,22 @@
#define whal_Stm32wb_Uart_Deinit whal_Uart_Deinit
#endif /* WHAL_CFG_STM32WB_UART_DMA_DIRECT_API_MAPPING */

#if defined(WHAL_CFG_STM32WB_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32H5_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32C0_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32N6_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32WBA_UART_SINGLE_INSTANCE)
const whal_Uart whal_Stm32wb_Uart_Dev = WHAL_CFG_STM32WB_UART_DEV;
#endif
Comment thread
AlexLanzano marked this conversation as resolved.
Comment thread
AlexLanzano marked this conversation as resolved.

whal_Error whal_Stm32wb_Uart_Init(whal_Uart *uartDev)
{
uint32_t brr;
#if defined(WHAL_CFG_STM32WB_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32H5_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32C0_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32N6_UART_SINGLE_INSTANCE)
defined(WHAL_CFG_STM32N6_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32WBA_UART_SINGLE_INSTANCE)
const whal_Stm32wb_Uart_Cfg *cfg =
(const whal_Stm32wb_Uart_Cfg *)whal_Stm32wb_Uart_Dev.cfg;
size_t base = whal_Stm32wb_Uart_Dev.base;
Expand Down Expand Up @@ -129,7 +140,8 @@ whal_Error whal_Stm32wb_Uart_Deinit(whal_Uart *uartDev)
#if defined(WHAL_CFG_STM32WB_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32H5_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32C0_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32N6_UART_SINGLE_INSTANCE)
defined(WHAL_CFG_STM32N6_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32WBA_UART_SINGLE_INSTANCE)
size_t base = whal_Stm32wb_Uart_Dev.base;
(void)uartDev;
#else
Expand Down Expand Up @@ -161,7 +173,8 @@ whal_Error whal_Stm32wb_Uart_Send(whal_Uart *uartDev, const void *data, size_t d
#if defined(WHAL_CFG_STM32WB_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32H5_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32C0_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32N6_UART_SINGLE_INSTANCE)
defined(WHAL_CFG_STM32N6_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32WBA_UART_SINGLE_INSTANCE)
const whal_Stm32wb_Uart_Cfg *cfg =
(const whal_Stm32wb_Uart_Cfg *)whal_Stm32wb_Uart_Dev.cfg;
size_t base = whal_Stm32wb_Uart_Dev.base;
Expand Down Expand Up @@ -202,7 +215,8 @@ whal_Error whal_Stm32wb_Uart_Recv(whal_Uart *uartDev, void *data, size_t dataSz)
#if defined(WHAL_CFG_STM32WB_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32H5_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32C0_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32N6_UART_SINGLE_INSTANCE)
defined(WHAL_CFG_STM32N6_UART_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32WBA_UART_SINGLE_INSTANCE)
const whal_Stm32wb_Uart_Cfg *cfg =
(const whal_Stm32wb_Uart_Cfg *)whal_Stm32wb_Uart_Dev.cfg;
size_t base = whal_Stm32wb_Uart_Dev.base;
Expand Down Expand Up @@ -260,7 +274,8 @@ whal_Error whal_Stm32wb_Uart_RecvAsync(whal_Uart *uartDev, void *data, size_t da
!defined(WHAL_CFG_STM32WB_UART_DMA_DIRECT_API_MAPPING) && \
!defined(WHAL_CFG_STM32H5_UART_DIRECT_API_MAPPING) && \
!defined(WHAL_CFG_STM32C0_UART_DIRECT_API_MAPPING) && \
!defined(WHAL_CFG_STM32N6_UART_DIRECT_API_MAPPING)
!defined(WHAL_CFG_STM32N6_UART_DIRECT_API_MAPPING) && \
!defined(WHAL_CFG_STM32WBA_UART_DIRECT_API_MAPPING)
const whal_UartDriver whal_Stm32wb_Uart_Driver = {
.Init = whal_Stm32wb_Uart_Init,
.Deinit = whal_Stm32wb_Uart_Deinit,
Expand Down
4 changes: 4 additions & 0 deletions src/uart/stm32wb_uart_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
#define whal_Stm32wb_UartDma_RecvAsync whal_Uart_RecvAsync
#endif /* WHAL_CFG_STM32WB_UART_DMA_DIRECT_API_MAPPING */

#ifdef WHAL_CFG_STM32WB_UART_DMA_SINGLE_INSTANCE
const whal_Uart whal_Stm32wb_UartDma_Dev = WHAL_CFG_STM32WB_UART_DMA_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

whal_Error whal_Stm32wb_UartDma_SendAsync(whal_Uart *uartDev, const void *data,
size_t dataSz)
{
Expand Down
4 changes: 4 additions & 0 deletions src/uart/stm32wba_uart_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
#define UART_RDR_REG 0x24
#define UART_TDR_REG 0x28

#ifdef WHAL_CFG_STM32WBA_UART_DMA_SINGLE_INSTANCE
const whal_Uart whal_Stm32wba_UartDma_Dev = WHAL_CFG_STM32WBA_UART_DMA_DEV;
Comment thread
AlexLanzano marked this conversation as resolved.
#endif

whal_Error whal_Stm32wba_UartDma_SendAsync(whal_Uart *uartDev, const void *data,
size_t dataSz)
{
Expand Down
5 changes: 0 additions & 5 deletions tests/ipc/test_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ static void Test_Ipc_InitDeinit(void)
WHAL_ASSERT_EQ(whal_Ipc_Init(BOARD_IPC_DEV), WHAL_SUCCESS);
}

static void Test_Ipc_InitNull(void)
{
}

static void Test_Ipc_SendNull(void)
{
WHAL_ASSERT_EQ(whal_Ipc_Send(BOARD_IPC_DEV, NULL, 0), WHAL_EINVAL);
Expand All @@ -48,7 +44,6 @@ void whal_Test_Ipc(void)
{
WHAL_TEST_SUITE_START("ipc");
WHAL_TEST(Test_Ipc_InitDeinit);
WHAL_TEST(Test_Ipc_InitNull);
WHAL_TEST(Test_Ipc_SendNull);
WHAL_TEST(Test_Ipc_RecvNull);
WHAL_TEST_SUITE_END();
Expand Down
8 changes: 0 additions & 8 deletions tests/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ void whal_Test_Dma_Platform(void);
void whal_Test_Irq_Platform(void);
#endif

#ifdef WHAL_TEST_ENABLE_SENSOR
void whal_Test_Sensor(void);
#endif

int g_whalTestPassed;
int g_whalTestFailed;
int g_whalTestSkipped;
Expand Down Expand Up @@ -347,10 +343,6 @@ void main(void)
whal_Test_Irq_Platform();
#endif

#ifdef WHAL_TEST_ENABLE_SENSOR
whal_Test_Sensor();
#endif

WHAL_TEST_SUMMARY();

if (g_whalTestFailed == 0) {
Expand Down
37 changes: 0 additions & 37 deletions tests/sensor/test_sensor.c

This file was deleted.

8 changes: 8 additions & 0 deletions wolfHAL/block/sdhc_spi_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ typedef struct whal_SdhcSpi_Cfg {
whal_Timeout *timeout; /* Optional timeout for poll loops */
} whal_SdhcSpi_Cfg;

/*
* @brief Single-instance device struct. Defined in the driver TU
* from the WHAL_CFG_SDHC_SPI_DEV initializer in board.h.
*/
#ifdef WHAL_CFG_SDHC_SPI_SINGLE_INSTANCE
extern const whal_Block whal_SdhcSpi_Dev;
#endif

#ifndef WHAL_CFG_SDHC_SPI_BLOCK_DIRECT_API_MAPPING
/*
* @brief Driver instance for SDHC/SDXC over SPI.
Expand Down
8 changes: 8 additions & 0 deletions wolfHAL/dma/stm32wb_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ typedef struct {
uint8_t numChannels; /* Number of channels (7 for DMA1, 5 for DMA2) */
} whal_Stm32wb_Dma_Cfg;

/*
* @brief Single-instance device struct. Defined in the driver TU
* from the WHAL_CFG_STM32WB_DMA_DEV initializer in board.h.
*/
#ifdef WHAL_CFG_STM32WB_DMA_SINGLE_INSTANCE
extern const whal_Dma whal_Stm32wb_Dma_Dev;
#endif

#ifndef WHAL_CFG_STM32WB_DMA_DIRECT_API_MAPPING
/*
* @brief Driver instance for STM32WB DMA.
Expand Down
9 changes: 9 additions & 0 deletions wolfHAL/dma/stm32wba_gpdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ typedef struct {
whal_Timeout *timeout; /* Timeout for channel reset/suspend polling */
} whal_Stm32wba_Gpdma_Cfg;

/*
* @brief Single-instance device struct. Defined in the driver TU
* from the WHAL_CFG_STM32WBA_GPDMA_DEV initializer in board.h.
*/
#if defined(WHAL_CFG_STM32WBA_GPDMA_SINGLE_INSTANCE) || \
defined(WHAL_CFG_STM32N6_GPDMA_SINGLE_INSTANCE)
extern const whal_Dma whal_Stm32wba_Gpdma_Dev;
#endif

extern const whal_DmaDriver whal_Stm32wba_Gpdma_Driver;

/*
Expand Down
8 changes: 8 additions & 0 deletions wolfHAL/flash/spi_nor_flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ typedef struct whal_SpiNor_Cfg {
size_t capacity; /* Total flash capacity in bytes */
} whal_SpiNor_Cfg;

/*
* @brief Single-instance device struct. Defined in the driver TU
* from the WHAL_CFG_SPI_NOR_DEV initializer in board.h.
*/
#ifdef WHAL_CFG_SPI_NOR_SINGLE_INSTANCE
extern const whal_Flash whal_SpiNor_Dev;
#endif

/*
* @brief Default driver vtable using 3-byte addressing with 4 KB erase.
*/
Expand Down
Loading
Loading