| 
									
										
										
										
											2019-03-20 16:11:42 +07:00
										 |  |  | /* 
 | 
					
						
							|  |  |  |  * The MIT License (MIT) | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-05-14 11:48:05 +07:00
										 |  |  |  * Copyright (c) 2019 Ha Thach (tinyusb.org) | 
					
						
							| 
									
										
										
										
											2019-03-20 16:11:42 +07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Permission is hereby granted, free of charge, to any person obtaining a copy | 
					
						
							|  |  |  |  * of this software and associated documentation files (the "Software"), to deal | 
					
						
							|  |  |  |  * in the Software without restriction, including without limitation the rights | 
					
						
							|  |  |  |  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 
					
						
							|  |  |  |  * copies of the Software, and to permit persons to whom the Software is | 
					
						
							|  |  |  |  * furnished to do so, subject to the following conditions: | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The above copyright notice and this permission notice shall be included in | 
					
						
							|  |  |  |  * all copies or substantial portions of the Software. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 
					
						
							|  |  |  |  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
					
						
							|  |  |  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 
					
						
							|  |  |  |  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 
					
						
							|  |  |  |  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 
					
						
							|  |  |  |  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | 
					
						
							|  |  |  |  * THE SOFTWARE. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This file is part of the TinyUSB stack. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "tusb_option.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-07 23:38:52 +07:00
										 |  |  | #if (TUSB_OPT_HOST_ENABLED && CFG_TUH_CDC)
 | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-12 22:45:35 +07:00
										 |  |  | #include "common/tusb_common.h"
 | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | #include "cdc_host.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							|  |  |  | // MACRO CONSTANT TYPEDEF
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  | typedef struct { | 
					
						
							|  |  |  |   uint8_t itf_num; | 
					
						
							|  |  |  |   uint8_t itf_protocol; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   uint8_t ep_notif; | 
					
						
							|  |  |  |   uint8_t ep_in; | 
					
						
							|  |  |  |   uint8_t ep_out; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-11 00:56:21 +07:00
										 |  |  |   cdc_acm_capability_t acm_capability; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  | } cdch_data_t; | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							|  |  |  | // INTERNAL OBJECT & FUNCTION DECLARATION
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  | static cdch_data_t cdch_data[CFG_TUSB_HOST_DEVICE_MAX]; | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  | bool tuh_cdc_mounted(uint8_t dev_addr) | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |   cdch_data_t* cdc = &cdch_data[dev_addr-1]; | 
					
						
							|  |  |  |   return cdc->ep_in && cdc->ep_out; | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-01 19:13:43 +07:00
										 |  |  | bool tuh_cdc_is_busy(uint8_t dev_addr, cdc_pipeid_t pipeid) | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-12-10 05:55:02 +07:00
										 |  |  |   if ( !tuh_cdc_mounted(dev_addr) ) return false; | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   cdch_data_t const * p_cdc = &cdch_data[dev_addr-1]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   switch (pipeid) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     case CDC_PIPE_NOTIFICATION: | 
					
						
							| 
									
										
										
										
											2018-12-11 13:15:05 +07:00
										 |  |  |       return hcd_edpt_busy(dev_addr, p_cdc->ep_notif ); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     case CDC_PIPE_DATA_IN: | 
					
						
							| 
									
										
										
										
											2018-12-11 13:15:05 +07:00
										 |  |  |       return hcd_edpt_busy(dev_addr, p_cdc->ep_in ); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     case CDC_PIPE_DATA_OUT: | 
					
						
							| 
									
										
										
										
											2018-12-11 13:15:05 +07:00
										 |  |  |       return hcd_edpt_busy(dev_addr, p_cdc->ep_out ); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     default: | 
					
						
							|  |  |  |       return false; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							|  |  |  | // APPLICATION API (parameter validation needed)
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							| 
									
										
										
										
											2015-05-01 19:13:43 +07:00
										 |  |  | bool tuh_cdc_serial_is_mounted(uint8_t dev_addr) | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | { | 
					
						
							|  |  |  |   // TODO consider all AT Command as serial candidate
 | 
					
						
							| 
									
										
										
										
											2018-12-10 05:55:02 +07:00
										 |  |  |   return tuh_cdc_mounted(dev_addr)                                         && | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |       (CDC_COMM_PROTOCOL_ATCOMMAND <= cdch_data[dev_addr-1].itf_protocol) && | 
					
						
							|  |  |  |       (cdch_data[dev_addr-1].itf_protocol <= CDC_COMM_PROTOCOL_ATCOMMAND_CDMA); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-10 22:19:01 +07:00
										 |  |  | bool tuh_cdc_send(uint8_t dev_addr, void const * p_data, uint32_t length, bool is_notify) | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-12-10 22:19:01 +07:00
										 |  |  |   TU_VERIFY( tuh_cdc_mounted(dev_addr) ); | 
					
						
							|  |  |  |   TU_VERIFY( p_data != NULL && length, TUSB_ERROR_INVALID_PARA); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-11 00:56:21 +07:00
										 |  |  |   uint8_t const ep_out = cdch_data[dev_addr-1].ep_out; | 
					
						
							| 
									
										
										
										
											2018-12-11 13:15:05 +07:00
										 |  |  |   if ( hcd_edpt_busy(dev_addr, ep_out) ) return false; | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-11 00:56:21 +07:00
										 |  |  |   return hcd_pipe_xfer(dev_addr, ep_out, (void *) p_data, length, is_notify); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-10 22:19:01 +07:00
										 |  |  | bool tuh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t length, bool is_notify) | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-12-10 22:19:01 +07:00
										 |  |  |   TU_VERIFY( tuh_cdc_mounted(dev_addr) ); | 
					
						
							|  |  |  |   TU_VERIFY( p_buffer != NULL && length, TUSB_ERROR_INVALID_PARA); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-11 00:56:21 +07:00
										 |  |  |   uint8_t const ep_in = cdch_data[dev_addr-1].ep_in; | 
					
						
							| 
									
										
										
										
											2018-12-11 13:15:05 +07:00
										 |  |  |   if ( hcd_edpt_busy(dev_addr, ep_in) ) return false; | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-11 00:56:21 +07:00
										 |  |  |   return hcd_pipe_xfer(dev_addr, ep_in, p_buffer, length, is_notify); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							|  |  |  | // USBH-CLASS DRIVER API
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							|  |  |  | void cdch_init(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-10-23 12:19:32 +07:00
										 |  |  |   tu_memclr(cdch_data, sizeof(cdch_data_t)*CFG_TUSB_HOST_DEVICE_MAX); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-10 19:25:57 +07:00
										 |  |  | bool cdch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *itf_desc, uint16_t *p_length) | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |   // Only support ACM
 | 
					
						
							|  |  |  |   TU_VERIFY( CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL == itf_desc->bInterfaceSubClass); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |   // Only support AT commands, no protocol and vendor specific commands.
 | 
					
						
							|  |  |  |   TU_VERIFY(tu_within(CDC_COMM_PROTOCOL_NONE, itf_desc->bInterfaceProtocol, CDC_COMM_PROTOCOL_ATCOMMAND_CDMA) || | 
					
						
							|  |  |  |             0xff == itf_desc->bInterfaceProtocol); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-03-14 00:06:43 +07:00
										 |  |  |   uint8_t const * p_desc; | 
					
						
							|  |  |  |   cdch_data_t * p_cdc; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-12 12:01:15 +07:00
										 |  |  |   p_desc = tu_desc_next(itf_desc); | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |   p_cdc  = &cdch_data[dev_addr-1]; | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |   p_cdc->itf_num   = itf_desc->bInterfaceNumber; | 
					
						
							|  |  |  |   p_cdc->itf_protocol = itf_desc->bInterfaceProtocol; // TODO 0xff is consider as rndis candidate, other is virtual Com
 | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   //------------- Communication Interface -------------//
 | 
					
						
							| 
									
										
										
										
											2018-03-23 12:32:40 +07:00
										 |  |  |   (*p_length) = sizeof(tusb_desc_interface_t); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |   // Communication Functional Descriptors
 | 
					
						
							| 
									
										
										
										
											2019-07-01 22:38:06 +07:00
										 |  |  |   while( TUSB_DESC_CS_INTERFACE == p_desc[DESC_OFFSET_TYPE] ) | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  |     if ( CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT == cdc_functional_desc_typeof(p_desc) ) | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |     { | 
					
						
							|  |  |  |       // save ACM bmCapabilities
 | 
					
						
							| 
									
										
										
										
											2018-03-23 12:42:30 +07:00
										 |  |  |       p_cdc->acm_capability = ((cdc_desc_func_acm_t const *) p_desc)->bmCapabilities; | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-13 17:48:26 +07:00
										 |  |  |     (*p_length) += p_desc[DESC_OFFSET_LEN]; | 
					
						
							| 
									
										
										
										
											2018-12-12 12:01:15 +07:00
										 |  |  |     p_desc = tu_desc_next(p_desc); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-13 17:48:26 +07:00
										 |  |  |   if ( TUSB_DESC_ENDPOINT == p_desc[DESC_OFFSET_TYPE]) | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2018-12-11 00:56:21 +07:00
										 |  |  |     // notification endpoint
 | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |     tusb_desc_endpoint_t const * ep_desc = (tusb_desc_endpoint_t const *) p_desc; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-11 13:12:21 +07:00
										 |  |  |     TU_ASSERT( hcd_edpt_open(rhport, dev_addr, ep_desc) ); | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |     p_cdc->ep_notif = ep_desc->bEndpointAddress; | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-13 17:48:26 +07:00
										 |  |  |     (*p_length) += p_desc[DESC_OFFSET_LEN]; | 
					
						
							| 
									
										
										
										
											2018-12-12 12:01:15 +07:00
										 |  |  |     p_desc = tu_desc_next(p_desc); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   //------------- Data Interface (if any) -------------//
 | 
					
						
							| 
									
										
										
										
											2018-07-13 17:48:26 +07:00
										 |  |  |   if ( (TUSB_DESC_INTERFACE == p_desc[DESC_OFFSET_TYPE]) && | 
					
						
							| 
									
										
										
										
											2018-12-11 00:56:21 +07:00
										 |  |  |        (TUSB_CLASS_CDC_DATA == ((tusb_desc_interface_t const *) p_desc)->bInterfaceClass) ) | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2018-07-13 17:48:26 +07:00
										 |  |  |     (*p_length) += p_desc[DESC_OFFSET_LEN]; | 
					
						
							| 
									
										
										
										
											2018-12-12 12:01:15 +07:00
										 |  |  |     p_desc = tu_desc_next(p_desc); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // data endpoints expected to be in pairs
 | 
					
						
							|  |  |  |     for(uint32_t i=0; i<2; i++) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |       tusb_desc_endpoint_t const *ep_desc = (tusb_desc_endpoint_t const *) p_desc; | 
					
						
							|  |  |  |       TU_ASSERT(TUSB_DESC_ENDPOINT == ep_desc->bDescriptorType); | 
					
						
							|  |  |  |       TU_ASSERT(TUSB_XFER_BULK == ep_desc->bmAttributes.xfer); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-11 13:12:21 +07:00
										 |  |  |       TU_ASSERT(hcd_edpt_open(rhport, dev_addr, ep_desc)); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-12 11:51:31 +07:00
										 |  |  |       if ( tu_edpt_dir(ep_desc->bEndpointAddress) ==  TUSB_DIR_IN ) | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |       { | 
					
						
							|  |  |  |         p_cdc->ep_in = ep_desc->bEndpointAddress; | 
					
						
							|  |  |  |       }else | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         p_cdc->ep_out = ep_desc->bEndpointAddress; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-13 17:48:26 +07:00
										 |  |  |       (*p_length) += p_desc[DESC_OFFSET_LEN]; | 
					
						
							| 
									
										
										
										
											2018-12-12 12:01:15 +07:00
										 |  |  |       p_desc = tu_desc_next( p_desc ); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-07 15:07:00 +07:00
										 |  |  |   // FIXME move to seperate API : connect
 | 
					
						
							|  |  |  |   tusb_control_request_t request = | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2018-12-07 15:07:00 +07:00
										 |  |  |     .bmRequestType_bit = { .recipient = TUSB_REQ_RCPT_INTERFACE, .type = TUSB_REQ_TYPE_CLASS, .direction = TUSB_DIR_OUT }, | 
					
						
							|  |  |  |     .bRequest = CDC_REQUEST_SET_CONTROL_LINE_STATE, | 
					
						
							|  |  |  |     .wValue = 0x03, // dtr on, cst on
 | 
					
						
							| 
									
										
										
										
											2018-12-10 19:01:28 +07:00
										 |  |  |     .wIndex = p_cdc->itf_num, | 
					
						
							| 
									
										
										
										
											2018-12-07 15:07:00 +07:00
										 |  |  |     .wLength = 0 | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   TU_ASSERT( usbh_control_xfer(dev_addr, &request, NULL) ); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-06 22:47:49 +07:00
										 |  |  |   return true; | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-10 05:55:02 +07:00
										 |  |  | void cdch_isr(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes) | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-12-11 16:18:56 +07:00
										 |  |  |   (void) ep_addr; | 
					
						
							| 
									
										
										
										
											2018-12-10 05:40:02 +07:00
										 |  |  |   tuh_cdc_xfer_isr( dev_addr, event, 0, xferred_bytes ); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void cdch_close(uint8_t dev_addr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   cdch_data_t * p_cdc = &cdch_data[dev_addr-1]; | 
					
						
							| 
									
										
										
										
											2018-10-23 12:19:32 +07:00
										 |  |  |   tu_memclr(p_cdc, sizeof(cdch_data_t)); | 
					
						
							| 
									
										
										
										
											2014-03-12 14:28:43 +07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 |