diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-09-16 16:25:30 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-09-25 14:31:26 +0200 |
commit | d9345607aab44c8fbacc35130b89024975fdb6ab (patch) | |
tree | 50c1e71fe387f345b538dc72a5c5ca5ce9f297e0 /include/usb_dfu_trailer.h | |
parent | 0217e514cfbc526e48b6906a61aac1641443e212 (diff) | |
download | barebox-d9345607aab44c8fbacc35130b89024975fdb6ab.tar.gz barebox-d9345607aab44c8fbacc35130b89024975fdb6ab.tar.xz |
Add USB device support
This patch adds support for USB devices. It uses
the Linux Kernel gadget API. Along with this patch
comes driver support for the Freescale (arc) USB OTG
Core and USB Device Firmware Update (DFU)
The serial gadget support is not working at the moment.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/usb_dfu_trailer.h')
-rw-r--r-- | include/usb_dfu_trailer.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/usb_dfu_trailer.h b/include/usb_dfu_trailer.h new file mode 100644 index 0000000000..3903b85b39 --- /dev/null +++ b/include/usb_dfu_trailer.h @@ -0,0 +1,31 @@ +#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 */ |