DS160PR810 HAL Based Library 1.0.0
This library is a software library that works with the DS160PR810 PCIe 4.0 16-Gbps 8-channel linear redriver. This library provides a convenient and efficient way to access the I2C interfaces of the chip, allowing developers to easily integrate this redriver into their systems.
Loading...
Searching...
No Matches
ds160pr810.c File Reference
#include "ds160pr810.h"

Functions

Status DS160PR810_init (DS160PR810 *self, I2C_HandleTypeDef *hi2c, uint8_t BANK0_I2C_ADDR)
 Initialize the DS160PR810 with the given config.
 
Status DS160PR810_resetRegisters (DS160PR810 *self)
 Resets the DS160PR810 registers.
 
Status __DS160PR810_writeByte (DS160PR810 *self, BankNumber bank_number, uint8_t MemAddress)
 Write a byte of data to DS160PR810 from the ds160pr810::_reg::raw_data.
 
Status __DS160PR810_readByte (DS160PR810 *self, BankNumber bank_number, uint8_t MemAddress)
 Read a byte of data from DS160PR810 and stores in the ds160pr810::_reg::raw_data.
 
Status __DS160PR810_setChannelConfig (DS160PR810 *self, ApplyTo target, uint8_t ChannelRegister)
 Configures the channel registers for the DS160PR810 This function writes configuration values to a specific channel register or broadcasts the configuration to all channels depending on the target parameter.
 
Status __DS160PR810_getChannelConfig (DS160PR810 *self, ApplyTo target, uint8_t ChannelRegister)
 Reads the configuration of a channel register of the DS160PR810 This function reads configuration values of a specific channel register.
 
Status DS160PR810_setCTLE (DS160PR810 *self, ApplyTo target, EQStage1Bypass isByPassed, uint8_t Stage1, uint8_t Stage2)
 Set the CTLE setting of the DS160PR810.
 
Status DS160PR810_setResetRxDetectStateMachine (DS160PR810 *self, ApplyTo target)
 Resets the RX detect state machine.
 
Status DS160PR810_setClearRxDetectStateMachine (DS160PR810 *self, ApplyTo target)
 Clear the reset flag of the RX detect state machine.
 
Status DS160PR810_setDCGain (DS160PR810 *self, ApplyTo target, TxVOD tx_vod, EQDCGain dc_gain)
 Set the DC gain settings of the DS160PR810.
 
EQStage1Bypass DS160PR810_getCTLE_EQStage1Bypass (DS160PR810 *self, ApplyTo target)
 Reads the DS160PR810 CTLE first stage status. This function reads status of the first stage of CTLE.
 
uint8_t DS160PR810_getCTLE_Stage1 (DS160PR810 *self, ApplyTo target)
 Reads the DS160PR810 CTLE first stage gain index. This function reads gain index of the first stage of CTLE.
 
uint8_t DS160PR810_getCTLE_Stage2 (DS160PR810 *self, ApplyTo target)
 Reads the DS160PR810 CTLE second stage gain index. This function reads gain index of the second stage of CTLE.
 
TxVOD DS160PR810_getDCGain_TxVOD (DS160PR810 *self, ApplyTo target)
 Reads the TX VOD of the DS160PR810.
 
EQDCGain DS160PR810_getDCGain_EQDCGain (DS160PR810 *self, ApplyTo target)
 Reads the DC gain of the DS160PR810.
 
RxDetectStatus DS160PR810_getRxDetectStatus (DS160PR810 *self, ApplyTo target)
 Reads the RX detect status of the DS160PR810.
 
uint8_t DS160PR810_getDevID0 (DS160PR810 *self, BankNumber bank_number)
 Reads device ID0 of the specific bank of th DS160PR810.
 
uint8_t DS160PR810_getDevID1 (DS160PR810 *self, BankNumber bank_number)
 Reads device ID1 of the specific bank of th DS160PR810.
 
uint8_t DS160PR810_getEELoadComplete (DS160PR810 *self, BankNumber bank_number)
 
uint8_t DS160PR810_getEELoadFail (DS160PR810 *self, BankNumber bank_number)
 
uint8_t DS160PR810_getEEAtemptCount (DS160PR810 *self, BankNumber bank_number)
 

Function Documentation

◆ __DS160PR810_getChannelConfig()

Status __DS160PR810_getChannelConfig ( DS160PR810 * self,
ApplyTo target,
uint8_t ChannelRegister )

Reads the configuration of a channel register of the DS160PR810 This function reads configuration values of a specific channel register.

Parameters
selfA pointer to the ds160pr810 object (struct)
targetSpecifies the target.
ChannelRegisterThe base address of the channel register to read.
Returns
The status of initialization
Return values
STATUS_OKin case of success
STATUS_TimeOutin case of failure

◆ __DS160PR810_readByte()

Status __DS160PR810_readByte ( DS160PR810 * self,
BankNumber bank_number,
uint8_t MemAddress )

Read a byte of data from DS160PR810 and stores in the ds160pr810::_reg::raw_data.

Parameters
selfA pointer to the ds160pr810 object (struct)
bank_numberIndex of the bank you want to read the data
MemAddressAddress of the target register
Returns
The status of initialization
Return values
STATUS_OKin case of success
STATUS_TimeOutin case of failure

◆ __DS160PR810_setChannelConfig()

Status __DS160PR810_setChannelConfig ( DS160PR810 * self,
ApplyTo target,
uint8_t ChannelRegister )

Configures the channel registers for the DS160PR810 This function writes configuration values to a specific channel register or broadcasts the configuration to all channels depending on the target parameter.

Parameters
selfA pointer to the ds160pr810 object (struct)
targetSpecifies the target.
ChannelRegisterThe base address of the channel register to configure.
Returns
The status of initialization
Return values
STATUS_OKin case of success
STATUS_TimeOutin case of failure

◆ __DS160PR810_writeByte()

Status __DS160PR810_writeByte ( DS160PR810 * self,
BankNumber bank_number,
uint8_t MemAddress )

Write a byte of data to DS160PR810 from the ds160pr810::_reg::raw_data.

Parameters
selfA pointer to the ds160pr810 object (struct)
bank_numberIndex of the bank you want to write the data
MemAddressAddress of the target register
Returns
The status of initialization
Return values
STATUS_OKin case of success
STATUS_TimeOutin case of failure

◆ DS160PR810_getCTLE_EQStage1Bypass()

EQStage1Bypass DS160PR810_getCTLE_EQStage1Bypass ( DS160PR810 * self,
ApplyTo target )

Reads the DS160PR810 CTLE first stage status. This function reads status of the first stage of CTLE.

Parameters
selfA pointer to the ds160pr810 object (struct)
targetSpecifies the target.
Returns
The status of first stage
Return values
EQ_STAGE1_BYPASS_DISABLEStage1 is active
EQ_STAGE1_BYPASS_ENABLEStage1 is bypassed

◆ DS160PR810_getCTLE_Stage1()

uint8_t DS160PR810_getCTLE_Stage1 ( DS160PR810 * self,
ApplyTo target )

Reads the DS160PR810 CTLE first stage gain index. This function reads gain index of the first stage of CTLE.

Parameters
selfA pointer to the ds160pr810 object (struct)
targetSpecifies the target.
Returns
The gain index of first stage
Return values
From0 to 7

◆ DS160PR810_getCTLE_Stage2()

uint8_t DS160PR810_getCTLE_Stage2 ( DS160PR810 * self,
ApplyTo target )

Reads the DS160PR810 CTLE second stage gain index. This function reads gain index of the second stage of CTLE.

Parameters
selfA pointer to the ds160pr810 object (struct)
targetSpecifies the target.
Returns
The gain index of second stage
Return values
From0 to 7

◆ DS160PR810_getDCGain_EQDCGain()

EQDCGain DS160PR810_getDCGain_EQDCGain ( DS160PR810 * self,
ApplyTo target )

Reads the DC gain of the DS160PR810.

Parameters
selfA pointer to the ds160pr810 object (struct)
targetSpecifies the target.
Returns
The DC gain
Return values
EQ_DC_GAIN_0db0.0db
EQ_DC_GAIN_3db53.5db

◆ DS160PR810_getDCGain_TxVOD()

TxVOD DS160PR810_getDCGain_TxVOD ( DS160PR810 * self,
ApplyTo target )

Reads the TX VOD of the DS160PR810.

Parameters
selfA pointer to the ds160pr810 object (struct)
targetSpecifies the target.
Returns
The TX VOD
Return values
TX_VOD_0db0.0db
TX_VOD_m1db6-1.6db
TX_VOD_m3db5-3.5db
TX_VOD_m6db-6.0db

◆ DS160PR810_getDevID0()

uint8_t DS160PR810_getDevID0 ( DS160PR810 * self,
BankNumber bank_number )

Reads device ID0 of the specific bank of th DS160PR810.

Parameters
selfA pointer to the ds160pr810 object (struct)
bank_numberThe bank index
Returns
The device ID0

◆ DS160PR810_getDevID1()

uint8_t DS160PR810_getDevID1 ( DS160PR810 * self,
BankNumber bank_number )

Reads device ID1 of the specific bank of th DS160PR810.

Parameters
selfA pointer to the ds160pr810 object (struct)
bank_numberThe bank index
Returns
The device ID1

◆ DS160PR810_getEEAtemptCount()

uint8_t DS160PR810_getEEAtemptCount ( DS160PR810 * self,
BankNumber bank_number )

◆ DS160PR810_getEELoadComplete()

uint8_t DS160PR810_getEELoadComplete ( DS160PR810 * self,
BankNumber bank_number )

◆ DS160PR810_getEELoadFail()

uint8_t DS160PR810_getEELoadFail ( DS160PR810 * self,
BankNumber bank_number )

◆ DS160PR810_getRxDetectStatus()

RxDetectStatus DS160PR810_getRxDetectStatus ( DS160PR810 * self,
ApplyTo target )

Reads the RX detect status of the DS160PR810.

Parameters
selfA pointer to the ds160pr810 object (struct)
targetSpecifies the target.
Returns
The RX detect status
Return values
RX_DET_NONE
RX_DET_N
RX_DET_P
RX_DET_BOTH

◆ DS160PR810_init()

Status DS160PR810_init ( DS160PR810 * self,
I2C_HandleTypeDef * hi2c,
uint8_t BANK0_I2C_ADDR )

Initialize the DS160PR810 with the given config.

Parameters
selfA pointer to the ds160pr810 object (struct)
hi2cA pointer to the I2C handler that is connected to DS160PR810
BANK0_I2C_ADDRThe I2C address of the bank0 of the DS160PR810. It depends on the state of ADDR0 and ADDR1 pins of the chip.
Returns
The status of initialization
Return values
STATUS_OKin case of success
STATUS_TimeOutin case of failure

◆ DS160PR810_resetRegisters()

Status DS160PR810_resetRegisters ( DS160PR810 * self)

Resets the DS160PR810 registers.

Parameters
selfA pointer to the ds160pr810 object (struct)
Returns
The status of initialization
Return values
STATUS_OKin case of success
STATUS_TimeOutin case of failure

◆ DS160PR810_setClearRxDetectStateMachine()

Status DS160PR810_setClearRxDetectStateMachine ( DS160PR810 * self,
ApplyTo target )

Clear the reset flag of the RX detect state machine.

Parameters
selfA pointer to the ds160pr810 object (struct)
targetSpecifies the target.
Returns
The status of config
Return values
STATUS_OKin case of success
STATUS_TimeOutin case of failure

◆ DS160PR810_setCTLE()

Status DS160PR810_setCTLE ( DS160PR810 * self,
ApplyTo target,
EQStage1Bypass isByPassed,
uint8_t Stage1,
uint8_t Stage2 )

Set the CTLE setting of the DS160PR810.

Parameters
selfA pointer to the ds160pr810 object (struct)
targetSpecifies the target.
isByPassedDetermines the status of first stage of CTLE
Stage1Determines the gain index of first stage of CTLE. This s value between 0 to 7.
Stage2Determines the gain index of second stage of CTLE. This s value between 0 to 7.
Returns
The status of config
Return values
STATUS_OKin case of success
STATUS_TimeOutin case of failure

◆ DS160PR810_setDCGain()

Status DS160PR810_setDCGain ( DS160PR810 * self,
ApplyTo target,
TxVOD tx_vod,
EQDCGain dc_gain )

Set the DC gain settings of the DS160PR810.

Parameters
selfA pointer to the ds160pr810 object (struct)
targetSpecifies the target.
tx_vodSpecifies the VOD
dc_gainSpecifies the DC gain
Returns
The status of config
Return values
STATUS_OKin case of success
STATUS_TimeOutin case of failure

◆ DS160PR810_setResetRxDetectStateMachine()

Status DS160PR810_setResetRxDetectStateMachine ( DS160PR810 * self,
ApplyTo target )

Resets the RX detect state machine.

Parameters
selfA pointer to the ds160pr810 object (struct)
targetSpecifies the target.
Returns
The status of config
Return values
STATUS_OKin case of success
STATUS_TimeOutin case of failure