diff options
| author | hathach <[email protected]> | 2013-10-30 12:52:25 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-10-30 12:52:25 +0700 |
| commit | b8a7ea6d46a49c1974e3f8d73aef19116927d0b2 (patch) | |
| tree | 355c12e800dd09381176cdd1128c79fc0d7ad5aa /tinyusb/device | |
| parent | d67a7b7959342e93c6ae63d5dac5149dec76d0e6 (diff) | |
add dcd control pipe stall protocol
Diffstat (limited to 'tinyusb/device')
| -rw-r--r-- | tinyusb/device/dcd.h | 3 | ||||
| -rw-r--r-- | tinyusb/device/dcd_lpc43xx.c | 9 |
2 files changed, 9 insertions, 3 deletions
diff --git a/tinyusb/device/dcd.h b/tinyusb/device/dcd.h index 6e10557ac..73cbeb2cb 100644 --- a/tinyusb/device/dcd.h +++ b/tinyusb/device/dcd.h @@ -83,13 +83,14 @@ void dcd_controller_set_configuration(uint8_t coreid, uint8_t config_num); //------------- PIPE API -------------// tusb_error_t dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, void * buffer, uint16_t length); +void dcd_pipe_control_stall(uint8_t coreid); //tusb_error_t dcd_pipe_control_write(uint8_t coreid, void const * buffer, uint16_t length); //tusb_error_t dcd_pipe_control_read(uint8_t coreid, void * buffer, uint16_t length); //void dcd_pipe_control_write_zero_length(uint8_t coreid); endpoint_handle_t dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const * p_endpoint_desc) ATTR_WARN_UNUSED_RESULT; -tusb_error_t dcd_pipe_xfer(endpoint_handle_t pipe_hdl, uint8_t buffer[], uint16_t total_bytes, bool int_on_complete) ATTR_WARN_UNUSED_RESULT; +tusb_error_t dcd_pipe_xfer(endpoint_handle_t pipe_hdl, uint8_t buffer[], uint16_t total_bytes, bool int_on_complete) ATTR_WARN_UNUSED_RESULT; #ifdef __cplusplus } diff --git a/tinyusb/device/dcd_lpc43xx.c b/tinyusb/device/dcd_lpc43xx.c index 213de5a6c..6ef650b18 100644 --- a/tinyusb/device/dcd_lpc43xx.c +++ b/tinyusb/device/dcd_lpc43xx.c @@ -72,7 +72,7 @@ typedef struct { volatile uint32_t halted : 1 ;
volatile uint32_t active : 1 ;
uint32_t : 2 ;
- uint32_t mult_override : 2 ; ///< This field can be used for transmit ISOs to override the MULT field in the dQH. This field must be zero for all packet types that are not transmit-ISO.
+ uint32_t iso_mult_override : 2 ; ///< This field can be used for transmit ISOs to override the MULT field in the dQH. This field must be zero for all packet types that are not transmit-ISO.
uint32_t : 3 ;
uint32_t int_on_complete : 1 ;
volatile uint32_t total_bytes : 15 ;
@@ -94,7 +94,7 @@ typedef struct { uint32_t max_package_size : 11 ; ///< This directly corresponds to the maximum packet size of the associated endpoint (wMaxPacketSize)
uint32_t : 2 ;
uint32_t zero_length_termination : 1 ; ///< This bit is used for non-isochronous endpoints to indicate when a zero-length packet is received to terminate transfers in case the total transfer length is “multiple”. 0 - Enable zero-length packet to terminate transfers equal to a multiple of Max_packet_length (default). 1 - Disable zero-length packet on transfers that are equal in length to a multiple Max_packet_length.
- uint32_t mult : 2 ; ///<
+ uint32_t iso_mult : 2 ; ///<
uint32_t : 0 ;
// Word 1: Current qTD Pointer
@@ -291,6 +291,11 @@ static void qtd_init(dcd_qtd_t* p_qtd, void * data_ptr, uint16_t total_bytes) }
}
+void dcd_pipe_control_stall(uint8_t coreid)
+{
+ LPC_USB0->ENDPTCTRL0 |= (ENDPTCTRL_MASK_STALL << 16); // stall Control IN
+}
+
tusb_error_t dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, void * buffer, uint16_t length)
{
uint8_t const endpoint_data = (dir == TUSB_DIR_DEV_TO_HOST) ? 1 : 0; // IN xfer --> data phase on Control IN, other Control OUT
|
