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

91 lines
3.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_BEACON_HTBUS_H
#define PLC_BEACON_HTBUS_H
/* os shim includes */
#include "os_types_api.h"
#ifdef __cplusplus
extern "C" {
#endif
/* define htbus beacon entry type */
typedef enum _beacon_htbus_entry_type_id {
MAC_BCN_HTBUS_ENTRY_TYPE_ID_TS = 0x00,
MAC_BCN_HTBUS_ENTRY_TYPE_ID_UD = 0x01,
} beacon_htbus_entry_type_id_t;
/* pack for the structures in the whole file */
#pragma pack(push) /* save the pack status */
#pragma pack(1) /* 1 byte align */
/* define htbus beacon type */
#define PLC_HTBUS_BC_TYPE_CCO 0
#define PLC_HTBUS_BC_TYPE_STA 1
/* htbus beacon payload header */
typedef struct _beacon_htbus_payload_fixed_header {
/* htbus becacon type, see PLC_HTBUS_BC_TYPE_XXX */
uint8_t type : 3,
/* number of entries */
beacon_entry_num : 5;
/* reboot counter */
uint8_t reboot_cnt;
/* reques period counter */
uint16_t period_cnt;
} beacon_htbus_payload_fixed_header_t;
/* htbus beacon entry header */
typedef struct _beacon_htbus_entry_hdr {
/* entry type, see beacon_htbus_entry_type_id_t */
uint16_t entry_type : 4,
/* entry len */
entry_len : 12;
} beacon_htbus_entry_hdr_t;
/* htbus time slot entry */
typedef struct _beacon_htbus_entry_ts {
/* htbus beacon entry header */
beacon_htbus_entry_hdr_t hdr;
/* cco slot duration, uint is 1ms */
uint8_t cco_slot_dur;
/* sta slot duration, uint is 1ms */
uint8_t sta_slot_dur;
/* reques period start NTB */
uint32_t start_ntb;
/* node tei bitmap len */
uint8_t bm_len : 4,
/* reserved for further use */
rsvd : 4;
/* node tei bitmap with response slot assigned. */
uint8_t rsp_bm[0];
} beacon_htbus_entry_ts_t;
/* htbus user data entry */
typedef struct _beacon_htbus_entry_ud {
/* htbus beacon entry header */
beacon_htbus_entry_hdr_t hdr;
/* user data payload */
uint8_t data[0];
} beacon_htbus_entry_ud_t;
#pragma pack(pop) /* restore the pack status */
#ifdef __cplusplus
}
#endif
#endif /* PLC_BEACON_HTBUS_H */