From d9918291aec25f8be8596471f306038f4a16412c Mon Sep 17 00:00:00 2001 From: jake-g00dwin Date: Tue, 24 Feb 2026 19:03:10 -0800 Subject: [PATCH] Added start of wwdg mocks for hardware dependencies. --- tests/wwdg/mocks/CMakeLists.txt | 12 +++++++++++ tests/wwdg/mocks/wwdg_hw.h | 37 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 tests/wwdg/mocks/wwdg_hw.h diff --git a/tests/wwdg/mocks/CMakeLists.txt b/tests/wwdg/mocks/CMakeLists.txt index e69de29..dbc03b0 100644 --- a/tests/wwdg/mocks/CMakeLists.txt +++ b/tests/wwdg/mocks/CMakeLists.txt @@ -0,0 +1,12 @@ +# Description: mocks for wwdg cmake config. +# File: /tests/wwdg/mocks/CMakesList.txt + +add_library(wwdg_mock STATIC + wwdg_hw.c +) + +target_include_directories(wwdg_mock PUBLIC + ${CMAKE_CURRENT_LIST_DIR} +) + + diff --git a/tests/wwdg/mocks/wwdg_hw.h b/tests/wwdg/mocks/wwdg_hw.h new file mode 100644 index 0000000..0c46349 --- /dev/null +++ b/tests/wwdg/mocks/wwdg_hw.h @@ -0,0 +1,37 @@ +#ifndef WWDG_MOCK_H +#define WWDG_MOCK_H + +#include +#include +#include + +// Stuff that we have globally. + +typedef struct +{ + bool is_enabled; + bool is_HSE; + uint32_t clock_rate; +}RISCV_APB_CLK; + +/* Window WatchDog Registers*/ +typedef struct +{ + uint16_t CTLR; /* Control Register */ + uint16_t RESERVED1; + uint16_t CFGR; /* Configuration Register */ + uint16_t RESERVED2; + uint16_t STATR; /* Status Register */ +} WWDG_TypeDef; + + + +void wwdg_mock_setup(WWDG_TypeDef *wwdg); + +void wwdg_mock_reset(void); + +void wwdg_mock_clock_tick(void); + +void wwdg_mock_tick_n_times(size_t n); + +#endif //WWDG_MOCK_H