diff options
author | Thomas Heijligen <thomas.heijligen@secunet.com> | 2022-02-19 21:17:44 +0100 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2022-04-12 09:55:45 +0000 |
commit | 6272c71fbbfb26ebde9954708f74f875c083f822 (patch) | |
tree | b63df2390c6826bb19022772267a48557266f784 /meson.build | |
parent | b94a5a21c34877082477af7a7f29f952f5364944 (diff) | |
download | flashrom-6272c71fbbfb26ebde9954708f74f875c083f822.tar.gz flashrom-6272c71fbbfb26ebde9954708f74f875c083f822.tar.bz2 flashrom-6272c71fbbfb26ebde9954708f74f875c083f822.zip |
hwaccess: replace macros by C code
Split the code for endian conversion into separate files for big and
little endian. The buildsystem selects the correct file for the used
endianness. Replace the swab macros with `static inline` c functions.
Define macros for returning the same or swapped value. Call those macros
in the endian specific files.
Change-Id: I86d38d816b37c283279c485fac8027f8fb94364a
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/62898
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/meson.build b/meson.build index b7fc25fb..0643b5fd 100644 --- a/meson.build +++ b/meson.build @@ -29,13 +29,6 @@ add_project_arguments('-D_POSIX_C_SOURCE=200809L', language : 'c') # required fo add_project_arguments('-D_BSD_SOURCE', language : 'c') # required for glibc < v2.19 add_project_arguments('-DFLASHROM_VERSION="' + meson.project_version() + '"', language : 'c') -if host_machine.endian() == 'little' - add_project_arguments('-D__FLASHROM_LITTLE_ENDIAN__=1', language : 'c') -endif -if host_machine.endian() == 'big' - add_project_arguments('-D__FLASHROM_BIG_ENDIAN__=1', language : 'c') -endif - if host_machine.system() in ['cygwin', 'windows'] add_project_arguments('-DIS_WINDOWS=1', language : 'c') else @@ -142,6 +135,15 @@ if cc.check_header('sys/utsname.h') add_project_arguments('-DHAVE_UTSNAME=1', language : 'c') endif +if host_machine.endian() == 'little' + srcs += 'hwaccess_endian_little.c' + add_project_arguments('-D__FLASHROM_LITTLE_ENDIAN__=1', language : 'c') +endif +if host_machine.endian() == 'big' + srcs += 'hwaccess_endian_big.c' + add_project_arguments('-D__FLASHROM_BIG_ENDIAN__=1', language : 'c') +endif + # some programmers require libusb if get_option('usb') srcs += 'usbdev.c' |