00001
00012 #ifndef _PHY_H_
00013 #define _PHY_H_
00014
00024
00025
00026
00027
00028
00029 #include "co_int.h"
00030 #include "co_bool.h"
00031 #include "mac_types.h"
00032 #include "rwnx_config.h"
00033
00034
00035 #include "compiler.h"
00036
00037
00038
00039
00040
00042 #define PHY_UNUSED 0xFF
00043
00045 #define PHY_CFG_BUF_SIZE 16
00046
00048 #define PHY_FREQ_5G 5000
00049
00052
00055 #define PHY_INFO_BAND(__x) ((__x.info1) & 0x000000FF)
00056
00059 #define PHY_INFO_BW(__x) (((__x.info1) & 0x0000FF00) >> 8)
00060
00063 #define PHY_INFO_CHAN(__x) (((__x.info1) & 0xFFFF0000) >> 16)
00064
00067 #define PHY_INFO_CENT_FREQ1(__x) ((__x.info2) & 0x0000FFFF)
00068
00071 #define PHY_INFO_CENT_FREQ2(__x) (((__x.info2) & 0xFFFF0000) >> 16)
00072
00074
00076 enum
00077 {
00079 PHY_PRIM,
00081 PHY_SEC,
00082 };
00083
00084
00085 struct dbg_debug_info_tag;
00086
00088 struct phy_channel_info
00089 {
00091 uint32_t info1;
00093 uint32_t info2;
00094 };
00095
00097 struct phy_radar_pulse
00098 {
00100 uint32_t pulse;
00101 };
00102
00104 struct phy_cfg_tag
00105 {
00107 uint32_t parameters[PHY_CFG_BUF_SIZE];
00108 };
00109
00110
00111
00112
00113
00114
00115
00123 void phy_init(const struct phy_cfg_tag *config);
00124
00131 void phy_reset(void);
00132
00133
00144 void phy_get_version(uint32_t *version_1, uint32_t *version_2);
00145
00160 void phy_set_channel(const struct mac_chan_op *chan, uint8_t index);
00161
00175 void phy_get_channel(struct phy_channel_info *info, uint8_t index);
00176
00184 void phy_stop(void);
00185
00193 uint32_t phy_get_channel_switch_dur(void);
00194
00204 __INLINE int phy_freq_to_channel(uint8_t band, uint16_t freq)
00205 {
00206 if ((band == PHY_BAND_2G4) && (freq >= 2412) && (freq <= 2484))
00207 {
00208 if (freq == 2484)
00209 return 14;
00210 else
00211 return (freq - 2407) / 5;
00212 }
00213 else if ((band == PHY_BAND_5G) && (freq >= 5005) && (freq <= 5825))
00214 {
00215 return (freq - PHY_FREQ_5G) / 5;
00216 }
00217
00218 return 0;
00219 }
00220
00230 __INLINE uint16_t phy_channel_to_freq(uint8_t band, int channel)
00231 {
00232 if ((band == PHY_BAND_2G4) && (channel >= 1) && (channel <= 14))
00233 {
00234 if (channel == 14)
00235 return 2484;
00236 else
00237 return 2407 + channel * 5;
00238 }
00239 else if ((band == PHY_BAND_5G) && (channel >= 1) && (channel <= 165))
00240 {
00241 return PHY_FREQ_5G + channel * 5;
00242 }
00243
00244 return 0;
00245 }
00246
00253 void phy_mdm_isr(void);
00254
00261 void phy_rc_isr(void);
00262
00274 bool phy_has_radar_pulse(int rd_idx);
00275
00288 bool phy_get_radar_pulse(int rd_idx, struct phy_radar_pulse *pulse);
00289
00297 bool phy_vht_supported(void);
00298
00306 bool phy_he_supported(void);
00307
00315 bool phy_uf_supported(void);
00316
00324 void phy_uf_enable(bool enable);
00325
00333 bool phy_ldpc_tx_supported(void);
00334
00342 bool phy_ldpc_rx_supported(void);
00343
00351 bool phy_bfmee_supported(void);
00352
00360 bool phy_bfmer_supported(void);
00361
00369 bool phy_mu_mimo_rx_supported(void);
00370
00378 bool phy_mu_mimo_tx_supported(void);
00379
00380 #if RW_MUMIMO_RX_EN
00381
00389 void phy_set_group_id_info(uint32_t membership_addr, uint32_t userpos_addr);
00390 #endif
00391
00399 void phy_set_aid(uint16_t aid);
00400
00408 uint8_t phy_get_bw(void);
00409
00417 uint8_t phy_get_nss(void);
00418
00426 uint8_t phy_get_ntx(void);
00427
00435 uint8_t phy_get_nrx(void);
00436
00444 uint8_t phy_get_bfr_mem_size(void);
00445
00459 void phy_get_rf_gain_idx(int8_t *power, uint8_t *idx);
00460
00461
00470 void phy_get_rf_gain_capab(int8_t *max, int8_t *min);
00471
00472 #if NX_DEBUG_DUMP
00473
00482 void phy_get_diag_state(struct dbg_debug_info_tag *dbg_info);
00483 #endif
00484
00492 uint8_t phy_switch_antenna_paths(void);
00493
00495
00496 #endif //_PHY_H_