/** * Handles proper timer action when outgoing data is delivered to the * HCI line discipline. Sets BT_TXDATA. */ static void bluesleep_outgoing_data(void) { if (mutex_is_locked(&bluesleep_mutex)) BT_DBG("Wait for mutex unlock in bluesleep_outgoing_data"); mutex_lock(&bluesleep_mutex); /* log data passing by */ set_bit(BT_TXDATA, &flags); BT_DBG("bluesleep_outgoing_data."); if (!test_bit(BT_EXT_WAKE, &flags)) BT_DBG("BT_EXT_WAKE freed"); if (!test_bit(BT_ASLEEP, &flags)) BT_DBG("BT_ASLEEP freed"); /* ** Uart Clk should be enabled promptly ** before bluedroid write TX data. */ hsuart_power(1); bluesleep_tx_data_wakeup(); mutex_unlock(&bluesleep_mutex); }
/** * Handles proper timer action when outgoing data is delivered to the * HCI line discipline. Sets BT_TXDATA. */ static void bluesleep_outgoing_data(void) { /* prevent entered upload mode or bt reset. */ /* if bluesleep_tx_timer_expire routine triggered, max 10ms wait for finish. */ int i; for(i=0; i<10 && !test_bit(BT_TXDATA, &flags) && !test_bit(BT_EXT_WAKE, &flags) && !test_bit(BT_ASLEEP, &flags); i++) { BT_DBG("bluesleep_tx_timer_expire routine has not yet finished. 1ms sleep"); usleep(1000); } if (mutex_is_locked(&bluesleep_mutex)) BT_DBG("Wait for mutex unlock in bluesleep_outgoing_data"); mutex_lock(&bluesleep_mutex); /* log data passing by */ set_bit(BT_TXDATA, &flags); BT_DBG("bluesleep_outgoing_data."); if (!test_bit(BT_EXT_WAKE, &flags)) BT_DBG("BT_EXT_WAKE freed"); if (!test_bit(BT_ASLEEP, &flags)) BT_DBG("BT_ASLEEP freed"); /* ** Uart Clk should be enabled promptly ** before bluedroid write TX data. */ hsuart_power(1); bluesleep_tx_data_wakeup(); mutex_unlock(&bluesleep_mutex); }