Skip to content

Commit

Permalink
Issue #25 : Add wider API support of RasPi Pico SDK
Browse files Browse the repository at this point in the history
hardware_resets.
  • Loading branch information
suikan4github committed Nov 28, 2024
1 parent 4d439a2 commit 34bda26
Show file tree
Hide file tree
Showing 10 changed files with 461 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/sdk/mocksdkwrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 4 additions & 0 deletions src/sdk/pico_api_alternate_defs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
298 changes: 298 additions & 0 deletions src/sdk/pico_sdk_apistub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/sdk/pico_sdk_headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
#include <hardware/rcp.h>
#endif // __has_include(<hardware/rcp.h>) || __has_include(<gmock/gmock.h>)

#if __has_include(<hardware/resets.h>) || __has_include(<gmock/gmock.h>)
#include <hardware/resets.h>
#endif // __has_include(<hardware/resets.h>) || __has_include(<gmock/gmock.h>)

#if __has_include(<hardware/gpio.h>) || __has_include(<gmock/gmock.h>)
#include <hardware/gpio.h>
#endif // __has_include(<hardware/gpio.h>) || __has_include(<gmock/gmock.h>)
Expand Down
1 change: 1 addition & 0 deletions src/sdk/scripts/api_dirs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ hardware pio
hardware powman
hardware pwm
hardware rcp
hardware resets
hardware gpio
hardware clocks
pico time
Expand Down
4 changes: 4 additions & 0 deletions src/sdk/scripts/blocks/pico_api_alternate_defs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 34bda26

Please sign in to comment.