mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-29 10:50:39 +02:00
Add bulk receive code to USB abstraction.
This commit is contained in:
parent
ba795ac17d
commit
0f35fd7a47
11
usbdev.c
11
usbdev.c
@ -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:
|
||||||
|
4
usbdev.h
4
usbdev.h
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user