Added start of wwdg mocks for hardware dependencies.

This commit is contained in:
Jake Goodwin 2026-02-24 19:03:10 -08:00
parent 6f191ce44c
commit d9918291ae
2 changed files with 49 additions and 0 deletions

View file

@ -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}
)

View file

@ -0,0 +1,37 @@
#ifndef WWDG_MOCK_H
#define WWDG_MOCK_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// 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