207 lines
		
	
	
		
			5.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			207 lines
		
	
	
		
			5.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 __PHY_TMAP_H
 | ||
|  | #define __PHY_TMAP_H
 | ||
|  | 
 | ||
|  | #include "hw_tonemask.h"
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | extern "C" { | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #define PHY_TMAP_MODU_EN_OFFSET     (3)
 | ||
|  | #define PHY_TMAP_TURBO_RATE_OFFSET  (2)
 | ||
|  | #define PHY_TMAP_MAX                (128)
 | ||
|  | #define PHY_TMAP_TURBO_GI_MAX       (16)
 | ||
|  | 
 | ||
|  | // CLK 75MHz mode
 | ||
|  | #define FFT_POINT                   (3072)
 | ||
|  | #define PB_GI0                      (567)
 | ||
|  | #define ALIGN_PARA                  (96)
 | ||
|  | #define HPAV_RIFS                   (140)
 | ||
|  | #define HPAV_BIFS                   (20)
 | ||
|  | 
 | ||
|  | typedef enum _plc_tone_map_modu_t { | ||
|  |     PHY_MODU_BPSK   = 0, | ||
|  |     PHY_MODU_QPSK, | ||
|  |     PHY_MODU_16QAM, | ||
|  |     PHY_MODU_8QAM, | ||
|  |     PHY_MODU_64QAM, | ||
|  |     PHY_MODU_256QAM, | ||
|  |     PHY_MODU_1024QAM, | ||
|  |     PHY_MODU_4096QAM | ||
|  | } plc_tone_map_modu_t; | ||
|  | 
 | ||
|  | typedef enum _plc_tone_map_turbo_rate_t { | ||
|  |     PHY_TURBO_RATE_1_2 = 0, | ||
|  |     PHY_TURBO_RATE_16_21, | ||
|  |     PHY_TURBO_RATE_16_18 | ||
|  | } plc_tone_map_turbo_rate_t; | ||
|  | 
 | ||
|  | typedef enum _plc_tone_map_gi_t { | ||
|  |     PHY_GI_417   = 0, | ||
|  |     PHY_GI_567, | ||
|  |     PHY_GI_3534 | ||
|  | } plc_tone_map_gi_t; | ||
|  | 
 | ||
|  | typedef struct _plc_tmap_rule{ | ||
|  |     uint8_t rule_id; | ||
|  |     uint8_t en; | ||
|  |     uint8_t stei; | ||
|  |     uint8_t dtei; | ||
|  |     uint8_t tmi; | ||
|  | } plc_tmap_rule_t; | ||
|  | 
 | ||
|  | 
 | ||
|  | /**
 | ||
|  |  *@brief phy_fft_4096p_init. | ||
|  |  * | ||
|  |  *  enable 4096 point fft for high speed modulation. | ||
|  |  * | ||
|  |  *@param en                 [true for enable or disable.] | ||
|  |  *@exception                [none.] | ||
|  |  *@return                   [none.] | ||
|  |  */ | ||
|  | void phy_fft_4096p_init(bool_t en); | ||
|  | 
 | ||
|  | #if SUPPORT_GREEN_PHY
 | ||
|  | 
 | ||
|  | /**
 | ||
|  |  *@brief phy_tmap_cal. | ||
|  |  * | ||
|  |  *  get tone map info from sound data. | ||
|  |  * | ||
|  |  *@param sound_data_ptr     [sound data pointer.] | ||
|  |  *@param tone_map_ptr       [tone map pointer.] | ||
|  |  *@param start_tone         [start tone.] | ||
|  |  *@param end_tone           [end tone.] | ||
|  |  *@param cal_lvl            [calibrate level.] | ||
|  |  *@exception                [none.] | ||
|  |  *@return                   [1 for success or other fail.] | ||
|  |  */ | ||
|  | uint32_t phy_tmap_cal( \ | ||
|  |     uint32_t *sound_data_ptr, \ | ||
|  |     uint32_t *tone_map_ptr, \ | ||
|  |     uint32_t start_tone, \ | ||
|  |     uint32_t end_tone, \ | ||
|  |     uint8_t cal_lvl); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  *@brief phy_tmap_tx_rule_set. | ||
|  |  * | ||
|  |  *  tx direction rule config. | ||
|  |  * | ||
|  |  *@param rule               [rule structure.] | ||
|  |  *@exception                [none.] | ||
|  |  *@return                   [none.] | ||
|  |  */ | ||
|  | void phy_tmap_tx_rule_set(plc_tmap_rule_t *rule); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  *@brief phy_tmap_rx_rule_set. | ||
|  |  * | ||
|  |  *  rx direction rule config. | ||
|  |  * | ||
|  |  *@param rule               [rule structure.] | ||
|  |  *@exception                [none.] | ||
|  |  *@return                   [none.] | ||
|  |  */ | ||
|  | void phy_tmap_rx_rule_set(plc_tmap_rule_t *rule); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  *@brief phy_tmap_init. | ||
|  |  * | ||
|  |  *  sound tone map initilze. | ||
|  |  * | ||
|  |  *@param none               [none.] | ||
|  |  *@exception                [none.] | ||
|  |  *@return                   [none.] | ||
|  |  */ | ||
|  | void phy_tmap_init(); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  *@brief phy_tmap_self_tmi_set. | ||
|  |  * | ||
|  |  *  phy tone map tx and rx tmi set. | ||
|  |  * | ||
|  |  *@param tmi                [which tmi to set.] | ||
|  |  *@exception                [none.] | ||
|  |  *@return                   [none.] | ||
|  |  */ | ||
|  | void phy_tmap_self_tmi_set(uint8_t tmi); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  *@brief phy_tmap_self_tmi_set. | ||
|  |  * | ||
|  |  *  phy tone map tx and rx tmi set. | ||
|  |  * | ||
|  |  *@param start_tone         [start tone number.] | ||
|  |  *@param end_tone           [end tone number.] | ||
|  |  *@param tone_map_ptr       [tone map pointer.] | ||
|  |  *@param tmt                [tone mask table pointer.] | ||
|  |  *@exception                [none.] | ||
|  |  *@return                   [symbol bits.] | ||
|  |  */ | ||
|  | uint32_t phy_cal_tmap_symb_bits( \ | ||
|  |     uint32_t start_tone, \ | ||
|  |     uint32_t end_tone, \ | ||
|  |     uint32_t *tone_map_ptr, \ | ||
|  |     const plc_tonemask_table *tmt); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  *@brief hpav_cal_fl_tmap. | ||
|  |  * | ||
|  |  *  phy frame length calibrate API. | ||
|  |  * | ||
|  |  *@param mpdu_cnt           [current mpdu counter.] | ||
|  |  *@param pb_num             [pb number.] | ||
|  |  *@param turbo_rate         [turbo rate select.] | ||
|  |  *@param tmap_gi            [GI value.] | ||
|  |  *@param bits_per_symb      [bits symbol number.] | ||
|  |  *@exception                [none.] | ||
|  |  *@return                   [frame length.] | ||
|  |  */ | ||
|  | int hpav_cal_fl_tmap | ||
|  | ( | ||
|  |     uint8_t mpdu_cnt, | ||
|  |     uint8_t pb_num, | ||
|  |     uint8_t turbo_rate, | ||
|  |     uint8_t tmap_gi, | ||
|  |     uint32_t bits_per_symb | ||
|  | ); | ||
|  | 
 | ||
|  | int hpav_cal_fl_robo(uint8_t tmi, uint8_t mpdu_cnt, uint8_t pb_num); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  *@brief phy_symb_bits_get. | ||
|  |  * | ||
|  |  *  phy symbol number bits calibrate API. | ||
|  |  * | ||
|  |  *@param tmap_addr          [tone map address.] | ||
|  |  *@exception                [none.] | ||
|  |  *@return                   [symbol number bits.] | ||
|  |  */ | ||
|  | uint32_t phy_symb_bits_get(uint32_t *tmap_addr); | ||
|  | #endif
 | ||
|  | 
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | } | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #endif
 | ||
|  | 
 |