| 
									
										
										
										
											2019-03-20 16:11:42 +07:00
										 |  |  | /* 
 | 
					
						
							|  |  |  |  * The MIT License (MIT) | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (c) 2018, hathach (tinyusb.org) | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * 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. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2013-05-13 22:36:49 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "common/common.h"
 | 
					
						
							|  |  |  | #include "host/usbh.h"
 | 
					
						
							|  |  |  | #include "host/usbh_hcd.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-13 23:31:06 +07:00
										 |  |  | static inline void helper_class_init_expect(void) | 
					
						
							| 
									
										
										
										
											2013-09-24 15:05:11 +07:00
										 |  |  | { // class code number order
 | 
					
						
							| 
									
										
										
										
											2018-12-06 22:24:31 +07:00
										 |  |  | #if CFG_TUH_CDC
 | 
					
						
							| 
									
										
										
										
											2013-07-01 10:35:37 +07:00
										 |  |  |   cdch_init_Expect(); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if HOST_CLASS_HID
 | 
					
						
							| 
									
										
										
										
											2013-05-13 22:36:49 +07:00
										 |  |  |   hidh_init_Expect(); | 
					
						
							| 
									
										
										
										
											2013-07-01 10:35:37 +07:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-06 22:24:31 +07:00
										 |  |  | #if CFG_TUH_MSC
 | 
					
						
							| 
									
										
										
										
											2013-09-24 15:05:11 +07:00
										 |  |  |   msch_init_Expect(); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2013-05-13 22:36:49 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-13 23:31:06 +07:00
										 |  |  |   //TODO update more classes
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-13 23:18:56 +07:00
										 |  |  | static inline void helper_usbh_init_expect(void) | 
					
						
							| 
									
										
										
										
											2013-05-13 22:36:49 +07:00
										 |  |  | { | 
					
						
							|  |  |  |   osal_queue_create_IgnoreAndReturn( (osal_queue_handle_t) 0x4566 ); | 
					
						
							| 
									
										
										
										
											2013-09-13 23:01:43 +07:00
										 |  |  |   osal_task_create_IgnoreAndReturn(TUSB_ERROR_NONE); | 
					
						
							| 
									
										
										
										
											2013-09-24 15:05:11 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   osal_semaphore_create_IgnoreAndReturn( (osal_semaphore_handle_t) 0x1234); | 
					
						
							| 
									
										
										
										
											2013-06-27 16:19:22 +07:00
										 |  |  |   osal_mutex_create_IgnoreAndReturn((osal_mutex_handle_t) 0x789a); | 
					
						
							| 
									
										
										
										
											2013-05-13 22:36:49 +07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline void helper_usbh_device_emulate(uint8_t dev_addr, uint8_t hub_addr, uint8_t hub_port, uint8_t hostid, tusb_speed_t speed) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-12-09 12:34:05 +07:00
										 |  |  |   _usbh_devices[dev_addr].rhport  = hostid; | 
					
						
							| 
									
										
										
										
											2018-12-07 00:47:16 +07:00
										 |  |  |   _usbh_devices[dev_addr].hub_addr = hub_addr; | 
					
						
							|  |  |  |   _usbh_devices[dev_addr].hub_port = hub_port; | 
					
						
							|  |  |  |   _usbh_devices[dev_addr].speed    = speed; | 
					
						
							|  |  |  |   _usbh_devices[dev_addr].state    = dev_addr ? TUSB_DEVICE_STATE_CONFIGURED : TUSB_DEVICE_STATE_UNPLUG; | 
					
						
							| 
									
										
										
										
											2013-05-13 22:36:49 +07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 |