Merge branch 'master' of github.com:xmos-jmccarthy/tinyusb
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
/* 
 | 
			
		||||
/*
 | 
			
		||||
 * The MIT License (MIT)
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2019 Ha Thach (tinyusb.org)
 | 
			
		||||
@@ -182,7 +182,19 @@ static usbd_class_driver_t const _usbd_driver[] =
 | 
			
		||||
    .reset            = dfu_rtd_reset,
 | 
			
		||||
    .open             = dfu_rtd_open,
 | 
			
		||||
    .control_xfer_cb  = dfu_rtd_control_xfer_cb,
 | 
			
		||||
    .xfer_cb          = dfu_rtd_xfer_cb,
 | 
			
		||||
    .xfer_cb          = NULL,
 | 
			
		||||
    .sof              = NULL
 | 
			
		||||
  },
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  #if CFG_TUD_DFU_MODE
 | 
			
		||||
  {
 | 
			
		||||
    DRIVER_NAME("DFU-MODE")
 | 
			
		||||
    .init             = dfu_moded_init,
 | 
			
		||||
    .reset            = dfu_moded_reset,
 | 
			
		||||
    .open             = dfu_moded_open,
 | 
			
		||||
    .control_xfer_cb  = dfu_moded_control_xfer_cb,
 | 
			
		||||
    .xfer_cb          = NULL,
 | 
			
		||||
    .sof              = NULL
 | 
			
		||||
  },
 | 
			
		||||
  #endif
 | 
			
		||||
@@ -1318,9 +1330,9 @@ bool usbd_edpt_stalled(uint8_t rhport, uint8_t ep_addr)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * usbd_edpt_close will disable an endpoint.
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * In progress transfers on this EP may be delivered after this call.
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void usbd_edpt_close(uint8_t rhport, uint8_t ep_addr)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
/* 
 | 
			
		||||
/*
 | 
			
		||||
 * The MIT License (MIT)
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2019 Ha Thach (tinyusb.org)
 | 
			
		||||
@@ -583,7 +583,7 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb
 | 
			
		||||
 | 
			
		||||
//------------- DFU Runtime -------------//
 | 
			
		||||
#define TUD_DFU_APP_CLASS    (TUSB_CLASS_APPLICATION_SPECIFIC)
 | 
			
		||||
#define TUD_DFU_APP_SUBCLASS 0x01u
 | 
			
		||||
#define TUD_DFU_APP_SUBCLASS (APP_SUBCLASS_DFU_RUNTIME)
 | 
			
		||||
 | 
			
		||||
// Length of template descriptr: 18 bytes
 | 
			
		||||
#define TUD_DFU_RT_DESC_LEN (9 + 9)
 | 
			
		||||
@@ -596,6 +596,17 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb
 | 
			
		||||
  /* Function */ \
 | 
			
		||||
  9, DFU_DESC_FUNCTIONAL, _attr, U16_TO_U8S_LE(_timeout), U16_TO_U8S_LE(_xfer_size), U16_TO_U8S_LE(0x0101)
 | 
			
		||||
 | 
			
		||||
// Length of template descriptr: 18 bytes
 | 
			
		||||
#define TUD_DFU_MODE_DESC_LEN (9 + 9)
 | 
			
		||||
 | 
			
		||||
// DFU runtime descriptor
 | 
			
		||||
// Interface number, string index, attributes, detach timeout, transfer size
 | 
			
		||||
#define TUD_DFU_MODE_DESCRIPTOR(_itfnum, _stridx, _attr, _timeout, _xfer_size) \
 | 
			
		||||
  /* Interface */ \
 | 
			
		||||
  9, TUSB_DESC_INTERFACE, _itfnum, 0, 0, TUD_DFU_APP_CLASS, TUD_DFU_APP_SUBCLASS, DFU_PROTOCOL_DFU, _stridx, \
 | 
			
		||||
  /* Function */ \
 | 
			
		||||
  9, DFU_DESC_FUNCTIONAL, _attr, U16_TO_U8S_LE(_timeout), U16_TO_U8S_LE(_xfer_size), U16_TO_U8S_LE(0x0101)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//------------- CDC-ECM -------------//
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -107,7 +107,7 @@ bool tud_control_xfer(uint8_t rhport, tusb_control_request_t const * request, vo
 | 
			
		||||
  _ctrl_xfer.buffer        = (uint8_t*) buffer;
 | 
			
		||||
  _ctrl_xfer.total_xferred = 0U;
 | 
			
		||||
  _ctrl_xfer.data_len      = tu_min16(len, request->wLength);
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  if (request->wLength > 0U)
 | 
			
		||||
  {
 | 
			
		||||
    if(_ctrl_xfer.data_len > 0U)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user