system/bt
Revision | c260f5f130b3443b91a4f737f76af681edd0b825 (tree) |
---|---|
Zeit | 2016-10-02 03:37:02 |
Autor | Ivan Ivanich <iivanich@gmai...> |
Commiter | Ivan Ivanich |
Revert "Fix the command timeout issue with TX idle timer"
This reverts commit 5a234ca06c185f336a6398efe09f78c4d0dacf0b.
Change-Id: I2cec99e8cc119a9f8142f7370db1d4e1ff880e97
@@ -41,9 +41,6 @@ typedef struct low_power_manager_t { | ||
41 | 41 | // Tell the low power manager that you're done transmitting data. Must be |
42 | 42 | // called on the thread provided at initialization time. |
43 | 43 | void (*transmit_done)(void); |
44 | - | |
45 | - void (*start_idle_timer)(bool check_LPM); | |
46 | - void (*stop_idle_timer)(); | |
47 | 44 | } low_power_manager_t; |
48 | 45 | |
49 | 46 | const low_power_manager_t *low_power_manager_get_interface(); |
@@ -534,9 +534,9 @@ static void event_command_ready(fixed_queue_t *queue, UNUSED_ATTR void *context) | ||
534 | 534 | pthread_mutex_unlock(&commands_pending_response_lock); |
535 | 535 | |
536 | 536 | // Send it off |
537 | - low_power_manager->stop_idle_timer(); | |
537 | + low_power_manager->wake_assert(); | |
538 | 538 | packet_fragmenter->fragment_and_dispatch(wait_entry->command); |
539 | - low_power_manager->start_idle_timer(false); | |
539 | + low_power_manager->transmit_done(); | |
540 | 540 | |
541 | 541 | update_command_response_timer(); |
542 | 542 | } |
@@ -61,8 +61,8 @@ static void event_allow_device_sleep(void *context); | ||
61 | 61 | static void event_idle_timeout(void *context); |
62 | 62 | |
63 | 63 | static void reset_state(); |
64 | -void start_idle_timer(bool check_LPM); | |
65 | -void stop_idle_timer(); | |
64 | +static void start_idle_timer(); | |
65 | +static void stop_idle_timer(); | |
66 | 66 | |
67 | 67 | static thread_fn event_functions[] = { |
68 | 68 | event_disable, |
@@ -129,7 +129,7 @@ static void transmit_done() { | ||
129 | 129 | transmit_is_done = true; |
130 | 130 | if (wake_state == LPM_WAKE_W4_TX_DONE) { |
131 | 131 | wake_state = LPM_WAKE_W4_TIMEOUT; |
132 | - start_idle_timer(true); | |
132 | + start_idle_timer(); | |
133 | 133 | } |
134 | 134 | } |
135 | 135 |
@@ -163,7 +163,7 @@ static void allow_device_sleep() { | ||
163 | 163 | if (state == LPM_ENABLED && wake_state == LPM_WAKE_ASSERTED) { |
164 | 164 | if (transmit_is_done) { |
165 | 165 | wake_state = LPM_WAKE_W4_TIMEOUT; |
166 | - start_idle_timer(true); | |
166 | + start_idle_timer(); | |
167 | 167 | } else { |
168 | 168 | wake_state = LPM_WAKE_W4_TX_DONE; |
169 | 169 | } |
@@ -190,8 +190,8 @@ static void idle_timer_expired(UNUSED_ATTR void *context) { | ||
190 | 190 | thread_post(thread, event_idle_timeout, NULL); |
191 | 191 | } |
192 | 192 | |
193 | -void start_idle_timer(bool check_LPM) { | |
194 | - if (state == LPM_ENABLED || !check_LPM) { | |
193 | +static void start_idle_timer() { | |
194 | + if (state == LPM_ENABLED) { | |
195 | 195 | if (idle_timeout_ms == 0) { |
196 | 196 | wake_deassert(); |
197 | 197 | } else { |
@@ -200,9 +200,8 @@ void start_idle_timer(bool check_LPM) { | ||
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | -void stop_idle_timer() { | |
203 | +static void stop_idle_timer() { | |
204 | 204 | alarm_cancel(idle_alarm); |
205 | - LOG_DEBUG("%s", __func__); | |
206 | 205 | } |
207 | 206 | |
208 | 207 | static void event_disable(UNUSED_ATTR void *context) { |
@@ -241,9 +240,7 @@ static const low_power_manager_t interface = { | ||
241 | 240 | cleanup, |
242 | 241 | post_command, |
243 | 242 | wake_assert, |
244 | - transmit_done, | |
245 | - start_idle_timer, | |
246 | - stop_idle_timer | |
243 | + transmit_done | |
247 | 244 | }; |
248 | 245 | |
249 | 246 | const low_power_manager_t *low_power_manager_get_interface() { |