- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
1)Where can I find IOR/IOW macros for component i build with sopc component editor? (i mean "user logic" component). Is there any file containing macros list that i can use for my component? 2)Where can I find macros for IRQs handling? thanks in advanceLink Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Include the following files:
#include <sys/alt_irq.h># include <altera_avalon_pio_regs.h>
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SoPC builder does not automatically create macros for your custom user component. You must do this yourself.
Look at one of the existing <component>_regs.h file as an example. Typically you include the <io.h> header file in your header file to gain access to the IOWR and IORD macros. All the information you need to access your component is compiled into the "system.h" file in your BSP or syslib software project. This will have things like the base address of your component on the NIOS' bus. As for as irq handling, the functions for working with interrupts are indicated in the HAL API reference document http://www.altera.com/literature/hb/nios2/n2sw_nii52010.pdf Again, macros you need that tell you which IRQ number your component is using are in the "system.h" file. Jake- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Alternatively define a C struct that maps your device registers.
Define an 'extern' variable of that type. Use the linker to place the variable at the correct address - setting the high address bit if you have the data cache enabled. You either need to make the structure members 'volatile', or put 'asm volatile("" ::: "memory")' in the C source at appropriate points to ensure gcc doesn't have any values cached in registers. Note that gcc generates additional instrctions for 8 and 16 bit volatile data.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you all for your answers and information :)
I'm not sure i understand exactly the meaning of 'volatile'. I guess i have to do some more reading in order to make things right in the system i'm building.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page