summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-03-30 18:36:04 +0700
committerhathach <[email protected]>2018-03-30 18:36:04 +0700
commit8516ca27a101c7fadb0bf98aa659800ffb2b9f11 (patch)
tree47d8f769a85ace7d84dc30f31b3ddda17e8bb600
parentd13160c4ae80e919267c22bdc6b3f31564b5ef98 (diff)
freertos semaphore post issue with control transfer
configAssert misunderstand _control_sem as mutex !!!!
-rw-r--r--tinyusb/osal/osal_common.h2
-rw-r--r--tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c27
-rw-r--r--tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.h10
3 files changed, 20 insertions, 19 deletions
diff --git a/tinyusb/osal/osal_common.h b/tinyusb/osal/osal_common.h
index 42ed6e77b..be8c59d69 100644
--- a/tinyusb/osal/osal_common.h
+++ b/tinyusb/osal/osal_common.h
@@ -52,7 +52,7 @@ enum
{
OSAL_TIMEOUT_NOTIMEOUT = 0, // for use within ISR, return immediately
OSAL_TIMEOUT_NORMAL = 10*5, // default is 10 msec, FIXME [CMSIS-RTX] easily timeout with 10 msec
- OSAL_TIMEOUT_WAIT_FOREVER = 0xFFFFFFFF
+ OSAL_TIMEOUT_WAIT_FOREVER = 0xFFFFFFFFUL
};
#ifdef __cplusplus
diff --git a/tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c b/tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c
index 57290b49f..7fffd99f1 100644
--- a/tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c
+++ b/tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c
@@ -63,9 +63,8 @@
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
typedef struct {
- dcd_qhd_t qhd[DCD_QHD_MAX]; ///< Must be at 2K alignment
+ dcd_qhd_t qhd[DCD_QHD_MAX] ATTR_ALIGNED(64); ///< Must be at 2K alignment
dcd_qtd_t qtd[DCD_QTD_MAX] ATTR_ALIGNED(32);
-
}dcd_data_t;
extern ATTR_WEAK dcd_data_t dcd_data0;
@@ -461,24 +460,22 @@ void hal_dcd_isr(uint8_t rhport)
dcd_setup_received(rhport, (uint8_t*) &p_dcd->qhd[0].setup_request);
}
+
//------------- Control Request Completed -------------//
else if ( edpt_complete & ( BIT_(0) | BIT_(16)) )
{
- for(uint8_t ep_idx = 0; ep_idx < 2; ep_idx++)
- {
- if ( BIT_TEST_(edpt_complete, edpt_phy2pos(ep_idx)) )
- {
- // TODO use the actual QTD instead of the qhd's overlay to get expected bytes for actual byte xferred
- dcd_qtd_t volatile * const p_qtd = &p_dcd->qhd[ep_idx].qtd_overlay;
+ // determine Control OUT or IN
+ uint8_t ep_idx = BIT_TEST_(edpt_complete, 0) ? 0 : 1;
- if ( p_qtd->int_on_complete )
- {
- bool succeeded = ( p_qtd->xact_err || p_qtd->halted || p_qtd->buffer_err ) ? false : true;
- (void) succeeded;
+ // TODO use the actual QTD instead of the qhd's overlay to get expected bytes for actual byte xferred
+ dcd_qtd_t* const p_qtd = (dcd_qtd_t*) p_dcd->qhd[ep_idx].qtd_addr;
- dcd_control_complete(rhport);
- }
- }
+ if ( p_qtd->int_on_complete )
+ {
+ bool succeeded = ( p_qtd->xact_err || p_qtd->halted || p_qtd->buffer_err ) ? false : true;
+ (void) succeeded;
+
+ dcd_control_complete(rhport);
}
}
diff --git a/tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.h b/tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.h
index 8430c2c09..92e24c1fb 100644
--- a/tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.h
+++ b/tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.h
@@ -43,6 +43,8 @@
#ifndef _TUSB_DCD_LPC43XX_H_
#define _TUSB_DCD_LPC43XX_H_
+#include "common/tusb_common.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -92,7 +94,8 @@ enum {
};
-typedef struct {
+typedef struct
+{
// Word 0: Next QTD Pointer
uint32_t next; ///< Next link pointer This field contains the physical memory address of the next dTD to be processed
@@ -121,7 +124,8 @@ typedef struct {
VERIFY_STATIC( sizeof(dcd_qtd_t) == 32, "size is not correct");
-typedef struct ATTR_ALIGNED(64) {
+typedef struct
+{
// Word 0: Capabilities and Characteristics
uint32_t : 15 ; ///< Number of packets executed per transaction descriptor 00 - Execute N transactions as demonstrated by the USB variable length protocol where N is computed using Max_packet_length and the Total_bytes field in the dTD. 01 - Execute one transaction 10 - Execute two transactions 11 - Execute three transactions Remark: Non-isochronous endpoints must set MULT = 00. Remark: Isochronous endpoints must set MULT = 01, 10, or 11 as needed.
uint32_t int_on_setup : 1 ; ///< Interrupt on setup This bit is used on control type endpoints to indicate if USBINT is set in response to a setup being received.
@@ -147,7 +151,7 @@ typedef struct ATTR_ALIGNED(64) {
volatile uint8_t list_qtd_idx[DCD_QTD_PER_QHD_MAX];
uint8_t reserved[16-DCD_QTD_PER_QHD_MAX];
-} dcd_qhd_t;
+} dcd_qhd_t;
VERIFY_STATIC( sizeof(dcd_qhd_t) == 64, "size is not correct");