diff --git a/src/rp2_common/pico_cyw43_driver/cyw43_bus_pio_spi.c b/src/rp2_common/pico_cyw43_driver/cyw43_bus_pio_spi.c index d9265dd0b..73996a8f9 100644 --- a/src/rp2_common/pico_cyw43_driver/cyw43_bus_pio_spi.c +++ b/src/rp2_common/pico_cyw43_driver/cyw43_bus_pio_spi.c @@ -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 \ No newline at end of file +#endif // CYW43_PIN_WL_DYNAMIC