summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
Diffstat (limited to 'board')
-rw-r--r--board/cr50/build.mk4
-rw-r--r--board/cr50/tpm2/endian.h39
2 files changed, 5 insertions, 38 deletions
diff --git a/board/cr50/build.mk b/board/cr50/build.mk
index 7cdc079bde..d2fe6309bd 100644
--- a/board/cr50/build.mk
+++ b/board/cr50/build.mk
@@ -40,6 +40,10 @@ EXTLIB := $(realpath ../../third_party/tpm2)
CFLAGS += -I$(EXTLIB)
LDFLAGS_EXTRA += -L$(out)/tpm2 -ltpm2
+# For the benefit of the tpm2 library.
+INCLUDE_ROOT := $(abspath ./include)
+CFLAGS += -I$(INCLUDE_ROOT)
+
# Add dependencies on that library
$(out)/RO/ec.RO.elf: $(out)/tpm2/libtpm2.a
$(out)/RW/ec.RW.elf: $(out)/tpm2/libtpm2.a
diff --git a/board/cr50/tpm2/endian.h b/board/cr50/tpm2/endian.h
index 893a794c16..b5b64d3bea 100644
--- a/board/cr50/tpm2/endian.h
+++ b/board/cr50/tpm2/endian.h
@@ -6,43 +6,6 @@
#ifndef __EC_BOARD_CR50_TPM2_ENDIAN_H
#define __EC_BOARD_CR50_TPM2_ENDIAN_H
-#include <stddef.h>
-#include <stdint.h>
-
-static inline void swap_n(void *in, void *out, size_t size)
-{
- int i;
-
- for (i = 0; i < size; i++)
- ((uint8_t *)out)[size - i - 1] = ((uint8_t *)in)[i];
-}
-
-static inline uint16_t be16toh(uint16_t in)
-{
- uint16_t out;
-
- swap_n(&in, &out, sizeof(out));
- return out;
-}
-
-static inline uint32_t be32toh(uint32_t in)
-{
- uint32_t out;
-
- swap_n(&in, &out, sizeof(out));
- return out;
-}
-
-static inline uint64_t be64toh(uint64_t in)
-{
- uint64_t out;
-
- swap_n(&in, &out, sizeof(out));
- return out;
-}
-
-#define htobe16 be16toh
-#define htobe32 be32toh
-#define htobe64 be64toh
+#include "byteorder.h"
#endif /* __EC_BOARD_CR50_TPM2_ENDIAN_H */