Files
kunlun/plc/inc/mme/plc_mme_nw_conflict.h
2024-09-28 14:24:04 +08:00

104 lines
3.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 PLC_MME_NW_CONFLICT_H
#define PLC_MME_NW_CONFLICT_H
/* os shim includes */
#include "os_types.h"
#include "plc_mme.h"
#include "plc_utils.h"
#ifdef __cplusplus
extern "C" {
#endif
/* pack for the structures in the whole file */
#pragma pack(push) // save the pack status
#pragma pack(1) // 1 byte align
// width of network id in byte. Should by 3 in SG.
#define NW_ID_WIDTH 0x03
typedef struct _nb_nw_info {
uint8_t nb_nw[NW_ID_WIDTH];
} nb_nw_info_t;
typedef struct _mme_nw_conflict {
uint8_t cco_mac_addr[IOT_MAC_ADDR_LEN];// CCo of conflicting network
uint8_t nb_nw_cnt; // available neighbour network count
uint8_t nw_id_width; // width of network id in byte
nb_nw_info_t nb_nw_info[0]; // available neighbour network info
} mme_nw_conflict_t;
typedef struct _nb_rf_option {
/* neighbour rf option */
uint8_t option :2,
/* reserved for future */
rsvd :6;
} nb_rf_option_t;
typedef struct _mme_rf_conflict {
/* cco of conflicting network */
uint8_t cco_mac_addr[IOT_MAC_ADDR_LEN];
/* count of neighbour rf channel and option combination */
uint8_t nb_rf_cnt;
/* neighbour rf channel, it corresponds to the following rf option */
uint8_t nb_rf_channel[0];
/* following one field is not defined in this data structure,
* due to nb_rf_channel has variable length.
* nb_rf_option_t rf_option[nb_rf_cnt];
*/
} mme_rf_conflict_t;
typedef struct _spg_mme_nw_conflict {
/* cco mac address of conflicting network */
uint8_t cco_mac_addr[IOT_MAC_ADDR_LEN];
/* available neighbour network count */
uint8_t nb_nw_cnt;
/* available neighbour network bitmap, bit 0 means nid 1 network, and bit 15
* is reserved bit
*/
uint16_t nb_nw_bm;
} spg_mme_nw_conflict_t;
typedef struct _nb_rf_op_chn {
/* neighbour rf channel */
uint8_t channel;
/* neighbour rf option */
uint8_t option :2,
/* reserved for future */
rsvd :6;
} nb_rf_op_chn_t;
typedef struct _spg_mme_rf_conflict {
/* cco of conflicting network */
uint8_t cco_mac_addr[IOT_MAC_ADDR_LEN];
/* count of neighbour rf channel and option combination */
uint8_t nb_rf_cnt;
/* neighbour rf channel and option combination */
nb_rf_op_chn_t nb_rf[0];
} spg_mme_rf_conflict_t;
#pragma pack(pop) // restore the pack status
#ifdef __cplusplus
}
#endif
#endif // PLC_MME_NW_CONFLICT_H