165 lines
		
	
	
		
			6.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			165 lines
		
	
	
		
			6.1 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_MAC_CFG_H
							 | 
						||
| 
								 | 
							
								#define PLC_MAC_CFG_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define MAX_PDEV_NUM                1
							 | 
						||
| 
								 | 
							
								#if PLC_SUPPORT_DBG_PKT_MODE
							 | 
						||
| 
								 | 
							
								#define MAX_VDEV_NUM                2
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								#define MAX_VDEV_NUM                1
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* max wireless pdev num */
							 | 
						||
| 
								 | 
							
								#define MAX_RF_PDEV_NUM             1
							 | 
						||
| 
								 | 
							
								/* max wireless vdev num */
							 | 
						||
| 
								 | 
							
								#define MAX_RF_VDEV_NUM             1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define PLC_SG_MAX_MSDU_SIZE        2076 //2048
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * TODO: resv value, to be refined later
							 | 
						||
| 
								 | 
							
								 *   sizeof(rx_mpdu_start) + \
							 | 
						||
| 
								 | 
							
								 *   sizeof(rx_mpdu_end) + \
							 | 
						||
| 
								 | 
							
								 *   sizeof(rx_pb_start) + \
							 | 
						||
| 
								 | 
							
								 *   sizeof(rx_pb_end)
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								#define PLC_HW_RX_DESC_SIZE         (16 << 2) /* this should include FC length */
							 | 
						||
| 
								 | 
							
								#define PLC_RX_BUF_RESV_SIZE        (PLC_HW_RX_DESC_SIZE)
							 | 
						||
| 
								 | 
							
								#define PLC_RX_BUF_DATA_LEN         (PLC_FC_LEN + PLC_SG_MAX_MSDU_SIZE)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define PLC_HW_RX_BUF_SIZE          (PLC_RX_BUF_RESV_SIZE + PLC_SG_MAX_MSDU_SIZE)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define MAC_BCAST_DEF_RETRY_CNT                 (1)
							 | 
						||
| 
								 | 
							
								#define MAC_BCAST_MAX_RETRY_CNT                 (5)
							 | 
						||
| 
								 | 
							
								/* default retry cnt for mac layer */
							 | 
						||
| 
								 | 
							
								#define MAC_DEF_RETRY_CNT                       (5)
							 | 
						||
| 
								 | 
							
								#define MAC_UCAST_MAX_RETRY_CNT                 (5)
							 | 
						||
| 
								 | 
							
								/* default retry cnt for cco bcn, 0 means not retry, try once */
							 | 
						||
| 
								 | 
							
								#define PLC_BCN_DEF_CCO_RETRY_CNT               (1)
							 | 
						||
| 
								 | 
							
								/* default retry cnt for sta bcn, 0 means not retry, try once */
							 | 
						||
| 
								 | 
							
								#define PLC_BCN_DEF_STA_RETRY_CNT               (1)
							 | 
						||
| 
								 | 
							
								/* default retry cnt for iot sunsonal cco bcn, 0 means not retry, try once */
							 | 
						||
| 
								 | 
							
								#define PLC_BCN_DEF_CCO_RETRY_CNT_IOT_SUNSONAL  (2)
							 | 
						||
| 
								 | 
							
								/* default retry cnt for iot sunsonal sta sta bcn, 0 means not retry, try once */
							 | 
						||
| 
								 | 
							
								#define PLC_BCN_DEF_STA_RETRY_CNT_IOT_SUNSONAL  (2)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* default retry cnt for detect pkt */
							 | 
						||
| 
								 | 
							
								#define PLC_BCN_DEF_DETECT_RETRY_CNT            (1)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* rf retry cnt */
							 | 
						||
| 
								 | 
							
								#define MAC_RF_BCAST_DEF_RETRY_CNT   (1)
							 | 
						||
| 
								 | 
							
								#define MAC_RF_BCAST_MAX_RETRY_CNT   (3)
							 | 
						||
| 
								 | 
							
								#define MAC_RF_DEF_RETRY_CNT         (3)
							 | 
						||
| 
								 | 
							
								#define MAC_RF_UCAST_MAX_RETRY_CNT   (3)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* RIFS config */
							 | 
						||
| 
								 | 
							
								#define MAC_MIN_SOF_SACK_RIFS_TMR           400
							 | 
						||
| 
								 | 
							
								#define MAC_MAX_SOF_SACK_RIFS_TMR           2300
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define MAC_FORCE_RIFS_US                   400
							 | 
						||
| 
								 | 
							
								/*final tx_rifs = MAC_FORCE_RIFS_US + MAC_TX_ADDTION_RIFS_US */
							 | 
						||
| 
								 | 
							
								#define MAC_TX_ADDTION_RIFS_US              100
							 | 
						||
| 
								 | 
							
								/*final rx_rifs = MAC_FORCE_RIFS_US + MAC_RX_ADDTION_RIFS_US */
							 | 
						||
| 
								 | 
							
								#define MAC_RX_ADDTION_RIFS_US              1900
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* Note: for cert mode, final rifs >= 900 */
							 | 
						||
| 
								 | 
							
								/*final cert_tx_rifs = MAC_FORCE_RIFS_US + MAC_CERT_TX_ADDTION_RIFS_US */
							 | 
						||
| 
								 | 
							
								#define MAC_CERT_TX_ADDTION_RIFS_US         500
							 | 
						||
| 
								 | 
							
								/*final cert_rx_rifs = MAC_FORCE_RIFS_US + MAC_CERT_RX_ADDTION_RIFS_US */
							 | 
						||
| 
								 | 
							
								#define MAC_CERT_RX_ADDTION_RIFS_US         1900
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* for special rifs addtion. */
							 | 
						||
| 
								 | 
							
								#define MAC_SPECIAL_RIFS_US                 1000
							 | 
						||
| 
								 | 
							
								/* final rifs = MAC_SPECIAL_RIFS_US + MAC_SPECIAL_TX_ADDTION_RIFS_US */
							 | 
						||
| 
								 | 
							
								#define MAC_SPECIAL_TX_ADDTION_RIFS_US      0
							 | 
						||
| 
								 | 
							
								/* final rifs = MAC_SPECIAL_RIFS_US + MAC_SPECIAL_RX_ADDTION_RIFS_US */
							 | 
						||
| 
								 | 
							
								#define MAC_SPECIAL_RX_ADDTION_RIFS_US      1300
							 | 
						||
| 
								 | 
							
								/* final rifs = MAC_SPECIAL_RIFS_US + MAC_SPECIAL_CERT_TX_ADDTION_RIFS_US */
							 | 
						||
| 
								 | 
							
								#define MAC_SPECIAL_CERT_TX_ADDTION_RIFS_US 0
							 | 
						||
| 
								 | 
							
								/* final rifs = MAC_SPECIAL_RIFS_US + MAC_SPECIAL_CERT_RX_ADDTION_RIFS_US */
							 | 
						||
| 
								 | 
							
								#define MAC_SPECIAL_CERT_RX_ADDTION_RIFS_US 1300
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* CIFS config */
							 | 
						||
| 
								 | 
							
								#define MAC_MIN_SOF_CIFS_TMR        350
							 | 
						||
| 
								 | 
							
								#define MAC_MAX_SOF_CIFS_TMR        1000
							 | 
						||
| 
								 | 
							
								#define MAC_FORCE_CIFS_US           400
							 | 
						||
| 
								 | 
							
								#define MAC_SPECIAL_CIFS_US         400 //TODO: check the final value
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*********************rf mac ifs configuration****************************/
							 | 
						||
| 
								 | 
							
								/* the macros indicate the time of backoff */
							 | 
						||
| 
								 | 
							
								/* define rf mac eifs 70ms */
							 | 
						||
| 
								 | 
							
								#define RF_MAC_EIFS_US                  (70000)
							 | 
						||
| 
								 | 
							
								/* define rf mac cifs 800us */
							 | 
						||
| 
								 | 
							
								#define RF_MAC_CIFS_US                  (800)
							 | 
						||
| 
								 | 
							
								/* define rf mac bifs 800us */
							 | 
						||
| 
								 | 
							
								#define RF_MAC_BIFS_US                  (800)
							 | 
						||
| 
								 | 
							
								/* define rf mac rifs 800 - 2300us */
							 | 
						||
| 
								 | 
							
								#define RF_MAC_TX_RIFS_US               (900)
							 | 
						||
| 
								 | 
							
								/* define rf mac rifs 800 - 2300us */
							 | 
						||
| 
								 | 
							
								#define RF_MAC_RX_RIFS_US               (2300)
							 | 
						||
| 
								 | 
							
								/* define rf mac rx sack certification margin, 1000us */
							 | 
						||
| 
								 | 
							
								#define RF_MAC_RX_SACK_CERT_MARGIN      (1000)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* spg rf cifs */
							 | 
						||
| 
								 | 
							
								#define SPG_RF_MAC_CIFS_US              (1600)
							 | 
						||
| 
								 | 
							
								/* spg rf bifs */
							 | 
						||
| 
								 | 
							
								#define SPG_RF_MAC_BIFS_US              (1600)
							 | 
						||
| 
								 | 
							
								/* spg rf rifs 1600 ~ 5000us */
							 | 
						||
| 
								 | 
							
								#define SPG_RF_MAC_TX_RIFS_US           (1700)
							 | 
						||
| 
								 | 
							
								/* spg rf rifs 1600 ~ 5000us */
							 | 
						||
| 
								 | 
							
								#define SPG_RF_MAC_RX_RIFS_US           (5000)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* mac zc config */
							 | 
						||
| 
								 | 
							
								/* CCO support max ntb count */
							 | 
						||
| 
								 | 
							
								#define MAC_ZC_NTB_SUPPORT_CNT_CCO      (12000)
							 | 
						||
| 
								 | 
							
								#if RUN_IN_PSRAM
							 | 
						||
| 
								 | 
							
								/* STA support max ntb count */
							 | 
						||
| 
								 | 
							
								#define MAC_ZC_NTB_SUPPORT_CNT_STA      (3000)
							 | 
						||
| 
								 | 
							
								/* STA 3phase support max ntb count */
							 | 
						||
| 
								 | 
							
								#define MAC_ZC_NTB_SUPPORT_CNT_STA_3P   (9000)
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								/* STA support max ntb count */
							 | 
						||
| 
								 | 
							
								#define MAC_ZC_NTB_SUPPORT_CNT_STA      (1902)
							 | 
						||
| 
								 | 
							
								/* STA 3phase support max ntb count */
							 | 
						||
| 
								 | 
							
								#define MAC_ZC_NTB_SUPPORT_CNT_STA_3P   (1902)
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* Note the max buffer size for per phase.
							 | 
						||
| 
								 | 
							
								 * for 50HZ system. full period collect. per phase buffer max count = 8400.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								#define MAC_ZC_BUF_PER_PHASE_MAX        (4200) //(8400)
							 | 
						||
| 
								 | 
							
								/* ring buffer max size for cco */
							 | 
						||
| 
								 | 
							
								#define MAC_ZC_BUF_SIZE_MAX_CCO         (MAC_ZC_BUF_PER_PHASE_MAX * 3)
							 | 
						||
| 
								 | 
							
								/* ring buffer max size for sta */
							 | 
						||
| 
								 | 
							
								#define MAC_ZC_BUF_SIZE_MAX_STA         MAC_ZC_BUF_PER_PHASE_MAX
							 | 
						||
| 
								 | 
							
								/* ring buffer max size for 3phase sta */
							 | 
						||
| 
								 | 
							
								#define MAC_ZC_BUF_SIZE_MAX_STA_3P      (MAC_ZC_BUF_PER_PHASE_MAX * 3)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* mpdu payload symbol number max */
							 | 
						||
| 
								 | 
							
								#define MAC_MPDU_PL_SYMBOL_NUM_SG_SPG   511
							 | 
						||
| 
								 | 
							
								#define MAC_MPDU_PL_SYMBOL_NUM_I1901    787
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif // !PLC_MAC_CFG_H
							 |