|
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.
|
#include "main.h"#include "i2c.h"Go to the source code of this file.
Data Structures | |
| struct | ds160pr810 |
| Class (struct) that stores variables for interacting with DS160PR180. More... | |
| union | ds160pr810::_reg |
| struct | ds160pr810::_reg::_general_control_register |
| struct | ds160pr810::_reg::_eeprom_status_register |
| struct | ds160pr810::_reg::_device_id0_register |
| struct | ds160pr810::_reg::_device_id1_register |
| struct | ds160pr810::_reg::_rx_det_sts |
| struct | ds160pr810::_reg::_eq_ctrl |
| struct | ds160pr810::_reg::_gain_ctrl |
| struct | ds160pr810::_reg::_rx_det_ctrl1 |
| struct | ds160pr810::_reg::_rx_det_ctrl2 |
Macros | |
| #define | OFFSET_CHANNEL_0 0x00 |
| #define | OFFSET_CHANNEL_1 0x20 |
| #define | OFFSET_CHANNEL_2 0x40 |
| #define | OFFSET_CHANNEL_3 0x60 |
| #define | RX_DET_STS 0x00 |
| #define | EQ_CTRL 0x01 |
| #define | GAIN_CTRL 0x02 |
| #define | RX_DET_CTRL1 0x03 |
| #define | RX_DET_CTRL2 0x09 |
| #define | BROADCAST_WRITE_ALL 0x80 |
| #define | BROADCAST_WRITE_0_1 0xA0 |
| #define | BROADCAST_WRITE_2_3 0xC0 |
| #define | GENERAL_CONTROL_REGISTER 0xE2 |
| #define | EEPROM_STATUS_REGISTER 0xE3 |
| #define | DEVICE_ID0_REGISTER 0xF0 |
| #define | DEVICE_ID1_REGISTER 0xF1 |
Typedefs | |
| typedef enum Status | Status |
| Status enum. | |
| typedef enum BankNumber | BankNumber |
| Bank indexes. | |
| typedef enum RxDetectStatus | RxDetectStatus |
| Rx Detect Status. | |
| typedef enum EQStage1Bypass | EQStage1Bypass |
| Bypass state of CTLE first stage. | |
| typedef enum EQDCGain | EQDCGain |
| DC gain. | |
| typedef enum TxVOD | TxVOD |
| TX VOD. | |
| typedef enum ApplyTo | ApplyTo |
| typedef struct ds160pr810 | DS160PR810 |
| Class (struct) that stores variables for interacting with DS160PR180. | |
Enumerations | |
| enum | Status { STATUS_OK , STATUS_TimeOut , STATUS_ArgumentError } |
| Status enum. More... | |
| enum | BankNumber { BANK0 , BANK1 } |
| Bank indexes. More... | |
| enum | RxDetectStatus { RX_DET_NONE , RX_DET_N , RX_DET_P , RX_DET_BOTH } |
| Rx Detect Status. More... | |
| enum | EQStage1Bypass { EQ_STAGE1_BYPASS_DISABLE , EQ_STAGE1_BYPASS_ENABLE } |
| Bypass state of CTLE first stage. More... | |
| enum | EQDCGain { EQ_DC_GAIN_0db , EQ_DC_GAIN_3db5 } |
| DC gain. More... | |
| enum | TxVOD { TX_VOD_m6db , TX_VOD_m3db5 , TX_VOD_m1db6 , TX_VOD_0db } |
| TX VOD. More... | |
| enum | ApplyTo { BANK0_CHANNEL0 = OFFSET_CHANNEL_0 , BANK0_CHANNEL1 = OFFSET_CHANNEL_1 , BANK0_CHANNEL2 = OFFSET_CHANNEL_2 , BANK0_CHANNEL3 = OFFSET_CHANNEL_3 , BANK0_CHANNEL0_1 = BROADCAST_WRITE_0_1 , BANK0_CHANNEL2_3 = BROADCAST_WRITE_2_3 , BANK1_CHANNEL0 = OFFSET_CHANNEL_0 | 0x01 , BANK1_CHANNEL1 = OFFSET_CHANNEL_1 | 0x01 , BANK1_CHANNEL2 = OFFSET_CHANNEL_2 | 0x01 , BANK1_CHANNEL3 = OFFSET_CHANNEL_3 | 0x01 , BANK1_CHANNEL0_1 = BROADCAST_WRITE_0_1 | 0x01 , BANK1_CHANNEL2_3 = BROADCAST_WRITE_2_3 | 0x01 , CHANNEL0 = OFFSET_CHANNEL_0 , CHANNEL1 = OFFSET_CHANNEL_1 , CHANNEL2 = OFFSET_CHANNEL_2 , CHANNEL3 = OFFSET_CHANNEL_3 , CHANNEL4 = OFFSET_CHANNEL_0 | 0x01 , CHANNEL5 = OFFSET_CHANNEL_1 | 0x01 , CHANNEL6 = OFFSET_CHANNEL_2 | 0x01 , CHANNEL7 = OFFSET_CHANNEL_3 | 0x01 , CHANNEL0_1 = BROADCAST_WRITE_0_1 , CHANNEL2_3 = BROADCAST_WRITE_2_3 , CHANNEL4_5 = BROADCAST_WRITE_0_1 | 0x01 , CHANNEL6_7 = BROADCAST_WRITE_2_3 | 0x01 , BANK0_ALL_CHANNELS = BROADCAST_WRITE_ALL , BANK1_ALL_CHANNELS = BROADCAST_WRITE_ALL | 0x01 , ALL_BANKS = 0xFF } |
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) |
| #define BROADCAST_WRITE_0_1 0xA0 |
| #define BROADCAST_WRITE_2_3 0xC0 |
| #define BROADCAST_WRITE_ALL 0x80 |
| #define DEVICE_ID0_REGISTER 0xF0 |
| #define DEVICE_ID1_REGISTER 0xF1 |
| #define EEPROM_STATUS_REGISTER 0xE3 |
| #define EQ_CTRL 0x01 |
| #define GAIN_CTRL 0x02 |
| #define GENERAL_CONTROL_REGISTER 0xE2 |
| #define OFFSET_CHANNEL_0 0x00 |
| #define OFFSET_CHANNEL_1 0x20 |
| #define OFFSET_CHANNEL_2 0x40 |
| #define OFFSET_CHANNEL_3 0x60 |
| #define RX_DET_CTRL1 0x03 |
| #define RX_DET_CTRL2 0x09 |
| #define RX_DET_STS 0x00 |
| typedef enum BankNumber BankNumber |
Bank indexes.
| typedef struct ds160pr810 DS160PR810 |
Class (struct) that stores variables for interacting with DS160PR180.
| typedef enum EQStage1Bypass EQStage1Bypass |
Bypass state of CTLE first stage.
| typedef enum RxDetectStatus RxDetectStatus |
Rx Detect Status.
| enum ApplyTo |
| enum BankNumber |
| enum EQDCGain |
| enum EQStage1Bypass |
| enum RxDetectStatus |
| enum Status |
| enum TxVOD |
| 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.
| self | A pointer to the ds160pr810 object (struct) |
| target | Specifies the target. |
| ChannelRegister | The base address of the channel register to read. |
| STATUS_OK | in case of success |
| STATUS_TimeOut | in case of failure |
| 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.
| self | A pointer to the ds160pr810 object (struct) |
| bank_number | Index of the bank you want to read the data |
| MemAddress | Address of the target register |
| STATUS_OK | in case of success |
| STATUS_TimeOut | in case of failure |
| 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.
| self | A pointer to the ds160pr810 object (struct) |
| target | Specifies the target.
|
| ChannelRegister | The base address of the channel register to configure. |
| STATUS_OK | in case of success |
| STATUS_TimeOut | in case of failure |
| Status __DS160PR810_writeByte | ( | DS160PR810 * | self, |
| BankNumber | bank_number, | ||
| uint8_t | MemAddress ) |
Write a byte of data to DS160PR810 from the ds160pr810::_reg::raw_data.
| self | A pointer to the ds160pr810 object (struct) |
| bank_number | Index of the bank you want to write the data |
| MemAddress | Address of the target register |
| STATUS_OK | in case of success |
| STATUS_TimeOut | in case of failure |
| 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.
| self | A pointer to the ds160pr810 object (struct) |
| target | Specifies the target. |
| EQ_STAGE1_BYPASS_DISABLE | Stage1 is active |
| EQ_STAGE1_BYPASS_ENABLE | Stage1 is bypassed |
| 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.
| self | A pointer to the ds160pr810 object (struct) |
| target | Specifies the target. |
| From | 0 to 7 |
| 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.
| self | A pointer to the ds160pr810 object (struct) |
| target | Specifies the target. |
| From | 0 to 7 |
| EQDCGain DS160PR810_getDCGain_EQDCGain | ( | DS160PR810 * | self, |
| ApplyTo | target ) |
Reads the DC gain of the DS160PR810.
| self | A pointer to the ds160pr810 object (struct) |
| target | Specifies the target. |
| EQ_DC_GAIN_0db | 0.0db |
| EQ_DC_GAIN_3db5 | 3.5db |
| TxVOD DS160PR810_getDCGain_TxVOD | ( | DS160PR810 * | self, |
| ApplyTo | target ) |
Reads the TX VOD of the DS160PR810.
| self | A pointer to the ds160pr810 object (struct) |
| target | Specifies the target. |
| TX_VOD_0db | 0.0db |
| TX_VOD_m1db6 | -1.6db |
| TX_VOD_m3db5 | -3.5db |
| TX_VOD_m6db | -6.0db |
| uint8_t DS160PR810_getDevID0 | ( | DS160PR810 * | self, |
| BankNumber | bank_number ) |
Reads device ID0 of the specific bank of th DS160PR810.
| self | A pointer to the ds160pr810 object (struct) |
| bank_number | The bank index |
| uint8_t DS160PR810_getDevID1 | ( | DS160PR810 * | self, |
| BankNumber | bank_number ) |
Reads device ID1 of the specific bank of th DS160PR810.
| self | A pointer to the ds160pr810 object (struct) |
| bank_number | The bank index |
| uint8_t DS160PR810_getEEAtemptCount | ( | DS160PR810 * | self, |
| BankNumber | bank_number ) |
| uint8_t DS160PR810_getEELoadComplete | ( | DS160PR810 * | self, |
| BankNumber | bank_number ) |
| uint8_t DS160PR810_getEELoadFail | ( | DS160PR810 * | self, |
| BankNumber | bank_number ) |
| RxDetectStatus DS160PR810_getRxDetectStatus | ( | DS160PR810 * | self, |
| ApplyTo | target ) |
Reads the RX detect status of the DS160PR810.
| self | A pointer to the ds160pr810 object (struct) |
| target | Specifies the target. |
| RX_DET_NONE | |
| RX_DET_N | |
| RX_DET_P | |
| RX_DET_BOTH |
| Status DS160PR810_init | ( | DS160PR810 * | self, |
| I2C_HandleTypeDef * | hi2c, | ||
| uint8_t | BANK0_I2C_ADDR ) |
Initialize the DS160PR810 with the given config.
| self | A pointer to the ds160pr810 object (struct) |
| hi2c | A pointer to the I2C handler that is connected to DS160PR810 |
| BANK0_I2C_ADDR | The I2C address of the bank0 of the DS160PR810. It depends on the state of ADDR0 and ADDR1 pins of the chip. |
| STATUS_OK | in case of success |
| STATUS_TimeOut | in case of failure |
| Status DS160PR810_resetRegisters | ( | DS160PR810 * | self | ) |
Resets the DS160PR810 registers.
| self | A pointer to the ds160pr810 object (struct) |
| STATUS_OK | in case of success |
| STATUS_TimeOut | in case of failure |
| Status DS160PR810_setClearRxDetectStateMachine | ( | DS160PR810 * | self, |
| ApplyTo | target ) |
Clear the reset flag of the RX detect state machine.
| self | A pointer to the ds160pr810 object (struct) |
| target | Specifies the target.
|
| STATUS_OK | in case of success |
| STATUS_TimeOut | in case of failure |
| Status DS160PR810_setCTLE | ( | DS160PR810 * | self, |
| ApplyTo | target, | ||
| EQStage1Bypass | isByPassed, | ||
| uint8_t | Stage1, | ||
| uint8_t | Stage2 ) |
Set the CTLE setting of the DS160PR810.
| self | A pointer to the ds160pr810 object (struct) |
| target | Specifies the target.
|
| isByPassed | Determines the status of first stage of CTLE |
| Stage1 | Determines the gain index of first stage of CTLE. This s value between 0 to 7. |
| Stage2 | Determines the gain index of second stage of CTLE. This s value between 0 to 7. |
| STATUS_OK | in case of success |
| STATUS_TimeOut | in case of failure |
| Status DS160PR810_setDCGain | ( | DS160PR810 * | self, |
| ApplyTo | target, | ||
| TxVOD | tx_vod, | ||
| EQDCGain | dc_gain ) |
Set the DC gain settings of the DS160PR810.
| self | A pointer to the ds160pr810 object (struct) |
| target | Specifies the target.
|
| tx_vod | Specifies the VOD
|
| dc_gain | Specifies the DC gain
|
| STATUS_OK | in case of success |
| STATUS_TimeOut | in case of failure |
| Status DS160PR810_setResetRxDetectStateMachine | ( | DS160PR810 * | self, |
| ApplyTo | target ) |
Resets the RX detect state machine.
| self | A pointer to the ds160pr810 object (struct) |
| target | Specifies the target.
|
| STATUS_OK | in case of success |
| STATUS_TimeOut | in case of failure |