From 2ef87f75d16bcdc2a29e7339b8f2c2508985fe12 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Fri, 24 Sep 2021 23:06:48 +0200 Subject: tools: kwboot: Split sending image into header and data stages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change is required to implement other features in kwboot. Split sending header and data parts of the image into two stages. Signed-off-by: Pali Rohár [ refactored ] Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwbimage.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tools/kwbimage.h') diff --git a/tools/kwbimage.h b/tools/kwbimage.h index 10e3254a58..73da950d86 100644 --- a/tools/kwbimage.h +++ b/tools/kwbimage.h @@ -195,6 +195,10 @@ struct register_set_hdr_v1 { #define OPT_HDR_V1_BINARY_TYPE 0x2 #define OPT_HDR_V1_REGISTER_TYPE 0x3 +#define KWBHEADER_V0_SIZE(hdr) \ + (((hdr)->ext & 0x1) ? sizeof(struct kwb_header) : \ + sizeof(struct main_hdr_v0)) + #define KWBHEADER_V1_SIZE(hdr) \ (((hdr)->headersz_msb << 16) | le16_to_cpu((hdr)->headersz_lsb)) @@ -225,9 +229,9 @@ void init_kwb_image_type (void); * header, byte 8 was reserved, and always set to 0. In the v1 header, * byte 8 has been changed to a proper field, set to 1. */ -static inline unsigned int image_version(void *header) +static inline unsigned int image_version(const void *header) { - unsigned char *ptr = header; + const unsigned char *ptr = header; return ptr[8]; } -- cgit v1.2.3