mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #10162 from pan-/cordio-driver-notify-inactivity
BLE - Notify HCI driver of host stack inactivitypull/9904/head
commit
365cf1143e
|
@ -283,6 +283,10 @@ uint16_t CordioHCIDriver::write(uint8_t type, uint16_t len, uint8_t *pData)
|
||||||
return _transport_driver.write(type, len, pData);
|
return _transport_driver.write(type, len, pData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CordioHCIDriver::on_host_stack_inactivity()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace cordio
|
} // namespace cordio
|
||||||
} // namespace vendor
|
} // namespace vendor
|
||||||
} // namespace ble
|
} // namespace ble
|
||||||
|
|
|
@ -134,6 +134,16 @@ public:
|
||||||
*/
|
*/
|
||||||
uint16_t write(uint8_t type, uint16_t len, uint8_t *pData);
|
uint16_t write(uint8_t type, uint16_t len, uint8_t *pData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* React to host stack inactivity.
|
||||||
|
*
|
||||||
|
* The host stack invoke this function when it is inactive. It allows a
|
||||||
|
* driver to put its controller to sleep if all the conditions are met.
|
||||||
|
*
|
||||||
|
* Any call to write signals to the driver that the host stack is active.
|
||||||
|
*/
|
||||||
|
virtual void on_host_stack_inactivity();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Return a default set of memory pool that the Cordio stack can use.
|
* Return a default set of memory pool that the Cordio stack can use.
|
||||||
|
|
|
@ -555,7 +555,7 @@ void BLE::callDispatcher()
|
||||||
|
|
||||||
wsfOsDispatcher();
|
wsfOsDispatcher();
|
||||||
|
|
||||||
static Timeout nextTimeout;
|
static LowPowerTimeout nextTimeout;
|
||||||
CriticalSectionLock critical_section;
|
CriticalSectionLock critical_section;
|
||||||
|
|
||||||
if (wsfOsReadyToSleep()) {
|
if (wsfOsReadyToSleep()) {
|
||||||
|
@ -564,6 +564,9 @@ void BLE::callDispatcher()
|
||||||
timestamp_t nextTimestamp = (timestamp_t) (WsfTimerNextExpiration(&pTimerRunning) * WSF_MS_PER_TICK) * 1000;
|
timestamp_t nextTimestamp = (timestamp_t) (WsfTimerNextExpiration(&pTimerRunning) * WSF_MS_PER_TICK) * 1000;
|
||||||
if (pTimerRunning) {
|
if (pTimerRunning) {
|
||||||
nextTimeout.attach_us(timeoutCallback, nextTimestamp);
|
nextTimeout.attach_us(timeoutCallback, nextTimestamp);
|
||||||
|
} else {
|
||||||
|
critical_section.disable();
|
||||||
|
_hci_driver->on_host_stack_inactivity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue