Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

custom component and system.h

Altera_Forum
Honored Contributor II
988 Views

Hi, 

I have create some components for SoPC Builder and now I am working on the device drivers. 

Some of my components serialize datas and I need to setup the output frequency. 

This frequency is function of the avalon port clock frequency. 

 

I see that for custom component, the avalon port clock frequency isn't reported in the system.h file ! 

 

For some components like the ALTERA_AVALON_UART, when I create the system library I can find the frequency of the avalon port input clock. 

#define <component_name>_FREQ            50000000 

 

Someone know how to do that for custom components ? 

 

Thanks for any help 

 

Fabrice
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
276 Views

Hello, 

 

It's allready some time ago, but I found a solution for QSYS: 

 

In the xxx_hw.tcl: 

# # parameters# add_parameter CLOCK_RATE POSITIVE 100000000 "" set_parameter_property CLOCK_RATE DEFAULT_VALUE 100000000 set_parameter_property CLOCK_RATE DISPLAY_NAME CLOCK_RATE set_parameter_property CLOCK_RATE WIDTH "" set_parameter_property CLOCK_RATE TYPE POSITIVE set_parameter_property CLOCK_RATE UNITS Hertz set_parameter_property CLOCK_RATE DESCRIPTION "" set_parameter_property CLOCK_RATE HDL_PARAMETER true set_parameter_property CLOCK_RATE SYSTEM_INFO_TYPE CLOCK_RATE set_parameter_property CLOCK_RATE SYSTEM_INFO_ARG clock # # parameters for system.h# set in ELABORATION_CALLBACK because only then, the parameters are set...# set_module_property ELABORATION_CALLBACK elaborate proc elaborate {} { set_module_assignment embeddedsw.CMacro.FREQ u }  

 

This gives the folowing line in system.h: 

 

#define MODULE_NAME_FREQ 100000000u 

 

This solution is not realy documented somewhere. But it looks like  

set_module_assignment embeddedsw.CMacro.XXX text 

defines 

#define MODULE_NAME_XXX text 

 

For the clock frequenty, this can only be done in the elaborate callback because the clock is not known at loading time. 

 

Regards, 

Hannes
0 Kudos
Reply