move get_core_num() into platform.h (#852)

This commit is contained in:
Graham Sanderson
2022-06-06 08:20:00 -05:00
committed by GitHub
parent 4e4cf11d9b
commit f3c446ae14
4 changed files with 14 additions and 11 deletions

View File

@ -304,15 +304,6 @@ __force_inline static void spin_unlock(spin_lock_t *lock, uint32_t saved_irq) {
restore_interrupts(saved_irq);
}
/*! \brief Get the current core number
* \ingroup hardware_sync
*
* \return The core number the call was made from
*/
__force_inline static uint get_core_num(void) {
return (*(uint32_t *) (SIO_BASE + SIO_CPUID_OFFSET));
}
/*! \brief Initialise a spin lock
* \ingroup hardware_sync
*

View File

@ -17,6 +17,8 @@
*/
#include "hardware/platform_defs.h"
#include "hardware/regs/addressmap.h"
#include "hardware/regs/sio.h"
// Marker for builds targeting the RP2040
#define PICO_RP2040 1
@ -423,6 +425,15 @@ static inline void busy_wait_at_least_cycles(uint32_t minimum_cycles) {
);
}
/*! \brief Get the current core number
* \ingroup pico_platform
*
* \return The core number the call was made from
*/
__force_inline static uint get_core_num(void) {
return (*(uint32_t *) (SIO_BASE + SIO_CPUID_OFFSET));
}
#else // __ASSEMBLER__
#define WRAPPER_FUNC_NAME(x) __wrap_##x