Forum Discussion
Altera_Forum
Honored Contributor
20 years agoaddress
How can I access "my own component" I/O ports in Nios IDE?
What I should write in file "*_regs.h"? How address and offset calculates? eg: //#define IOADDR_PDIUSBD12_DATA(base) __IO_CALC_ADDRESS_NATIVE(base, 0)# define IORD_USB_USB_DATA(base) IORD(base, 0) # define IOWR_USB_USB_DATA(base, data) IOWR(base, 0, data) //#define IOADDR_PDIUSBD12_COMMAND(base) __IO_CALC_ADDRESS_NATIVE(base, 1)# define IORD_USB_USB_COMMAND(base) IORD(base, 1) # define IOWR_USB_USB_COMMAND(base, data) IOWR(base, 1, data) ---why the offset IORD_USB_USB_DATA is "0",IORD_USB_USB_COMMAND is "1"2 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by nwpu_zhf2004@Apr 11 2006, 06:17 AM how can i access "my own component" i/o ports in nios ide?what i should write in file "*_regs.h"?
how address and offset calculates?
eg:
//#define ioaddr_pdiusbd12_data(base) __io_calc_address_native(base, 0)# define iord_usb_usb_data(base) iord(base, 0) # define iowr_usb_usb_data(base, data) iowr(base, 0, data)
//#define ioaddr_pdiusbd12_command(base) __io_calc_address_native(base, 1)# define iord_usb_usb_command(base) iord(base, 1) # define iowr_usb_usb_command(base, data) iowr(base, 1, data)
---why the offset iord_usb_usb_data is "0",iord_usb_usb_command is "1"
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=14238)
--- quote end ---
--- Quote End --- Address offset is defined in hardware register file which translates low level software I/O call to corresponding hardware addressing calls.
- Altera_Forum
Honored Contributor
If you use NiosII IDE,the hardware address must be assigned in the SOPC Builder.
Then pushing "generate" button can make the file called as "system.h".All device's address of you are listed in it.