summaryrefslogtreecommitdiff
path: root/tools/kwbimage.h
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-09-24 23:06:48 +0200
committerStefan Roese <sr@denx.de>2021-10-01 11:07:13 +0200
commit2ef87f75d16bcdc2a29e7339b8f2c2508985fe12 (patch)
tree01fcfbd97cc28372efe214104b9f39cf18a20465 /tools/kwbimage.h
parentd5ba8dbd75c1b3f45c341341a1259114d894c45f (diff)
tools: kwboot: Split sending image into header and data stages
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 <pali@kernel.org> [ refactored ] Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'tools/kwbimage.h')
-rw-r--r--tools/kwbimage.h8
1 files changed, 6 insertions, 2 deletions
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];
}