Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
공지
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 토론

accessing hardware - a smart start?

Altera_Forum
명예로운 기여자 II
1,158 조회수

Hello everyone. 

 

I am using the DE2 2C35 Board with uClinux NOMMU an DE2_NET.sof and ptf. 

 

I would like to ask for a smart way to start developing own software. 

 

I would like to begin to control the LEDs. 

 

I am trying to port the example "Board Diagnostics" Project from Nios2 EDS into Linux. 

 

But how to start? 

 

I see: 

 

led = 0xff; 

IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, led); 

printf( "\nAll LEDs should now be on.\n" ); 

 

I searched for the defines and found: 

// altera_avalon_pio_regs.h# define IORD_ALTERA_AVALON_PIO_DATA(base) IORD(base, 0)# define IOWR_ALTERA_AVALON_PIO_DATA(base, data) IOWR(base, 0, data) 

 

// io.h# define IORD(BASE, REGNUM)  

__builtin_ldwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)))# define IOWR(BASE, REGNUM, DATA)  

__builtin_stwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)), (DATA)) 

 

 

But i am not quiet sure i this is the correct way. 

 

 

Any ideas? Are there examples somewhere how to access the hardware from uclinux?
0 포인트
1 응답
Altera_Forum
명예로운 기여자 II
491 조회수

The correct way is to use the GPIO Kernel driver provided with the uClinux distribution: 

http://www.nioswiki.com/gpio 

 

There are several article on accessing hardware in the Wiki. Generally hardware should be accessed via device drivers. With NoMMU it's possible to access hardware directly from user mode, for MMU this should be possible in some cases with "uio", but doing a device driver is more clean and more portable. 

 

-Michael
0 포인트
응답