AN 755: Implementing JESD204B IP Core System Reference Design with ARM HPS As Control Unit (Baremetal Flow)

ID 683776
Date 12/30/2015
Public
Document Table of Contents

1.7.5.3. Custom Peripheral Access Macros in macros.c Source File

A set of peripheral access macros are provided for you to access specific information in the CSR of the following peripherals:

  • Reset sequencer
  • JESD204B IP core TX base layer
  • JESD204B IP core RX base layer
  • FPGA core control PIO
  • FPGA core status PIO

The function prototypes of the macros listed in the table below can be found in the macros.h header file.

Table 19.  Functions in macros.c
Function Prototype Description
int CALC_BASE_ADDRESS_LINK (int base , int link) Calculates and returns the base address based on the link provided. In the QSYS system (jesd204b_ed_soc.qsys) address map, bits 16-17 are reserved for multi-link addressing. The address map allocation allows for up to a maximum of 4 links to be supported using the existing address map. The number of multi-links in the design is defined by the MAX_LINKS parameter in the main.h header file. You are responsible to set the parameter correctly to reflect the system configuration.
int CALC_BASE_ADDRESS_XCVR_PLL (int base , int instance) Calculates and returns the base address of the TX transceiver PLL (ATX PLL) based on the instance number. In the JESD204B subsystem (jesd204b_system.qsys) address map, bits 12-13 are reserved for multi ATX PLL addressing. The address map allocation allows for up to a maximum of four ATX PLLs per link to be supported using the existing address map. The number of ATX PLLs per link in the design is defined by the XCVR_PLL_PER_LINK parameter in the main.h header file. You are responsible to set the parameter correctly to reflect the system configuration.
int IORD_RESET_SEQUENCER_STATUS_REG (int link) Read reset sequencer status register at link and return the value.
int IORD_RESET_SEQUENCER_RESET_ACTIVE (int link) Read reset sequencer status register at link and return 1 if the reset active signal is asserted, else return 0.
void IOWR_RESET_SEQUENCER_INIT_RESET_SEQ (int link) Write reset sequencer at link to trigger full hardware reset sequence.
void IOWR_RESET_SEQUENCER_FORCE_RESET (int link , int val) Write reset sequencer at link to force assert or deassert resets based on the val value.
int IORD_JESD204_TX_STATUS0_REG (int link) Read the JESD204B TX CSR tx_status0 register at link and return the value.
int IORD_JESD204_TX_SYNCN_SYSREF_CTRL_REG (int link) Read the JESD204B TX CSR syncn_sysref_ctrl register at link and return the value.
void IOWR_JESD204_TX_SYNCN_SYSREF_CTRL_REG (int link , int val) Write val value into the JESD204B TX CSR syncn_sysref_ctrl register at link link.
int IORD_JESD204_RX_STATUS0_REG (int link) Read JESD204B RX CSR rx_status0 register at link link and return value.
int IORD_JESD204_RX_SYNCN_SYSREF_CTRL_REG (int link) Read JESD204B RX CSR syncn_sysref_ctrl register at link link and return value.
void IOWR_JESD204_RX_SYNCN_SYSREF_CTRL_REG (int link, int val) Write val value into the JESD204B RX CSR syncn_sysref_ctrl register at link.
int IORD_JESD204_TX_ILAS_DATA1_REG (int link) Read the JESD204B TX CSR ilas_data1 register at link and return the value.
int IORD_JESD204_RX_ILAS_DATA1_REG (int link) Read the JESD204B RX CSR ilas_data1 register at link and return the value.
void IOWR_JESD204_TX_ILAS_DATA1_REG (int link, int val) Write val value into the JESD204B TX CSR ilas_data1 register at link.
void IOWR_JESD204_RX_ILAS_DATA1_REG (int link, int val) Write val value into the JESD204B RX CSR ilas_data1 register at link.
int IORD_JESD204_TX_ILAS_DATA2_REG (int link) Read the JESD204B TX CSR ilas_data2 register at link and return the value.
int IORD_JESD204_RX_ILAS_DATA2_REG (int link) Read the JESD204B RX CSR ilas_data2 register at link and return the value.
void IOWR_JESD204_TX_ILAS_DATA2_REG (int link, int val) Write val value into the JESD204B TX CSR ilas_data2 register at link.
void IOWR_JESD204_RX_ILAS_DATA2_REG (int link, int val) Write val value into the JESD204B RX CSR ilas_data2 register at link.
int IORD_JESD204_TX_ILAS_DATA12_REG (int link) Read the JESD204B TX CSR ilas_data12 register at link and return the value.
int IORD_JESD204_RX_ILAS_DATA12_REG (int link) Read the JESD204B RX CSR ilas_data12 register at link and return the value.
void IOWR_JESD204_TX_ILAS_DATA12_REG (int link, int val) Write val value into the JESD204B TX CSR ilas_data12 register at link.
void IOWR_JESD204_RX_ILAS_DATA12_REG (int link, int val) Write val value into the JESD204B RX CSR ilas_data12 register at link.
int IORD_JESD204_TX_GET_L_VAL (int link) Read the JESD204B TX CSR ilas_data1 register at link and return the L value.
int IORD_JESD204_RX_GET_L_VAL (int link) Read the JESD204B RX CSR ilas_data1 register at link and return the L value.
int IORD_JESD204_TX_GET_F_VAL (int link) Read the JESD204B TX CSR ilas_data1 register at link and return the F value.
int IORD_JESD204_RX_GET_F_VAL (int link) Read the JESD204B RX CSR ilas_data1 register at link and return the F value.
int IORD_JESD204_TX_GET_K_VAL (int link) Read the JESD204B TX CSR ilas_data1 register at link and return the K value.
int IORD_JESD204_RX_GET_K_VAL (int link) Read JESD204B RX CSR ilas_data1 register at link link and return K value.
int IORD_JESD204_TX_GET_M_VAL (int link) Read the JESD204B TX CSR ilas_data1 register at link and return the M value.
int IORD_JESD204_RX_GET_M_VAL (int link) Read the JESD204B RX CSR ilas_data1 register at link and return the M value.
int IORD_JESD204_TX_GET_N_VAL (int link) Read the JESD204B TX CSR ilas_data1 register at link and return the N value.
int IORD_JESD204_RX_GET_N_VAL (int link) Read the JESD204B RX CSR ilas_data1 register at link and return the N value.
int IORD_JESD204_TX_GET_NP_VAL (int link) Read the JESD204B TX CSR ilas_data1 register at link and return the NP value.
int IORD_JESD204_RX_GET_NP_VAL (int link) Read the JESD204B RX CSR ilas_data1 register at link and return the NP value.
int IORD_JESD204_TX_GET_S_VAL (int link) Read the JESD204B TX CSR ilas_data1 register at link and return the S value.
int IORD_JESD204_RX_GET_S_VAL (int link) Read theJESD204B RX CSR ilas_data1 register at link and return the S value.
int IORD_JESD204_TX_GET_HD_VAL (int link) Read the JESD204B TX CSR ilas_data1 register at link and return the HD value.
int IORD_JESD204_RX_GET_HD_VAL (int link) Read the JESD204B RX CSR ilas_data1 register at link and return the HD value.
int IORD_JESD204_TX_LANE_CTRL_REG (int link, int offset) Read the JESD204B TX CSR lane_ctrl_* register at link and return the value.
int IORD_JESD204_RX_LANE_CTRL_REG (int link, int offset) Read the JESD204B RX CSR lane_ctrl_* register at link and return the value.
void IOWR_JESD204_TX_LANE_CTRL_REG (int link, int offset, int val) Write val value into the JESD204B TX CSR lane_ctrl_* register at link.
void IOWR_JESD204_RX_LANE_CTRL_REG (int link, int offset, int val) Write val value into the JESD204B RX CSR lane_ctrl_* register at link.
int IORD_PIO_CONTROL_REG (void) Read the PIO control register and return the value.
void IOWR_PIO_CONTROL_REG (int val) Write val value into the PIO control register.
int IORD_PIO_STATUS_REG (void) Read the PIO status register and return thevalue.
int IORD_JESD204_TX_TEST_MODE_REG (int link) Read the JESD204B TX CSR tx_test register at link and return the value.
int IORD_JESD204_RX_TEST_MODE_REG (int link) Read the JESD204B RX CSR rx_test register at link and return the value.
void IOWR_JESD204_TX_TEST_MODE_REG (int link, int val) Write val value into the JESD204B TX CSR tx_test register at link.
void IOWR_JESD204_RX_TEST_MODE_REG (int link, int val) Write val value into the JESD204B RX CSR rx_test register at link.
int IORD_JESD204_RX_ERR0_REG (int link) Read the JESD204B RX CSR rx_err0 register at link and return the value.
void IOWR_JESD204_RX_ERR0_REG (int link, int val) Write val value into the JESD204B RX CSR rx_err0 register at link.
int IORD_JESD204_RX_ERR1_REG (int link) Read the JESD204B RX CSR rx_err1 register at link and return the value.
void IOWR_JESD204_RX_ERR1_REG (int link, int val) Write val value into the JESD204B RX CSR rx_err1 register at link.
int IORD_JESD204_TX_ERR_REG (int link) Read the JESD204B TX CSR tx_err register at link link and return the value.
void IOWR_JESD204_TX_ERR_REG (int link, int val) Write val value into the JESD204B TX CSR tx_err register at link.
int IORD_XCVR_NATIVE_A10_REG (int link, int offset) Read the transceiver reconfiguration register at link and address offset at offset and return the value.
void IOWR_XCVR_NATIVE_A10_REG (int link, int offset, int val) Write val value into the transceiver reconfiguration register at link and address offset at offset.
int IORD_XCVR_ATX_PLL_A10_REG (int link, int instance, int offset) Read the ATX PLL reconfiguration register indicated by the instance number instance at link and address offset at offset and return the value.
void IOWR_XCVR_ATX_PLL_A10_REG (int link, int instance, int offset, int val) Write val value into the ATX PLL reconfiguration register indicated by instance number instance at link and address offset at offset.
int IORD_CORE_PLL_RECONFIG_C0_COUNTER_REG (void) Read the core PLL reconfiguration C0 counter register and return the value.
int IORD_CORE_PLL_RECONFIG_C1_COUNTER_REG (void) Read the core PLL reconfiguration C1 counter register and return the value.
void IOWR_CORE_PLL_RECONFIG_C0_COUNTER_REG (int val) Write val value into the core PLL reconfiguration C0 counter register.
void IOWR_CORE_PLL_RECONFIG_C1_COUNTER_REG (int val) Write val value into the core PLL reconfiguration C1 counter register.