Forum Discussion
Altera_Forum
Honored Contributor
21 years agoAccess to the PIO in eCos
Hi. What is the best way to access the PIO in eCos. I would like access to led_pio and button_pio. I would have been nice to be able to make a program similar to count_binary, but I don't know ho...
Altera_Forum
Honored Contributor
21 years agoYou can access the PIO regs file by just adding the following include paths to your compiler flags:
-I'$(SOPC_KIT_NIOS2)'/components/altera_avalon_pio/inc -I$(PREFIX)/include/cyg/hal As far as how to connect to an interrupt, you seem to have answered your own question in the code you posted. You connect by making calls to the three functions: cyg_drv_interrupt_create(), cyg_drv_interrupt_attach(), and cyg_drv_interrupt_unmask(). Details on how to use these functions can be found in the eCos documentation. Whether you do this in a similar manner to the count_pio example, or write a full blown driver is up to you (although I might be inclined to go for the former). If you do want to create a DEVTAB entry, then take a look at: packages/devs/touch/arm/ipaq/current/src/ipaq_ts.c for a simple example (that's the IPAQ touch screen driver). Finally, in the spirit of open source development, if you do come up with anything that you’d like to make available to others, or maybe even see in the next release – please post it to this forum http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif