# /space/home/slher/rel/Beken/v6_4_5/macsw/plf/refip/src/driver/phy/phy_custom_rf.c File Reference

Copyright (C) RivieraWaves 2014-2019. More...

`#include "rwnx_config.h"`
`#include "phy.h"`
`#include "dbg.h"`
`#include "hal_machw.h"`
`#include "reg_mac_core.h"`
`#include "reg_mdm_stat.h"`
`#include "reg_mdmdsss_cfg.h"`
`#include "reg_mdm_cfg.h"`
`#include "reg_riu.h"`
`#include "reg_rc.h"`
`#include "reg_macbypass.h"`
`#include "crm.h"`
`#include "rd.h"`
`#include "uf.h"`

Go to the source code of this file.

## Data Structures
struct | phy_custom_cfg_tag
| Structure containing the parameters of the Custom RF configuration, coming from host or any other mean. More...
struct | phy_env_tag
| PHY driver context structure. More...
## Defines
#define | __RIU_RADARFIFO_ADDR 0x60C04000
| Radar fifo address.
## Functions
static void | custom_rf_set_channel (uint8_t band, uint16_t freq1, uint8_t chantype)
| Configure new channel at RF level.
static void | riu_pssel_set (uint16_t freq, uint16_t freq1, uint8_t chantype)
| Configure Primary/Secondary at RIU level.
static void | mdm_primary_set (uint16_t freq, uint16_t freq1, uint8_t chantype)
| Configure Primary at Modem level.
static void | mdm_set_channel (uint8_t band, uint16_t freq, uint16_t freq1, uint8_t chantype, uint8_t flags)
| Configure new channel at modem level.
static void | phy_hw_set_channel (uint8_t band, uint16_t freq, uint16_t freq1, uint8_t chantype, uint8_t flags, uint8_t index)
| Configure a new channel.
static void | custom_rf_init (const struct phy_custom_cfg_tag *cfg)
| Initialize RF layer.
static void | mdm_init (const struct phy_custom_cfg_tag *cfg)
| Initialize Modem.
static void | phy_hw_init (const struct phy_custom_cfg_tag *cfg)
| Initialize PHY interface.
void | phy_init (const struct phy_cfg_tag *config)
| Modem and Radio initialization function.
void | phy_mdm_isr (void)
| Modem interrupt service routine.
void | phy_rc_isr (void)
| FIXME: This is for debug purpose only and does not call rd_event_ind.
void | phy_get_version (uint32_t *version_1, uint32_t *version_2)
| PHY version reading function.
void | phy_set_channel (const struct mac_chan_op *chan, uint8_t index)
| Set channel function.
void | phy_get_channel (struct phy_channel_info *info, uint8_t index)
| Get channel function.
void | phy_stop (void)
| PHY stop function.
uint32_t | phy_get_channel_switch_dur (void)
| Get maximum duration to set a new channel.
bool | phy_has_radar_pulse (int rd_idx)
| Indicates if the PHY has radar pulses available or not.
bool | phy_get_radar_pulse (int rd_idx, struct phy_radar_pulse *pulse)
| Read a radar pulse from the FIFO, and writes it to the buffer passed as parameter.
bool | phy_vht_supported (void)
| Return the VHT capability of the PHY.
bool | phy_he_supported (void)
| Return the HE capability of the PHY.
bool | phy_uf_supported (void)
| Return the unsupported HT frame handling capability of the PHY.
void | phy_uf_enable (bool enable)
| Configure the unsupported HT frame handling capability of the PHY.
bool | phy_ldpc_tx_supported (void)
| Return the LDPC TX capability of the PHY.
bool | phy_ldpc_rx_supported (void)
| Return the LDPC RX capability of the PHY.
bool | phy_bfmee_supported (void)
| Return the Beamformee capability of the PHY.
bool | phy_bfmer_supported (void)
| Return the Beamformer capability of the PHY.
bool | phy_mu_mimo_rx_supported (void)
| Return the MU-MIMO RX capability of the PHY.
bool | phy_mu_mimo_tx_supported (void)
| Return the MU-MIMO TX capability of the PHY.
void | phy_set_aid (uint16_t aid)
| Set the AID to the PHY, in order to allow correct operation of OFDMA-RX.
uint8_t | phy_get_bw (void)
| Return the supported BW of the PHY.
uint8_t | phy_get_nss (void)
| Return the NSS of the PHY.
uint8_t | phy_get_ntx (void)
| Return the NTX of the PHY.
uint8_t | phy_get_nrx (void)
| Return the NRX of the PHY.
uint8_t | phy_get_bfr_mem_size (void)
| Return the size of the BFMER memory in kBytes.
void | phy_get_rf_gain_idx (int8_t *power, uint8_t *idx)
| Get radio code to set a specific TX power Return the idx to use (set in policy table), to configure a specific TX power.
void | phy_get_rf_gain_capab (int8_t *max, int8_t *min)
| Get radio's transmission power capabilities.
uint8_t | phy_switch_antenna_paths (void)
| Switch paths connections.
## Variables
struct phy_env_tag | phy_env
| PHY driver context.

## Detailed Description

Copyright (C) RivieraWaves 2014-2019.

When setting a channel, several procedures can be advantageously left-out depending on whether the band, bw, frequency remain unchanged (calibrations, old modem clk mmc toggles ..), e.g. for multi-channel. Although the changes are trivial they might get in the way of properly measuring the RF behavior.

Definition in file phy_custom_rf.c.

## Function Documentation

static void custom_rf_init | ( | const struct phy_custom_cfg_tag * | cfg | ) | `[static]`

Initialize RF layer.

Parameters:

  `[in]` | cfg | Custom RF configuration

Definition at line 404 of file phy_custom_rf.c.

Referenced by phy_hw_init().

static void custom_rf_set_channel | ( | uint8_t | band,
|  | uint16_t | freq1,
|  | uint8_t | chantype |
| ) |  |  | `[static]`

Configure new channel at RF level.

Parameters:

  `[in]` | band | Channel band
  `[in]` | freq1 | Channel center frequency
  `[in]` | chantype | Channel bandwidth

Definition at line 70 of file phy_custom_rf.c.

Referenced by phy_hw_set_channel().

static void mdm_init | ( | const struct phy_custom_cfg_tag * | cfg | ) | `[static]`

Initialize Modem.

Parameters:

  `[in]` | cfg | Custom RF configuration

Definition at line 416 of file phy_custom_rf.c.

References ASSERT_ERR, crm_mdm_reset(), phy_he_supported(), and phy_vht_supported().

Referenced by phy_hw_init().

static void mdm_primary_set | ( | uint16_t | freq,
|  | uint16_t | freq1,
|  | uint8_t | chantype |
| ) |  |  | `[static]`

Configure Primary at Modem level.

Parameters:

  `[in]` | freq | Channel frequency of primary
  `[in]` | freq1 | Channel center frequency
  `[in]` | chantype | Channel bandwidth

Definition at line 122 of file phy_custom_rf.c.

References PHY_CHNL_BW_40, and PHY_CHNL_BW_80.

Referenced by mdm_set_channel().

static void mdm_set_channel | ( | uint8_t | band,
|  | uint16_t | freq,
|  | uint16_t | freq1,
|  | uint8_t | chantype,
|  | uint8_t | flags |
| ) |  |  | `[static]`

Configure new channel at modem level.

Parameters:

  `[in]` | band | Channel band
  `[in]` | freq | Channel frequency of primary
  `[in]` | freq1 | Channel center frequency
  `[in]` | chantype | Channel bandwidth
  `[in]` | flags | Channel flags

Definition at line 155 of file phy_custom_rf.c.

References CHAN_RADAR, crm_mdm_reset(), mdm_primary_set(), MODE_802_11AC_5, MODE_802_11N_2_4, PHY_BAND_5G, PHY_CHNL_BW_20, PHY_CHNL_BW_40, and riu_pssel_set().

Referenced by phy_hw_set_channel().

static void phy_hw_init | ( | const struct phy_custom_cfg_tag * | cfg | ) | `[static]`

Initialize PHY interface.

Parameters:

  `[in]` | cfg | Custom RF configuration

Definition at line 596 of file phy_custom_rf.c.

References custom_rf_init(), mdm_init(), PHY_BAND_5G, PHY_CHNL_BW_20, and phy_hw_set_channel().

Referenced by phy_init().

static void phy_hw_set_channel | ( | uint8_t | band,
|  | uint16_t | freq,
|  | uint16_t | freq1,
|  | uint8_t | chantype,
|  | uint8_t | flags,
|  | uint8_t | index |
| ) |  |  | `[static]`

Configure a new channel.

Parameters:

  `[in]` | band | Channel band
  `[in]` | freq | Channel primary frequency
  `[in]` | freq1 | Channel center frequency
  `[in]` | chantype | Channel bandwidth
  `[in]` | flags | Channel flags
  `[in]` | index | RIU index to configure (ignored if only one RIU)

Definition at line 370 of file phy_custom_rf.c.

References crm_clk_set(), custom_rf_set_channel(), D_INF, D_PHY, dbg, and mdm_set_channel().

Referenced by phy_hw_init(), and phy_set_channel().

static void riu_pssel_set | ( | uint16_t | freq,
|  | uint16_t | freq1,
|  | uint8_t | chantype |
| ) |  |  | `[static]`

Configure Primary/Secondary at RIU level.

Parameters:

  `[in]` | freq | Channel frequency of primary
  `[in]` | freq1 | Channel center frequency
  `[in]` | chantype | Channel bandwidth

PSSEL - use pssel of RW-WSDM-RIU-HW-REG.xls

Definition at line 84 of file phy_custom_rf.c.

References PHY_CHNL_BW_40, and PHY_CHNL_BW_80.

Referenced by mdm_set_channel().