Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2a8ae70 authored by Chris Manton's avatar Chris Manton
Browse files

Add ConvertMillisecondsToBasebandSlots

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I3fec52556049d6832db59dd89096217d224b792a
parent 5bdf1d10
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1202,6 +1202,10 @@ bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) {
 * NOTE             This flush timeout applies to all logical channels active on
 *                  the ACL link.
 ******************************************************************************/
inline uint32_t ConvertMillisecondsToBasebandSlots(uint32_t milliseconds) {
  return ((milliseconds * 8) + 3) / 5;
}

bool L2CA_SetFlushTimeout(const RawAddress& bd_addr, uint16_t flush_tout) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::L2CA_SetFlushTimeout(bd_addr, flush_tout);
@@ -1228,7 +1232,7 @@ bool L2CA_SetFlushTimeout(const RawAddress& bd_addr, uint16_t flush_tout) {
    hci_flush_to = 0x0000;
  } else {
    /* convert L2CAP flush_to to 0.625 ms units, with round */
    temp = (((uint32_t)flush_tout * 8) + 3) / 5;
    temp = ConvertMillisecondsToBasebandSlots(flush_tout);

    /* if L2CAP flush_to within range of HCI, set HCI flush timeout */
    if (temp > HCI_MAX_AUTOMATIC_FLUSH_TIMEOUT) {