• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


Commit MetaInfo

修訂5a234ca06c185f336a6398efe09f78c4d0dacf0b (tree)
時間2016-09-13 16:29:34
作者Luke Zhang <lukez@qca....>
CommiterIvan Grinko

Log Message

Fix the command timeout issue with TX idle timer

Start the idle timer after sending out each command to prevent power
collapse.

CRs-fixed:926763
Change-Id: I98e649fa40a4622e3c6bce4ea5c53d51e25413b3

Change Summary

差異

--- a/hci/include/low_power_manager.h
+++ b/hci/include/low_power_manager.h
@@ -41,6 +41,9 @@ typedef struct low_power_manager_t {
4141 // Tell the low power manager that you're done transmitting data. Must be
4242 // called on the thread provided at initialization time.
4343 void (*transmit_done)(void);
44+
45+ void (*start_idle_timer)(bool check_LPM);
46+ void (*stop_idle_timer)();
4447 } low_power_manager_t;
4548
4649 const low_power_manager_t *low_power_manager_get_interface();
--- a/hci/src/hci_layer.c
+++ b/hci/src/hci_layer.c
@@ -534,9 +534,9 @@ static void event_command_ready(fixed_queue_t *queue, UNUSED_ATTR void *context)
534534 pthread_mutex_unlock(&commands_pending_response_lock);
535535
536536 // Send it off
537- low_power_manager->wake_assert();
537+ low_power_manager->stop_idle_timer();
538538 packet_fragmenter->fragment_and_dispatch(wait_entry->command);
539- low_power_manager->transmit_done();
539+ low_power_manager->start_idle_timer(false);
540540
541541 update_command_response_timer();
542542 }
--- a/hci/src/low_power_manager.c
+++ b/hci/src/low_power_manager.c
@@ -61,8 +61,8 @@ static void event_allow_device_sleep(void *context);
6161 static void event_idle_timeout(void *context);
6262
6363 static void reset_state();
64-static void start_idle_timer();
65-static void stop_idle_timer();
64+void start_idle_timer(bool check_LPM);
65+void stop_idle_timer();
6666
6767 static thread_fn event_functions[] = {
6868 event_disable,
@@ -129,7 +129,7 @@ static void transmit_done() {
129129 transmit_is_done = true;
130130 if (wake_state == LPM_WAKE_W4_TX_DONE) {
131131 wake_state = LPM_WAKE_W4_TIMEOUT;
132- start_idle_timer();
132+ start_idle_timer(true);
133133 }
134134 }
135135
@@ -163,7 +163,7 @@ static void allow_device_sleep() {
163163 if (state == LPM_ENABLED && wake_state == LPM_WAKE_ASSERTED) {
164164 if (transmit_is_done) {
165165 wake_state = LPM_WAKE_W4_TIMEOUT;
166- start_idle_timer();
166+ start_idle_timer(true);
167167 } else {
168168 wake_state = LPM_WAKE_W4_TX_DONE;
169169 }
@@ -190,8 +190,8 @@ static void idle_timer_expired(UNUSED_ATTR void *context) {
190190 thread_post(thread, event_idle_timeout, NULL);
191191 }
192192
193-static void start_idle_timer() {
194- if (state == LPM_ENABLED) {
193+void start_idle_timer(bool check_LPM) {
194+ if (state == LPM_ENABLED || !check_LPM) {
195195 if (idle_timeout_ms == 0) {
196196 wake_deassert();
197197 } else {
@@ -200,8 +200,9 @@ static void start_idle_timer() {
200200 }
201201 }
202202
203-static void stop_idle_timer() {
203+void stop_idle_timer() {
204204 alarm_cancel(idle_alarm);
205+ LOG_DEBUG("%s", __func__);
205206 }
206207
207208 static void event_disable(UNUSED_ATTR void *context) {
@@ -240,7 +241,9 @@ static const low_power_manager_t interface = {
240241 cleanup,
241242 post_command,
242243 wake_assert,
243- transmit_done
244+ transmit_done,
245+ start_idle_timer,
246+ stop_idle_timer
244247 };
245248
246249 const low_power_manager_t *low_power_manager_get_interface() {