devcfg: xdevcfg_reg_readback_example.c File Reference

| devcfg Xilinx SDK Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
xdevcfg_reg_readback_example.c File Reference

## Overview

This file contains a design example using the DevCfg driver and hardware device.

This example prints out the values of all the configuration registers in the FPGA.

This example assumes that there is a UART Device or STDIO Device in the hardware system.

Note
  None.

MODIFICATION HISTORY:

      Ver   Who  Date     Changes

      3.1   sb  08/25/14  First Release
    *

## Macros
Configuration Type1 packet headers masks
#define | XDC_TYPE_SHIFT 29
#define | XDC_REGISTER_SHIFT 13
#define | XDC_OP_SHIFT 27
#define | XDC_TYPE_1 1
#define | OPCODE_READ 1

## Functions
int | XDcfgRegReadExample (u16 DeviceId)
| This function reads the configuration registers inside the FPGA. More...
int | XDcfg_GetConfigReg (XDcfg *DcfgInstancePtr, u32 ConfigReg, u32 *RegData)
| This function returns the value of the specified configuration register. More...
u32 | XDcfg_RegAddr (u8 Register, u8 OpCode, u8 Size)
| Generates a Type 1 packet header that reads back the requested Configuration register. More...
int | main (void)
| Main function to call the DevCfg Reg Read example. More...

## Function Documentation

int main | ( | void |  | ) |

Main function to call the DevCfg Reg Read example.

Parameters

  None. |

Returns
  - XST_SUCCESS if successful
  - XST_FAILURE if unsuccessful

Note
  None.

References XDcfgRegReadExample().

int XDcfg_GetConfigReg | ( | XDcfg * | DcfgInstancePtr,
|  | u32 | ConfigReg,
|  | u32 * | RegData
| ) |  |

This function returns the value of the specified configuration register.

Parameters

  InstancePtr | is a pointer to the XHwIcap instance.
  ConfigReg | is a constant which represents the configuration register value to be returned.
  RegData | is the value of the specified configuration register.

Returns
  - XST_SUCCESS if successful
  - XST_FAILURE if unsuccessful

Note
  None.

References XDcfg_Config::BaseAddr, XDcfg::Config, XDCFG_DMA_INVALID_ADDRESS, XDcfg_InitiateDma(), XDcfg_IntrClear(), XDcfg_IntrGetStatus(), XDCFG_IXR_D_P_DONE_MASK, XDCFG_IXR_DMA_DONE_MASK, XDCFG_IXR_PCFG_DONE_MASK, XDcfg_ReadReg, XDcfg_RegAddr(), XDCFG_STATUS_DMA_CMD_Q_F_MASK, XDCFG_STATUS_OFFSET, and XDcfg_Transfer().

Referenced by XDcfgRegReadExample().

u32 XDcfg_RegAddr | ( | u8 | Register,
|  | u8 | OpCode,
|  | u8 | Size
| ) |  |

Generates a Type 1 packet header that reads back the requested Configuration register.

Parameters

  Register | is the address of the register to be read back.
  OpCode | is the read/write operation code.
  Size | is the size of the word to be read.

Returns
  Type 1 packet header to read the specified register

Note
  None.

Referenced by XDcfg_GetConfigReg().

int XDcfgRegReadExample | ( | u16 | DeviceId | ) |

This function reads the configuration registers inside the FPGA.

Parameters

  DeviceId | is the unique device id of the device.

Returns
  - XST_SUCCESS if successful
  - XST_FAILURE if unsuccessful

Note
  None.

References XDcfg_Config::BaseAddr, XDcfg_CfgInitialize(), XDcfg_GetConfigReg(), XDcfg_LookupConfig(), and XDcfg_SelfTest().

Referenced by main().