diff options
author | Sharvil Nanavati <sharvil@google.com> | 2014-06-29 18:10:15 -0700 |
---|---|---|
committer | Sharvil Nanavati <sharvil@google.com> | 2014-07-01 22:42:23 -0700 |
commit | b5382489d4092d6e8418297ce7bd5d0c82ad2eef (patch) | |
tree | 2853aa41b167c439da6efa11b9384744f2b8169d | |
parent | d42dba5420e5636dfcf71f883d73821ac923d549 (diff) | |
download | android_system_bt-b5382489d4092d6e8418297ce7bd5d0c82ad2eef.tar.gz android_system_bt-b5382489d4092d6e8418297ce7bd5d0c82ad2eef.tar.bz2 android_system_bt-b5382489d4092d6e8418297ce7bd5d0c82ad2eef.zip |
Remove more unused code from GKI timers.
Change-Id: I4fc3a64312b49a3dd23d80454244f8eb6340d8e6
-rw-r--r-- | gki/common/gki.h | 19 | ||||
-rw-r--r-- | gki/common/gki_common.h | 7 | ||||
-rw-r--r-- | gki/common/gki_time.c | 148 | ||||
-rw-r--r-- | gki/ulinux/gki_ulinux.c | 32 | ||||
-rw-r--r-- | include/gki_target.h | 11 | ||||
-rwxr-xr-x | main/bte_main.c | 2 |
6 files changed, 3 insertions, 216 deletions
diff --git a/gki/common/gki.h b/gki/common/gki.h index 8bc23d1a9..0382e2df3 100644 --- a/gki/common/gki.h +++ b/gki/common/gki.h @@ -146,7 +146,7 @@ GKI_API extern UINT8 GKI_get_taskid(void); GKI_API extern void GKI_init(void); GKI_API extern void GKI_shutdown(void); GKI_API extern INT8 *GKI_map_taskname(UINT8); -GKI_API extern void GKI_run(void *); +GKI_API extern void GKI_run(void); GKI_API extern void GKI_stop(void); /* To send buffers and events between tasks @@ -185,9 +185,7 @@ GKI_API extern UINT16 GKI_get_pool_bufsize (UINT8); GKI_API extern void GKI_add_to_timer_list (TIMER_LIST_Q *, TIMER_LIST_ENT *); GKI_API extern void GKI_delay(UINT32); GKI_API extern UINT32 GKI_get_tick_count(void); -GKI_API extern INT8 *GKI_get_time_stamp(INT8 *); GKI_API extern void GKI_init_timer_list (TIMER_LIST_Q *); -GKI_API extern void GKI_init_timer_list_entry (TIMER_LIST_ENT *); GKI_API extern INT32 GKI_ready_to_sleep (void); GKI_API extern void GKI_remove_from_timer_list (TIMER_LIST_Q *, TIMER_LIST_ENT *); GKI_API extern void GKI_start_timer(UINT8, INT32, BOOLEAN); @@ -198,22 +196,7 @@ GKI_API extern UINT32 GKI_get_remaining_ticks (TIMER_LIST_Q *, TIMER_LIST_ENT GKI_API extern UINT16 GKI_wait(UINT16, UINT32); GKI_API extern BOOLEAN GKI_timer_queue_is_empty(const TIMER_LIST_Q *timer_q); GKI_API extern TIMER_LIST_ENT *GKI_timer_getfirst(const TIMER_LIST_Q *timer_q); -GKI_API extern TIMER_LIST_ENT *GKI_timer_getlast(const TIMER_LIST_Q *timer_q); -GKI_API extern INT32 GKI_timer_ticks_getlast(const TIMER_LIST_Q *timer_q); -GKI_API extern TIMER_LIST_ENT *GKI_timer_entry_next(const TIMER_LIST_ENT *tle); -GKI_API extern INT32 GKI_timer_ticks_getcurrent(const TIMER_LIST_ENT *tle); GKI_API extern INT32 GKI_timer_ticks_getinitial(const TIMER_LIST_ENT *tle); -GKI_API extern BOOLEAN GKI_timer_in_use(const TIMER_LIST_ENT *tle); - -/* Start and Stop system time tick callback - * true for start system tick if time queue is not empty - * false to stop system tick if time queue is empty -*/ -typedef void (SYSTEM_TICK_CBACK)(BOOLEAN); - -/* Time queue management for system ticks -*/ -GKI_API extern void GKI_timer_queue_register_callback(SYSTEM_TICK_CBACK *); /* Disable Interrupts, Enable Interrupts */ diff --git a/gki/common/gki_common.h b/gki/common/gki_common.h index d94a3a22a..042024e1f 100644 --- a/gki/common/gki_common.h +++ b/gki/common/gki_common.h @@ -267,9 +267,6 @@ typedef struct /* Timer related variables */ INT32 OSTicksTilExp; /* Number of ticks till next timer expires */ -#if (defined(GKI_DELAY_STOP_SYS_TICK) && (GKI_DELAY_STOP_SYS_TICK > 0)) - UINT32 OSTicksTilStop; /* inactivity delay timer; OS Ticks till stopping system tick */ -#endif INT32 OSNumOrigTicks; /* Number of ticks between last timer expiration to the next one */ INT32 OSWaitTmr [GKI_MAX_TASKS]; /* ticks the task has to wait, for specific events */ @@ -324,10 +321,6 @@ typedef struct BOOLEAN timer_nesting; /* flag to prevent timer interrupt nesting */ - /* System tick callback */ - SYSTEM_TICK_CBACK *p_tick_cb; - BOOLEAN system_tick_running; /* TRUE if system tick is running. Valid only if p_tick_cb is not NULL */ - #if (GKI_DEBUG == TRUE) UINT16 ExceptionCnt; /* number of GKI exceptions that have happened */ EXCEPTION_T Exception[GKI_MAX_EXCEPTION]; diff --git a/gki/common/gki_time.c b/gki/common/gki_time.c index a01b6b802..1a1554907 100644 --- a/gki/common/gki_time.c +++ b/gki/common/gki_time.c @@ -48,9 +48,6 @@ void gki_timers_init(void) gki_cb.com.OSTicksTilExp = 0; /* Remaining time (of OSTimeCurTimeout) before next timer expires */ gki_cb.com.OSNumOrigTicks = 0; -#if (defined(GKI_DELAY_STOP_SYS_TICK) && (GKI_DELAY_STOP_SYS_TICK > 0)) - gki_cb.com.OSTicksTilStop = 0; /* clear inactivity delay timer */ -#endif for (tt = 0; tt < GKI_MAX_TASKS; tt++) { @@ -77,9 +74,6 @@ void gki_timers_init(void) #endif } - gki_cb.com.p_tick_cb = NULL; - gki_cb.com.system_tick_running = FALSE; - return; } @@ -210,28 +204,6 @@ void GKI_start_timer (UINT8 tnum, INT32 ticks, BOOLEAN is_continuous) GKI_disable(); - if(gki_timers_is_timer_running() == FALSE) - { -#if (defined(GKI_DELAY_STOP_SYS_TICK) && (GKI_DELAY_STOP_SYS_TICK > 0)) - /* if inactivity delay timer is not running, start system tick */ - if(gki_cb.com.OSTicksTilStop == 0) - { -#endif - if(gki_cb.com.p_tick_cb) - { - /* start system tick */ - gki_cb.com.system_tick_running = TRUE; - (gki_cb.com.p_tick_cb) (TRUE); - } -#if (defined(GKI_DELAY_STOP_SYS_TICK) && (GKI_DELAY_STOP_SYS_TICK > 0)) - } - else - { - /* clear inactivity delay timer */ - gki_cb.com.OSTicksTilStop = 0; - } -#endif - } /* Add the time since the last task timer update. ** Note that this works when no timers are active since ** both OSNumOrigTicks and OSTicksTilExp are 0. @@ -334,31 +306,6 @@ void GKI_stop_timer (UINT8 tnum) break; #endif } - - GKI_disable(); - - if (gki_timers_is_timer_running() == FALSE) - { - if (gki_cb.com.p_tick_cb) - { -#if (defined(GKI_DELAY_STOP_SYS_TICK) && (GKI_DELAY_STOP_SYS_TICK > 0)) - /* if inactivity delay timer is not running */ - if ((gki_cb.com.system_tick_running)&&(gki_cb.com.OSTicksTilStop == 0)) - { - /* set inactivity delay timer */ - /* when timer expires, system tick will be stopped */ - gki_cb.com.OSTicksTilStop = GKI_DELAY_STOP_SYS_TICK; - } -#else - gki_cb.com.system_tick_running = FALSE; - gki_cb.com.p_tick_cb(FALSE); /* stop system tick */ -#endif - } - } - - GKI_enable(); - - } @@ -399,26 +346,6 @@ void GKI_timer_update (INT32 ticks_since_last_update) gki_cb.com.timer_nesting = 1; -#if (defined(GKI_DELAY_STOP_SYS_TICK) && (GKI_DELAY_STOP_SYS_TICK > 0)) - /* if inactivity delay timer is set and expired */ - if (gki_cb.com.OSTicksTilStop) - { - if( gki_cb.com.OSTicksTilStop <= (UINT32)ticks_since_last_update ) - { - if(gki_cb.com.p_tick_cb) - { - gki_cb.com.system_tick_running = FALSE; - (gki_cb.com.p_tick_cb) (FALSE); /* stop system tick */ - } - gki_cb.com.OSTicksTilStop = 0; /* clear inactivity delay timer */ - gki_cb.com.timer_nesting = 0; - return; - } - else - gki_cb.com.OSTicksTilStop -= ticks_since_last_update; - } -#endif - /* No need to update the ticks if no timeout has occurred */ if (gki_cb.com.OSTicksTilExp > 0) { @@ -438,15 +365,12 @@ void GKI_timer_update (INT32 ticks_since_last_update) */ gki_cb.com.OSNumOrigTicks -= gki_cb.com.OSTicksTilExp; -#if GKI_TIMER_LIST_NOPREEMPT == TRUE /* Protect this section because if a GKI_timer_stop happens between: * - gki_cb.com.OSTaskTmr0[task_id] -= gki_cb.com.OSNumOrigTicks; * - gki_cb.com.OSTaskTmr0[task_id] = gki_cb.com.OSTaskTmr0R[task_id]; * then the timer may appear stopped while it is about to be reloaded. - * Note: Not needed if this function cannot be preempted (typical). */ GKI_disable(); -#endif /* Check for OS Task Timers */ for (task_id = 0; task_id < GKI_MAX_TASKS; task_id++) @@ -551,10 +475,7 @@ void GKI_timer_update (INT32 ticks_since_last_update) // Set alarm service for next alarm. alarm_service_reschedule(); -#if GKI_TIMER_LIST_NOPREEMPT == TRUE - /* End the critical section */ GKI_enable(); -#endif gki_cb.com.timer_nesting = 0; @@ -563,26 +484,6 @@ void GKI_timer_update (INT32 ticks_since_last_update) /******************************************************************************* ** -** Function GKI_timer_queue_register_callback -** -** Description This function is called by applications to register system tick -** start/stop callback for time queues -** -** -** Parameters p_callback - (input) pointer to the system tick callback -** -** Returns BOOLEAN -** -*******************************************************************************/ -void GKI_timer_queue_register_callback (SYSTEM_TICK_CBACK *p_callback) -{ - gki_cb.com.p_tick_cb = p_callback; - - return; -} - -/******************************************************************************* -** ** Function GKI_init_timer_list ** ** Description This function is called by applications when they @@ -609,61 +510,12 @@ TIMER_LIST_ENT *GKI_timer_getfirst(const TIMER_LIST_Q *timer_q) { return timer_q->p_first; } -TIMER_LIST_ENT *GKI_timer_getlast(const TIMER_LIST_Q *timer_q) { - assert(timer_q != NULL); - return timer_q->p_last; -} - -/* Returns the number of ticks of the last entry in the queue. */ -INT32 GKI_timer_ticks_getlast(const TIMER_LIST_Q *timer_q) { - assert(timer_q != NULL); - return timer_q->last_ticks; -} - -/******************************************************************************* -** -** Function GKI_init_timer_list_entry -** -** Description This function is called by the applications when they -** want to initialize a timer list entry. This must be -** done prior to first use of the entry. -** -** Parameters p_tle - (input) pointer to a timer list queue entry -** -** Returns void -** -*******************************************************************************/ -void GKI_init_timer_list_entry(TIMER_LIST_ENT *tle) { - tle->p_next = NULL; - tle->p_prev = NULL; - tle->ticks = GKI_UNUSED_LIST_ENTRY; - tle->ticks_initial = 0; - tle->in_use = FALSE; -} - -/* Returns the next linked entry from this tle or NULL. */ -TIMER_LIST_ENT *GKI_timer_entry_next(const TIMER_LIST_ENT *tle) { - assert(tle != NULL); - return tle->p_next; -} - -/* Returns the current number of ticks for this timer entry. */ -INT32 GKI_timer_ticks_getcurrent(const TIMER_LIST_ENT *tle) { - assert(tle != NULL); - return tle->ticks; -} - /* Returns the initial number of ticks for this timer entry. */ INT32 GKI_timer_ticks_getinitial(const TIMER_LIST_ENT *tle) { assert(tle != NULL); return tle->ticks_initial; } -BOOLEAN GKI_timer_in_use(const TIMER_LIST_ENT *tle) { - assert(tle != NULL); - return tle->in_use; -} - /******************************************************************************* ** ** Function GKI_update_timer_list diff --git a/gki/ulinux/gki_ulinux.c b/gki/ulinux/gki_ulinux.c index c2312fedc..6c7182d1c 100644 --- a/gki/ulinux/gki_ulinux.c +++ b/gki/ulinux/gki_ulinux.c @@ -566,27 +566,6 @@ void GKI_shutdown(void) } -/******************************************************************************* - ** - ** Function gki_system_tick_start_stop_cback - ** - ** Description This function runs a task - ** - ** Parameters: start: TRUE start system tick (again), FALSE stop - ** - ** Returns void - ** - *********************************************************************************/ - -void gki_system_tick_start_stop_cback(BOOLEAN start) -{ - if (start) { - ALOGV("Starting system ticks\n"); - } else { - ALOGV("Stopping system ticks\n"); - } -} - /***************************************************************************** ** ** Function gki_set_timer_scheduling @@ -634,20 +613,11 @@ static void gki_set_timer_scheduling( void ) ** *******************************************************************************/ -void GKI_run (void * p_task_id) +void GKI_run(void) { - UNUSED(p_task_id); - -#ifndef GKI_NO_TICK_STOP /* adjust btld scheduling scheme now */ gki_set_timer_scheduling(); - - /* register start stop function which disable timer loop in GKI_run() when no timers are - * in any GKI/BTA/BTU this should save power when BTLD is idle! */ - GKI_timer_queue_register_callback( gki_system_tick_start_stop_cback ); GKI_TRACE( "GKI_run(): Start/Stop GKI_timer_update_registered!" ); -#endif - return; } diff --git a/include/gki_target.h b/include/gki_target.h index 187abeede..d71c268f6 100644 --- a/include/gki_target.h +++ b/include/gki_target.h @@ -129,17 +129,6 @@ #define GKI_OS_TICKS_TO_SECS(x) ((x) / OS_TICKS_PER_SEC)) #endif - -/* delay in ticks before stopping system tick. */ -#ifndef GKI_DELAY_STOP_SYS_TICK -#define GKI_DELAY_STOP_SYS_TICK 0 -#endif - -/* Option to guarantee no preemption during timer expiration (most system don't need this) */ -#ifndef GKI_TIMER_LIST_NOPREEMPT -#define GKI_TIMER_LIST_NOPREEMPT TRUE -#endif - /****************************************************************************** ** ** Buffer configuration diff --git a/main/bte_main.c b/main/bte_main.c index 688deca85..2b604a811 100755 --- a/main/bte_main.c +++ b/main/bte_main.c @@ -204,7 +204,7 @@ void bte_main_enable() bte_hci_enable(); - GKI_run(0); + GKI_run(); } /****************************************************************************** |