1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-01 14:14:38 +02:00

Add bulk receive code to USB abstraction.

This commit is contained in:
Peter Zotov 2010-12-04 07:25:17 +03:00
parent ba795ac17d
commit 0f35fd7a47
2 changed files with 13 additions and 2 deletions

View File

@ -1,6 +1,7 @@
/* /*
* JzBoot: an USB bootloader for JZ series of Ingenic(R) microprocessors. * JzBoot: an USB bootloader for JZ series of Ingenic(R) microprocessors.
* Copyright (C) 2010 Sergey Gridassov <grindars@gmail.com> * Copyright (C) 2010 Sergey Gridassov <grindars@gmail.com>,
* Peter Zotov <whitequark@whitequark.org>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -143,6 +144,14 @@ int usbdev_sendbulk(void *hndl, void *data, int size) {
return translate_libusb(libusb_bulk_transfer(hndl, ENDPOINT_OUT, data, size, &trans, CONTROL_TIMEOUT)); return translate_libusb(libusb_bulk_transfer(hndl, ENDPOINT_OUT, data, size, &trans, CONTROL_TIMEOUT));
} }
int usbdev_recvbulk(void *hndl, void *data, int size) {
int trans;
debug(LEVEL_DEBUG, "Bulk: reading data %p, size %d\n", data, size);
return translate_libusb(libusb_bulk_transfer(hndl, ENDPOINT_IN, data, size, &trans, CONTROL_TIMEOUT));
}
static int translate_libusb(int code) { static int translate_libusb(int code) {
switch(code) { switch(code) {
case LIBUSB_SUCCESS: case LIBUSB_SUCCESS:

View File

@ -1,6 +1,7 @@
/* /*
* JzBoot: an USB bootloader for JZ series of Ingenic(R) microprocessors. * JzBoot: an USB bootloader for JZ series of Ingenic(R) microprocessors.
* Copyright (C) 2010 Sergey Gridassov <grindars@gmail.com> * Copyright (C) 2010 Sergey Gridassov <grindars@gmail.com>,
* Peter Zotov <whitequark@whitequark.org>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -32,5 +33,6 @@ void *usbdev_open(void *dev);
void usbdev_close(void *hndl); void usbdev_close(void *hndl);
int usbdev_vendor(void *hndl, int direction, uint8_t req, uint16_t value, uint16_t index, void *data, uint16_t size); int usbdev_vendor(void *hndl, int direction, uint8_t req, uint16_t value, uint16_t index, void *data, uint16_t size);
int usbdev_sendbulk(void *hndl, void *data, int size); int usbdev_sendbulk(void *hndl, void *data, int size);
int usbdev_recvbulk(void *hndl, void *data, int size);
#endif #endif