Hallo
I want to write a C program. This C program should use a led on my NIOS II Evaluation Kit, Cyclone Edition. I think i can use the command outl but i believe i must use the include header asm/io. My first question. Is that correct? But i have not this header. So what can i do. Have anyone an idea? Have anyone this header? Thanks链接已复制
2 回复数
#define inl(addr)
({ unsigned int __res; __asm__ __volatile__( "ldwio %0, 0(%1)" : "=r"(__res) : "r" (addr)); __res; }) //----------------------------------------------------------------------- # define inb(addr) ({ unsigned int __res; __asm__ __volatile__( "ldbio %0, 0(%1)" : "=r"(__res) : "r" (addr)); __res; }) //----------------------------------------------------------------------- # define outl(b,addr) ({ __asm__ __volatile__( "stwio %0, 0(%1)" : : "r"(http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif , "r" (addr)); }) //----------------------------------------------------------------------- # define outw(b,addr) ({ __asm__ __volatile__( "sthio %0, 0(%1)" : : "r"(http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif , "r" (addr)); }) //----------------------------------------------------------------------- # define outb(b,addr) ({ __asm__ __volatile__( "stbio %0, 0(%1)" : : "r"(http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif , "r" (addr)); })