/******************************************************************************* ** ** Function nfc_start_timer ** ** Description Start a timer for the specified amount of time. ** NOTE: The timeout resolution is in SECONDS! (Even ** though the timer structure field is ticks) ** ** Returns void ** *******************************************************************************/ void nfc_start_timer (TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout) { BT_HDR *p_msg; /* if timer list is currently empty, start periodic GKI timer */ if (nfc_cb.timer_queue.p_first == NULL) { /* if timer starts on other than NFC task (scritp wrapper) */ if (GKI_get_taskid () != NFC_TASK) { /* post event to start timer in NFC task */ if ((p_msg = (BT_HDR *) GKI_getbuf (BT_HDR_SIZE)) != NULL) { p_msg->event = BT_EVT_TO_START_TIMER; GKI_send_msg (NFC_TASK, NFC_MBOX_ID, p_msg); } } else { /* Start nfc_task 1-sec resolution timer */ GKI_start_timer (NFC_TIMER_ID, GKI_SECS_TO_TICKS (1), TRUE); } } GKI_remove_from_timer_list (&nfc_cb.timer_queue, p_tle); p_tle->event = type; p_tle->ticks = timeout; /* Save the number of seconds for the timer */ GKI_add_to_timer_list (&nfc_cb.timer_queue, p_tle); }
/******************************************************************************* ** ** Function nfc_hal_main_start_quick_timer ** ** Description Start a timer for the specified amount of time. ** NOTE: The timeout resolution depends on including modules. ** QUICK_TIMER_TICKS_PER_SEC should be used to convert from ** time to ticks. ** ** ** Returns void ** *******************************************************************************/ void nfc_hal_main_start_quick_timer (TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout) { NFC_HDR *p_msg; /* if timer list is currently empty, start periodic GKI timer */ if (nfc_hal_cb.quick_timer_queue.p_first == NULL) { /* if timer starts on other than NCIT task (script wrapper) */ if(GKI_get_taskid () != NFC_HAL_TASK) { /* post event to start timer in NCIT task */ if ((p_msg = (NFC_HDR *) GKI_getbuf (NFC_HDR_SIZE)) != NULL) { p_msg->event = NFC_HAL_EVT_TO_START_QUICK_TIMER; GKI_send_msg (NFC_HAL_TASK, NFC_HAL_TASK_MBOX, p_msg); } } else { GKI_start_timer (NFC_HAL_QUICK_TIMER_ID, ((GKI_SECS_TO_TICKS (1) / QUICK_TIMER_TICKS_PER_SEC)), TRUE); } } GKI_remove_from_timer_list (&nfc_hal_cb.quick_timer_queue, p_tle); p_tle->event = type; p_tle->ticks = timeout; /* Save the number of ticks for the timer */ GKI_add_to_timer_list (&nfc_hal_cb.quick_timer_queue, p_tle); }
/******************************************************************************* ** ** Function btu_start_quick_timer ** ** Description Start a timer for the specified amount of time. ** NOTE: The timeout resolution depends on including modules. ** QUICK_TIMER_TICKS_PER_SEC should be used to convert from ** time to ticks. ** ** ** Returns void ** *******************************************************************************/ void btu_start_quick_timer (TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout) { BT_HDR *p_msg; /* if timer list is currently empty, start periodic GKI timer */ if (btu_cb.quick_timer_queue.p_first == NULL) { /* script test calls stack API without posting event */ if (GKI_get_taskid() != BTU_TASK) { /* post event to start timer in BTU task */ if ((p_msg = (BT_HDR *)GKI_getbuf(BT_HDR_SIZE)) != NULL) { p_msg->event = BT_EVT_TO_START_QUICK_TIMER; GKI_send_msg (BTU_TASK, TASK_MBOX_0, p_msg); } } else GKI_start_timer(TIMER_2, QUICK_TIMER_TICKS, TRUE); } GKI_remove_from_timer_list (&btu_cb.quick_timer_queue, p_tle); p_tle->event = type; p_tle->ticks = timeout; /* Save the number of ticks for the timer */ GKI_add_to_timer_list (&btu_cb.quick_timer_queue, p_tle); }
/******************************************************************************* ** ** Function btu_start_timer ** ** Description Start a timer for the specified amount of time. ** NOTE: The timeout resolution is in SECONDS! (Even ** though the timer structure field is ticks) ** ** Returns void ** *******************************************************************************/ void btu_start_timer (TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout) { BT_HDR *p_msg; /* if timer list is currently empty, start periodic GKI timer */ if (btu_cb.timer_queue.p_first == NULL) { /* if timer starts on other than BTU task */ if (GKI_get_taskid() != BTU_TASK) { /* post event to start timer in BTU task */ if ((p_msg = (BT_HDR *)GKI_getbuf(BT_HDR_SIZE)) != NULL) { p_msg->event = BT_EVT_TO_START_TIMER; GKI_send_msg (BTU_TASK, TASK_MBOX_0, p_msg); } } else { /* Start free running 1 second timer for list management */ GKI_start_timer (TIMER_0, GKI_SECS_TO_TICKS (1), TRUE); } } GKI_remove_from_timer_list (&btu_cb.timer_queue, p_tle); p_tle->event = type; p_tle->ticks = timeout; /* Save the number of seconds for the timer */ GKI_add_to_timer_list (&btu_cb.timer_queue, p_tle); }
/******************************************************************************* ** ** Function ptim_start_timer ** ** Description Start a protocol timer for the specified amount ** of time in seconds. ** ** Returns void ** *******************************************************************************/ void ptim_start_timer(tPTIM_CB *p_cb, TIMER_LIST_ENT *p_tle, UINT16 type, INT32 timeout) { /* if timer list is currently empty, start periodic GKI timer */ if (p_cb->timer_queue.p_first == NULL) { p_cb->last_gki_ticks = GKI_get_tick_count(); GKI_start_timer(p_cb->timer_id, GKI_MS_TO_TICKS(p_cb->period), TRUE); } GKI_remove_from_timer_list(&p_cb->timer_queue, p_tle); p_tle->event = type; p_tle->ticks = timeout; p_tle->ticks_initial = timeout; GKI_add_to_timer_list(&p_cb->timer_queue, p_tle); }
/******************************************************************************* ** ** Function nfa_sys_ptim_start_timer ** ** Description Start a protocol timer for the specified amount ** of time in seconds. ** ** Returns void ** *******************************************************************************/ void nfa_sys_ptim_start_timer (tPTIM_CB *p_cb, TIMER_LIST_ENT *p_tle, UINT16 type, INT32 timeout) { NFA_TRACE_DEBUG1 ("nfa_sys_ptim_start_timer %08x", p_tle); /* if timer list is currently empty, start periodic GKI timer */ if (p_cb->timer_queue.p_first == NULL) { NFA_TRACE_DEBUG0 ("ptim timer start"); p_cb->last_gki_ticks = GKI_get_tick_count (); GKI_start_timer (p_cb->timer_id, GKI_MS_TO_TICKS (p_cb->period), TRUE); } GKI_remove_from_timer_list (&p_cb->timer_queue, p_tle); p_tle->event = type; p_tle->ticks = timeout; GKI_add_to_timer_list (&p_cb->timer_queue, p_tle); }