249 lines
8.0 KiB
C
249 lines
8.0 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_PROXY_CHANGE_H
|
|
#define PLC_MME_PROXY_CHANGE_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
|
|
|
|
/* proxy change reason for SG spec */
|
|
#define PROXY_CHANGE_UNKNOWN 0x00
|
|
#define PROXY_CHANGE_PERIODIC 0x01
|
|
|
|
/* proxy change reason for SPG spec */
|
|
#define SPG_PROXY_CHANGE_PERIODIC 0x01
|
|
#define SPG_PROXY_CHANGE_FAST 0x02
|
|
|
|
/* proxy change result */
|
|
#define PROXY_CHANGE_RET_OK 0x00
|
|
|
|
#if SUPPORT_SMART_GRID
|
|
|
|
/* proxy change request mme */
|
|
typedef struct _mme_proxy_change_req {
|
|
/* sta requesting to change its proxy */
|
|
uint16_t sta_tei : 12,
|
|
/* reserved for future */
|
|
rsvd : 4;
|
|
/* candidate proxy array */
|
|
pco_link_info_t new_proxy[CANDIDATE_PROXY_COUNT];
|
|
/* current proxy */
|
|
uint16_t old_proxy : 12,
|
|
/* reserved for future */
|
|
rsvd1 : 4;
|
|
/* current proxy type. must be 0 */
|
|
uint8_t proxy_type;
|
|
/* change reason, see PROXY_CHANGE_XXX */
|
|
uint8_t reason;
|
|
/* peer to peer sequence number */
|
|
uint32_t p2p_sn;
|
|
/* estimated power line phase */
|
|
uint8_t phase_1 : 2;
|
|
uint8_t phase_2 : 2;
|
|
uint8_t phase_3 : 2;
|
|
uint8_t reserved_1 : 2;
|
|
uint8_t reserved_2[3];
|
|
} mme_proxy_change_req_t;
|
|
|
|
/* proxy change confirm mme */
|
|
typedef struct _mme_proxy_change_cnf {
|
|
/* result of the proxy change request, see PROXY_CHANGE_RET_XXX */
|
|
uint8_t result;
|
|
/* fragmented packets count */
|
|
uint8_t packet_cnt;
|
|
/* fragmented packet sequence number */
|
|
uint8_t packet_sn;
|
|
uint8_t reserved_1;
|
|
/* target sta of the confirmation */
|
|
uint16_t sta : 12,
|
|
/* link type between target station and proxy, see PLC_LINK_TYPE_XXX */
|
|
link : 1,
|
|
rsvd : 3;
|
|
/* new proxy of the sta */
|
|
uint16_t proxy : 12,
|
|
/* reserved for future */
|
|
rsvd1 : 4;
|
|
/* peer to peer sequence number. must be same as the one in request mme */
|
|
uint32_t p2p_sn;
|
|
/* path sequence number */
|
|
uint32_t path_sn;
|
|
/* sub sta count of the target sta */
|
|
uint16_t sub_sta_cnt;
|
|
uint16_t reserved_2;
|
|
/* contain all sub STA of proxy change requester */
|
|
tei_t sub_sta[0];
|
|
} mme_proxy_change_cnf_t;
|
|
|
|
/* proxy change confirm mme */
|
|
typedef struct _mme_proxy_change_bitmap_cnf {
|
|
/* result of the proxy change request, see PROXY_CHANGE_RET_XXX */
|
|
uint8_t result;
|
|
uint8_t reserved_1;
|
|
#if (SUPPORT_IEEE_1901)
|
|
/* target sta of the confirmation */
|
|
uint16_t sta : 12,
|
|
/* link type between target station and proxy, see PLC_LINK_TYPE_XXX */
|
|
link : 1,
|
|
rsvd : 3;
|
|
/* new proxy of the sta */
|
|
uint16_t proxy : 12,
|
|
/* reserved for future */
|
|
rsvd1 : 4;
|
|
uint16_t reserved_2;
|
|
/* peer to peer sequence number. must be same as the one in request mme */
|
|
uint32_t p2p_sn;
|
|
/* path sequence number */
|
|
uint32_t path_sn;
|
|
uint16_t reserved_3;
|
|
/* bitmap size. unit is 1 byte */
|
|
uint16_t bitmap_size;
|
|
#else /* SUPPORT_IEEE_1901 */
|
|
/* bitmap size. unit is 1 byte */
|
|
uint16_t bitmap_size;
|
|
/* target sta of the confirmation */
|
|
uint16_t sta : 12,
|
|
/* link type between target station and proxy, see PLC_LINK_TYPE_XXX */
|
|
link : 1,
|
|
rsvd : 3;
|
|
/* new proxy of the sta */
|
|
uint16_t proxy : 12,
|
|
/* reserved for future */
|
|
rsvd1 : 4;
|
|
/* peer to peer sequence number. must be same as the one in request mme */
|
|
uint32_t p2p_sn;
|
|
/* path sequence number */
|
|
uint32_t path_sn;
|
|
uint32_t reserved_2;
|
|
#endif /* SUPPORT_IEEE_1901 */
|
|
/* bitmap of the sub sta */
|
|
uint8_t bitmap[0];
|
|
} mme_proxy_change_bitmap_cnf_t;
|
|
|
|
#endif
|
|
|
|
#if SUPPORT_SOUTHERN_POWER_GRID
|
|
|
|
#define SUB_STA_BITMAP_CNT 130
|
|
|
|
/* proxy change request mme */
|
|
typedef struct _spg_mme_proxy_change_req {
|
|
/* sta requesting to change its proxy */
|
|
tei_t sta_tei;
|
|
/* candidate proxy array */
|
|
tei_t new_proxy[CANDIDATE_PROXY_COUNT];
|
|
/* current proxy */
|
|
tei_t old_proxy;
|
|
/* current proxy type. must be 2 */
|
|
uint8_t proxy_type;
|
|
/* change reason, see SPG_PROXY_CHANGE_XXX */
|
|
uint8_t reason;
|
|
/* estimated power line phase */
|
|
uint8_t phase_1;
|
|
uint8_t phase_2;
|
|
uint8_t phase_3;
|
|
/* candidate proxy 0 link type */
|
|
uint8_t cand_pco_link0 : 1,
|
|
/* candidate proxy 1 link type */
|
|
cand_pco_link1 : 1,
|
|
/* candidate proxy 2 link type */
|
|
cand_pco_link2 : 1,
|
|
/* candidate proxy 3 link type */
|
|
cand_pco_link3 : 1,
|
|
/* candidate proxy 4 link type */
|
|
cand_pco_link4 : 1,
|
|
/* reserved for future */
|
|
reserved_1 : 3;
|
|
/* peer to peer sequence number */
|
|
uint32_t p2p_sn;
|
|
/* network sequence number */
|
|
uint8_t network_sn;
|
|
uint8_t reserved_2[15];
|
|
} spg_mme_proxy_change_req_t;
|
|
|
|
/* proxy change confirm mme */
|
|
typedef struct _spg_mme_proxy_change_cnf {
|
|
/* result of the proxy change request, see PROXY_CHANGE_RET_XXX */
|
|
uint32_t result;
|
|
/* fragmented packets count */
|
|
uint8_t packet_cnt;
|
|
/* fragmented packet sequence number */
|
|
uint8_t packet_sn;
|
|
/* target sta of the confirmation */
|
|
tei_t sta;
|
|
/* new proxy of the sta */
|
|
tei_t proxy;
|
|
/* sub sta count of the target sta */
|
|
uint16_t sub_sta_cnt;
|
|
uint8_t rsvd1;
|
|
/* network sequence number */
|
|
uint8_t network_sn;
|
|
/* link type between target station and proxy, see PLC_LINK_TYPE_XXX */
|
|
uint8_t link : 1,
|
|
/* reserved for future */
|
|
rsvd2 : 7;
|
|
uint8_t rsvd3;
|
|
/* peer to peer sequence number */
|
|
uint32_t p2p_sn;
|
|
/* path sequence number */
|
|
uint32_t path_sn;
|
|
uint8_t rsvd4[8];
|
|
/* contain all sub STA of proxy change requester */
|
|
tei_t sub_sta[0];
|
|
} spg_mme_proxy_change_cnf_t;
|
|
|
|
/* proxy change confirm mme */
|
|
typedef struct _spg_mme_proxy_change_bitmap_cnf {
|
|
/* result of the proxy change request, see PROXY_CHANGE_RET_XXX */
|
|
uint32_t result;
|
|
/* target sta of the confirmation */
|
|
tei_t sta;
|
|
/* new proxy of the sta */
|
|
tei_t proxy;
|
|
/* network sequence number */
|
|
uint8_t network_sn;
|
|
/* bitmap of the sub sta */
|
|
uint8_t sub_sta_bitmap[SUB_STA_BITMAP_CNT];
|
|
/* link type between target station and proxy, see PLC_LINK_TYPE_XXX */
|
|
uint8_t link : 1,
|
|
/* reserved for future */
|
|
rsvd1 : 7;
|
|
/* peer to peer sequence number */
|
|
uint32_t p2p_sn;
|
|
/* path sequence number */
|
|
uint32_t path_sn;
|
|
} spg_mme_proxy_change_bitmap_cnf_t;
|
|
|
|
#endif /* SUPPORT_SOUTHERN_POWER_GRID */
|
|
|
|
#pragma pack(pop) // restore the pack status
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* PLC_MME_PROXY_CHANGE_H */
|