diff options
Diffstat (limited to 'tinyusb/device')
| -rw-r--r-- | tinyusb/device/dcd_lpc43xx.c | 25 | ||||
| -rw-r--r-- | tinyusb/device/dcd_lpc_11uxx_13uxx.c | 6 |
2 files changed, 9 insertions, 22 deletions
diff --git a/tinyusb/device/dcd_lpc43xx.c b/tinyusb/device/dcd_lpc43xx.c index 3d9fa62d8..1d400d2af 100644 --- a/tinyusb/device/dcd_lpc43xx.c +++ b/tinyusb/device/dcd_lpc43xx.c @@ -348,28 +348,15 @@ tusb_error_t dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, void * LPC_USB0_Type* const lpc_usb = LPC_USB[coreid];
dcd_data_t* p_dcd = dcd_data_ptr[coreid];
- // determine Endpoint where Data & Status phase occurred (IN or OUT)
- uint8_t const endpoint_data = (dir == TUSB_DIR_DEV_TO_HOST) ? 1 : 0;
- uint8_t const endpoint_status = 1 - endpoint_data;
+ uint8_t const ep_id = dir; // IN : 1, OUT = 0
- ASSERT_FALSE(p_dcd->qhd[0].qtd_overlay.active || p_dcd->qhd[1].qtd_overlay.active, TUSB_ERROR_FAILED);
+ ASSERT_FALSE(p_dcd->qhd[ep_id].qtd_overlay.active, TUSB_ERROR_FAILED);
- //------------- Data Phase -------------//
- if (length)
- {
- dcd_qtd_t* p_qtd_data = &p_dcd->qtd[0];
- qtd_init(p_qtd_data, buffer, length);
- p_dcd->qhd[endpoint_data].qtd_overlay.next = (uint32_t) p_qtd_data;
-
- lpc_usb->ENDPTPRIME = BIT_( edpt_phy2pos(endpoint_data) );
- }
-
- //------------- Status Phase -------------//
- dcd_qtd_t* p_qtd_status = &p_dcd->qtd[1];
- qtd_init(p_qtd_status, NULL, 0); // zero length xfer
- p_dcd->qhd[endpoint_status].qtd_overlay.next = (uint32_t) p_qtd_status;
+ dcd_qtd_t* p_qtd = &p_dcd->qtd[ep_id];
+ qtd_init(p_qtd, buffer, length);
+ p_dcd->qhd[ep_id].qtd_overlay.next = (uint32_t) p_qtd;
- LPC_USB0->ENDPTPRIME |= BIT_( edpt_phy2pos(endpoint_status) );
+ lpc_usb->ENDPTPRIME = BIT_( edpt_phy2pos(ep_id) );
return TUSB_ERROR_NONE;
}
diff --git a/tinyusb/device/dcd_lpc_11uxx_13uxx.c b/tinyusb/device/dcd_lpc_11uxx_13uxx.c index 1ce96b2b0..dac52d406 100644 --- a/tinyusb/device/dcd_lpc_11uxx_13uxx.c +++ b/tinyusb/device/dcd_lpc_11uxx_13uxx.c @@ -362,11 +362,11 @@ tusb_error_t dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr) endpoint_handle_t dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
{
(void) coreid;
-
endpoint_handle_t const null_handle = { 0 };
- if (p_endpoint_desc->bmAttributes.xfer == TUSB_XFER_ISOCHRONOUS)
- return null_handle; // TODO not support ISO yet
+ if (p_endpoint_desc->bmAttributes.xfer == TUSB_XFER_ISOCHRONOUS) return null_handle; // TODO not support ISO yet
+
+ ASSERT (p_endpoint_desc->wMaxPacketSize.size <= 64, null_handle); // TODO ISO can be 1023, but ISO not supported now
//------------- Prepare Queue Head -------------//
uint8_t ep_id = edpt_addr2phy(p_endpoint_desc->bEndpointAddress);
|
