Nios II Classic Software Developer’s Handbook

ID 683282
Date 5/14/2015
Public
Document Table of Contents

7.10.2.1. Using Character-Mode Functions

The lightweight device driver API allows you to minimize the overhead of character-mode device drivers. It does this by removing the need for the alt_fd file descriptor table, and the alt_dev data structure required by each driver instance.

If you want to support the lightweight device driver API on a character-mode device, you need to write at least one of the lightweight character-mode functions listed in the "Driver Functions for Lightweight Device Driver API" table (Table 7–7). Implement the functions needed by your software. For example, if you only use the device for stdout, you only need to implement the <component class>_write () function.

Table 40.  Driver Functions for Lightweight Device Driver API
Function Purpose Example7
<component class>_read () Implements character-mode read functions altera_avalon_jtag_uart_read()
<component class>_write () Implements character-mode write functions altera_avalon_jtag_uart_write()
<component class>_ioctl () Implements device-dependent functions altera_avalon_jtag_uart_ioctl()
7 Based on component altera_avalon_jtag_uart.