Forum Discussion
Altera_Forum
Honored Contributor
17 years agoUsing np_pio and other stuff in custom program
Hello, I've read Philipp Lutz's tutorial and his code for the drivers for altera de2 board. I saw that he used np_pio struct and stuff from other .h, like asm/io.h. I'm a newbie try...
Altera_Forum
Honored Contributor
17 years agoThis kind of I/O access in user space is not portable at all and thus I'd not do this (other than for primary testing purpose).
Especially as, soon, we will be able to use the MMU that optionally can be activated with SOPC builder when doing a NIOS design. ( -> http://www.nioswiki.com/linux (http://www.nioswiki.com/linux) ) Here a decent Linux-standard conform access to I/O is necessary. There are many ways to do this: writing a dedicated Kernel driver, that does the (maybe even quite complex) low-level I/O for the user land software (you might take a look at the "piobutton" driver for the altera demo board; linux-2.6/drivers/char/altera_pio_button.c) , using a non-dedicated driver concept like providing an "mmap" view to the I/O addresses for the user land software (see: http://www.nioswiki.com/accessing_hardware..._space_programs (http://www.nioswiki.com/accessing_hardware_registers_from_user_space_programs) ) or using "uio" (which I did not explore yet). -Michael