Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

How to read Register Field (RegField) of adsp in DS-5?

Hi everyone,

I am trying to read/write register field designed in adsp using bare-metal projects in DS-5.

In adsp, I configure the address for two register fields (e.g a = 1 and b = 2, data width = 32, address width = 16).

In Qsys, I connect bus of this component (containing two reg fields) to h2f_lw_axi_master bus, the base address of its is 0x0004_0000.

Then, in DS-5 I use alt_write_word() and alt_read_word() functions to write/read data to these register fields as following.# define ALT_LWFPGASLVS_OFST 0xff200000# define REGFIELD_BASE 0x0004000# define REG1_BASE 0x0001# define REG2_BASE 0x0002

The read/write data is

read_data = alt_read_word(ALT_LWFPGASLVS_OFST+ REGFIELD_BASE+REG1_BASE);

and

alt_write_word(ALT_LWFPGASLVS_OFST+ REGFIELD_BASE+REG1_BASE, 0x08);

I put these functions after alt_bridge_init (ALT_BRIDGE_LWH2F) runs successfully, but it is not working.

Is there anything wrong in my program? Please help me to solve it.

Thank you so much.

Thuc
No RepliesBe the first to reply