Nios® V Processor Software Developer Handbook

ID 743810
Date 5/26/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

7.7.1.1.2. Default Behavior for Functions Defined in alt_dev

A driver is not required to provide all of the functions in the alt_dev structure. If a given function pointer is set to NULL, a default action is used instead.
Table 30.  Default Behavior for Functions Defined in alt_dev
Function Default Behavior
open Calls to open() for this device succeed, unless the device was previously locked by a call to ioctl() with req = TIOCEXCL.
close Calls to close() for a valid file descriptor for this device always succeed.
read Calls to read() for this device always fail.
write Calls to write() for this device always fail.
lseek Calls to lseek() for this device always fail.
fstat The device identifies itself as a character mode device.
ioctl ioctl() requests that cannot be handled without reference to the device fail.

In addition to the function pointers, the alt_dev structure contains two other fields: llist and name. llist is for internal use, and must always be set to the value ALT_LLIST_ENTRY. name is the location of the device in the HAL file system and is the name of the device as defined in system.h.