Nios® V Processor Software Developer Handbook

ID 743810
Date 7/20/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.2. Register a Character Device

After you create an instance of the alt_dev structure, the device must be made available to the system by registering it with the HAL and by calling the following function:

int alt_dev_reg (alt_dev* dev)

This function takes a single input argument, which is the device structure to register. The return value is zero upon success. A negative return value indicates that the device cannot be registered.

After a device is registered with the HAL file system, you can access it through the HAL API and the ANSI C standard library. The node name for the device is the name specified in the alt_dev structure.

For more information, refer to the Developing Programs Using the Hardware Abstraction Layer section.