Add SAMD21 and SAMD51 support for CircuitPython.

The ProtoThreads style subtasks were removed because it led to
extremely unclear control flow. RTOSes can be used if threading is
needed.

Also added some additional functionality to MSC to support dynamic
LUNs and read-only LUNs.
This commit is contained in:
Scott Shawcroft
2018-10-24 23:55:10 -07:00
parent cb9bcce6a2
commit c582c0fda9
16 changed files with 1051 additions and 208 deletions
+1 -14
View File
@@ -64,20 +64,7 @@ void usbd_task (void* param);
// helper to parse an pair of In and Out endpoint descriptors. They must be consecutive
tusb_error_t usbd_open_edpt_pair(uint8_t rhport, tusb_desc_endpoint_t const* p_desc_ep, uint8_t xfer_type, uint8_t* ep_out, uint8_t* ep_in);
// Carry out Data and Status stage of control transfer
// Must be call in a subtask (_st) function
#define usbd_control_xfer_st(_rhport, _dir, _buffer, _len) \
do { \
if (_len) { \
uint32_t err; \
dcd_control_xfer(_rhport, _dir, (uint8_t*) _buffer, _len); \
osal_semaphore_wait( _usbd_ctrl_sem, OSAL_TIMEOUT_CONTROL_XFER, &err ); \
STASK_ASSERT_ERR( err ); \
} \
dcd_control_status(_rhport, _dir); \
/* No need to wait for status phase to complete */ \
}while(0)
uint32_t usbd_control_xfer_st(uint8_t _rhport, uint8_t _dir, uint8_t* _buffer, uint16_t _len);
/*------------------------------------------------------------------*/
/* Other Helpers