Visible to Intel only — GUID: iga1430779800353
Ixiasoft
Visible to Intel only — GUID: iga1430779800353
Ixiasoft
1. Guidelines for Developing a Nios II HAL Device Driver
This application note explains the process of creating and debugging a hardware abstraction layer (HAL) software device driver. The included example of a HAL software device driver, called my_uart_driver, illustrates various software development stages. The example driver targets the Altera_Avalon_UART device, connected through a Vectored Interrupt Controller (VIC) to the Nios® II processor.
This application note helps you with custom device driver development for Nios II systems in the following ways:
- Shows the development process steps, from sending bits out the transmit pin in the main() through the construction of device access macros and automatic device initialization in alt_sys_init()
- Shows how to develop a driver with the command-line based Nios II Software Build Tools (SBT)
- Shows how to create applications and a board support package (BSP) based on your driver
- Shows how to import and debug the applications and BSP with the Nios II Software Build Tools for Eclipse
- Explains interrupt latency, interrupt nesting, and determinism
- Identifies system calls that cannot be included in a device driver interrupt service routine (ISR)
- Describes debugging tips and techniques, such as identifying UART transmission errors
For more information about the HAL, refer to the "Overview of the Hardware Abstraction Layer" chapter in the Nios II Software Developer's Handbook. For more information about interrupt latency, refer to the "Exception Handling" chapter in the Nios II Software Developer's Handbook.
Section Content
Prerequisites for HAL Device Driver Development
Developing the HAL UART Device Driver
Debugging the bit_bang_uart Project
The BitBangUartTransmit() Function
The BitBangUartReceive() Function
Creating Device Hardware Access Macros
Staging the HAL Device Driver Development
Understanding the Hardware-Specific INSTANCE and INIT Macros
Integrating a New HAL Device Driver in the BSP
Understanding HAL Mutual Exclusion Resources
Overview of Debugging Tools for HAL Device Drivers
Debugging the HAL UART Device Driver
Conclusion
Document Revision History