Files
kunlun/plc/halphy/inc/phy_ada_dump.h

142 lines
4.6 KiB
C
Raw Normal View History

2024-09-28 14:24:04 +08:00
/****************************************************************************
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_DUMP_H
#define __HW_PHY_DUMP_H
#include "plc_chn_est.h"
#include "hw_ada_dump.h"
#define K (1024)
#define ADC_DUMP_FROM_DDR_EN (0)
#define ADC_DUMP_RAM_ADDR (ADC_DUMP_RAM_OFFSET + ADC_DUMP_DST_ADDR)
#define ADC_DUMP_DDR_ADDR (ADC_DUMP_DDR_OFFSET + ADC_DUMP_DST_ADDR)
#define PHY_DUMP_THD_DFT (100)
#define ADA_TONE_ID (41)
#define ADA_DUMP_R_SHIFT_NUM (3)
#define ADC_DUMP_EDA_DLY_CYCLE (0x1000)
#define ADC_DUMP_SPEED_SUPPORT ADC_DUMP_TRIG_ORIG_SPD
#define ADC_DUMP_TRIG_SUPPORT ADC_DUMP_TRIG_PB_CRC_OK
/* dump agc gain info */
#define ADC_DUMP_SEL_DATA_RAW (0)
#define ADC_DUMP_SEL_GAIN_SAT (1)
#define ADC_DUMP_SEL_GAIN_RAW (2)
#define ADC_DUMP_SEL_FD_TDAGC_RAE (3)
#define ADC_DUMP_SEL_FD_TD_AGC_RTOP (4)
#define ADC_DUMP_SEL_FD_FEC_TD (5)
#define ADC_DUMP_DATA_SEL ADC_DUMP_SEL_DATA_RAW
/* phy trig with thrd */
#define ADC_DUMP_TRIG_WITH_THRD (0)
/*
* dump mode:
* 1.ADA AUTO DUMP with threshold
* 2.ADA FORCE DUMP without threshold
* 3.ADA PHY DUMP with more condition
*/
typedef enum
{
ADC_DUMP_MODE_AUTO = 0,
ADC_DUMP_MODE_FORCE ,
ADC_DUMP_MODE_PHY ,
}ADC_DUMP_MODE;
#define ADC_DUMP_MODE_SUPPORT ADC_DUMP_MODE_FORCE
/*
* do csi buf dump before ada dump
* need config tone id to 0 for noise floor dump.
*/
#define ADA_DUMP_WITH_CSI_BUF_DUMP (0)
#define ADA_DUMP_NF_WITH_CSI_BUF_DUMP (0)
#define ADC_DUMP_FLASH_START (0x00020000)
#define ADC_DUMP_FLASH_END (0x000E0000)
#define ADC_DUMP_FLASH_MG0 (0x5a)
#define ADC_DUMP_FLASH_MG1 (0xa5)
#define ADC_DUMP_FLASH_MG2 (0x55)
#define ADC_DUMP_FLASH_MG3 (0xaa)
/**
*@brief phy_ada_dump_adc_init.
* ADC moudle initlize.
*
*@param tone_id [tone number.]
*@param b_size [buffer size to dump.]
*@param s_size [sample size to dump.]
*@exception [none.]
*@return [none.]
*/
void phy_ada_dump_adc_init( \
uint16_t tone_id, \
uint32_t b_size, \
uint32_t s_size);
/**
*@brief phy_ada_dump_dac_init.
* DAC moudle initlize.
*
*@param tone_id [tone number.]
*@exception [none.]
*@return [none.]
*/
void phy_ada_dump_dac_init(uint16_t tone_id);
/**
*@brief phy_dump_size_cal.
* get ada dump buffer size and sample size.
*
*@param b_size [buffer size to dump.]
*@param s_size [sample size to dump.]
*@exception [none.]
*@return [ERR_OK for true and others false.]
*/
uint32_t phy_dump_size_cal(uint32_t *b_size, uint32_t *s_size);
/**
*@brief phy_ada_dump_addr_get.
* phy ada dump addr get.
*
*@param addr [dump address to return]
*@exception [none.]
*@return [buffer size, unit: 1 byte]
*/
uint32_t phy_ada_dump_addr_get(uint32_t *addr);
/**
*@brief phy_ada_dump_start.
* phy ada dump special flow depend on hardware platform.
*
*@param b_size [buffer size to dump, uint is 1 word(4 byte)]
*@param s_size [sample size to dump, uint is 1 word(4 byte)]
*@param mode [AUTO, FORCE, PHY etc.]
*@param dly_cnt [dly cycle counter.]
*@param trig_offset [trigger offset pointer.]
*@param trig_id [phy trigger id.]
*@param speed [dump speed.]
*@exception [none.]
*@return [ERR_OK, others ERR_FAIL.]
*/
uint32_t phy_ada_dump_start(uint32_t b_size, \
uint32_t s_size, \
ADC_DUMP_MODE mode, \
uint32_t dly_cnt, \
uint32_t *trig_offset, \
uint32_t trig_id, \
uint32_t speed);
#endif