64 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			64 lines
		
	
	
		
			1.7 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 MAC_AVLN_H
							 | 
						||
| 
								 | 
							
								#define MAC_AVLN_H
							 | 
						||
| 
								 | 
							
								#include "plc_utils.h"
							 | 
						||
| 
								 | 
							
								#include "plc_const.h"
							 | 
						||
| 
								 | 
							
								#include "mac_key.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef enum _vlan_id {
							 | 
						||
| 
								 | 
							
								    AES_VLAN0,
							 | 
						||
| 
								 | 
							
								    AES_VLAN1,
							 | 
						||
| 
								 | 
							
								    AES_VLAN2,
							 | 
						||
| 
								 | 
							
								    AES_VLAN3,
							 | 
						||
| 
								 | 
							
								    AES_VLAN4,
							 | 
						||
| 
								 | 
							
								    AES_VLAN5,
							 | 
						||
| 
								 | 
							
								    AES_VLAN6,
							 | 
						||
| 
								 | 
							
								    AES_VLAN7
							 | 
						||
| 
								 | 
							
								} vlan_id_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _mac_avln {
							 | 
						||
| 
								 | 
							
								    /* key table ptr */
							 | 
						||
| 
								 | 
							
								    mac_key_table_t *key_tbl;
							 | 
						||
| 
								 | 
							
								    /* the idx of avln locally, the same to HW avln idx */
							 | 
						||
| 
								 | 
							
								    uint8_t avln_idx : 3,
							 | 
						||
| 
								 | 
							
								        key_tbl_num : 5; /* how many key tbl allocated */
							 | 
						||
| 
								 | 
							
								} mac_avln_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _mac_avln_ctxt {
							 | 
						||
| 
								 | 
							
								    mac_avln_t *mac_avln_array;
							 | 
						||
| 
								 | 
							
								    uint32_t avln_num_allocated;
							 | 
						||
| 
								 | 
							
								} mac_avln_ctxt_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								extern mac_avln_ctxt_t g_mac_avln_ctxt;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								uint32_t mac_avln_ctxt_init(uint8_t avln_num);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* avln init function
							 | 
						||
| 
								 | 
							
								 * return 0 if successul, else failed.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t mac_avln_init(uint8_t avln_idx, uint8_t key_tbl_num);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif // !MAC_AVLN_H
							 |