-------------------------------------------------------------------------------
README file for "USBD" USB host controller driver.
-created march-may 2014, JPEmbedded (info@jpembedded.eu)
+created march-june 2014, JPEmbedded (info@jpembedded.eu)
-------------------------------------------------------------------------------
* KNOWN LIMITATIONS: *
- DDEKit does not implement resource deallocation for corresponding thread
creation (see ddekit_thread_terminate, ddekit_thread_create) thus resources
are spilled
-- Driver assumes that there is no preemption for DDEKit threading
\ No newline at end of file
+- Driver assumes that there is no preemption for DDEKit threading
+- URBs are enqueued in DDEKit but not in USBD itself
+- DDEKit way of handling interface numbers is not explicitly defined, bitmask
+ formatting for it, is therefore hardcoded into USBD
request->data += transfer_len;
/* Total length shall not become negative */
- USB_ASSERT(request->size >= 0,
- "Invalid amount of data received");
+ if (request->size < 0) {
+ USB_MSG("Invalid amount of data received");
+ return EXIT_FAILURE;
+ }
#ifdef DEBUG
/* TODO: REMOVEME (dumping of data transfer) */
int i;
USB_MSG("RECEIVED: %d", transfer_len);
for (i = 0; i < transfer_len; i++)
- USB_MSG("%c",
+ USB_MSG("0x%02X: %c",
+ (request->data-transfer_len)[i],
(request->data-transfer_len)[i]);
}
#endif
/* Total length shall not become negative */
USB_ASSERT(request->size >= 0,
- "Invalid amount of data received");
+ "Invalid amount of transfer data calculated");
/* Start actual data transfer */
d->tx_stage(d->private_data, &temp_req);
DEBUG_DUMP;
+ /* TODO: ISO transfer */
+ USB_ASSERT(HCD_TRANSFER_ISOCHRONOUS != transfer,
+ "ISO transfer not supported");
+
r = ((musb_core_config *)cfg)->regs;
/* Set EP and device address to be used in this command */
musb_set_state((musb_core_config *)cfg);
- /* TODO: In MUSB only EP0 is allowed to handle control transfers
- * so there is no EP checking in this function */
+ /* TODO: More than one control EP? */
+ /* In MUSB EP0 has it's own registers for error handling */
if (HCD_TRANSFER_CONTROL == transfer) {
/* Get control status register */
host_csr = HCD_RD2(r, MUSB_REG_HOST_CSR0);
return EXIT_SUCCESS;
}
- if ((HCD_TRANSFER_BULK == transfer) && (HCD_DIRECTION_OUT == dir)) {
+ /* Non-control transfer error check,
+ * is based on transfer direction */
+ if (HCD_DIRECTION_OUT == dir) {
/* Get RX status register */
host_csr = HCD_RD2(r, MUSB_REG_HOST_TXCSR);
return EXIT_SUCCESS;
}
- if ((HCD_TRANSFER_BULK == transfer) && (HCD_DIRECTION_IN == dir)) {
+ if (HCD_DIRECTION_IN == dir) {
/* Get RX status register */
host_csr = HCD_RD2(r, MUSB_REG_HOST_RXCSR);