Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 1c8a910

Browse files
purdeaandreiwhitequark
authored andcommitted
Update the whole repository to use SETUP_EP0_IN_BUF.
This is now used instead of SETUP_EP0_BUF whenever setting up an IN transfer. This commit doesn't introduce any kind of functional change.
1 parent 539adf8 commit 1c8a910

8 files changed

Lines changed: 13 additions & 13 deletions

File tree

examples/boot-dfu-spiflash/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ usb_dfu_iface_state_t usb_dfu_iface_state = {
268268
void handle_usb_get_interface(uint8_t interface) {
269269
if(interface == 0) {
270270
EP0BUF[0] = dfu_alt_setting;
271-
SETUP_EP0_BUF(1);
271+
SETUP_EP0_IN_BUF(1);
272272
return;
273273
}
274274
STALL_EP0();

examples/cdc-acm/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) {
190190
line_coding->bCharFormat = USB_CDC_REQ_LINE_CODING_STOP_BITS_1;
191191
line_coding->bParityType = USB_CDC_REQ_LINE_CODING_PARITY_NONE;
192192
line_coding->bDataBits = 8;
193-
SETUP_EP0_BUF(sizeof(struct usb_cdc_req_line_coding));
193+
SETUP_EP0_IN_BUF(sizeof(struct usb_cdc_req_line_coding));
194194
return;
195195
}
196196

firmware/boot-cypress/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void handle_pending_usb_setup(void) {
145145
STALL_EP0();
146146
break;
147147
}
148-
SETUP_EP0_BUF(len);
148+
SETUP_EP0_IN_BUF(len);
149149
} else {
150150
SETUP_EP0_BUF(0);
151151
while(EP0CS & _BUSY);
@@ -177,7 +177,7 @@ void handle_pending_usb_setup(void) {
177177
if(arg_read) {
178178
while(EP0CS & _BUSY);
179179
xmemcpy(EP0BUF, (__xdata void *)arg_addr, len);
180-
SETUP_EP0_BUF(len);
180+
SETUP_EP0_IN_BUF(len);
181181
} else {
182182
SETUP_EP0_BUF(0);
183183
while(EP0CS & _BUSY);

firmware/library/defusbgetconfig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
void handle_usb_get_configuration(void) {
44
EP0BUF[0] = usb_config_value;
5-
SETUP_EP0_BUF(1);
5+
SETUP_EP0_IN_BUF(1);
66
}

firmware/library/defusbgetiface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
void handle_usb_get_interface(uint8_t interface) {
44
interface;
55
EP0BUF[0] = 0;
6-
SETUP_EP0_BUF(1);
6+
SETUP_EP0_IN_BUF(1);
77
}

firmware/library/usb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ __endasm;
113113
EP0BUF[0] = (usb_self_powered << 0) |
114114
(usb_remote_wakeup << 1);
115115
EP0BUF[1] = 0;
116-
SETUP_EP0_BUF(2);
116+
SETUP_EP0_IN_BUF(2);
117117
// Get Status - Interface
118118
} else if(req->bmRequestType == (USB_RECIP_IFACE|USB_TYPE_STANDARD|USB_DIR_IN) &&
119119
req->bRequest == USB_REQ_GET_STATUS) {
120120
EP0BUF[0] = 0;
121121
EP0BUF[1] = 0;
122-
SETUP_EP0_BUF(2);
122+
SETUP_EP0_IN_BUF(2);
123123
// Set Feature - Endpoint
124124
// Clear Feature - Endpoint
125125
} else if(req->bmRequestType == (USB_RECIP_ENDPT|USB_TYPE_STANDARD|USB_DIR_OUT) &&
@@ -147,7 +147,7 @@ __endasm;
147147
if(EPnCS != 0) {
148148
EP0BUF[0] = ((*EPnCS & _STALL) != 0);
149149
EP0BUF[1] = 0;
150-
SETUP_EP0_BUF(2);
150+
SETUP_EP0_IN_BUF(2);
151151
}
152152
} else {
153153
handle_usb_setup(req);

firmware/library/usbdfu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ bool usb_dfu_setup(usb_dfu_iface_state_t *dfu, __xdata struct usb_req_setup *req
2323
req->bRequest == USB_DFU_REQ_GETSTATE && req->wValue == 0 &&
2424
req->wLength == sizeof(uint8_t)) {
2525
EP0BUF[0] = dfu->state;
26-
SETUP_EP0_BUF(1);
26+
SETUP_EP0_IN_BUF(1);
2727
return true;
2828
}
2929

@@ -55,7 +55,7 @@ bool usb_dfu_setup(usb_dfu_iface_state_t *dfu, __xdata struct usb_req_setup *req
5555
status->bwPollTimeoutHigh = 0;
5656
status->bState = dfu->state;
5757
status->iString = 0;
58-
SETUP_EP0_BUF(sizeof(struct usb_dfu_req_get_status));
58+
SETUP_EP0_IN_BUF(sizeof(struct usb_dfu_req_get_status));
5959
return true;
6060
}
6161

@@ -139,7 +139,7 @@ void usb_dfu_setup_deferred(usb_dfu_iface_state_t *dfu) {
139139
uint16_t length = dfu->length;
140140
dfu->status = dfu->firmware_upload(dfu->offset, &EP0BUF[0], &dfu->length);
141141
if(dfu->status == USB_DFU_STATUS_OK) {
142-
SETUP_EP0_BUF(dfu->length);
142+
SETUP_EP0_IN_BUF(dfu->length);
143143
if(dfu->length < length) {
144144
dfu->state = USB_DFU_STATE_dfuIDLE;
145145
}

firmware/library/usbmassstor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ bool usb_mass_storage_bbb_setup(usb_mass_storage_bbb_state_t *state,
1818
request->bRequest == USB_REQ_MASS_STORAGE_GET_MAX_LUN &&
1919
request->wValue == 0 && request->wIndex == state->interface && request->wLength == 1) {
2020
EP0BUF[0] = state->max_lun;
21-
SETUP_EP0_BUF(1);
21+
SETUP_EP0_IN_BUF(1);
2222
return true;
2323
}
2424

0 commit comments

Comments
 (0)