mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-22 23:21:53 +02:00
ba82ccbff1
X-Git-Url: http://git.openmoko.org/?p=qi.git;a=commitdiff_plain;h=bdc874553c41b5c540188798928433ad9ef89a76 add-mkudfu-to-qi
32 lines
786 B
C
32 lines
786 B
C
#ifndef _USB_DFU_TRAILER_H
|
|
#define _USB_DFU_TRAILER_H
|
|
|
|
/* trailer handling for DFU files */
|
|
|
|
#define UBOOT_DFU_TRAILER_V1 1
|
|
#define UBOOT_DFU_TRAILER_MAGIC 0x19731978
|
|
struct uboot_dfu_trailer {
|
|
u_int32_t magic;
|
|
u_int16_t version;
|
|
u_int16_t length;
|
|
u_int16_t vendor;
|
|
u_int16_t product;
|
|
u_int32_t revision;
|
|
} __attribute__((packed));
|
|
|
|
/* we mirror the trailer because we want it to be longer in later versions
|
|
* while keeping backwards compatibility */
|
|
static inline void dfu_trailer_mirror(struct uboot_dfu_trailer *trailer,
|
|
unsigned char *eof)
|
|
{
|
|
int i;
|
|
int len = sizeof(struct uboot_dfu_trailer);
|
|
unsigned char *src = eof - len;
|
|
unsigned char *dst = (unsigned char *) trailer;
|
|
|
|
for (i = 0; i < len; i++)
|
|
dst[len-1-i] = src[i];
|
|
}
|
|
|
|
#endif /* _USB_DFU_TRAILER_H */
|