# MM_TIMER
[MM]

LMAC MAC Management timer module. More...

Collaboration diagram for MM_TIMER:

## Data Structures
struct | mm_timer_tag
| Structure defining the properties of a timer. More...
struct | mm_timer_env_tag
| LMAC MAC Management Timer Context. More...
## Typedefs
typedef void(* | cb_timer_func_ptr )(void *)
| Pointer to callback function.
## Functions
void | mm_timer_init (void)
| MM Timer Module initialization function.
static void | mm_timer_hw_set (struct mm_timer_tag *timer)
| Set the HW timer with the first timer of the queue.
static bool | cmp_abs_time (struct co_list_hdr const *timerA, struct co_list_hdr const *timerB)
| Compare timer absolute expiration time.
void | mm_timer_set (struct mm_timer_tag *timer, uint32_t value)
| Program a timer to be scheduled in the future.
void | mm_timer_clear (struct mm_timer_tag *timer)
| Clear a programmed timer.
void | mm_timer_schedule (int dummy)
| Schedule the next timer(s).
## Variables
struct mm_timer_env_tag | mm_timer_env
| Context variable for TIMER module.
struct mm_timer_env_tag | mm_timer_env
| Context variable for TIMER module.

## Detailed Description

LMAC MAC Management timer module.

## Function Documentation

static bool cmp_abs_time | ( | struct co_list_hdr const * | timerA,
|  | struct co_list_hdr const * | timerB |
| ) |  |  | `[static]`

Compare timer absolute expiration time.

Parameters:

  `[in]` | timerA | Timer to compare.
  `[in]` | timerB | Timer to compare.

Returns:
  true if timerA will expire before timerB.

Definition at line 103 of file mm_timer.c.

References hal_machw_time_cmp().

void mm_timer_clear | ( | struct mm_timer_tag * | timer | ) |

Clear a programmed timer.

This function searches for the timer passed as parameter in the list of programmed timers and extract it from the list.

Parameters:

  `[in]` | timer | Pointer to the timer to be extracted

Referenced by chan_switch_reset_timer(), mm_set_vif_state_req_handler(), p2p_cli_noa_cancel(), ps_disable_cfm(), rxu_cntrl_defrag_check(), tdls_cancel_chan_switch_req_handler(), tdls_check_frame_action(), tdls_chsw_null_frame_tx_cfm(), tdls_chsw_time_evt(), and tdls_chsw_timeout_evt().

static void mm_timer_hw_set | ( | struct mm_timer_tag * | timer | ) | `[static]`

Set the HW timer with the first timer of the queue.

Parameters:

  `[in]` | timer |

Definition at line 65 of file mm_timer.c.

References GLOBAL_INT_DISABLE, GLOBAL_INT_RESTORE, HAL_MM_TIMER, HAL_MM_TIMER_BIT, and mm_timer_tag::time.

void mm_timer_init | ( | void |  | ) |

MM Timer Module initialization function.

This function is called after reset and initializes all MM timer related env and data.

void mm_timer_schedule | ( | int | dummy | ) |

Schedule the next timer(s).

This function pops the first timer from the timer queue and notifies the appropriate task by sending a kernel message. If the timer is periodic, it is set again; if it is one-shot, the timer is freed. The function checks also the next timers and process them if they have expired or are about to expire.

Parameters:

  `[in]` | dummy | Event id. (not used)

This function pops the first timer from the timer queue and notifies calls the attached callback function. The function checks also the next timers and process them if they have expired or are about to expire.

void mm_timer_set | ( | struct mm_timer_tag * | timer,
|  | uint32_t | value |
| ) |  |  |

Program a timer to be scheduled in the future.

Parameters:

  `[in]` | timer | Pointer to the pre-filled timer structure (except value)
  `[in]` | value | Absolute timeout value

Referenced by bfr_calib_tmr_exp_cb(), chan_conn_less_delay_prog(), chan_p2p_noa_tsf_updated(), chan_switch_set_timer(), mm_ap_tbtt(), mm_set_vif_state_req_handler(), p2p_noa_timer_prog(), p2p_oppps_timer_end(), ps_enable_cfm(), ps_uapsd_timer_handle(), rxu_cntrl_defrag_check(), rxu_cntrl_reord_timeout_cb(), tdls_chan_switch_req_handler(), tdls_check_frame_action(), tdls_chsw_rsp_tx_cfm(), tdls_chsw_time_evt(), and tdls_keep_alive_evt().