all: Fix delays for all operations
This commit is contained in:
1 parent
e94279eecb
commit
f37c2cd7e8
5 files changed
+15
-10
No files matched your search
+7
-7
@@ -191,14 +191,14 @@ static int send_2nd(usb_dev_handle * udev, struct image * image) {
|
||||
if ( ret != sizeof(omap_peripheral_msg) )
|
||||
ERROR_RETURN("Sending OMAP peripheral boot message failed", -1);
|
||||
|
||||
SLEEP(5000);
|
||||
MSLEEP(5);
|
||||
|
||||
printf("Sending 2nd X-Loader image size...\n");
|
||||
ret = usb_bulk_write(udev, USB_WRITE_EP, (char *)&image->size, 4, WRITE_TIMEOUT);
|
||||
if ( ret != 4 )
|
||||
ERROR_RETURN("Sending 2nd X-Loader image size failed", -1);
|
||||
|
||||
SLEEP(5000);
|
||||
MSLEEP(5);
|
||||
|
||||
printf("Sending 2nd X-Loader image...\n");
|
||||
printf_progressbar(0, image->size);
|
||||
@@ -217,7 +217,7 @@ static int send_2nd(usb_dev_handle * udev, struct image * image) {
|
||||
printf_progressbar(sent, image->size);
|
||||
}
|
||||
|
||||
SLEEP(50000);
|
||||
MSLEEP(50);
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -237,7 +237,7 @@ static int send_secondary(usb_dev_handle * udev, struct image * image) {
|
||||
ERROR_RETURN("Sending X-Loader init message failed", -1);
|
||||
|
||||
printf("Waiting for X-Loader response...\n");
|
||||
SLEEP(5000);
|
||||
MSLEEP(5);
|
||||
ret = usb_bulk_read(udev, USB_READ_EP, (char *)&buffer, 4, READ_TIMEOUT); /* 4 bytes - dummy value */
|
||||
if ( ret != 4 )
|
||||
ERROR_RETURN("No response", -1);
|
||||
@@ -260,7 +260,7 @@ static int send_secondary(usb_dev_handle * udev, struct image * image) {
|
||||
}
|
||||
|
||||
printf("Waiting for X-Loader response...\n");
|
||||
SLEEP(5000);
|
||||
MSLEEP(5);
|
||||
ret = usb_bulk_read(udev, USB_READ_EP, (char *)&buffer, 4, READ_TIMEOUT); /* 4 bytes - dummy value */
|
||||
if ( ret != 4 )
|
||||
ERROR_RETURN("No response", -1);
|
||||
@@ -296,7 +296,7 @@ static int ping_timeout(usb_dev_handle * udev) {
|
||||
break;
|
||||
}
|
||||
|
||||
SLEEP(5000);
|
||||
MSLEEP(5);
|
||||
--try_read;
|
||||
|
||||
}
|
||||
@@ -413,7 +413,7 @@ int leave_cold_flash(struct usb_device_info * dev) {
|
||||
if ( ret != sizeof(omap_memory_msg) )
|
||||
ERROR_RETURN("Sending OMAP memory boot message failed", -1);
|
||||
|
||||
SLEEP(1000000);
|
||||
MSLEEP(250);
|
||||
return 0;
|
||||
|
||||
}
|
||||
+1
-1
@@ -22,7 +22,7 @@ extern int verbose;
|
||||
#define ALLOC_ERROR() do { ERROR("Cannot allocate memory"); } while (0)
|
||||
#define ALLOC_ERROR_RETURN(...) do { ALLOC_ERROR(); return __VA_ARGS__; } while (0)
|
||||
|
||||
#define SLEEP(usec) do { struct timespec _t = { 0, (usec) }; nanosleep(&_t, NULL); } while (0)
|
||||
#define MSLEEP(msec) do { nanosleep(&(struct timespec){ (msec / 1000), (1000L * 1000L * (msec % 1000)) }, NULL); } while (0)
|
||||
|
||||
static inline void * MEMMEM(void *haystack, size_t haystacklen, const void *needle, size_t needlelen) {
|
||||
for ( size_t i = 0; i < haystacklen; ++i ) {
|
||||
|
||||
@@ -361,6 +361,11 @@ int mkii_reboot_device(struct usb_device_info * dev, int update) {
|
||||
if ( ret != 1 || msg->data[0] != 0 )
|
||||
ERROR_RETURN("Cannot send reboot command", -1);
|
||||
|
||||
if (dev->data & MKII_UPDATE_MODE)
|
||||
MSLEEP(100);
|
||||
else
|
||||
MSLEEP(3000);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -541,7 +541,7 @@ int nolo_flash_image(struct usb_device_info * dev, struct image * image) {
|
||||
|
||||
}
|
||||
|
||||
SLEEP(0xc350); // 0.5s
|
||||
MSLEEP(50);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -361,7 +361,7 @@ struct usb_device_info * usb_open_and_wait_for_device(void) {
|
||||
if ( ret )
|
||||
break;
|
||||
|
||||
SLEEP(0xc350); // 0.5s
|
||||
MSLEEP(50);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user