1SPI Features 2============ 3 4.. _spi_master_features: 5 6SPI Master 7---------- 8 9.. _spi_bus_lock: 10 11SPI Bus Lock 12^^^^^^^^^^^^ 13 14To realize the multiplexing of different devices from different drivers (SPI Master, SPI Flash, 15etc.), an SPI bus lock is applied on each SPI bus. Drivers can attach their devices onto the bus 16with the arbitration of the lock. 17 18Each bus lock are initialized with a BG (background) service registered, all devices request to 19do transactions on the bus should wait until the BG to be successfully disabled. 20 21- For SPI1 bus, the BG is the cache, the bus lock will help to disable the cache before device 22 operations starts, and enable it again after device releasing the lock. No devices on SPI1 is 23 allowed using ISR (it's meaningless for the task to yield to other tasks when the cache is 24 disabled). 25 26 .. only:: esp32 27 28 There are quite a few limitations when using SPI Master driver on the SPI1 bus, see 29 :ref:`spi_master_on_spi1_bus`. 30 31 .. only:: esp32s2 32 33 The SPI Master driver hasn't supported SPI1 bus. Only SPI Flash driver can attach to the bus. 34 35- For other buses, the driver may register its ISR as the BG. The bus lock will block a device 36 task when it requests for exclusive use of the bus, try to disable the ISR, and unblock the 37 device task allowed to exclusively use the bus when the ISR is successfully disabled. When the 38 task releases the lock, the lock will also try to resume the ISR if there are pending 39 transactions to be done in the ISR. 40