public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/5] tools: mtk_image.h: Use portable uintXX_t instead of linux-specific __leXX
Date: Wed, 16 Oct 2019 09:27:22 -0700	[thread overview]
Message-ID: <1571243245-4991-3-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1571243245-4991-1-git-send-email-bmeng.cn@gmail.com>

__leXX has Linux kernel specific __attribute__((bitwise)) which is
not portable. Use corresponding uintXX_t instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 tools/mtk_image.h | 86 +++++++++++++++++++++++++++----------------------------
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/tools/mtk_image.h b/tools/mtk_image.h
index 0a9eab3..4e78b3d 100644
--- a/tools/mtk_image.h
+++ b/tools/mtk_image.h
@@ -9,14 +9,14 @@
 #ifndef _MTK_IMAGE_H
 #define _MTK_IMAGE_H
 
-/* Device header definitions */
+/* Device header definitions, all fields are little-endian */
 
 /* Header for NOR/SD/eMMC */
 union gen_boot_header {
 	struct {
 		char name[12];
-		__le32 version;
-		__le32 size;
+		uint32_t version;
+		uint32_t size;
 	};
 
 	uint8_t pad[0x200];
@@ -32,14 +32,14 @@ union nand_boot_header {
 		char name[12];
 		char version[4];
 		char id[8];
-		__le16 ioif;
-		__le16 pagesize;
-		__le16 addrcycles;
-		__le16 oobsize;
-		__le16 pages_of_block;
-		__le16 numblocks;
-		__le16 writesize_shift;
-		__le16 erasesize_shift;
+		uint16_t ioif;
+		uint16_t pagesize;
+		uint16_t addrcycles;
+		uint16_t oobsize;
+		uint16_t pages_of_block;
+		uint16_t numblocks;
+		uint16_t writesize_shift;
+		uint16_t erasesize_shift;
 		uint8_t dummy[60];
 		uint8_t ecc_parity[28];
 	};
@@ -54,14 +54,14 @@ union nand_boot_header {
 /* BootROM layout header */
 struct brom_layout_header {
 	char name[8];
-	__le32 version;
-	__le32 header_size;
-	__le32 total_size;
-	__le32 magic;
-	__le32 type;
-	__le32 header_size_2;
-	__le32 total_size_2;
-	__le32 unused;
+	uint32_t version;
+	uint32_t header_size;
+	uint32_t total_size;
+	uint32_t magic;
+	uint32_t type;
+	uint32_t header_size_2;
+	uint32_t total_size_2;
+	uint32_t unused;
 };
 
 #define BRLYT_NAME		"BRLYT"
@@ -90,8 +90,8 @@ struct gen_device_header {
 struct gfh_common_header {
 	uint8_t magic[3];
 	uint8_t version;
-	__le16 size;
-	__le16 type;
+	uint16_t size;
+	uint16_t type;
 };
 
 #define GFH_HEADER_MAGIC	"MMM"
@@ -106,17 +106,17 @@ struct gfh_common_header {
 struct gfh_file_info {
 	struct gfh_common_header gfh;
 	char name[12];
-	__le32 unused;
-	__le16 file_type;
+	uint32_t unused;
+	uint16_t file_type;
 	uint8_t flash_type;
 	uint8_t sig_type;
-	__le32 load_addr;
-	__le32 total_size;
-	__le32 max_size;
-	__le32 hdr_size;
-	__le32 sig_size;
-	__le32 jump_offset;
-	__le32 processed;
+	uint32_t load_addr;
+	uint32_t total_size;
+	uint32_t max_size;
+	uint32_t hdr_size;
+	uint32_t sig_size;
+	uint32_t jump_offset;
+	uint32_t processed;
 };
 
 #define GFH_FILE_INFO_NAME	"FILE_INFO"
@@ -129,16 +129,16 @@ struct gfh_file_info {
 
 struct gfh_bl_info {
 	struct gfh_common_header gfh;
-	__le32 attr;
+	uint32_t attr;
 };
 
 struct gfh_brom_cfg {
 	struct gfh_common_header gfh;
-	__le32 cfg_bits;
-	__le32 usbdl_by_auto_detect_timeout_ms;
+	uint32_t cfg_bits;
+	uint32_t usbdl_by_auto_detect_timeout_ms;
 	uint8_t unused[0x48];
-	__le32 usbdl_by_kcol0_timeout_ms;
-	__le32 usbdl_by_flag_timeout_ms;
+	uint32_t usbdl_by_kcol0_timeout_ms;
+	uint32_t usbdl_by_flag_timeout_ms;
 	uint32_t pad;
 };
 
@@ -157,15 +157,15 @@ struct gfh_anti_clone {
 	uint8_t ac_b2k;
 	uint8_t ac_b2c;
 	uint16_t pad;
-	__le32 ac_offset;
-	__le32 ac_len;
+	uint32_t ac_offset;
+	uint32_t ac_len;
 };
 
 struct gfh_brom_sec_cfg {
 	struct gfh_common_header gfh;
-	__le32 cfg_bits;
+	uint32_t cfg_bits;
 	char customer_name[0x20];
-	__le32 pad;
+	uint32_t pad;
 };
 
 #define BROM_SEC_CFG_JTAG_EN	1
@@ -184,11 +184,11 @@ struct gfh_header {
 
 union lk_hdr {
 	struct {
-		__le32 magic;
-		__le32 size;
+		uint32_t magic;
+		uint32_t size;
 		char name[32];
-		__le32 loadaddr;
-		__le32 mode;
+		uint32_t loadaddr;
+		uint32_t mode;
 	};
 
 	uint8_t data[512];
-- 
2.7.4

  parent reply	other threads:[~2019-10-16 16:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 16:27 [U-Boot] [PATCH 0/5] tools: Support building U-Boot host tools for Windows via MSYS2 Bin Meng
2019-10-16 16:27 ` [U-Boot] [PATCH 1/5] tools: image.h: Use portable uint32_t instead of linux-specific __be32 Bin Meng
2019-10-16 16:27 ` Bin Meng [this message]
2019-10-16 16:27 ` [U-Boot] [PATCH 3/5] tools: zynqmpbif: Use compiler builtin instead of linux-specific __swab32 Bin Meng
2019-10-16 16:27 ` [U-Boot] [PATCH 4/5] linux/types.h: Surround 'struct ustat' with __linux__ Bin Meng
2019-10-16 16:27 ` [U-Boot] [PATCH 5/5] doc: Add documentation for how to build U-Boot host tools Bin Meng
2019-10-16 18:20   ` Tom Rini
2019-10-17  1:50     ` Bin Meng
2019-10-17 14:10       ` Tom Rini
2019-10-17 15:02         ` Bin Meng
2019-10-17 15:12           ` Tom Rini
2019-10-18  1:53             ` Bin Meng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1571243245-4991-3-git-send-email-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox