Nios® V Processor Software Developer Handbook

ID 743810
Date 10/31/2022
Public

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

Document Table of Contents

12.1.1.17. alt_dev_reg()

Prototype

int alt_dev_reg(alt_dev* dev)

Commonly Called By

Device drivers

Thread-safe

No.

Available from ISR

No.

Include

<sys/alt_dev.h>

Description

The alt_dev_reg() function registers a device with the system. After it is registered, you can access a device using the standard I/O functions.

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

The system behavior is undefined in the event that a device is registered with a name that conflicts with an existing device or file system.

The alt_dev_reg() function is not thread-safe in the sense that no other thread can use the device list at the time that alt_dev_reg() is called. Call alt_dev_reg() only in the following circumstances:

  • When running in single-threaded mode.
  • From a device initialization function called by alt_sys_init(). alt_sys_init() may only be called by the single-threaded C startup code.

Return

The return value is zero upon success. A negative return value indicates failure.