132 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			132 lines
		
	
	
		
			4.6 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 HW_PHY_INIT_H
							 | 
						||
| 
								 | 
							
								#define HW_PHY_INIT_H
							 | 
						||
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								#include "hw_tonemask.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 *  Ver.        Description.
							 | 
						||
| 
								 | 
							
								 *  1           build version ctrl, phy init including DC calibration.
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								#define PHY_SW_VER  0x1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 *@brief phy_init.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * initialize phy reg with mac proto, band id and mask.
							 | 
						||
| 
								 | 
							
								 * pls check mask for each useful band id.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 *@param mac_proto          [description:
							 | 
						||
| 
								 | 
							
								 *                              0 - PLC_PROTO_TYPE_SG  (smart grid)
							 | 
						||
| 
								 | 
							
								 *                              1 - PLC_PROTO_TYPE_GP  (green grid)
							 | 
						||
| 
								 | 
							
								 *                              2 - PLC_PROTO_TYPE_AV
							 | 
						||
| 
								 | 
							
								 *                              3 - PLC_PROTO_TYPE_SPG (southern power grid)]
							 | 
						||
| 
								 | 
							
								 *@param band_id            [ref to phy_bb.h, 100-230, 80-490 etc.]
							 | 
						||
| 
								 | 
							
								 *@param mask_id            [description:
							 | 
						||
| 
								 | 
							
								 *                              0 - TONE_MASK_ID_NULL
							 | 
						||
| 
								 | 
							
								 *                              1 - TONE_MASK_ID_SG0
							 | 
						||
| 
								 | 
							
								 *                              2 - TONE_MASK_ID_SG1
							 | 
						||
| 
								 | 
							
								 *                              3 - TONE_MASK_ID_GP]
							 | 
						||
| 
								 | 
							
								 *@param bbai_en            [true for enable and false for disable.]
							 | 
						||
| 
								 | 
							
								 *@exception                [none.]
							 | 
						||
| 
								 | 
							
								 *@return                   [none.]
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								void phy_init(uint32_t mac_proto, \
							 | 
						||
| 
								 | 
							
								    uint32_t band_id, \
							 | 
						||
| 
								 | 
							
								    plc_tone_mask_id mask_id, \
							 | 
						||
| 
								 | 
							
								    bool_t bbai_en);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 *@brief phy_band_init.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * initialize phy bandwidth with mac proto and band id.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 *@param mac_typ            [description:
							 | 
						||
| 
								 | 
							
								 *                              0 - PLC_PROTO_TYPE_SG  (smart grid)
							 | 
						||
| 
								 | 
							
								 *                              1 - PLC_PROTO_TYPE_GP  (green grid)
							 | 
						||
| 
								 | 
							
								 *                              2 - PLC_PROTO_TYPE_AV
							 | 
						||
| 
								 | 
							
								 *                              3 - PLC_PROTO_TYPE_SPG (southern power grid)]
							 | 
						||
| 
								 | 
							
								 *@param band_id            [ref to phy_bb.h, 100-230, 80-490 etc.]
							 | 
						||
| 
								 | 
							
								 *@exception                [none.]
							 | 
						||
| 
								 | 
							
								 *@return                   [none.]
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								void phy_band_init(uint32_t mac_typ, uint32_t band_id);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 *@brief phy_reinit.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * initialize phy reg with mac proto after warm reset, band id and mask.
							 | 
						||
| 
								 | 
							
								 * pls check mask for each useful band id.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 *@param mac_proto          [description:
							 | 
						||
| 
								 | 
							
								 *                              0 - PLC_PROTO_TYPE_SG  (smart grid)
							 | 
						||
| 
								 | 
							
								 *                              1 - PLC_PROTO_TYPE_GP  (green grid)
							 | 
						||
| 
								 | 
							
								 *                              2 - PLC_PROTO_TYPE_AV
							 | 
						||
| 
								 | 
							
								 *                              3 - PLC_PROTO_TYPE_SPG (southern power grid)]
							 | 
						||
| 
								 | 
							
								 *@param band_id            [ref to phy_bb.h, 100-230, 80-490 etc.]
							 | 
						||
| 
								 | 
							
								 *@param mask_id            [description:
							 | 
						||
| 
								 | 
							
								 *                              0 - TONE_MASK_ID_NULL
							 | 
						||
| 
								 | 
							
								 *                              1 - TONE_MASK_ID_SG0
							 | 
						||
| 
								 | 
							
								 *                              2 - TONE_MASK_ID_SG1
							 | 
						||
| 
								 | 
							
								 *                              3 - TONE_MASK_ID_GP]
							 | 
						||
| 
								 | 
							
								 *@param bbai_en            [true for enable and false for disable.]
							 | 
						||
| 
								 | 
							
								 *@exception                [none.]
							 | 
						||
| 
								 | 
							
								 *@return                   [none.]
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								void phy_reinit(uint32_t mac_proto, \
							 | 
						||
| 
								 | 
							
								    uint32_t band_id, \
							 | 
						||
| 
								 | 
							
								    plc_tone_mask_id mask_id, \
							 | 
						||
| 
								 | 
							
								    bool_t bbai_en);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief   phy_new_cfg_apply()
							 | 
						||
| 
								 | 
							
								 *          apply the cfg already to saved
							 | 
						||
| 
								 | 
							
								 * @param   [none]
							 | 
						||
| 
								 | 
							
								 * @return  [none]
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void phy_new_cfg_apply();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief phy_trx_phase_switch_gpio_init() - trx switch phase gpio control init.
							 | 
						||
| 
								 | 
							
								 * @param        void
							 | 
						||
| 
								 | 
							
								 * @return       void
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void phy_trx_phase_switch_gpio_init();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief phy_set_trx_switch_gpio_phase() - set tx/rx switch gpio phase.
							 | 
						||
| 
								 | 
							
								 * @param phase:                          - see PLC_PHASE_xx
							 | 
						||
| 
								 | 
							
								 * @return                                - 1: set fail; 0: set success.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t phy_set_trx_switch_gpio_phase(uint8_t phase);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief phy_get_trx_switch_gpio_phase() - get tx/rx switch gpio phase.
							 | 
						||
| 
								 | 
							
								 * @param void:                           - void.
							 | 
						||
| 
								 | 
							
								 * @return uint8_t                        - see PLC_PHASE_xx.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint8_t phy_get_trx_switch_gpio_phase();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif // !HW_PHY_INIT_H
							 |