I think the only way to transmit those kind of parameters to the C/C++ app is through a custom component. Please note that this example is quite old, I'm still working on a design with Quartus 11 and SOPC builder, but I think it should still apply to QSys and HPS designs.
All those lines need to be put in the component's *_hw.tcl file
The component needs a custom elaboration callback
set_module_property ELABORATION_CALLBACK elaboration_proc
Create a generic parameter for the component that takes a clock frequency as value
add_parameter CLOCK_FREQ Integer
set_parameter_property CLOCK_FREQ SYSTEM_INFO { CLOCK_RATE clock }
set_parameter_property CLOCK_FREQ VISIBLE False
set_parameter_property CLOCK_FREQ AFFECTS_ELABORATION True
set_parameter_property CLOCK_FREQ AFFECTS_GENERATION False
For that property to work you need a clock input port with the "clock" name
# +-----------------------------------
# | connection point clock
# |
add_interface clock clock end
set_interface_property clock clockRate 0
set_interface_property clock ENABLED true
add_interface_port clock csi_sys_Clk clk Input 1
And then in the elaboration procedure you can transmit the value to the software layer
# custom elaboration procedure
proc elaboration_proc { } {
set_module_assignment embeddedsw.CMacro.CLOCK_FREQ
}
It's probably overkill if you don't already have a custom component with custom driver but it's the only way I know, other than parsing the sopcinfo file yourself.