Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

header file for my DSP Builder peripheral

Altera_Forum
Honored Contributor II
956 Views

I've created a Nios system with a peripheral that I built in DSP Builder. Now, I want to program the system in Nios II 10.0 IDE. To write in my DSP peripheral I use the macro IOWR, but what .h file do I have to add? (For example, if you use the PIO, you have to add the file "altera_avalon_pio_regs.h" because in this file is defined the macro IOWR) 

 

Thanks.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
265 Views

Hi! 

 

IOWR and IORD are not defined in this *.h-file. In this file are macros defined which only use IOWR/IORD. 

 

For example 

 

--- Quote Start ---  

#define IORD_ALTERA_AVALON_PIO_DATA(base) IORD(base, 0)  

--- Quote End ---  

Meaning that the PIO_DATA-register lies at <BASE_ADDRESS> + (offset=0). 

 

Usually the developer who created the sopc-component write these reg-files so that a software-engineer can access the component more easily.  

If you are writing code using iord_altera_avalon_pio_data(base) your code becomes more readable. Of course you could use iord(base, offset). But then you have to take care that you are using the correct offset everytime you access your component. 

 

So in your case, you have to do it on your own or use IORD/IOWR directly, knowing which offset is for which register. 

 

Regards 

 

P.S.: I don't know, never used the DSP Builder. But maybe there is a tool/template for the DSP Builder?
0 Kudos
Altera_Forum
Honored Contributor II
265 Views

Thanks pillemann. 

 

I'll use IOWR/IORD directly.
0 Kudos
Reply