xmos / xcore_iot

Other
29 stars 39 forks source link

Test spi slave with normal priority #563

Closed shuchitak closed 1 year ago

shuchitak commented 1 year ago

https://github.com/xmos/sw_xvf3800/issues/317

xmos-jmccarthy commented 1 year ago

Could you please implement this as a configuration option to enable spi_slave with and without the high priority mode bit?

Something like:

ifndef HIL_IO_SPI_SLAVE_HIGH_PRIO

define HIL_IO_SPI_SLAVE_HIGH_PRIO 0

endif

... / Enable fast mode and high priority /

if HIL_IO_SPI_SLAVE_HIGH_PRIO

local_thread_mode_set_bits(thread_mode_fast | thread_mode_high_priority);

else

local_thread_mode_set_bits(thread_mode_fast);

endif

This way by default it will work for the 3800, but still support the ideal RTOS use case.

Disabling the high priority bit will result in performance loss of the IO peripheral. For hybrid and bare metal applications, the high priority mode bit being set can lead to application issues, as linked in your description. For the RTOS only use case, the purpose of the high priority mode bit is to ensure the real time behavior of the IO module, intentionally at the loss of the other RTOS cores MIPs. The MIPs loss of the other cores still happens, but since dynamic scheduling has the potential to "reclaim" cycles that otherwise would be lost due to static thread allocation, it is less of an issue in an RTOS only application.