229 lines
7.6 KiB
C
229 lines
7.6 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_CCO_RF_H
|
|
#define CVG_NWM_CCO_RF_H
|
|
|
|
/* cvg module internal includes */
|
|
#include "cvg_nwm_cco_common.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#if (HPLC_RF_SUPPORT) && (PLC_SUPPORT_CCO_ROLE)
|
|
|
|
/*
|
|
* @brief cvg_nwm_cco_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_cco_add_nn_rf(cvg_nwm_vdev_t *nwm, uint8_t rf_channel,
|
|
uint8_t rf_option);
|
|
|
|
/*
|
|
* @brief cvg_nwm_cco_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_cco_remove_nn_rf(cvg_nwm_vdev_t *nwm, uint8_t rf_channel,
|
|
uint8_t rf_option);
|
|
|
|
/*
|
|
* @brief cvg_nwm_cco_clear_nn_rf() - clear all neighbor network rf list
|
|
* @param nwm: pointer of nwm
|
|
*/
|
|
void cvg_nwm_cco_clear_nn_rf(cvg_nwm_vdev_t *nwm);
|
|
|
|
/*
|
|
* @brief cvg_nwm_cco_rf_coordination() - coordinate remote conflicting
|
|
* rf channels.
|
|
* @param nwm: pointer of nwm
|
|
* @param cco_addr: if valid, pointer to the CCO addr of the conflicting
|
|
* network
|
|
* @param nid: if valid, pointer to the NID of the conflicting network
|
|
* @retval: 1 - local rf channel needs to be changed.
|
|
* @retval: 0 - local rf channel does not need to be changedd.
|
|
*/
|
|
uint32_t cvg_nwm_cco_rf_coordination(cvg_nwm_vdev_t *nwm,
|
|
uint8_t *cco_addr, uint32_t *nid);
|
|
|
|
/*
|
|
* @brief cvg_nwm_cco_stop_rf_coordination() - stop rf coordinate remote.
|
|
* @param nwm: pointer of nwm
|
|
*/
|
|
void cvg_nwm_cco_stop_rf_coordination(cvg_nwm_vdev_t *nwm);
|
|
|
|
/*
|
|
* @brief cvg_nwm_cco_rf_rpt_check - check rf list report from mac layer
|
|
* against local rf.
|
|
* @param nwm: pointer of nwm
|
|
* @param rpt: nid list report from mac layer
|
|
* @param is_mac_compare: whether CCO MAC address comparison is required, 1 -
|
|
* yes, 0 - ignored.
|
|
* @retval: 1 - rf conflict detected, local RF channel needs to be changed.
|
|
* @retval: 0 - other case.
|
|
*/
|
|
uint32_t cvg_nwm_cco_rf_rpt_check(cvg_nwm_vdev_t *nwm, mac_nid_list_rpt_t *rpt,
|
|
uint8_t is_mac_compare);
|
|
|
|
/*
|
|
* @brief cvg_nwm_cco_sel_rf_channel - select rf channel from free rf channel
|
|
* @param nwm: pointer of nwm
|
|
* @param rf_option: selected rf option
|
|
* @retval: selected rf channel
|
|
*/
|
|
uint8_t cvg_nwm_cco_sel_rf_channel(cvg_nwm_vdev_t *nwm, uint8_t *rf_option);
|
|
|
|
/*
|
|
* @brief cvg_nwm_cco_rf_check() - check if any neighbor rf info expired
|
|
* @param nwm: pointer of nwm
|
|
*/
|
|
void cvg_nwm_cco_rf_list_age_check(cvg_nwm_vdev_t *nwm);
|
|
|
|
/*
|
|
* @brief cvg_nwm_cco_compare_proxy_rf() - compare which rf proxy is better,
|
|
* both proxys should be rf link
|
|
* @param nwm: pointer to nwm
|
|
* @param pco1: pointer of rf pco 1, whose link type is rf link
|
|
* @param pco2: pointer of rf pco 2, whose link type is rf link
|
|
*
|
|
* @retval better pco
|
|
*/
|
|
pco_link_info_t *cvg_nwm_cco_compare_proxy_rf(cvg_nwm_vdev_t *nwm,
|
|
pco_link_info_t *pco1, pco_link_info_t *pco2);
|
|
|
|
/*
|
|
* @brief cvg_nwm_cco_compare_proxy_mix() - compare which proxy is better,
|
|
* the two proxys have different link type
|
|
* @param nwm: pointer to nwm
|
|
* @param hplc_pco: pointer of hplc pco, whose link type is hplc link
|
|
* @param rf_pco: pointer of rf pco, whose link type is rf link
|
|
*
|
|
* @retval better pco
|
|
*/
|
|
pco_link_info_t *cvg_nwm_cco_compare_proxy_mix(cvg_nwm_vdev_t *nwm,
|
|
pco_link_info_t *hplc_pco, pco_link_info_t *rf_pco);
|
|
|
|
/**
|
|
* @brief set rf tx power cap for whole network
|
|
* @param vdev: pointer to vdev
|
|
* @param power: rf tx power cap. unit is 1dbm
|
|
*
|
|
* @return:
|
|
* 0 -- for success case
|
|
* otherwise -- error code
|
|
*/
|
|
uint32_t cvg_nwm_cco_set_rf_tx_power_cap(cvg_vdev_t *vdev, int8_t power);
|
|
|
|
/**
|
|
* @brief get rf tx power cap for whole network
|
|
* @param vdev: pointer to vdev
|
|
*
|
|
* @return:
|
|
* rf tx power cap. unit is 1dmb.
|
|
*/
|
|
int8_t cvg_nwm_cco_get_rf_tx_power_cap(cvg_vdev_t *vdev);
|
|
|
|
#if HPLC_RF_DEV_SUPPORT
|
|
|
|
/*
|
|
* @brief cvg_nwm_cco_rf_hb_check() - rf link heart beat check.
|
|
* @param nwm: pointer to nwm
|
|
*/
|
|
void cvg_nwm_cco_rf_hb_check(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_cco_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
|
|
*/
|
|
void cvg_nwm_cco_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_cco_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_cco_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);
|
|
|
|
#else /* HPLC_RF_DEV_SUPPORT */
|
|
|
|
#define cvg_nwm_cco_rf_hb_check(nwm)
|
|
|
|
#define cvg_nwm_cco_rf_dis_node_list_rx(nwm, rx_info, data, len, dis_sta)
|
|
|
|
#define cvg_nwm_cco_single_hop_msdu_rx(nwm, buf, s_mac, stei, dtei, \
|
|
is_bcast, app_id)
|
|
|
|
#endif /* HPLC_RF_DEV_SUPPORT */
|
|
|
|
#else /* HPLC_RF_SUPPORT && PLC_SUPPORT_CCO_ROLE */
|
|
|
|
#define cvg_nwm_cco_add_nn_rf(nwm, rf_channel, rf_option)
|
|
|
|
#define cvg_nwm_cco_remove_nn_rf(nwm, rf_channel, rf_option)
|
|
|
|
#define cvg_nwm_cco_clear_nn_rf(nwm)
|
|
|
|
#define cvg_nwm_cco_rf_list_age_check(nwm)
|
|
|
|
#define cvg_nwm_cco_rf_rpt_check(nwm, rpt, is_mac_compare) (0)
|
|
|
|
#define cvg_nwm_cco_rf_dis_node_list_rx(nwm, rx_info, data, len, dis_sta)
|
|
|
|
#define cvg_nwm_cco_single_hop_msdu_rx(nwm, buf, s_mac, stei, dtei, \
|
|
is_bcast, app_id)
|
|
|
|
#define cvg_nwm_cco_sel_rf_channel(nwm, rf_option) (0)
|
|
|
|
#define cvg_nwm_cco_rf_hb_check(nwm)
|
|
|
|
#define cvg_nwm_cco_compare_proxy_rf(nwm, pco1, pco2) (pco1)
|
|
|
|
#define cvg_nwm_cco_compare_proxy_mix(nwm, hplc_pco, rf_pco) (hplc_pco)
|
|
|
|
#define cvg_nwm_cco_rf_coordination(nwm, cco_addr, nid) (0)
|
|
|
|
#define cvg_nwm_cco_stop_rf_coordination(nwm)
|
|
|
|
#define cvg_nwm_cco_set_rf_tx_power_cap(vdev, power) (ERR_NOSUPP)
|
|
|
|
#define cvg_nwm_cco_get_rf_tx_power_cap(vdev) (RF_TX_PWR_INVALID)
|
|
|
|
#endif /* HPLC_RF_SUPPORT && PLC_SUPPORT_CCO_ROLE */
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* CVG_NWM_CCO_RF_H */
|