--- Quote Start ---
originally posted by atjung+jun 8 2006, 05:32 am--><div class='quotetop'>quote (atjung @ jun 8 2006, 05:32 am)</div>
--- quote start ---
<!--quotebegin-fplank@Jun 5 2006, 02:55 AM
hello
thanks, but i know this paper (nios ii hardware development tutorial ) allready. this paper shows fine how to build a soc with standard components.
but my problem is, that i have a own component topach_avalonslave wich a
avalonreadslave base adr:0xyyyyyyyy and avalonwriteslvae base adr: 0xzzzzzzzz
and my question is how can i write an value like int i=2 on the avalonwriteslave and how can i read the value from the avalonreadslave?
can i use the macros like
iowr_altera_avalon_pio_data(????;i);
thanks for your help
lg florian
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=15908)
--- quote end ---
--- Quote End ---
Hi lg florian,
It sounds like what you want to do are memory mapped IOs. You can declare a pointer to the address locations directly (or use the system.h declarations of the component's base address with an offset).
Then you only have to write a value to a pointer location or read back a value from a pointer location in your program.
It may look something like this (this is a very simple way of doing this, I'm sure there are much better ways):
// defines LED_BASE to have address value # define LED_BASE 0xyyyyyyyy
volatile unsigned int *led_port = ((volatile unsigned int *) (LED_BASE));
// declares pointer to LED_BASE address location
.
.
void main()
.
.
*led_port = 0x5555aaaa; // writes value to LEd_BASE address
.
.
I hope this helps.
Regards,
-ATJ
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16016)</div>
[/b]
--- Quote End ---
!!! DON'T DO THAT - IT WILL NOT WORK IF YOU HAVE EANBLED THE DATA CACHE OF YOUR CPU. !!!
Allways use the macros from the IOWR() and IORD() family to access anything besides real memory.
look at %nios_install_dir%/components/altera_nios2/HAL/inc/io.h how to use them...
regards
Stonie