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.9.1.2. altera_avalon_jtag_uart.h Defining Macros

For example, altera_avalon_jtag_uart.h must define the macros ALTERA_AVALON_JTAG_UART_INSTANCE and ALTERA_AVALON_JTAG_UART_INIT.

The purpose of these macros is as follows:
  • The *_INSTANCE macro performs any required static memory allocation. For drivers, *_INSTANCE is invoked once per device instance, so that memory can be initialized on a per-device basis. For software packages, is invoked once.
  • The *_INIT macro performs runtime initialization of the device driver or software package. In the case of a device driver, both macros take two input arguments:
  • The first argument, name, is the capitalized name of the device instance.
  • The second argument, dev, is the lower case version of the device name. dev is the name given to the component at system generation time.

You can use these input parameters to extract device-specific configuration information from the system.h file.

The name of the header file must be as follows:
  • Device driver: <hardware component class>.h. For example, if your driver targets the altera_avalon_uart component, the file name is altera_avalon_uart.h.
  • Software packages <package name>.h. For example, if you create the software package with the following command:

    create_sw_package my_sw_package

    The header file is called my_sw_package.h.

For more information about a complete example, refer to any of the Intel supplied device drivers, such as the JTAG UART driver in <Intel Quartus Prime installation>/ip/sopc_builder_ip/altera_avalon_jtag_uart.