Files
kunlun/plc/cvg/bwm/inc/cvg_bwm_rf.h
2024-09-28 14:24:04 +08:00

186 lines
5.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_BWM_RF_H
#define CVG_BWM_RF_H
/* os shim includes */
#include "os_timer_api.h"
/* common includes */
#include "iot_config.h"
#include "iot_plc_msg_api.h"
/* public api includes */
#include "mac_bcm_api.h"
/* cvg module internal includes */
#include "cvg.h"
#ifdef __cplusplus
extern "C" {
#endif
#if (HPLC_RF_SUPPORT)
/**
* @brief cvg_bwm_set_rf() - set rf channel
* @param vdev: pointer to vdev
* @param option: new rf option to be set, see RF_OPRION_XXX
* @param channel: new rf channel to be set, see RF_CHANNEL_ID_XXX.
* @param is_from_inner: flag to mark if rf channel change is initiated
* by internal module
* @retval: 0 -- success
* @retval: otherwise -- error code
*/
uint32_t cvg_bwm_set_rf(cvg_vdev_t *vdev, uint8_t option, uint8_t channel,
uint8_t is_from_inner);
/**
* @brief cvg_bwm_get_rf() - gets the currently used rf channel information.
* @param vdev: pointer to vdev
* @param option: returns the rf option value currently used, see RF_OPRION_XXX.
* @param channel: returns the rf channel value currently used, see
* RF_CHANNEL_ID_XXX.
*/
void cvg_bwm_get_rf(cvg_vdev_t *vdev, uint8_t *option,
uint8_t *channel);
/**
* @brief cvg_bwm_config_self_rf() - set rf channel to MAC layer
* @param vdev: pointer to vdev
* @param rf_option: new rf option to be set, if the rf option value is
* invalid, rf option does not update.
* @param rf_channel: new rf channel ID to be set. if the rf channel ID
* value is invalid, rf channel does not update.
* @param rf_lock: if set, rf cfg will be locked.
* @return:
* ERR_OK - success
* otherwise - see ERR_XXX
*/
uint32_t cvg_bwm_config_self_rf(cvg_vdev_t *vdev, uint8_t option,
uint8_t channel, uint8_t rf_lock);
/**
* @brief cvg_bwm_update_rf_chg() - update rf channel change entry
* assignment info
* @param vdev: pointer to vdev
* @param rf_chg: pointer to rf channel change entry assignment info
* to be updated. if rf_chg == NULL, indicates that no
* rf channel change entries in the beacon frame
* @param rf_channel: rf channel beacon carried for standard beacon
* @param rf_option: rf option beacon carried for standard beacon
* @param default_cfg: flag to mark if rf channel is from default config.
*/
void cvg_bwm_update_rf_chg(cvg_vdev_t *vdev, mac_bc_rf_channel_chg_t *rf_chg,
uint8_t rf_channel, uint8_t rf_option, uint8_t default_cfg);
/**
* @brief cvg_bwm_clear_rf_chg_cnt() - clear rf change count
* @param vdev: pointer to vdev
*/
void cvg_bwm_clear_rf_chg_cnt(cvg_vdev_t *vdev);
/**
* @brief cvg_bwm_rf_chg_timer_func() - timer function for rf channel change
* fuction.
* @param vdev: id of the timer
* @param vdev: argument pass back to the callback function
*/
void cvg_bwm_rf_chg_timer_func(timer_id_t timer_id, void *arg);
/**
* @brief cvg_bwm_rc_chg_timeout_handle() - rf channel change timeout
* fuction.
* @param vdev: pointer to vdev
*/
void cvg_bwm_rf_chg_timeout_handle(cvg_vdev_t *vdev);
#if (PLC_SUPPORT_CCO_ROLE)
/**
* @brief cvg_bwm_cco_assign_rf_chg() - cco assign rf channel change entry info.
* @param vdev: pointer to vdev
*/
void cvg_bwm_cco_assign_rf_chg(cvg_vdev_t *vdev);
#endif /* PLC_SUPPORT_CCO_ROLE */
#else /* HPLC_RF_SUPPORT */
#define cvg_bwm_rf_chg_timeout_handle(vdev)
#define cvg_bwm_cco_assign_rf_chg(vdev)
#define cvg_bwm_clear_rf_chg_cnt(vdev)
static inline uint32_t cvg_bwm_set_rf(cvg_vdev_t *vdev, uint8_t option,
uint8_t channel, uint8_t is_from_inner)
{
(void)vdev;
(void)option;
(void)channel;
(void)is_from_inner;
return ERR_NOSUPP;
}
static inline void cvg_bwm_update_rf_chg(cvg_vdev_t *vdev,
mac_bc_rf_channel_chg_t *rf_chg, uint8_t rf_channel, uint8_t rf_option,
uint8_t default_cfg)
{
(void)vdev;
(void)rf_chg;
(void)rf_channel;
(void)rf_option;
(void)default_cfg;
return;
}
static inline void cvg_bwm_rf_chg_timer_func(timer_id_t timer_id, void *arg)
{
(void)timer_id;
(void)arg;
return;
}
static inline uint32_t cvg_bwm_config_self_rf(cvg_vdev_t *vdev,
uint8_t rf_option, uint8_t rf_channel, uint8_t rf_lock)
{
(void)vdev;
(void)rf_option;
(void)rf_channel;
(void)rf_lock;
return ERR_NOSUPP;
}
static inline void cvg_bwm_get_rf(cvg_vdev_t *vdev, uint8_t *option,
uint8_t *channel)
{
(void)vdev;
(void)option;
(void)channel;
return;
}
#define cvg_bwm_sta_set_rf_scan_tbl(rf_scan_tbl, rf_cnt) ERR_NOSUPP
#endif /* HPLC_RF_SUPPORT */
#ifdef __cplusplus
}
#endif
#endif /* CVG_BWM_RF_H */