74 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			2.3 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 HTBUS_PROTO_H
 | 
						|
#define HTBUS_PROTO_H
 | 
						|
 | 
						|
/* os shim includes */
 | 
						|
#include "os_types.h"
 | 
						|
 | 
						|
/* public api includes */
 | 
						|
#include "plc_fr.h"
 | 
						|
#include "plc_utils.h"
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
/* TEI definitions */
 | 
						|
#define HTBUS_TEI_INVAL                 (0)
 | 
						|
#define HTBUS_TEI_CCO                   (1)
 | 
						|
#define HTBUS_TEI_FIRST                 (1)
 | 
						|
 | 
						|
/* #define number of nodes supported in the HTBUS network */
 | 
						|
#define HTBUS_NETWORK_SCALE             (2)
 | 
						|
 | 
						|
#define HTBUS_TEI_LAST                  (HTBUS_NETWORK_SCALE)
 | 
						|
 | 
						|
#define HTBUS_TEI_MAX_NUM               (HTBUS_TEI_LAST - HTBUS_TEI_FIRST + 1)
 | 
						|
#define HTBUS_TEI_BCAST                 (0xFF)
 | 
						|
#define HTBUS_TEI_IS_VALID(__tei) \
 | 
						|
    ((__tei) >= HTBUS_TEI_FIRST && (__tei) <= HTBUS_TEI_LAST)
 | 
						|
 | 
						|
#define HTBUS_TEI_BM_SIZE               iot_ceil(HTBUS_TEI_MAX_NUM, 8)
 | 
						|
 | 
						|
#pragma pack(push)  /* save the pack status */
 | 
						|
#pragma pack(1)     /* 1 byte align */
 | 
						|
 | 
						|
/* #define htbus service data unit function code */
 | 
						|
#define HTBUS_PROTO_FN_COMM_TEST        0xF
 | 
						|
 | 
						|
/* htbus service Data Unit header */
 | 
						|
typedef struct  {
 | 
						|
    /* destination tei, see HTBUS_TEI_XXX */
 | 
						|
    uint8_t  src_tei;
 | 
						|
    /* source tei, see HTBUS_TEI_XXX */
 | 
						|
    uint8_t  dst_tei;
 | 
						|
    /* seq number */
 | 
						|
    uint8_t  sn;
 | 
						|
    /* function code, see HTBUS_PROTO_FN_XXX */
 | 
						|
    uint16_t  fn         :4,
 | 
						|
    /* data len */
 | 
						|
              len        :12;
 | 
						|
    /* payload label */
 | 
						|
    uint8_t  data[0];
 | 
						|
} htbus_sdu_hdr_t;
 | 
						|
 | 
						|
#pragma pack(pop)   /* restore the pack status */
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
#endif /* HTBUS_PROTO_H */ |