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

165 lines
5.4 KiB
C
Executable File

/****************************************************************************
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_SG_INTERNAL_H
#define CVG_NWM_CCO_SG_INTERNAL_H
#include "cvg_nwm_internal.h"
#ifdef __cplusplus
extern "C" {
#endif
#if (SUPPORT_SMART_GRID) && (PLC_SUPPORT_CCO_ROLE)
/*
* @brief cvg_nwm_init_cco_vdev() - nwm cco vdev init function
* @param: nwm -- nwm vdev pointer
* @param: cfg -- pointer of vdev configuration
*
* @return 0 - for success case
* @return otherwise - error code
*/
uint32_t cvg_nwm_init_cco_vdev(cvg_nwm_vdev_t *nwm, cvg_vdev_cfg_t *cfg);
/*
* @brief cvg_nwm_deinit_cco_vdev() - deinit cco vdev
* @param: nwm -- nwm vdev pointer
*/
void cvg_nwm_deinit_cco_vdev(cvg_nwm_vdev_t *nwm);
/*
* @brief cvg_nwm_reset_cco_vdev() - nwm cco vdev reset function
* @param: nwm -- nwm vdev pointer
* @param: cfg -- pointer of vdev configuration
*/
void cvg_nwm_reset_cco_vdev(cvg_nwm_vdev_t *nwm, cvg_vdev_cfg_t *cfg);
/*
* @brief cvg_nwm_cco_update_bc_sg() - update the bc template to mac layer
as the private part of sg.
* @param: nwm -- nwm vdev pointer
* @param: ent -- pointer to update command entry
* @return ERR_OK - for success case
* @return otherwise - error code
*/
uint32_t cvg_nwm_cco_update_bc_sg(cvg_nwm_vdev_t *nwm, mac_bc_update_t *ent);
/*
* @brief cvg_nwm_is_pco_out_of_sync() - check if the routing to remote peer
* has pco out of sync issue.
* @param: nwm -- nwm vdev pointer
* @param: remote_tei -- remote peer tei
*
* @retval: 1 - if pco out of sync exist
* @retval: 0 - otherwise
*/
uint8_t cvg_nwm_is_pco_out_of_sync(cvg_nwm_vdev_t *nwm, tei_t remote_tei);
/*
* @brief cvg_nwm_cco_send_assoc_gather_ind_spg() - send assoc gather ind MME.
* @param: nwm -- nwm vdev pointer
* @param: is_rf -- flag to mark if send to rf link
*/
void cvg_nwm_cco_send_assoc_gather_ind_sg(cvg_nwm_vdev_t *nwm, uint8_t is_rf);
/*
* @brief cvg_nwm_cco_kickout_peer_sg() - kick out peer.
* @param nwm: pointer to nwm
* @param cnt count of kickout peer list
* @param peer kickout peer list
* @param reason kickout reason
*/
void cvg_nwm_cco_kickout_peer_sg(cvg_nwm_vdev_t *nwm, uint16_t cnt,
cvg_peer_info_t *peer[], uint16_t reason);
/*
* @brief cvg_nwm_cco_kickout_unknown_peer_sg() - kick out unknown peer.
* @param nwm: pointer to nwm
* @param addr kickout peer addr list
* @param reason kickout reason
*/
void cvg_nwm_cco_kickout_unknown_peer_sg(cvg_nwm_vdev_t *nwm, uint16_t cnt,
uint8_t addr[][IOT_MAC_ADDR_LEN], uint16_t reason);
/**
* @brief calculate max allowed none cco beacon slot count in one beacon
* period
* @param vdev: pointer to vdev
* @param bc_pld_min: flag to mark if CCO device using minimum beacon payload
* size
*
* @return:
* number of none cco beacon slot allowed
*/
uint32_t cvg_nwm_cco_get_non_cco_bc_slot_max_sg(cvg_vdev_t *vdev,
uint8_t bc_pld_min);
/*
* @brief cvg_nwm_cco_send_zc_ntb_req_sg() - send zc collect request to a peer
* @param nwm: pointer to nwm
* @param bcast: flag to mark if broacast send
* @param peer: pointer to peer
* @param cnt: zc collect count
* @param period: collecting period. see MME_ZC_CP_XXX
*/
void cvg_nwm_cco_send_zc_ntb_req_sg(cvg_nwm_vdev_t *nwm, uint8_t bcast,
cvg_peer_info_t *peer, uint8_t cnt, uint8_t period);
/*
* @brief cvg_nwm_cco_send_zc_ntb_req_v2_sg() - send zc collect request v2 to a
* peer
* @param nwm: pointer to nwm
* @param bcast: flag to mark if broacast send
* @param peer: pointer to peer
* @param cnt: zc collect count
* @param period: collecting period. see MME_ZC_CP_XXX
*/
void cvg_nwm_cco_send_zc_ntb_req_v2_sg(cvg_nwm_vdev_t *nwm, uint8_t bcast,
cvg_peer_info_t *peer, uint8_t cnt, uint8_t period);
#else /* SUPPORT_SMART_GRID && PLC_SUPPORT_CCO_ROLE */
#define cvg_nwm_init_cco_vdev(nwm, cfg) (ERR_NOSUPP)
#define cvg_nwm_deinit_cco_vdev(nwm)
#define cvg_nwm_reset_cco_vdev(nwm, cfg)
#define cvg_nwm_cco_update_bc_sg(nwm, ent) (ERR_NOSUPP)
#define cvg_nwm_cco_send_assoc_gather_ind_sg(nwm, is_rf)
#define cvg_nwm_is_pco_out_of_sync(nwm, remote_tei) (0)
#define cvg_nwm_cco_kickout_peer_sg(nwm, cnt, peer, reason)
#define cvg_nwm_cco_kickout_unknown_peer_sg(nwm, cnt, addr, reason)
#define cvg_nwm_cco_get_non_cco_bc_slot_max_sg(vdev, bc_pld_min) (0)
#define cvg_nwm_cco_send_zc_ntb_req_sg(nwm, bcast, peer, cnt, period)
#define cvg_nwm_cco_send_zc_ntb_req_v2_sg(nwm, bcast, peer, cnt, period)
#endif /* SUPPORT_SMART_GRID && PLC_SUPPORT_CCO_ROLE */
#ifdef __cplusplus
}
#endif
#endif /* CVG_NWM_CCO_SG_INTERNAL_H */