Skip to content

Commit bad5cd3

Browse files
authored
Merge pull request #114 from adafruit/update-tinyusb
update tinyusb
2 parents f3a4622 + 1df185e commit bad5cd3

31 files changed

+1677
-781
lines changed

src/class/audio/audio.h

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ typedef enum
489489
AUDIO_DATA_FORMAT_TYPE_I_IEEE_FLOAT = (uint32_t) (1 << 2),
490490
AUDIO_DATA_FORMAT_TYPE_I_ALAW = (uint32_t) (1 << 3),
491491
AUDIO_DATA_FORMAT_TYPE_I_MULAW = (uint32_t) (1 << 4),
492-
AUDIO_DATA_FORMAT_TYPE_I_RAW_DATA = 0x100000000,
492+
AUDIO_DATA_FORMAT_TYPE_I_RAW_DATA = 0x80000000,
493493
} audio_data_format_type_I_t;
494494

495495
/// All remaining definitions are taken from the descriptor descriptions in the UAC2 main specification
@@ -823,6 +823,33 @@ typedef struct TU_ATTR_PACKED
823823
uint16_t wLockDelay ; ///< Indicates the time it takes this endpoint to reliably lock its internal clock recovery circuitry. Units used depend on the value of the bLockDelayUnits field.
824824
} audio_desc_cs_as_iso_data_ep_t;
825825

826+
// 5.2.2 Control Request Layout
827+
typedef struct TU_ATTR_PACKED
828+
{
829+
union
830+
{
831+
struct TU_ATTR_PACKED
832+
{
833+
uint8_t recipient : 5; ///< Recipient type tusb_request_recipient_t.
834+
uint8_t type : 2; ///< Request type tusb_request_type_t.
835+
uint8_t direction : 1; ///< Direction type. tusb_dir_t
836+
} bmRequestType_bit;
837+
838+
uint8_t bmRequestType;
839+
};
840+
841+
uint8_t bRequest; ///< Request type audio_cs_req_t
842+
uint8_t bChannelNumber;
843+
uint8_t bControlSelector;
844+
union
845+
{
846+
uint8_t bInterface;
847+
uint8_t bEndpoint;
848+
};
849+
uint8_t bEntityID;
850+
uint16_t wLength;
851+
} audio_control_request_t;
852+
826853
//// 5.2.3 Control Request Parameter Block Layout
827854

828855
// 5.2.3.1 1-byte Control CUR Parameter Block

src/class/audio/audio_device.c

Lines changed: 214 additions & 185 deletions
Large diffs are not rendered by default.

src/class/cdc/cdc.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ typedef enum
215215
// Class Specific Functional Descriptor (Communication Interface)
216216
//--------------------------------------------------------------------+
217217

218+
// Start of all packed definitions for compiler without per-type packed
219+
TU_ATTR_PACKED_BEGIN
220+
TU_ATTR_BIT_FIELD_ORDER_BEGIN
221+
218222
/// Header Functional Descriptor (Communication Interface)
219223
typedef struct TU_ATTR_PACKED
220224
{
@@ -235,7 +239,7 @@ typedef struct TU_ATTR_PACKED
235239
}cdc_desc_func_union_t;
236240

237241
#define cdc_desc_func_union_n_t(no_slave)\
238-
struct TU_ATTR_PACKED { \
242+
struct TU_ATTR_PACKED { \
239243
uint8_t bLength ;\
240244
uint8_t bDescriptorType ;\
241245
uint8_t bDescriptorSubType ;\
@@ -254,7 +258,7 @@ typedef struct TU_ATTR_PACKED
254258
}cdc_desc_func_country_selection_t;
255259

256260
#define cdc_desc_func_country_selection_n_t(no_country) \
257-
struct TU_ATTR_PACKED {\
261+
struct TU_ATTR_PACKED { \
258262
uint8_t bLength ;\
259263
uint8_t bDescriptorType ;\
260264
uint8_t bDescriptorSubType ;\
@@ -283,7 +287,6 @@ typedef struct TU_ATTR_PACKED
283287
uint8_t bDataInterface;
284288
}cdc_desc_func_call_management_t;
285289

286-
287290
typedef struct TU_ATTR_PACKED
288291
{
289292
uint8_t support_comm_request : 1; ///< Device supports the request combination of Set_Comm_Feature, Clear_Comm_Feature, and Get_Comm_Feature.
@@ -295,8 +298,8 @@ typedef struct TU_ATTR_PACKED
295298

296299
TU_VERIFY_STATIC(sizeof(cdc_acm_capability_t) == 1, "mostly problem with compiler");
297300

298-
/// \brief Abstract Control Management Functional Descriptor
299-
/// \details This functional descriptor describes the commands supported by by the Communications Class interface with SubClass code of \ref CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL
301+
/// Abstract Control Management Functional Descriptor
302+
/// This functional descriptor describes the commands supported by by the Communications Class interface with SubClass code of \ref CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL
300303
typedef struct TU_ATTR_PACKED
301304
{
302305
uint8_t bLength ; ///< Size of this descriptor in bytes.
@@ -367,6 +370,7 @@ typedef struct TU_ATTR_PACKED
367370
} bmCapabilities;
368371
}cdc_desc_func_telephone_call_state_reporting_capabilities_t;
369372

373+
// TODO remove
370374
static inline uint8_t cdc_functional_desc_typeof(uint8_t const * p_desc)
371375
{
372376
return p_desc[2];
@@ -394,7 +398,8 @@ typedef struct TU_ATTR_PACKED
394398

395399
TU_VERIFY_STATIC(sizeof(cdc_line_control_state_t) == 2, "size is not correct");
396400

397-
/** @} */
401+
TU_ATTR_PACKED_END // End of all packed definitions
402+
TU_ATTR_BIT_FIELD_ORDER_END
398403

399404
#ifdef __cplusplus
400405
}

src/class/cdc/cdc_device.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,6 @@ uint16_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint1
273273
TU_VERIFY( TUSB_CLASS_CDC == itf_desc->bInterfaceClass &&
274274
CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL == itf_desc->bInterfaceSubClass, 0);
275275

276-
// Note: 0xFF can be used with RNDIS
277-
TU_VERIFY(tu_within(CDC_COMM_PROTOCOL_NONE, itf_desc->bInterfaceProtocol, CDC_COMM_PROTOCOL_ATCOMMAND_CDMA), 0);
278-
279276
// Find available interface
280277
cdcd_interface_t * p_cdc = NULL;
281278
for(uint8_t cdc_id=0; cdc_id<CFG_TUD_CDC; cdc_id++)
@@ -303,10 +300,11 @@ uint16_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint1
303300

304301
if ( TUSB_DESC_ENDPOINT == tu_desc_type(p_desc) )
305302
{
306-
// notification endpoint if any
307-
TU_ASSERT( usbd_edpt_open(rhport, (tusb_desc_endpoint_t const *) p_desc), 0 );
303+
// notification endpoint
304+
tusb_desc_endpoint_t const * desc_ep = (tusb_desc_endpoint_t const *) p_desc;
308305

309-
p_cdc->ep_notif = ((tusb_desc_endpoint_t const *) p_desc)->bEndpointAddress;
306+
TU_ASSERT( usbd_edpt_open(rhport, desc_ep), 0 );
307+
p_cdc->ep_notif = desc_ep->bEndpointAddress;
310308

311309
drv_len += tu_desc_len(p_desc);
312310
p_desc = tu_desc_next(p_desc);

src/class/dfu/dfu.h

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
//--------------------------------------------------------------------+
3737
// Common Definitions
3838
//--------------------------------------------------------------------+
39+
3940
// DFU Protocol
4041
typedef enum
4142
{
@@ -77,28 +78,28 @@ typedef enum {
7778

7879
// DFU Status
7980
typedef enum {
80-
DFU_STATUS_OK = 0x00,
81-
DFU_STATUS_ERRTARGET = 0x01,
82-
DFU_STATUS_ERRFILE = 0x02,
83-
DFU_STATUS_ERRWRITE = 0x03,
84-
DFU_STATUS_ERRERASE = 0x04,
85-
DFU_STATUS_ERRCHECK_ERASED = 0x05,
86-
DFU_STATUS_ERRPROG = 0x06,
87-
DFU_STATUS_ERRVERIFY = 0x07,
88-
DFU_STATUS_ERRADDRESS = 0x08,
89-
DFU_STATUS_ERRNOTDONE = 0x09,
90-
DFU_STATUS_ERRFIRMWARE = 0x0A,
91-
DFU_STATUS_ERRVENDOR = 0x0B,
92-
DFU_STATUS_ERRUSBR = 0x0C,
93-
DFU_STATUS_ERRPOR = 0x0D,
94-
DFU_STATUS_ERRUNKNOWN = 0x0E,
95-
DFU_STATUS_ERRSTALLEDPKT = 0x0F,
96-
} dfu_device_status_t;
81+
DFU_STATUS_OK = 0x00,
82+
DFU_STATUS_ERR_TARGET = 0x01,
83+
DFU_STATUS_ERR_FILE = 0x02,
84+
DFU_STATUS_ERR_WRITE = 0x03,
85+
DFU_STATUS_ERR_ERASE = 0x04,
86+
DFU_STATUS_ERR_CHECK_ERASED = 0x05,
87+
DFU_STATUS_ERR_PROG = 0x06,
88+
DFU_STATUS_ERR_VERIFY = 0x07,
89+
DFU_STATUS_ERR_ADDRESS = 0x08,
90+
DFU_STATUS_ERR_NOTDONE = 0x09,
91+
DFU_STATUS_ERR_FIRMWARE = 0x0A,
92+
DFU_STATUS_ERR_VENDOR = 0x0B,
93+
DFU_STATUS_ERR_USBR = 0x0C,
94+
DFU_STATUS_ERR_POR = 0x0D,
95+
DFU_STATUS_ERR_UNKNOWN = 0x0E,
96+
DFU_STATUS_ERR_STALLEDPKT = 0x0F,
97+
} dfu_status_t;
9798

98-
#define DFU_FUNC_ATTR_CAN_DOWNLOAD_BITMASK (1 << 0)
99-
#define DFU_FUNC_ATTR_CAN_UPLOAD_BITMASK (1 << 1)
100-
#define DFU_FUNC_ATTR_MANIFESTATION_TOLERANT_BITMASK (1 << 2)
101-
#define DFU_FUNC_ATTR_WILL_DETACH_BITMASK (1 << 3)
99+
#define DFU_ATTR_CAN_DOWNLOAD (1u << 0)
100+
#define DFU_ATTR_CAN_UPLOAD (1u << 1)
101+
#define DFU_ATTR_MANIFESTATION_TOLERANT (1u << 2)
102+
#define DFU_ATTR_WILL_DETACH (1u << 3)
102103

103104
// DFU Status Request Payload
104105
typedef struct TU_ATTR_PACKED
@@ -107,9 +108,9 @@ typedef struct TU_ATTR_PACKED
107108
uint8_t bwPollTimeout[3];
108109
uint8_t bState;
109110
uint8_t iString;
110-
} dfu_status_req_payload_t;
111+
} dfu_status_response_t;
111112

112-
TU_VERIFY_STATIC( sizeof(dfu_status_req_payload_t) == 6, "size is not correct");
113+
TU_VERIFY_STATIC( sizeof(dfu_status_response_t) == 6, "size is not correct");
113114

114115
#ifdef __cplusplus
115116
}

0 commit comments

Comments
 (0)