Guidelines for Developing a Nios II HAL Device Driver

ID 683146
Date 6/12/2015
Public
Document Table of Contents

1.8. Understanding the Hardware-Specific INSTANCE and INIT Macros

The INSTANCE macro creates the alt_dev structure, which represents the component instance. This macro creates unique component instance-specific data structures.

The INIT macro must perform the following tasks:

  • Create mutual exclusion resources
  • Install the component's ISR with alt_ic_isr_register()

    The my_uart_driver example driver supports both the enhanced and the legacy HAL interrupt APIs. Supporting both APIs ensures that the driver can be used in combination with legacy drivers supporting only the legacy API. For information about supporting both APIs, refer to "Interrupt Service Routines" in the "Exception Handling" chapter in the Nios II Software Developer's Handbook.

  • Register the alt_dev structure with alt_dev_reg()
  • Enable interrupts

Did you find the information on this page useful?

Characters remaining:

Feedback Message