Visible to Intel only — GUID: upd1656035051737
Ixiasoft
Visible to Intel only — GUID: upd1656035051737
Ixiasoft
8.9.1.1. Creating alt_sys_init.c Based on Associated Header Files
The Nios® V processor tools create alt_sys_init.c based on the header files associated with each device driver and software package. For a device driver, the header file must define the macros <component name>_INSTANCE and <component name>_INIT.
Like a device driver, a software package provides an INSTANCE macro, which alt_sys_init() invokes once. A software package header file can optionally provide an INIT macro.
Excerpt from an alt_sys_init.c File Performing Driver Initialization
#include "system.h" #include "sys/alt_sys_init.h" /* * device headers */ #include "altera_avalon_timer.h" #include "altera_avalon_uart.h" /* * Allocate the device storage */ ALTERA_AVALON_UART_INSTANCE( UART1, uart1 ); ALTERA_AVALON_TIMER_INSTANCE( SYSCLK, sysclk ); /* * Initialize the devices */ void alt_sys_init( void ) { ALTERA_AVALON_UART_INIT( UART1, uart1 ); ALTERA_AVALON_TIMER_INIT( SYSCLK, sysclk ); }