mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-28 12:06:59 +03:00
Put static variable of dfu.c into context structure
This commit is contained in:
10
src/dfu.c
10
src/dfu.c
@@ -88,8 +88,6 @@ int dfu_upload(struct dfu_dev *dfu, void * ptr, int size) {
|
||||
* is sent to the device.
|
||||
*/
|
||||
|
||||
static uint16_t wIndex = 0;
|
||||
|
||||
/* INTERNAL FUNCTION PROTOTYPES
|
||||
*/
|
||||
|
||||
@@ -325,10 +323,10 @@ int dfu_dnload(struct dfu_dev *dfu, void *ptr, int size)
|
||||
int result;
|
||||
|
||||
pmsg_trace("dfu_dnload(): issuing control OUT message, wIndex = %d, ptr = %p, size = %d\n",
|
||||
wIndex, ptr, size);
|
||||
cx->dfu_wIndex, ptr, size);
|
||||
|
||||
result = usb_control_msg(dfu->dev_handle,
|
||||
USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_DNLOAD, wIndex++, 0,
|
||||
USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_DNLOAD, cx->dfu_wIndex++, 0,
|
||||
ptr, size, dfu->timeout);
|
||||
|
||||
if (result < 0) {
|
||||
@@ -354,10 +352,10 @@ int dfu_upload(struct dfu_dev *dfu, void *ptr, int size)
|
||||
int result;
|
||||
|
||||
pmsg_trace("dfu_upload(): issuing control IN message, wIndex = %d, ptr = %p, size = %d\n",
|
||||
wIndex, ptr, size);
|
||||
cx->dfu_wIndex, ptr, size);
|
||||
|
||||
result = usb_control_msg(dfu->dev_handle,
|
||||
0x80 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_UPLOAD, wIndex++, 0,
|
||||
0x80 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_UPLOAD, cx->dfu_wIndex++, 0,
|
||||
ptr, size, dfu->timeout);
|
||||
|
||||
if (result < 0) {
|
||||
|
||||
@@ -1568,6 +1568,9 @@ typedef struct {
|
||||
LISTID cfg_pushedcomms; // Temporarily pushed main comments
|
||||
int cfg_pushed; // ... for memory sections
|
||||
int cfg_init_search; // used in cfg_comp_search()
|
||||
|
||||
// Static variable from dfu.c
|
||||
uint16_t dfu_wIndex; // A running number for USB messages
|
||||
} cx_t;
|
||||
|
||||
extern cx_t *cx;
|
||||
|
||||
Reference in New Issue
Block a user