Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

Very simple question about PIO

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;

can you explain me how to use PIO register...for example if i want to read

a pio register... i do PIO->np_piodata..

Why does the function of " np_piodirection"

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ph34r.gif http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ph34r.gif http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ph34r.gif http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ph34r.gif

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    in general if you want learn something about the peripherials, you might want to read "Altera Embeeded Peripherals Handbook" (n2cpu_nii5v3.pdf).

    However you should use inl(...) for reading and outl(...) for writing the hardware register.

    Accessing the hardware register with such a structure is a "Nios speciality".