Visible to Intel only — GUID: mwh1416946863504
Ixiasoft
Visible to Intel only — GUID: mwh1416946863504
Ixiasoft
7.8.5.3.8. Setting Creation Example
#include "system.h" #ifdef MY_CUSTOM_DRIVER_SMALL int send_data( <args> ) { // Small implementation } #else int send_data( <args> ) { // fast implementation } #endif
A simple Boolean definition setting is added to your driver Tcl file. This feature allows BSP users to control your driver through the BSP settings interface. When users set the setting to true or 1, the BSP defines MY_CUSTOM_DRIVER_SMALL in either system.h or the BSP public.mk file. When the user compiles the BSP, your driver is compiled with the appropriate routine incorporated in the object file. When a user disables the setting, MY_CUSTOM_DRIVER_SMALL is not defined.
You add the MY_CUSTOM_DRIVER_SMALL setting to your driver as follows using the add_sw_setting Tcl command:
add_sw_setting boolean_define_only system_h_define small_driver
MY_CUSTOM_DRIVER_SMALL false
"Enable the small implementation of the driver for my_peripheral"
Each argument has several variants.
For more information about detailed usage and restrictions, refer to the "Nios II Software Build Tools Reference" chapter.