foldedtoad / dwm3000

Port of Qorvo/Decawave's DWM3000 Module on the DWS3000 Arduino Shield
GNU General Public License v3.0
87 stars 20 forks source link

Review removal of port_XXXXEXT_IRQ related functions #4

Closed foldedtoad closed 2 years ago

foldedtoad commented 3 years ago

in platform/port.c there are four function which appear not needed.

These functions were included in the original code from Decawave, which targeted the Nordic SDK build environment. This Nordic SDK support is not a complete operating system, but rather a minimalistic platform. As such the SPI support within it does not provide serialization for SPI transactions...the app must provide serialization within its code base. This is what the nRF52840 code for the DWM3000 did, within the above functions.

But Zephyr is a much more complete OS and as such provide serialization of SPI transactions within the Zephyr-provided code. In other words, the above functions are redundant and actually add to the overall code path for the SPI transactions. See ./zephyr/drivers/spi/spi_context.h (circa line 54) and the usage of the lock and sync mutexes.

In the future, I will remove this functions, and any references, such as in deca_mutex.c. This change will have a ripple effect into the deca_spi.c code also.

krbvroc1 commented 3 years ago

Are you sure that these are unnecessary? My understanding, which could be wrong, is that you need to mask IRQ so that the DW3000 interrupt does not fire while you are in the middle of reading/writing the registers.

foldedtoad commented 2 years ago

The Zephyr OS kernel will serialize IRQs. This issues is now implemented and checked-in.

foldedtoad commented 2 years ago

resolved