Nios II Classic Software Developer’s Handbook

ID 683282
Date 5/14/2015
Public
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.