cold-flash: Use struct usb_device_info
This commit is contained in:
1 parent
cc6e2dcfcd
commit
f79b653523
3 files changed
+12
-13
No files matched your search
+8
-8
@@ -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 ) {
|
if ( x2nd->type != IMAGE_2ND ) {
|
||||||
fprintf(stderr, "Image type is not 2nd X-Loader\n");
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! read_asic(udev) ) {
|
if ( ! read_asic(dev->udev) ) {
|
||||||
fprintf(stderr, "Reading ASIC ID failed\n");
|
fprintf(stderr, "Reading ASIC ID failed\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! send_2nd(udev, x2nd) ) {
|
if ( ! send_2nd(dev->udev, x2nd) ) {
|
||||||
fprintf(stderr, "Sending 2nd X-Loader image failed\n");
|
fprintf(stderr, "Sending 2nd X-Loader image failed\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! ping_timeout(udev) ) {
|
if ( ! ping_timeout(dev->udev) ) {
|
||||||
fprintf(stderr, "Sending X-Loader ping message failed\n");
|
fprintf(stderr, "Sending X-Loader ping message failed\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! send_secondary(udev, secondary) ) {
|
if ( ! send_secondary(dev->udev, secondary) ) {
|
||||||
fprintf(stderr, "Sending Secondary image failed\n");
|
fprintf(stderr, "Sending Secondary image failed\n");
|
||||||
return 1;
|
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;
|
int ret;
|
||||||
|
|
||||||
if ( ! read_asic(udev) ) {
|
if ( ! read_asic(dev->udev) ) {
|
||||||
fprintf(stderr, "Reading ASIC ID failed\n");
|
fprintf(stderr, "Reading ASIC ID failed\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Sending OMAP memory boot message...\n");
|
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);
|
usleep(5000);
|
||||||
if ( ret != sizeof(omap_memory_msg) ) {
|
if ( ret != sizeof(omap_memory_msg) ) {
|
||||||
fprintf(stderr, "Error while sending OMAP memory boot message\n");
|
fprintf(stderr, "Error while sending OMAP memory boot message\n");
|
||||||
|
|||||||
+3
-4
@@ -20,14 +20,13 @@
|
|||||||
#ifndef COLD_FLASH_H
|
#ifndef COLD_FLASH_H
|
||||||
#define COLD_FLASH_H
|
#define COLD_FLASH_H
|
||||||
|
|
||||||
#include <usb.h>
|
|
||||||
|
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
|
#include "usb-device.h"
|
||||||
|
|
||||||
/* Flash 2nd and secondary image in Cold Flash mode. After flashing device will boot secondary image */
|
/* 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 */
|
/* 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
|
#endif
|
||||||
+1
-1
@@ -727,7 +727,7 @@ int main(int argc, char **argv) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
cold_flash(usb_dev->udev, image_2nd, image_secondary);
|
cold_flash(usb_dev, image_2nd, image_secondary);
|
||||||
usb_close_device(usb_dev);
|
usb_close_device(usb_dev);
|
||||||
usb_dev = NULL;
|
usb_dev = NULL;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user