[PPC] Move include/asm-ppc/arch-* to arch/ppc/*/include/mach
[barebox-mini2440.git] / include / usb_dfu_trailer.h
blob3903b85b39922d3b2e306b0257bf7398e922273e
1 #ifndef _USB_DFU_TRAILER_H
2 #define _USB_DFU_TRAILER_H
4 /* trailer handling for DFU files */
6 #define UBOOT_DFU_TRAILER_V1 1
7 #define UBOOT_DFU_TRAILER_MAGIC 0x19731978
8 struct uboot_dfu_trailer {
9 u_int32_t magic;
10 u_int16_t version;
11 u_int16_t length;
12 u_int16_t vendor;
13 u_int16_t product;
14 u_int32_t revision;
15 } __attribute__((packed));
17 /* we mirror the trailer because we want it to be longer in later versions
18 * while keeping backwards compatibility */
19 static inline void dfu_trailer_mirror(struct uboot_dfu_trailer *trailer,
20 unsigned char *eof)
22 int i;
23 int len = sizeof(struct uboot_dfu_trailer);
24 unsigned char *src = eof - len;
25 unsigned char *dst = (unsigned char *) trailer;
27 for (i = 0; i < len; i++)
28 dst[len-1-i] = src[i];
31 #endif /* _USB_DFU_TRAILER_H */