Are the new libraries (specifically interrupt, GPIO, I2C) thread safe? Or do I need to manage my own locks/mutexes for safe access between threads when writing/reading to these libraries?
Also, what is the scenario where multiple calls to i2c_init() on same line (ex: ‘I2C3’). Should I also keep track so no multiple calls to i2c_init() on same line, or does it simply just give me the currently opened handle if already opened?
The interrupt library is thread safe on all modules.
The i2c library is not thread safe on all modules.
The Gpio library is thread safe on the T20 and T30 modules.
The Tegra CPUs provide atomic bit-set and bit-clear registers for the GPIO peripherals.
To make the Gpio library thread safe on all modules, we needed to protect each GPIO operation with a mutex, which would have huge impacts on performance. Therefore we decided to avoid the mutex and implement as much thread safety as possible, without mutexes.