262 lines
8.4 KiB
C
262 lines
8.4 KiB
C
/****************************************************************************
|
|
|
|
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
|
|
|
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
|
be copied by any method or incorporated into another program without
|
|
the express written consent of Aerospace C.Power. This Information or any portion
|
|
thereof remains the property of Aerospace C.Power. The Information contained herein
|
|
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
|
liability for its use in any way and conveys no license or title under
|
|
any patent or copyright and makes no representation or warranty that this
|
|
Information is free from patent or copyright infringement.
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef CVG_NWM_STA_RF_H
|
|
#define CVG_NWM_STA_RF_H
|
|
|
|
/* cvg module internal includes */
|
|
#include "cvg_nwm_sta_common.h"
|
|
#include "mac_vdev_api.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#if (HPLC_RF_SUPPORT) && (PLC_SUPPORT_STA_ROLE)
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_add_nn_rf() - add a neighbor network rf info into rf list
|
|
* @param nwm: pointer of nwm
|
|
* @param rf_channel: rf channel
|
|
* @param rf_option: rf option
|
|
*/
|
|
void cvg_nwm_sta_add_nn_rf(cvg_nwm_vdev_t *nwm, uint8_t rf_channel,
|
|
uint8_t rf_option);
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_remove_nn_rf() - remove a neighbor network rf info from
|
|
* rf list
|
|
* @param nwm: pointer of nwm
|
|
* @param rf_channel: rf channel
|
|
* @param rf_option: rf option
|
|
*/
|
|
void cvg_nwm_sta_remove_nn_rf(cvg_nwm_vdev_t *nwm, uint8_t rf_channel,
|
|
uint8_t rf_option);
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_rf_list_age_check() - check if any neighbor rf info
|
|
* expired
|
|
* @param nwm: pointer of nwm
|
|
*/
|
|
void cvg_nwm_sta_rf_list_age_check(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_check_rf_proxy() - check if this a good rf proxy
|
|
* @param nwm: - nwm vdev pointer
|
|
* @param tei: - station tei.
|
|
* @param addr: - station addr.
|
|
* @param phase: - staion phase.
|
|
* @param role: - station role.
|
|
* @param level: - station level.
|
|
* @param min_ul_dl_sr: - min_ul_dl_sr pf station.
|
|
* @param min_sr_invalid:- flag to mark if min_ul_dl_sr is invalid
|
|
* @param snr: - snr of packet of received from station.
|
|
* @param noise_floor: - noise floor of station.
|
|
* @param rf_hop: - station rf hop.
|
|
* @param rssi: - rssi of packet of received from station.
|
|
* @retval: return none zero if state machine restart required
|
|
*/
|
|
uint8_t cvg_nwm_sta_check_rf_proxy(cvg_nwm_vdev_t *nwm,
|
|
tei_t tei, uint8_t addr[], uint8_t phase, uint8_t role,
|
|
uint8_t level, uint8_t min_ul_dl_sr, uint8_t min_sr_invalid, int8_t snr,
|
|
uint8_t noise_floor, uint8_t rf_hop, int8_t rssi);
|
|
|
|
#if HPLC_RF_DEV_SUPPORT
|
|
|
|
/*
|
|
* @brief set rf scan table to mac
|
|
* @param nwm: pointer to nwm
|
|
*/
|
|
void cvg_nwm_sta_set_rf_scan_to_mac(cvg_nwm_vdev_t *nwm);
|
|
|
|
/*
|
|
* @brief set prefer rf scan table according to neighbor network information
|
|
* @param nwm: pointer to nwm
|
|
*/
|
|
void cvg_nwm_sta_set_prefer_rf_scan(cvg_nwm_vdev_t *nwm);
|
|
|
|
/*
|
|
* @brief set rf channel order
|
|
* @param nwm: pointer to nwm
|
|
* @param option: rf option
|
|
* @param channel: rf channel
|
|
* @param order: order to be set in rf scan table,
|
|
* 1 - first seat, 0 - last seat
|
|
*/
|
|
void cvg_nwm_sta_set_channel_order(cvg_nwm_vdev_t *nwm,
|
|
uint8_t option, uint8_t channel, uint8_t order);
|
|
|
|
/*
|
|
* @brief check rf channel order in rf scan table
|
|
* @param nwm: pointer to nwm
|
|
*/
|
|
void cvg_nwm_sta_check_rf_scan(cvg_nwm_vdev_t *nwm);
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_rf_hb_check() - rf link heart beat check.
|
|
* @param nwm: pointer to nwm
|
|
*/
|
|
void cvg_nwm_sta_rf_hb_check(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_rf_dis_node_list_rx() - rf discover node list mme rx
|
|
* handling
|
|
* @param nwm: - nwm vdev pointer
|
|
* @param rx_info: - rx information
|
|
* @param data: - pointer to buffer of discovery node list mme
|
|
* @param len: - length of the mme in byte
|
|
* @param dis_sta: - TEI of sta sending discovery node list
|
|
* @retval: return next state of the vdev
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_sta_rf_dis_node_list_rx(cvg_nwm_vdev_t *nwm,
|
|
mac_rx_info_t *rx_info, uint8_t *data, uint32_t len, tei_t dis_sta);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_single_hop_msdu_rx() - rf single hop frame rx handling
|
|
* @param nwm: - nwm vdev pointer
|
|
* @param buf: - pointer to rx buffer
|
|
* @param s_mac: - pointer to mac header of single hop frame
|
|
* @param stei: - source tei come from fc
|
|
* @param dtei: - destination tei come from fc
|
|
* @param is_bcast: - flag to mark if this packet is broadcast packet
|
|
* @param app_id: - application id of the msdu
|
|
*/
|
|
void cvg_nwm_sta_single_hop_msdu_rx(cvg_nwm_vdev_t *nwm, iot_pkt_t *buf,
|
|
void *s_mac, tei_t stei, tei_t dtei, uint8_t is_bcast, uint8_t app_id);
|
|
|
|
/**
|
|
* @brief set local device rf tx power cap for sta role device
|
|
* @param vdev: pointer to vdev
|
|
* @param local: flag to mark if the source of the tx power control is
|
|
* from local device or network.
|
|
* @param power: tx power cap. unit is 1dbm
|
|
*
|
|
* @return:
|
|
* 0 -- for success case
|
|
* otherwise -- error code
|
|
*/
|
|
uint32_t cvg_nwm_sta_set_rf_tx_power_cap(cvg_vdev_t *vdev, uint8_t local,
|
|
int8_t power);
|
|
|
|
/**
|
|
* @brief get rf tx power cap of local device
|
|
* @param vdev: pointer to vdev
|
|
*
|
|
* @return:
|
|
* tx power cap. unit is 1dbm. RF_TX_POWER_INVALID means unavailable.
|
|
*/
|
|
int8_t cvg_nwm_sta_get_rf_tx_power_cap(cvg_vdev_t *vdev);
|
|
|
|
/**
|
|
* @brief switch to recommended rf scan table
|
|
* @param nwm: nwm vdev pointer
|
|
* @param set_mac: flag to mark if rf scan table set to mac
|
|
*/
|
|
void cvg_nwm_sta_switch_to_rf_recommend_tbl(cvg_nwm_vdev_t *nwm,
|
|
uint8_t set_mac);
|
|
|
|
/**
|
|
* @brief switch to option 2 full frequency table
|
|
* @param nwm: nwm vdev pointer
|
|
* @param set_mac: flag to mark if rf scan table set to mac
|
|
*/
|
|
void cvg_nwm_sta_switch_to_rf_global_tbl(cvg_nwm_vdev_t *nwm, uint8_t set_mac);
|
|
|
|
#else /* HPLC_RF_DEV_SUPPORT */
|
|
|
|
#define cvg_nwm_sta_set_rf_scan_to_mac(nwm)
|
|
|
|
#define cvg_nwm_sta_set_prefer_rf_scan(nwm)
|
|
|
|
#define cvg_nwm_sta_set_channel_order(nwm, option, channel, order)
|
|
|
|
#define cvg_nwm_sta_check_rf_scan(nwm)
|
|
|
|
#define cvg_nwm_sta_rf_hb_check(nwm)
|
|
|
|
#define cvg_nwm_sta_rf_dis_node_list_rx(nwm, rx_info, data, len, dis_sta) \
|
|
(nwm->desc.sta.pst_info.sm.cur_state)
|
|
|
|
#define cvg_nwm_sta_single_hop_msdu_rx(nwm, buf, s_mac, stei, dtei, \
|
|
is_bcast, app_id)
|
|
|
|
static inline uint32_t cvg_nwm_sta_set_rf_tx_power_cap(cvg_vdev_t *vdev,
|
|
uint8_t local, int8_t power)
|
|
{
|
|
(void)vdev;
|
|
(void)local;
|
|
(void)power;
|
|
return ERR_NOSUPP;
|
|
}
|
|
|
|
#define cvg_nwm_sta_get_rf_tx_power_cap(vdev) (RF_TX_PWR_INVALID)
|
|
|
|
#define cvg_nwm_sta_switch_to_rf_recommend_tbl(nwm, set_mac)
|
|
|
|
#define cvg_nwm_sta_switch_to_rf_global_tbl(nwm, set_mac)
|
|
|
|
#endif /* HPLC_RF_DEV_SUPPORT */
|
|
|
|
#else /* HPLC_RF_SUPPORT && PLC_SUPPORT_STA_ROLE */
|
|
|
|
#define cvg_nwm_sta_add_nn_rf(nwm, rf_channel, rf_option)
|
|
|
|
#define cvg_nwm_sta_remove_nn_rf(nwm, rf_channel, rf_option)
|
|
|
|
#define cvg_nwm_sta_rf_list_age_check(nwm)
|
|
|
|
#define cvg_nwm_sta_rf_dis_node_list_rx(nwm, rx_info, data, len, dis_sta) \
|
|
(nwm->desc.sta.pst_info.sm.cur_state)
|
|
|
|
#define cvg_nwm_sta_single_hop_msdu_rx(nwm, buf, s_mac, stei, dtei, \
|
|
is_bcast, app_id)
|
|
|
|
#define cvg_nwm_sta_check_rf_proxy(nwm, tei, addr, phase, role, level, \
|
|
min_ul_dl_sr, min_sr_invalid, snr, noise_floor, rf_hop, rssi) (0)
|
|
|
|
#define cvg_nwm_sta_set_rf_scan_to_mac(nwm)
|
|
|
|
#define cvg_nwm_sta_set_prefer_rf_scan(nwm)
|
|
|
|
#define cvg_nwm_sta_set_channel_order(nwm, option, channel, order)
|
|
|
|
#define cvg_nwm_sta_check_rf_scan(nwm)
|
|
|
|
#define cvg_nwm_sta_rf_hb_check(nwm)
|
|
|
|
static inline uint32_t cvg_nwm_sta_set_rf_tx_power_cap(cvg_vdev_t *vdev,
|
|
uint8_t local, int8_t power)
|
|
{
|
|
(void)vdev;
|
|
(void)local;
|
|
(void)power;
|
|
return ERR_NOSUPP;
|
|
}
|
|
|
|
#define cvg_nwm_sta_get_rf_tx_power_cap(vdev) (RF_TX_PWR_INVALID)
|
|
|
|
#define cvg_nwm_sta_switch_to_rf_recommend_tbl(nwm, set_mac)
|
|
|
|
#define cvg_nwm_sta_switch_to_rf_global_tbl(nwm, set_mac)
|
|
|
|
#endif /* HPLC_RF_SUPPORT && PLC_SUPPORT_STA_ROLE */
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* CVG_NWM_STA_RF_H */
|