From f79b653523980cb3a7510a474860aa1594868c9f Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Fri, 10 Aug 2012 13:22:01 +0200 Subject: cold-flash: Use struct usb_device_info --- src/cold-flash.c | 16 ++++++++-------- src/cold-flash.h | 7 +++---- src/main2.c | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) (limited to 'src') 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 - #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; -- cgit v1.2.3