Altera_Forum
Honored Contributor
16 years agoarch/nios2/.../gpio.h versus PIO peripheral
I am looking at the file in linux-2.6/include/nios2/include/asm/gpio.h in the source code I downloaded from the NiosWiki.
See https://www.alteraforum.com/forum/attachment.php?attachmentid=1945 It doesn't seem to match up at all with the register map shown in the PIO data sheet found here: http://www.altera.com/literature/hb/nios2/n2cpu_nii51007.pdf Unfortunately, the functions in gpio.h are used by the bit-banged GPIO/I2C driver and thus do not work. Has anyone else noticed this? Is there another version of the gpio.h file? Thanks, Dave ... P.S. Oddly enough, there is some other code in that same Linux release that exercises the PIO peripheral to toggle LEDs. That code matches the datasheet exactly and can be found in .../linux-2.6/include/nios2/include/asm/pio.h and pio_struct.h. It uses the following structure:
// PIO Registers
typedef volatile struct
{
int np_piodata; // read/write, up to 32 bits
int np_piodirection; // write/readable, up to 32 bits, 1->output bit
int np_piointerruptmask; // write/readable, up to 32 bits, 1->enable interrupt
int np_pioedgecapture; // read, up to 32 bits, cleared by any write
} np_pio;