/*-------------------------------------------------------------------------------------------------
--
-- File Name    : coaxpressXcvrSpeed.h



-- Description  : This module replicates the CoaXPress Device Speed settings.




-- Targeted device : Microchip FPGAs
-- Author          : India Solutions Team




--
-- COPYRIGHT 2023 BY MICROCHIP
-- THE INFORMATION CONTAINED IN THIS DOCUMENT IS SUBJECT TO LICENSING RESTRICTIONS
-- FROM MICROCHIP CORP.  IF YOU ARE NOT IN POSSESSION OF WRITTEN AUTHORIZATION FROM
-- MICROCHIP FOR USE OF THIS FILE, THEN THE FILE SHOULD BE IMMEDIATELY DESTROYED AND
-- NO BACK-UP OF THE FILE SHOULD BE MADE.
--



-------------------------------------------------------------------------------------------------*/

#ifndef COAXPRESSXCVRSPEED_H_
#define COAXPRESSXCVRSPEED_H_

#define CMD_RATE_SEL_ADDR     (0x71000000 + 0x00)

#define CXP_DEV_XCVR_BASE   0x60000000UL
// XVCR Register Offsets
#define DES_CDR_CTRL_2      0x01041008
#define DES_CDR_CTRL_3      0x0104100c
#define DES_DFEEM_CTRL_1    0x01041010
#define DES_DFEEM_CTRL_2    0x01041014
#define DES_DFEEM_CTRL_3    0x01041018
#define DES_DFE_CTRL_2      0x01041024
#define DES_EM_CTRL_2       0x0104102c
#define DES_RXPLL_DIV       0x01041040
#define DES_RSTPD           0x0104104c
#define SER_CLK_CTRL        0x01041074
#define SER_RSTPD           0x01041078

#define SER_TERM_CTRL       0x01041090
#define SER_DRV_DATA_CTRL   0x01041098
#define SER_DRV_CTRL        0x0104109C
#define SER_DRV_CTRL_SEL    0x010410A0

#define SERDES_RTL_CTRL     0x010410c0
#define DES_DFE_CAL_CTRL_0  0x010410d0
#define DES_DFE_CAL_CTRL_1  0x010410d4
#define DES_DFE_CAL_CTRL_2  0x010410d8
#define DES_DFE_CAL_CMD     0x010410dc

#define TXPLL_DIV_1         0x01050010
#define TXPLL_DIV_2         0x01050014

//Configuring different rates 1.25G, 2.5G, 3.125G, 5.0G, 6.25G, 10.0G, 12.5G
#define RATE_1DOT25G    0x28
#define RATE_2DOT5G     0x30
#define RATE_3DOT125G   0x38
#define RATE_5DOT0G     0x40
#define RATE_6DOT25G    0x48
#define RATE_10DOT0G    0x50
#define RATE_12DOT5G    0x58

void wait_for_pll_lock();
void update_cxp_xcvr_uplink_speed(uint8_t data);

#endif /* COAXPRESSXCVRSPEED_H_ */
