[new uImage] Define a API for image handling operations
- Add inline helper macros for basic header processing
- Move common non inline code common/image.c
- Replace direct header access with the API routines
- Rename IH_CPU_* to IH_ARCH_*
Signed-off-by: Marian Balakowicz <m8@semihalf.com>
diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index f55447a..4030d04 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -221,13 +221,13 @@
image_header_t *hdr = &header;
ulong data;
- memmove (&header, (char *)fpga_data, sizeof(image_header_t));
- if (ntohl(hdr->ih_magic) != IH_MAGIC) {
+ memmove (&header, (char *)fpga_data, image_get_header_size ());
+ if (!image_check_magic (hdr)) {
puts ("Bad Magic Number\n");
return 1;
}
- data = ((ulong)fpga_data + sizeof(image_header_t));
- data_size = ntohl(hdr->ih_size);
+ data = ((ulong)fpga_data + image_get_header_size ());
+ data_size = image_get_data_size (hdr);
rc = fpga_load (dev, (void *)data, data_size);
}
break;