# APM
[UMAC]

Declaration of all structures and functions used by the APM module. More...

Collaboration diagram for APM:

## Data Structures
struct | apm
| APM environment declaration. More...
## Modules
| TASK_APM

| Declaration of all structures and functions used by the APM module.
## Defines
#define | AGING_DURATION 25 * TU_DURATION * TU_DURATION
| Aging Duration : The time period is 100 sec.
#define | MAC_AGING_STA 10
| number of stations to be checked for aging
#define | STAID_NOTRAFFIC_THRESHOLD_NULL 3
| the threshold for null frame
#define | QOS_CAPA_VALUE 0x10
| the value of the QOS capability info
## Functions
static void | apm_bss_config_init (void)
| Initialize the BSS configuration list.
static void | apm_bss_config_push (void *param)
| Push a BSS configuration message to the list.
void | apm_init (void)
| Initialize the APM context.
void | apm_start_cfm (uint8_t status)
| Send the AP starting confirmation to the upper layers.
void | apm_set_bss_param (void)
| Set the BSS parameters to the LMAC/MACHW.
void | apm_bss_config_send (void)
| Send the next BSS parameter message present in the list.
void | apm_bcn_set (void)
| Send the AP beacon information to the Lower MAC.
void | apm_stop (struct vif_info_tag *vif)
| Stop the AP.
bool | apm_tx_int_ps_check (struct txdesc *txdesc)
| Checks if an internal frame can be sent.
void | apm_tx_int_ps_postpone (struct txdesc *txdesc, struct sta_info_tag *sta)
| Updates status after postponing an internal frame.
struct txdesc * | apm_tx_int_ps_get_postpone (struct vif_info_tag *vif, struct sta_info_tag *sta, int *stop)
| Get the next txdesc to push from postpone queue.
void | apm_tx_int_ps_clear (struct vif_info_tag *vif, uint8_t sta_idx)
| Clears PS status regarding internal frame.
void | apm_tx_int_ps_sent (struct txdesc *txdesc, struct sta_info_tag *sta)
| Updates status after sending a postponed frame.
## Variables
struct apm | apm_env
| Definition of the global environment.
struct apm | apm_env
| APM module environment declaration.

## Detailed Description

Declaration of all structures and functions used by the APM module.

## Function Documentation

void apm_bcn_set | ( | void |  | ) |

Send the AP beacon information to the Lower MAC.

Referenced by me_set_active_cfm_handler().

static void apm_bss_config_push | ( | void * | param | ) | `[static]`

Push a BSS configuration message to the list.

Parameters:

  `[in]` | param | Pointer to the message parameters

Definition at line 57 of file apm.c.

References apm_env, apm::bss_config, co_list_push_back(), ke_msg::hdr, and ke_param2msg().

void apm_bss_config_send | ( | void |  | ) |

Send the next BSS parameter message present in the list.

Referenced by me_set_ps_disable_cfm_handler(), mm_bss_param_setting_handler(), mm_chan_ctxt_unlink_cfm_handler(), and mm_set_vif_state_cfm_handler().

void apm_init | ( | void |  | ) |

Initialize the APM context.

void apm_set_bss_param | ( | void |  | ) |

Set the BSS parameters to the LMAC/MACHW.

Referenced by apm_start_req_handler().

void apm_start_cfm | ( | uint8_t | status | ) |

Send the AP starting confirmation to the upper layers.

Parameters:

  `[in]` | status | Status of the AP starting procedure

Referenced by mm_bcn_change_cfm_handler().

void apm_stop | ( | struct vif_info_tag * | vif | ) |

Stop the AP.

Parameters:

  `[in]` | vif | Pointer to the VIF instance

Referenced by apm_stop_req_handler().

bool apm_tx_int_ps_check | ( | struct txdesc * | txdesc | ) |

Checks if an internal frame can be sent.

Checks if an internal frame should be postponed because the peer is in power save mode. Does nothing if sending vif is not of type VIF_AP.

Parameters:

  `[in]` | txdesc | TX desc of the frame to check

Returns:
  false if the frame is about to be sent via an AP interface to a station that is currently in power save mode, true otherwise

void apm_tx_int_ps_clear | ( | struct vif_info_tag * | vif,
|  | uint8_t | sta_idx |
| ) |  |  |

Clears PS status regarding internal frame.

Call to push all postponed frames and clear PS status of internal PS traffix, when a STA exit PS state. Does nothing when called on a non AP interface.

Parameters:

  `[in]` | vif | VIF entry.
  `[in]` | sta_idx | Index of the sta that exit PS.

Referenced by rxl_pm_check().

struct txdesc * apm_tx_int_ps_get_postpone | ( | struct vif_info_tag * | vif,
|  | struct sta_info_tag * | sta,
|  | int * | stop |
| ) |  |  | `[read]`

Get the next txdesc to push from postpone queue.

When a PS service period (legacy PS or U_APSD) is in progress, this fucntion will extract the next frame to push from the postpone queue. Since both legacy PS and U-APSD frames may be present in the postpone queue, the function will take care to extract the first frame that correspond to the service period. After selecting a frame, the rest of the queue is checked to see there there are pending frame to correctly set the MORE_DATA flag.

On a non AP interface or outside of a service period, it immediately return NULL and set `stop` to 0.

Parameters:

  `[in]` | vif | Vif entry that will send the frame
  `[in]` | sta | STA entry for the destination of the frame
  `[out]` | stop | Indicates if more postponed frames can be pushed

Returns:
  txdesc to push. If txdesc is NULL then it is necessary to test the value of `stop` parameter. If set to 1 it means that no more frame can be pushed for this service period. If set to 0, it means that there is no service period in progress and postpone queue can be pushed in its current order.

void apm_tx_int_ps_postpone | ( | struct txdesc * | txdesc,
|  | struct sta_info_tag * | sta |
| ) |  |  |

Updates status after postponing an internal frame.

If an internal frame has been postponed because peer in in PS (apm_tx_int_ps_check), this function will update internal status and TIM IE if necessary.

Parameters:

  `[in]` | txdesc | TX desc of the frame postponed
  `[in]` | sta | STA entry for the destination of the frame

Referenced by txl_cntrl_postpone().

void apm_tx_int_ps_sent | ( | struct txdesc * | txdesc,
|  | struct sta_info_tag * | sta |
| ) |  |  |

Updates status after sending a postponed frame.

It is called before sending a posponed frame. If the postpone reason was PS then this function will update TIM IE or set MORE_DATA flag in the frame.

Parameters:

  `[in]` | txdesc | TX desc of the frame postponed
  `[in]` | sta | STA entry for the destination of the frame

## Variable Documentation

struct apm apm_env

Definition of the global environment.

APM module environment declaration.

Definition at line 29 of file apm.c.

Referenced by apm_bss_config_init(), apm_bss_config_push(), apm_start_req_handler(), and me_set_active_cfm_handler().