-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Description
The QSPI driver has an _owner
member and a private _acquire()
function that sets _owner
to this
. This is similar to the SPI driver, which also has an _owner
and _acquire()
. However, the SPI driver uses these because it has a static array of spi_peripheral_s
, each containing their own spi_t
, and so it makes sense for the SPI
object to need to take ownership of a particular spi_peripheral_s
. The QSPI driver uses no such mechanism and stores a qspi_t
directly, so is it still necessary to have a concept of ownership or acquisition in that driver?
Moreover, the first time _acquire()
is called in the QSPI driver, _initialize()
will be called, in turn calling qspi_init()
for the second time (as it was already called in the constructor). That qspi_init()
needs to be repeatedly callable on the same qspi_t
is not documented in the QSPI porting documentation, unlike the Watchdog or RTC documentation that explicitly notes this requirement. Is this behavior intentional? There is a comment in the QSPI driver:
//Otherwise we may have to change mode as well, so call _acquire
but as far as I can tell, _mode
is only set in the constructor, so there is never a need to update it via qspi_init()
.
As an aside, there is a protected function acquire()
declared in QSPI.h which seems to be neither defined nor used anywhere.
Issue request type
[X] Question
[ ] Enhancement
[ ] Bug