Specifications
Related Information
• Header Files and alt_sys_init.c on page 7-28
• Provide a Software Initialization Function on page 7-15
Provide a Software Initialization Function
The *INSTANCE() macro inserts a pointer to your initialization function in the alt_iniche_dev
structure.
For more information, refer to the “Provide *INSTANCE and *INIT Macros” chapter.
Your software initialization function must perform at least the following three tasks:
• Initialize the hardware and verify its readiness
• Finish initializing the alt_iniche_dev structure
• Call get_mac_addr()
The initialization function must perform any other initialization your driver needs, such as creation and
initialization of custom data structures and ISRs.
For more information about the get_mac_addr() function, refer to the "Ethernet and the NicheStack
TCP/IP Stack - Nios II Edition" chapter.
For more information about an example of a software initialization function, refer to
alt_avalon_lan91c111_init() in <SMSC path>/src/iniche/smsc91x.c.
Related Information
• Provide *INSTANCE and *INIT Macros on page 7-14
• Ethernet and the NicheStack TCP/IP Stack - Nios II Edition on page 11-1
Integrating a Device Driver in the HAL
The Nios II SBT can incorporate device drivers and software packages supplied by Altera, supplied by
other third-party developers, or created by you. This section describes how to prepare device drivers and
software packages so the BSP generator recognizes and adds them to a generated BSP.
You can take advantage of this service, whether you created a device driver for one of the HAL generic
device models, or you created a peripheral-specific device driver.
Note:
The process required to integrate a device driver is nearly identical to that required to develop a
software package. The following sections describe the process for both. Certain steps are not
needed for software packages, as noted in the text.
Overview
To publish a device driver or a software package, you provide the following items:
• A header file defining the package or driver interface
• A Tcl script specifying how to add the package or driver to a BSP
The header file and Tcl script are described in the following sections.
NII5V2
2015.05.14
Provide a Software Initialization Function
7-15
Developing Device Drivers for the Hardware Abstraction Layer
Altera Corporation
Send Feedback