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

182 lines
7.9 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 PLC_MME_H
#define PLC_MME_H
/* os shim includes */
#include "os_types.h"
/* plc includes */
#include "plc_fr.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
#define CANDIDATE_PROXY_COUNT 5
/* proxy structure */
typedef struct _pco_link_info_t {
/* tei of proxy */
uint16_t tei :12,
/* link type between station and proxy, see PLC_LINK_TYPE_XXX */
link :1,
/* reserved for future */
rsvd :3;
} pco_link_info_t;
#if SUPPORT_SMART_GRID
/* mme type definition */
#define MME_ASSOC_REQ 0x0000 // associate request
#define MME_ASSOC_CNF 0x0001 // associate response
#define MME_ASSOC_GATHER_IND 0x0002 // associate gather indication
#define MME_CHANGE_PROXY_REQ 0x0003 // change proxy request
#define MME_CHANGE_PROXY_CNF 0x0004 // change proxy confirm
#define MME_CHANGE_PROXY_BITMAP_CNF 0x0005 // change proxy bitmap confirm
#define MME_LEAVE_IND 0x0006 // leave indication
#define MME_HEART_BEAT_CHECK 0x0007 // heart beat check
#define MME_DISCOVER_NODE_LIST 0x0008 // discover node list
#define MME_SUCCESS_RATE_REPORT 0x0009 // success rate report
#define MME_NETWORK_CONFLICT_REPORT 0x000A // network conflict report
#define MME_ZERO_CROSS_NTB_COLLECT_IND 0x000B // zero cross NTB collect ind
#define MME_ZERO_CROSS_NTB_IND 0x000C // zero cross NTB indication
/* local bridge destination address table request */
#define MME_LBDAT_REQ 0x000D
/* local bridge destination address table confirm */
#define MME_LBDAT_CNF 0x000E
/* high-precision zero cross NTB area notify report */
#define MME_AREA_NOTIFY_NTB_REPORT 0x000F
#define MME_SET_KEY_REQ 0x000F // set key request
#define MME_SET_KEY_CNF 0x0010 // set key confirm
#define MME_GET_KEY_REQ 0x0011 // get key request
#define MME_GET_KEY_CNF 0x0012 // get key confirm
#define MME_AUTH_REQ 0x0013 // authorize request
#define MME_AUTH_CNF 0x0014 // authorize confirm
#define MME_ENCRYPTED_PAYLOAD_IND 0x0015 // encrypted payload indication
#define MME_SET_AMP_MAP_REQ 0x0016 // set amplitude map request
#define MME_SET_AMP_MAP_CNF 0x0017 // set amplitude map response
#define MME_DIAGNOSE 0x004F // network diagnose, vendor spec
#define MME_ROUTE_REQ 0x0050 // route request
#define MME_ROUTE_REPLY 0x0051 // route reply
#define MME_ROUTE_ERROR 0x0052 // route error
#define MME_ROUTE_ACK 0x0053 // route ack
#define MME_LINK_CFM_REQ 0x0054 // link confirm request
#define MME_LINK_CFM_RSP 0x0055 // link confirm response
#define MME_CEK_REQ 0x0060 // cek request
#define MME_CEK_CNF 0x0061 // cek response
#define MME_CEK_UPDATE 0x0062 // cek update
#define MME_RF_CONFLICT_REPORT 0x0080 // rf channel conflict report
/* define priority of each MME frames */
#define MME_ASSOC_REQ_PRIO 3
#define MME_ASSOC_CNF_PRIO 3
#define MME_ASSOC_GATHER_IND_PRIO 3
#define MME_CHANGE_PROXY_REQ_PRIO 3
#define MME_CHANGE_PROXY_CNF_PRIO 3
#define MME_CHANGE_PROXY_BITMAP_CNF_PRIO 3
#define MME_LEAVE_IND_PRIO 3
#define MME_CEK_REQ_PRIO 3
#define MME_CEK_CNF_PRIO 3
#define MME_CEK_UPDATE_PRIO 0
#define MME_HEART_BEAT_CHECK_PRIO 0
#define MME_DISCOVER_NODE_LIST_PRIO 0
#define MME_SUCCESS_RATE_REPORT_PRIO 0
#define MME_NETWORK_CONFLICT_REPORT_PRIO 0
#define MME_ZERO_CROSS_NTB_COLLECT_IND_PRIO 0
#define MME_ZERO_CROSS_NTB_IND_PRIO 0
#define MME_ZERO_CROSS_AREA_NOTIFY_PRIO 0
#define MME_DIAGNOSE_PRIO 0
#define MME_ROUTE_REQ_PRIO 0
#define MME_ROUTE_REPLY_PRIO 0
#define MME_ROUTE_ERROR_PRIO 0
#define MME_ROUTE_ACK_PRIO 0
#define MME_LINK_CFM_REQ_PRIO 0
#define MME_LINK_CFM_RSP_PRIO 0
typedef struct _mme_header {
uint16_t mme_type;
uint16_t reserved;
} mme_header_t;
#endif
#if SUPPORT_SOUTHERN_POWER_GRID
/* mme type definition */
#define SPG_MME_ASSOC_REQ 0x30 // associate request
#define SPG_MME_ASSOC_CNF 0x31 // associate response
#define SPG_MME_ASSOC_IND 0x34 // associate indication
#define SPG_MME_ASSOC_GATHER_IND 0x3A // associate gather indication
#define SPG_MME_CHANGE_PROXY_REQ 0x32 // change proxy request
#define SPG_MME_CHANGE_PROXY_CNF 0x37 // change proxy confirm
#define SPG_MME_CHANGE_PROXY_BITMAP_CNF 0x3B // change proxy bitmap confirm
#define SPG_MME_LEAVE_IND 0x49 // leave indication
#define SPG_MME_HEART_BEAT_CHECK 0x51 // heart beat check
#define SPG_MME_DISCOVER_NODE_LIST 0x55 // discover node list
#define SPG_MME_DELAY_LEAVE_IND 0x5D // delay leave indication
#define SPG_MME_SUCCESS_RATE_REPORT 0x5E // success rate report
#define SPG_MME_NETWORK_CONFLICT_REPORT 0x5F // network conflict report
#define SPG_MME_ZERO_CROSS_NTB_COLLECT_IND 0x62 // zero cross NTB collect ind
#define SPG_MME_ZERO_CROSS_NTB_RPT 0x63 // zero cross NTB indication
#define SPG_MME_DIAGNOSE 0x64 // network diagnose
#define SPG_MME_RF_CONFLICT_REPORT 0x70 // rf channel conflict report
#define SPG_MME_DIAGNOSE_V2 0xE0 // network diagnose version 2
/* define priority of each MME frames */
#define SPG_MME_ASSOC_REQ_PRIO 3
#define SPG_MME_ASSOC_CNF_PRIO 3
#define SPG_MME_ASSOC_IND_PRIO 3
#define SPG_MME_ASSOC_GATHER_IND_PRIO 3
#define SPG_MME_CHANGE_PROXY_REQ_PRIO 3
#define SPG_MME_CHANGE_PROXY_CNF_PRIO 3
#define SPG_MME_CHANGE_PROXY_BITMAP_CNF_PRIO 3
#define SPG_MME_LEAVE_IND_PRIO 3
#define SPG_MME_HEART_BEAT_CHECK_PRIO 0
#define SPG_MME_DISCOVER_NODE_LIST_PRIO 0
#define SPG_MME_SUCCESS_RATE_REPORT_PRIO 0
#define SPG_MME_ZERO_CROSS_NTB_COLLECT_IND_PRIO 0
#define SPG_MME_ZERO_CROSS_NTB_IND_PRIO 0
#define SPG_MME_SUCCESS_RATE_REPORT_PRIO 0
#define SPG_MME_NETWORK_CONFLICT_REPORT_PRIO 0
#define SPG_MME_DIAGNOSE_PRIO 0
typedef struct _spg_mme_header {
uint8_t mme_version;
uint16_t mme_type;
uint8_t reserved[3];
} spg_mme_header_t;
#endif
#pragma pack(pop) // restore the pack status
#ifdef __cplusplus
}
#endif
#endif /* PLC_MME_H */