- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone.
I am using the DE2 2C35 Board with uClinux NOMMU an DE2_NET.sof and ptf. I would like to ask for a smart way to start developing own software. I would like to begin to control the LEDs. I am trying to port the example "Board Diagnostics" Project from Nios2 EDS into Linux. But how to start? I see: led = 0xff; IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, led); printf( "\nAll LEDs should now be on.\n" ); I searched for the defines and found: // altera_avalon_pio_regs.h# define IORD_ALTERA_AVALON_PIO_DATA(base) IORD(base, 0)# define IOWR_ALTERA_AVALON_PIO_DATA(base, data) IOWR(base, 0, data) // io.h# define IORD(BASE, REGNUM) __builtin_ldwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)))# define IOWR(BASE, REGNUM, DATA) __builtin_stwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)), (DATA)) But i am not quiet sure i this is the correct way. Any ideas? Are there examples somewhere how to access the hardware from uclinux?Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The correct way is to use the GPIO Kernel driver provided with the uClinux distribution:
http://www.nioswiki.com/gpio There are several article on accessing hardware in the Wiki. Generally hardware should be accessed via device drivers. With NoMMU it's possible to access hardware directly from user mode, for MMU this should be possible in some cases with "uio", but doing a device driver is more clean and more portable. -Michael
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