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++
12748 Discussions

How can I write a simple driver ?

Altera_Forum
Honored Contributor II
1,178 Views

Hello, 

 

I want to know the different things to write a simple driver in Nios IDE. Because I've already written a driver but It wasn't in Nios IDE. 

 

David
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
473 Views

Hi 

For components already in the system, go through NIOS software development manual. For peripherals you need to the following 

You want to go through the following steps 

1. include "system.h" which shall contain the base address to your peripheral. 

2. make a file <peripheral_name.h> and define your register accesses in it. 

Eg. If your perihperal has a 2 registers, define the following# define MY_PERIPHERAL_REG1_WR(MY_PERPHERAL_BASE,data) IOWR(base, 0,data)# define MY_PERIPHERAL_REG1_RD(MY_PERPHERAL_BASE,data) IOWR(base, 0) 

 

 

This defines your RD and WR access. Remember that the "0" after base refers to the offset from the base address. 

 

Feel free to use this.
0 Kudos
Reply