Thomas Heijligen has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/75236 )
Change subject: meson: Add support for ni845x_spi on windows ......................................................................
meson: Add support for ni845x_spi on windows
Change-Id: I2d32f11852ac1a5184af8e8683ca1914a6e72973 Signed-off-by: Thomas Heijligen thomas.heijligen@secunet.com --- M meson.build M meson_options.txt M ni845x_spi.c 3 files changed, 43 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/36/75236/1
diff --git a/meson.build b/meson.build index b04f7e5..cd52b1e 100644 --- a/meson.build +++ b/meson.build @@ -149,6 +149,21 @@ libftdi1 = dependency('libftdi1', required : group_ftdi) libjaylink = dependency('libjaylink', required : group_jlink)
+if host_machine.system() == 'windows' + _libni845x = cc.find_library('ni845x', + dirs : get_option('ni845x_search_path'), + required : get_option('programmer').contains('ni845x_spi')) +else + _libni845x = dependency('', required : false) +endif +if _libni845x.found() + libni845x = declare_dependency( + dependencies : [ _libni845x ], + include_directories : [ get_option('ni845x_search_path') ]) +else + libni845x = _libni845x +endif + subdir('platform')
if systems_hwaccess.contains(host_machine.system()) @@ -369,6 +384,14 @@ 'flags' : [ '-DCONFIG_MSTARDDC_SPI=1' ], 'default' : false }, + 'ni845x_spi' : { + 'systems' : [ 'windows' ], + 'cpu_families' : [ 'x86' ], # The required ni845x library is 32-bit only + 'deps' : [ libni845x ], + 'srcs' : files('ni845x_spi.c'), + 'flsgs' : [ '-DCONFIG_NI845X_SPI=1' ], + 'default' : false, + }, 'nic3com' : { 'systems' : systems_hwaccess, 'cpu_families' : cpus_port_io, diff --git a/meson_options.txt b/meson_options.txt index 732d8d52..e62deb6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -13,10 +13,12 @@ 'asm106x', 'atahpt', 'atapromise', 'atavia', 'buspirate_spi', 'ch341a_spi', 'ch347_spi','dediprog', 'developerbox_spi', 'digilent_spi', 'dirtyjtag_spi', 'drkaiser', 'dummy', 'ft2232_spi', 'gfxnvidia', 'internal', 'it8212', 'jlink_spi', 'linux_mtd', 'linux_spi', 'mediatek_i2c_spi', - 'mstarddc_spi', 'nic3com', 'nicintel', 'nicintel_eeprom', 'nicintel_spi', 'nicnatsemi', + 'mstarddc_spi', 'ni845x_spi', 'nic3com', 'nicintel', 'nicintel_eeprom', 'nicintel_spi', 'nicnatsemi', 'nicrealtek', 'ogp_spi', 'parade_lspcon', 'pickit2_spi', 'pony_spi', 'raiden_debug_spi', 'rayer_spi', 'realtek_mst_i2c_spi', 'satamv', 'satasii', 'serprog', 'stlinkv3_spi', 'usbblaster_spi', ], description: 'Active programmers') option('llvm_cov', type : 'feature', value : 'disabled', description : 'build for llvm code coverage') option('man-pages', type : 'feature', value : 'auto', description : 'build the man-page for classic_cli') option('documentation', type : 'feature', value : 'auto', description : 'build the html documentation') +option('ni845x_search_path', type : 'string', value : 'C:\Program Files (x86)\National Instruments\Ni-845x\MS Visual C', + description : 'Path to search for the proprietary ni845x library and header (32-bit Windows only)') diff --git a/ni845x_spi.c b/ni845x_spi.c index d4ae294..6e7bb76 100644 --- a/ni845x_spi.c +++ b/ni845x_spi.c @@ -15,6 +15,13 @@ * */
+/* The ni845x header does need the WIN32 symbol to be defined and meson does not do it. + * Define it just here, since this driver will only work on 32-bit Windows. + */ +#ifndef WIN32 +#define WIN32 +#endif + #include <ctype.h> #include <inttypes.h> #include <string.h>