summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2012-08-10 13:22:01 +0200
committerPali Rohár <pali.rohar@gmail.com>2012-08-10 13:22:01 +0200
commitf79b653523980cb3a7510a474860aa1594868c9f (patch)
tree876baaae0e2d0495cfb5da64a8431cca436442a2 /src
parentcc6e2dcfcdd8eb59b2bc9bc135b90de04ae15e25 (diff)
download0xFFFF-f79b653523980cb3a7510a474860aa1594868c9f.tar.bz2
cold-flash: Use struct usb_device_info
Diffstat (limited to 'src')
-rw-r--r--src/cold-flash.c16
-rw-r--r--src/cold-flash.h7
-rw-r--r--src/main2.c2
3 files changed, 12 insertions, 13 deletions
diff --git a/src/cold-flash.c b/src/cold-flash.c
index 6f47e1a..6b14684 100644
--- a/src/cold-flash.c
+++ b/src/cold-flash.c
@@ -305,7 +305,7 @@ static int ping_timeout(usb_dev_handle * udev) {
}
-int cold_flash(usb_dev_handle * udev, struct image * x2nd, struct image * secondary) {
+int cold_flash(struct usb_device_info * dev, struct image * x2nd, struct image * secondary) {
if ( x2nd->type != IMAGE_2ND ) {
fprintf(stderr, "Image type is not 2nd X-Loader\n");
@@ -317,22 +317,22 @@ int cold_flash(usb_dev_handle * udev, struct image * x2nd, struct image * second
return 1;
}
- if ( ! read_asic(udev) ) {
+ if ( ! read_asic(dev->udev) ) {
fprintf(stderr, "Reading ASIC ID failed\n");
return 1;
}
- if ( ! send_2nd(udev, x2nd) ) {
+ if ( ! send_2nd(dev->udev, x2nd) ) {
fprintf(stderr, "Sending 2nd X-Loader image failed\n");
return 1;
}
- if ( ! ping_timeout(udev) ) {
+ if ( ! ping_timeout(dev->udev) ) {
fprintf(stderr, "Sending X-Loader ping message failed\n");
return 1;
}
- if ( ! send_secondary(udev, secondary) ) {
+ if ( ! send_secondary(dev->udev, secondary) ) {
fprintf(stderr, "Sending Secondary image failed\n");
return 1;
}
@@ -342,17 +342,17 @@ int cold_flash(usb_dev_handle * udev, struct image * x2nd, struct image * second
}
-int leave_cold_flash(usb_dev_handle * udev) {
+int leave_cold_flash(struct usb_device_info * dev) {
int ret;
- if ( ! read_asic(udev) ) {
+ if ( ! read_asic(dev->udev) ) {
fprintf(stderr, "Reading ASIC ID failed\n");
return 1;
}
printf("Sending OMAP memory boot message...\n");
- ret = usb_bulk_write(udev, WRITE_DEV, (char *)&omap_memory_msg, sizeof(omap_memory_msg), WRITE_TIMEOUT);
+ ret = usb_bulk_write(dev->udev, WRITE_DEV, (char *)&omap_memory_msg, sizeof(omap_memory_msg), WRITE_TIMEOUT);
usleep(5000);
if ( ret != sizeof(omap_memory_msg) ) {
fprintf(stderr, "Error while sending OMAP memory boot message\n");
diff --git a/src/cold-flash.h b/src/cold-flash.h
index 4e291eb..3f296b4 100644
--- a/src/cold-flash.h
+++ b/src/cold-flash.h
@@ -20,14 +20,13 @@
#ifndef COLD_FLASH_H
#define COLD_FLASH_H
-#include <usb.h>
-
#include "image.h"
+#include "usb-device.h"
/* Flash 2nd and secondary image in Cold Flash mode. After flashing device will boot secondary image */
-int cold_flash(usb_dev_handle * udev, struct image * x2nd, struct image * secondary);
+int cold_flash(struct usb_device_info * dev, struct image * x2nd, struct image * secondary);
/* Leave Cold Flashing mode and continue booting */
-int leave_cold_flash(usb_dev_handle * udev);
+int leave_cold_flash(struct usb_device_info * dev);
#endif
diff --git a/src/main2.c b/src/main2.c
index bb30ce4..2736828 100644
--- a/src/main2.c
+++ b/src/main2.c
@@ -727,7 +727,7 @@ int main(int argc, char **argv) {
continue;
}
- cold_flash(usb_dev->udev, image_2nd, image_secondary);
+ cold_flash(usb_dev, image_2nd, image_secondary);
usb_close_device(usb_dev);
usb_dev = NULL;