Remove ARM assembly from RISC-V CYW43 SPI PIO (#2045)

Add hand-coded assembly RISC-V version of swap16x2 for CYW32 SPI PIO
driver.

Fixes #2044
This commit is contained in:
Earle F. Philhower, III 2024-11-18 15:11:39 -08:00 committed by GitHub
parent 1b64cac8d6
commit 0f847db371
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -80,7 +80,15 @@ static uint32_t counter = 0;
//#define SWAP32(A) ((((A) & 0xff000000U) >> 8) | (((A) & 0xff0000U) << 8) | (((A) & 0xff00U) >> 8) | (((A) & 0xffU) << 8))
__force_inline static uint32_t __swap16x2(uint32_t a) {
#ifndef __riscv
pico_default_asm ("rev16 %0, %0" : "+l" (a) : : );
#else
uint32_t tmp;
pico_default_asm (
"rev8 %1, %0\n"
"rori %0, %1, 16\n"
: "+l" (a), "=l" (tmp));
#endif
return a;
}
#define SWAP32(a) __swap16x2(a)
@ -596,4 +604,4 @@ uint cyw43_get_pin_wl(cyw43_pin_index_t pin_id) {
assert(cyw43_pin_array[pin_id] < NUM_BANK0_GPIOS);
return cyw43_pin_array[pin_id];
}
#endif // CYW43_PIN_WL_DYNAMIC
#endif // CYW43_PIN_WL_DYNAMIC