diff --git a/src/sdk/mocksdkwrapper.hpp b/src/sdk/mocksdkwrapper.hpp index d3a71b7..d817712 100644 --- a/src/sdk/mocksdkwrapper.hpp +++ b/src/sdk/mocksdkwrapper.hpp @@ -563,6 +563,20 @@ class MockSdkWrapper : public SdkWrapper { MOCK_METHOD1(rcp_salt_core0_nodelay, void(uint64_t salt)); MOCK_METHOD1(rcp_salt_core1, void(uint64_t salt)); MOCK_METHOD1(rcp_salt_core1_nodelay, void(uint64_t salt)); + MOCK_METHOD1(reset_block, void(uint32_t bits)); + MOCK_METHOD1(reset_block_mask, void(uint32_t bits)); + MOCK_METHOD1(reset_block_num, void(uint32_t block_num)); + MOCK_METHOD2(reset_block_reg_mask, void(io_rw_32* reset, uint32_t mask)); + MOCK_METHOD1(reset_unreset_block_num_wait_blocking, void(uint block_num)); + MOCK_METHOD1(unreset_block, void(uint32_t bits)); + MOCK_METHOD1(unreset_block_mask, void(uint32_t bits)); + MOCK_METHOD1(unreset_block_mask_wait_blocking, void(uint32_t bits)); + MOCK_METHOD1(unreset_block_num, void(uint block_num)); + MOCK_METHOD1(unreset_block_num_wait_blocking, void(uint block_num)); + MOCK_METHOD2(unreset_block_reg_mask, void(io_rw_32* reset, uint32_t mask)); + MOCK_METHOD3(unreset_block_reg_mask_wait_blocking, + void(io_rw_32* reset, io_ro_32* reset_done, uint32_t mask)); + MOCK_METHOD1(unreset_block_wait, void(uint32_t bits)); MOCK_METHOD2(gpio_acknowledge_irq, void(uint gpio, uint32_t event_mask)); MOCK_METHOD2(gpio_add_raw_irq_handler, void(uint gpio, irq_handler_t handler)); diff --git a/src/sdk/pico_api_alternate_defs.hpp b/src/sdk/pico_api_alternate_defs.hpp index 791d994..08c2f30 100644 --- a/src/sdk/pico_api_alternate_defs.hpp +++ b/src/sdk/pico_api_alternate_defs.hpp @@ -37,6 +37,10 @@ enum powman_power_domains { o, p }; /// @brief Alternate definition for Google Test build. enum pwm_clkdiv_mode { q, r }; +//// @brief Alternate definition for Google Test build. +typedef int io_rw_32; +//// @brief Alternate definition for Google Test build. +typedef int io_ro_32; //// @brief Alternate definition for Google Test build. typedef int pwm_config; //// @brief Alternate definition for Google Test build. diff --git a/src/sdk/pico_sdk_apistub.cpp b/src/sdk/pico_sdk_apistub.cpp index c97efca..59b5276 100644 --- a/src/sdk/pico_sdk_apistub.cpp +++ b/src/sdk/pico_sdk_apistub.cpp @@ -9450,6 +9450,304 @@ extern "C" void _weak_rcp_salt_core1_nodelay(uint64_t salt) #endif // _MSC_VER // -------------------------------------------------- #if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void reset_block(uint32_t bits); +__attribute__((weak)) void reset_block(uint32_t bits) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_reset_block(uint32_t bits) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment(linker, "/alternatename:_reset_block=__weak_reset_block") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment(linker, "/alternatename:reset_block=_weak_reset_block") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void reset_block_mask(uint32_t bits); +__attribute__((weak)) void reset_block_mask(uint32_t bits) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_reset_block_mask(uint32_t bits) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment(linker, \ + "/alternatename:_reset_block_mask=__weak_reset_block_mask") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment(linker, \ + "/alternatename:reset_block_mask=_weak_reset_block_mask") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void reset_block_num(uint32_t block_num); +__attribute__((weak)) void reset_block_num(uint32_t block_num) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_reset_block_num(uint32_t block_num) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment(linker, \ + "/alternatename:_reset_block_num=__weak_reset_block_num") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment(linker, "/alternatename:reset_block_num=_weak_reset_block_num") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void reset_block_reg_mask(io_rw_32* reset, uint32_t mask); +__attribute__((weak)) void reset_block_reg_mask(io_rw_32* reset, uint32_t mask) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_reset_block_reg_mask(io_rw_32* reset, uint32_t mask) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment( \ + linker, \ + "/alternatename:_reset_block_reg_mask=__weak_reset_block_reg_mask") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment( \ + linker, "/alternatename:reset_block_reg_mask=_weak_reset_block_reg_mask") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void reset_unreset_block_num_wait_blocking(uint block_num); +__attribute__((weak)) void reset_unreset_block_num_wait_blocking(uint block_num) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_reset_unreset_block_num_wait_blocking(uint block_num) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment( \ + linker, \ + "/alternatename:_reset_unreset_block_num_wait_blocking=__weak_reset_unreset_block_num_wait_blocking") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment( \ + linker, \ + "/alternatename:reset_unreset_block_num_wait_blocking=_weak_reset_unreset_block_num_wait_blocking") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void unreset_block(uint32_t bits); +__attribute__((weak)) void unreset_block(uint32_t bits) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_unreset_block(uint32_t bits) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment(linker, "/alternatename:_unreset_block=__weak_unreset_block") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment(linker, "/alternatename:unreset_block=_weak_unreset_block") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void unreset_block_mask(uint32_t bits); +__attribute__((weak)) void unreset_block_mask(uint32_t bits) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_unreset_block_mask(uint32_t bits) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment( \ + linker, "/alternatename:_unreset_block_mask=__weak_unreset_block_mask") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment(linker, \ + "/alternatename:unreset_block_mask=_weak_unreset_block_mask") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void unreset_block_mask_wait_blocking(uint32_t bits); +__attribute__((weak)) void unreset_block_mask_wait_blocking(uint32_t bits) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_unreset_block_mask_wait_blocking(uint32_t bits) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment( \ + linker, \ + "/alternatename:_unreset_block_mask_wait_blocking=__weak_unreset_block_mask_wait_blocking") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment( \ + linker, \ + "/alternatename:unreset_block_mask_wait_blocking=_weak_unreset_block_mask_wait_blocking") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void unreset_block_num(uint block_num); +__attribute__((weak)) void unreset_block_num(uint block_num) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_unreset_block_num(uint block_num) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment(linker, \ + "/alternatename:_unreset_block_num=__weak_unreset_block_num") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment(linker, \ + "/alternatename:unreset_block_num=_weak_unreset_block_num") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void unreset_block_num_wait_blocking(uint block_num); +__attribute__((weak)) void unreset_block_num_wait_blocking(uint block_num) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_unreset_block_num_wait_blocking(uint block_num) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment( \ + linker, \ + "/alternatename:_unreset_block_num_wait_blocking=__weak_unreset_block_num_wait_blocking") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment( \ + linker, \ + "/alternatename:unreset_block_num_wait_blocking=_weak_unreset_block_num_wait_blocking") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void unreset_block_reg_mask(io_rw_32* reset, uint32_t mask); +__attribute__((weak)) void unreset_block_reg_mask(io_rw_32* reset, + uint32_t mask) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_unreset_block_reg_mask(io_rw_32* reset, uint32_t mask) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment( \ + linker, \ + "/alternatename:_unreset_block_reg_mask=__weak_unreset_block_reg_mask") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment( \ + linker, \ + "/alternatename:unreset_block_reg_mask=_weak_unreset_block_reg_mask") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void unreset_block_reg_mask_wait_blocking(io_rw_32* reset, + io_ro_32* reset_done, + uint32_t mask); +__attribute__((weak)) void unreset_block_reg_mask_wait_blocking( + io_rw_32* reset, io_ro_32* reset_done, uint32_t mask) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_unreset_block_reg_mask_wait_blocking(io_rw_32* reset, + io_ro_32* reset_done, + uint32_t mask) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment( \ + linker, \ + "/alternatename:_unreset_block_reg_mask_wait_blocking=__weak_unreset_block_reg_mask_wait_blocking") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment( \ + linker, \ + "/alternatename:unreset_block_reg_mask_wait_blocking=_weak_unreset_block_reg_mask_wait_blocking") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection +extern "C" void unreset_block_wait(uint32_t bits); +__attribute__((weak)) void unreset_block_wait(uint32_t bits) +#elif defined(_MSC_VER) // Microsoft Visual C +extern "C" void _weak_unreset_block_wait(uint32_t bits) +#else // Other compilers are not supported +#error "Unknown compiler." +#endif // Compiler detection +{ + assert(false && + "Error : The hardware_resets library is missing in the link phase."); +} +#if defined(_MSC_VER) // weak binding in MSVC must be after definition +#if defined(_M_IX86) // for x86 +#pragma comment( \ + linker, "/alternatename:_unreset_block_wait=__weak_unreset_block_wait") +#elif defined(_M_AMD64) // for AMD64 +#pragma comment(linker, \ + "/alternatename:unreset_block_wait=_weak_unreset_block_wait") +#endif // x86 or amd64 +#endif // _MSC_VER +// -------------------------------------------------- +#if defined(__GNUC__) || defined(__clang__) // Compiler detection extern "C" void gpio_acknowledge_irq(uint gpio, uint32_t event_mask); __attribute__((weak)) void gpio_acknowledge_irq(uint gpio, uint32_t event_mask) #elif defined(_MSC_VER) // Microsoft Visual C diff --git a/src/sdk/pico_sdk_headers.h b/src/sdk/pico_sdk_headers.h index f9368b2..889f3b0 100644 --- a/src/sdk/pico_sdk_headers.h +++ b/src/sdk/pico_sdk_headers.h @@ -60,6 +60,10 @@ #include #endif // __has_include() || __has_include() +#if __has_include() || __has_include() +#include +#endif // __has_include() || __has_include() + #if __has_include() || __has_include() #include #endif // __has_include() || __has_include() diff --git a/src/sdk/scripts/api_dirs.txt b/src/sdk/scripts/api_dirs.txt index 1aeeca2..23b5a74 100644 --- a/src/sdk/scripts/api_dirs.txt +++ b/src/sdk/scripts/api_dirs.txt @@ -11,6 +11,7 @@ hardware pio hardware powman hardware pwm hardware rcp +hardware resets hardware gpio hardware clocks pico time diff --git a/src/sdk/scripts/blocks/pico_api_alternate_defs.hpp b/src/sdk/scripts/blocks/pico_api_alternate_defs.hpp index 791d994..08c2f30 100644 --- a/src/sdk/scripts/blocks/pico_api_alternate_defs.hpp +++ b/src/sdk/scripts/blocks/pico_api_alternate_defs.hpp @@ -37,6 +37,10 @@ enum powman_power_domains { o, p }; /// @brief Alternate definition for Google Test build. enum pwm_clkdiv_mode { q, r }; +//// @brief Alternate definition for Google Test build. +typedef int io_rw_32; +//// @brief Alternate definition for Google Test build. +typedef int io_ro_32; //// @brief Alternate definition for Google Test build. typedef int pwm_config; //// @brief Alternate definition for Google Test build. diff --git a/src/sdk/sdkwrapper.cpp b/src/sdk/sdkwrapper.cpp index e5a2061..e815e37 100644 --- a/src/sdk/sdkwrapper.cpp +++ b/src/sdk/sdkwrapper.cpp @@ -2332,6 +2332,78 @@ void rpp_driver::SdkWrapper::rcp_salt_core1_nodelay(uint64_t salt) { } #endif // __has_include() || __has_include() +#if __has_include() || __has_include() +// -------------------------------------------------- +extern "C" void reset_block(uint32_t bits); +void rpp_driver::SdkWrapper::reset_block(uint32_t bits) { ::reset_block(bits); } +// -------------------------------------------------- +extern "C" void reset_block_mask(uint32_t bits); +void rpp_driver::SdkWrapper::reset_block_mask(uint32_t bits) { + ::reset_block_mask(bits); +} +// -------------------------------------------------- +extern "C" void reset_block_num(uint32_t block_num); +void rpp_driver::SdkWrapper::reset_block_num(uint32_t block_num) { + ::reset_block_num(block_num); +} +// -------------------------------------------------- +extern "C" void reset_block_reg_mask(io_rw_32* reset, uint32_t mask); +void rpp_driver::SdkWrapper::reset_block_reg_mask(io_rw_32* reset, + uint32_t mask) { + ::reset_block_reg_mask(reset, mask); +} +// -------------------------------------------------- +extern "C" void reset_unreset_block_num_wait_blocking(uint block_num); +void rpp_driver::SdkWrapper::reset_unreset_block_num_wait_blocking( + uint block_num) { + ::reset_unreset_block_num_wait_blocking(block_num); +} +// -------------------------------------------------- +extern "C" void unreset_block(uint32_t bits); +void rpp_driver::SdkWrapper::unreset_block(uint32_t bits) { + ::unreset_block(bits); +} +// -------------------------------------------------- +extern "C" void unreset_block_mask(uint32_t bits); +void rpp_driver::SdkWrapper::unreset_block_mask(uint32_t bits) { + ::unreset_block_mask(bits); +} +// -------------------------------------------------- +extern "C" void unreset_block_mask_wait_blocking(uint32_t bits); +void rpp_driver::SdkWrapper::unreset_block_mask_wait_blocking(uint32_t bits) { + ::unreset_block_mask_wait_blocking(bits); +} +// -------------------------------------------------- +extern "C" void unreset_block_num(uint block_num); +void rpp_driver::SdkWrapper::unreset_block_num(uint block_num) { + ::unreset_block_num(block_num); +} +// -------------------------------------------------- +extern "C" void unreset_block_num_wait_blocking(uint block_num); +void rpp_driver::SdkWrapper::unreset_block_num_wait_blocking(uint block_num) { + ::unreset_block_num_wait_blocking(block_num); +} +// -------------------------------------------------- +extern "C" void unreset_block_reg_mask(io_rw_32* reset, uint32_t mask); +void rpp_driver::SdkWrapper::unreset_block_reg_mask(io_rw_32* reset, + uint32_t mask) { + ::unreset_block_reg_mask(reset, mask); +} +// -------------------------------------------------- +extern "C" void unreset_block_reg_mask_wait_blocking(io_rw_32* reset, + io_ro_32* reset_done, + uint32_t mask); +void rpp_driver::SdkWrapper::unreset_block_reg_mask_wait_blocking( + io_rw_32* reset, io_ro_32* reset_done, uint32_t mask) { + ::unreset_block_reg_mask_wait_blocking(reset, reset_done, mask); +} +// -------------------------------------------------- +extern "C" void unreset_block_wait(uint32_t bits); +void rpp_driver::SdkWrapper::unreset_block_wait(uint32_t bits) { + ::unreset_block_wait(bits); +} +#endif // __has_include() || __has_include() + #if __has_include() || __has_include() // -------------------------------------------------- extern "C" void gpio_acknowledge_irq(uint gpio, uint32_t event_mask); diff --git a/src/sdk/sdkwrapper.hpp b/src/sdk/sdkwrapper.hpp index 3e24891..cf33163 100644 --- a/src/sdk/sdkwrapper.hpp +++ b/src/sdk/sdkwrapper.hpp @@ -627,6 +627,24 @@ class SdkWrapper { virtual void rcp_salt_core1_nodelay(uint64_t salt); #endif // __has_include() || __has_include() +#if __has_include() || __has_include() + virtual void reset_block(uint32_t bits); + virtual void reset_block_mask(uint32_t bits); + virtual void reset_block_num(uint32_t block_num); + virtual void reset_block_reg_mask(io_rw_32* reset, uint32_t mask); + virtual void reset_unreset_block_num_wait_blocking(uint block_num); + virtual void unreset_block(uint32_t bits); + virtual void unreset_block_mask(uint32_t bits); + virtual void unreset_block_mask_wait_blocking(uint32_t bits); + virtual void unreset_block_num(uint block_num); + virtual void unreset_block_num_wait_blocking(uint block_num); + virtual void unreset_block_reg_mask(io_rw_32* reset, uint32_t mask); + virtual void unreset_block_reg_mask_wait_blocking(io_rw_32* reset, + io_ro_32* reset_done, + uint32_t mask); + virtual void unreset_block_wait(uint32_t bits); +#endif // __has_include() || __has_include() + #if __has_include() || __has_include() virtual void gpio_acknowledge_irq(uint gpio, uint32_t event_mask); virtual void gpio_add_raw_irq_handler(uint gpio, irq_handler_t handler); diff --git a/test/test_sdkwrapper.cpp b/test/test_sdkwrapper.cpp index 3efb376..87b4e23 100644 --- a/test/test_sdkwrapper.cpp +++ b/test/test_sdkwrapper.cpp @@ -77,6 +77,7 @@ FAKE_VOID_FUNC(pll_deinit, PLL); FAKE_VALUE_FUNC(int, powman_set_power_state, powman_power_state); FAKE_VALUE_FUNC(uint, pwm_gpio_to_channel, uint); FAKE_VOID_FUNC(rcp_salt_core0, uint64_t); +FAKE_VOID_FUNC(reset_block, uint32_t); } // The cpp file of the library to test. #include "../src/sdk/sdkwrapper.cpp" @@ -1883,3 +1884,42 @@ TEST(SdkWrapper, rcp_salt_core0) { } RESET_FAKE(rcp_salt_core0); } // TEST(SdkWrapper, rcp_salt_core0) + +// ----------------------------------------------------------- +// +// hardware_powerman +// virtual void reset_block(uint32_t bits); +// +// ----------------------------------------------------------- + +TEST(SdkWrapper, reset_block) { + std::random_device rng; + ::rpp_driver::SdkWrapper pico; + + std::uniform_int_distribution param_dist(0, UINT32_MAX); + uint32_t param_array0[] = {param_dist(rng), param_dist(rng)}; + + FFF_RESET_HISTORY(); + RESET_FAKE(reset_block); + + // Check whether return values are correctly passed to wrapper. + int index = 0; + for (auto &¶m0 : param_array0) { + pico.reset_block(param0); + index++; + } + + // Check the data from test spy. How many time called? + ASSERT_EQ(reset_block_fake.call_count, std::size(param_array0)); + + // Check whether parameters were correctly passed from wrapper. + index = 0; + for (auto &¶m0 : param_array0) { + // Check the data from test spy. Call order. + ASSERT_EQ(fff.call_history[index], (void *)reset_block); + // Check the data from test spy. : Parameters. + ASSERT_EQ(reset_block_fake.arg0_history[index], param0); + index++; + } + RESET_FAKE(reset_block); +} // TEST(SdkWrapper, rcp_salt_core0) \ No newline at end of file diff --git a/test/todo/test_sdkwrapper.md b/test/todo/test_sdkwrapper.md index b8dac6c..e946fe7 100644 --- a/test/todo/test_sdkwrapper.md +++ b/test/todo/test_sdkwrapper.md @@ -1,11 +1,16 @@ # test_SdkWrapper TDD -## SdkWrapper::rcp_salt_core0() +## SdkWrapper::reset_block() - [x] Implement member function . - [x] Create test case to fail. - [x] Make it success. - [x] Remove the duplication. +## SdkWrapper::rcp_salt_core0() +- [x] Implement member function . +- [x] Create test case to fail. +- [x] Make it success. +- [x] Remove the duplication. ## SdkWrapper::pwm_gpio_to_channel() - [x] Implement member function .