# TPC
[TX]

LMAC Transmit Power Control module. More...

Collaboration diagram for TPC:

## Functions
void | tpc_update_tx_power (int8_t pwr)
| Set power level to be used for HW generated frame.
void | tpc_get_vif_tx_power (struct vif_info_tag *vif, int8_t *pwr, uint8_t *idx)
| Get TX power for a VIF.
void | tpc_set_vif_tx_power (struct vif_info_tag *vif, int8_t pwr)
| Configure TX power for a specific vif.
void | tpc_update_frame_tx_power (struct vif_info_tag *vif, struct txl_frame_desc_tag *frame)
| Set power level to be used for FW generated frame.
void | tpc_update_vif_tx_power (struct vif_info_tag *vif)
| Configure TX power for a specific vif based on bss information.

## Detailed Description

LMAC Transmit Power Control module.

## Function Documentation

void tpc_get_vif_tx_power | ( | struct vif_info_tag * | vif,
|  | int8_t * | pwr,
|  | uint8_t * | idx |
| ) |  |  |

Get TX power for a VIF.

Return the current TX power configured for the VIF.

Parameters:

  `[in]` | vif | VIF structure
  `[out]` | pwr | Updated with actual TX power in dBm (can be NULL)
  `[out]` | idx | Updated with the radio idx to use in policy table (can be NULL)

Definition at line 25 of file tpc.c.

References phy_get_rf_gain_idx(), vif_info_tag::tx_power, and VIF_UNDEF_POWER.

Referenced by me_update_buffer_control(), mm_set_power_req_handler(), tpc_update_frame_tx_power(), and txu_cntrl_umacdesc_mgmt_prep().

void tpc_set_vif_tx_power | ( | struct vif_info_tag * | vif,
|  | int8_t | pwr |
| ) |  |  |

Configure TX power for a specific vif.

Configure a TX power for a vif. The requested value must respect local regulatory. The actual value set may be lower because of radio capabilities.

Parameters:

  `[in,out]` | vif | VIF structure to configure
  `[in]` | pwr | Tx power to set for the vif

Definition at line 41 of file tpc.c.

References vif_info_tag::chan_ctxt, chan_update_tx_power(), CO_BIT, co_list_next(), co_list_pick(), NX_VIRT_DEV_MAX, phy_get_rf_gain_idx(), sta_info_tag::pol_tbl, vif_info_tag::sta_list, STA_MGMT_POL_UPD_TX_POWER, tpc_update_tx_power(), vif_info_tag::tx_power, sta_pol_tbl_cntl::upd_field, vif_info_tab, and VIF_UNDEF_POWER.

Referenced by mm_set_power_req_handler(), and tpc_update_vif_tx_power().

void tpc_update_frame_tx_power | ( | struct vif_info_tag * | vif,
|  | struct txl_frame_desc_tag * | frame |
| ) |  |  |

Set power level to be used for FW generated frame.

Update tx power in policy table used by the frame.

Parameters:

  `[in]` | vif | Pointer on vif that send the frame
  `[in]` | frame | Pointer on frame to be sent

Definition at line 90 of file tpc.c.

References HW2CPU, lmacdesc::hw_desc, txdesc::lmac, tx_hd::policyentryaddr, tx_policy_tbl::powercntrlinfo, tx_hw_desc::thd, tpc_get_vif_tx_power(), TX_PWR_LEVEL_SET, and txl_frame_desc_tag::txdesc.

Referenced by mm_bcn_build(), ps_send_pspoll(), txl_frame_send_null_frame(), txl_frame_send_qosnull_frame(), txl_frame_send_tdls_channel_switch_req_frame(), txl_frame_send_tdls_channel_switch_rsp_frame(), and txl_frame_send_tdls_peer_traffic_ind_frame().

void tpc_update_tx_power | ( | int8_t | pwr | ) |

Set power level to be used for HW generated frame.

Configure NXMAC_MAX_POWER_LEVEL register with the specified Tx power by converting it to a radio idx first.

Parameters:

  `[in]` | pwr | TX power (in dBm)

Definition at line 15 of file tpc.c.

References phy_get_rf_gain_idx().

Referenced by chan_switch_channel(), mm_start_req_handler(), and tpc_set_vif_tx_power().

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

Configure TX power for a specific vif based on bss information.

Configure a TX power for a vif based on the bss information and user request. The power configured is the minimum value among:

- The maximum allowed by the BSS regulatory
- The maximum supported by the phy driver
- The value requested by the upper layer

Parameters:

  `[in,out]` | vif | VIF structure to update

Definition at line 102 of file tpc.c.

References vif_info_tag::bss_info, me_bss_info::chan, vif_info_tag::index, me_bss_info::power_constraint, tpc_set_vif_tx_power(), TRACE_LMAC, vif_info_tag::tx_power, mac_chan_op::tx_power, vif_info_tag::user_tx_power, and VIF_UNDEF_POWER.

Referenced by apm_start_req_handler(), me_beacon_check(), mm_set_power_req_handler(), and scanu_join_frame_handler().