Nios® II Software Developer Handbook

ID 683525
Date 8/28/2023
Public
Document Table of Contents

8.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, located below. 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 41.  Driver Functions for Lightweight Device Driver API
Function Purpose Example8
<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()
8 Based on component altera_avalon_jtag_uart.