| 
									
										
										
										
											2013-05-06 12:50:19 +07:00
										 |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*!
 | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  |     @file     usbd.h | 
					
						
							| 
									
										
										
										
											2013-05-06 12:50:19 +07:00
										 |  |  |     @author   hathach (tinyusb.org) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @section LICENSE | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Software License Agreement (BSD License) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Copyright (c) 2013, hathach (tinyusb.org) | 
					
						
							|  |  |  |     All rights reserved. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Redistribution and use in source and binary forms, with or without | 
					
						
							|  |  |  |     modification, are permitted provided that the following conditions are met: | 
					
						
							|  |  |  |     1. Redistributions of source code must retain the above copyright | 
					
						
							|  |  |  |     notice, this list of conditions and the following disclaimer. | 
					
						
							|  |  |  |     2. Redistributions in binary form must reproduce the above copyright | 
					
						
							|  |  |  |     notice, this list of conditions and the following disclaimer in the | 
					
						
							|  |  |  |     documentation and/or other materials provided with the distribution. | 
					
						
							|  |  |  |     3. Neither the name of the copyright holders nor the | 
					
						
							|  |  |  |     names of its contributors may be used to endorse or promote products | 
					
						
							|  |  |  |     derived from this software without specific prior written permission. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY | 
					
						
							|  |  |  |     EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 
					
						
							|  |  |  |     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 
					
						
							|  |  |  |     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY | 
					
						
							|  |  |  |     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  |     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 
					
						
							|  |  |  |     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 
					
						
							| 
									
										
										
										
											2013-05-06 12:50:19 +07:00
										 |  |  |     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  |     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 
					
						
							| 
									
										
										
										
											2013-05-06 12:50:19 +07:00
										 |  |  |     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     This file is part of the tinyusb stack. | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							| 
									
										
										
										
											2012-11-29 17:52:57 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  | /** \ingroup TBD
 | 
					
						
							|  |  |  |  *  \defgroup TBD | 
					
						
							|  |  |  |  *  \brief TBD | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  @{ | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-11-29 17:52:57 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  | #ifndef _TUSB_USBD_H_
 | 
					
						
							|  |  |  | #define _TUSB_USBD_H_
 | 
					
						
							| 
									
										
										
										
											2012-11-29 17:52:57 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  | //--------------------------------------------------------------------+
 | 
					
						
							|  |  |  | // INCLUDE
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							| 
									
										
										
										
											2013-06-01 21:54:08 +07:00
										 |  |  | #include "common/common.h"
 | 
					
						
							| 
									
										
										
										
											2013-10-30 12:20:00 +07:00
										 |  |  | #include "osal/osal.h"
 | 
					
						
							|  |  |  | #include "dcd.h"
 | 
					
						
							| 
									
										
										
										
											2013-06-03 15:56:14 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  |  extern "C" { | 
					
						
							| 
									
										
										
										
											2013-01-16 12:43:17 +07:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2012-12-04 18:18:29 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-11 12:48:21 +07:00
										 |  |  | // LPC11uxx and LPC13uxx requires each buffer has to be 64-byte alignment
 | 
					
						
							| 
									
										
										
										
											2013-11-25 12:48:27 +07:00
										 |  |  | #if TUSB_CFG_MCU == MCU_LPC11UXX || TUSB_CFG_MCU == MCU_LPC13UXX
 | 
					
						
							| 
									
										
										
										
											2013-11-11 12:48:21 +07:00
										 |  |  |  #define ATTR_USB_MIN_ALIGNMENT   ATTR_ALIGNED(64)
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  |  #define ATTR_USB_MIN_ALIGNMENT
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-16 12:43:17 +07:00
										 |  |  | //--------------------------------------------------------------------+
 | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  | // MACRO CONSTANT TYPEDEF
 | 
					
						
							| 
									
										
										
										
											2013-01-16 12:43:17 +07:00
										 |  |  | //--------------------------------------------------------------------+
 | 
					
						
							| 
									
										
										
										
											2013-06-03 14:31:17 +07:00
										 |  |  | typedef struct { | 
					
						
							| 
									
										
										
										
											2013-11-08 12:03:32 +07:00
										 |  |  |   void (* const init) (void); | 
					
						
							| 
									
										
										
										
											2013-10-29 16:29:48 +07:00
										 |  |  |   tusb_error_t (* const open)(uint8_t, tusb_descriptor_interface_t const *, uint16_t*); | 
					
						
							| 
									
										
										
										
											2013-12-09 11:15:13 +07:00
										 |  |  |   tusb_error_t (* const control_request_subtask) (uint8_t, tusb_control_request_t const *); | 
					
						
							| 
									
										
										
										
											2013-11-26 13:15:40 +07:00
										 |  |  |   tusb_error_t (* const xfer_cb) (endpoint_handle_t, tusb_event_t, uint32_t); | 
					
						
							| 
									
										
										
										
											2013-11-21 12:47:55 +07:00
										 |  |  |   void (* const close) (uint8_t); | 
					
						
							| 
									
										
										
										
											2013-11-08 12:03:32 +07:00
										 |  |  | } usbd_class_driver_t; | 
					
						
							| 
									
										
										
										
											2012-11-29 17:52:57 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-16 12:43:17 +07:00
										 |  |  | //--------------------------------------------------------------------+
 | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  | // INTERNAL OBJECT & FUNCTION DECLARATION
 | 
					
						
							| 
									
										
										
										
											2013-01-16 12:43:17 +07:00
										 |  |  | //--------------------------------------------------------------------+
 | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							|  |  |  | // APPLICATION API
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							| 
									
										
										
										
											2013-05-31 21:24:40 +07:00
										 |  |  | bool tusbd_is_configured(uint8_t coreid) ATTR_WARN_UNUSED_RESULT; | 
					
						
							| 
									
										
										
										
											2013-11-22 15:16:24 +07:00
										 |  |  | //void tusbd_device_suspended_cb(uint8_t coreid);
 | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							|  |  |  | // CLASS-USBD & INTERNAL API
 | 
					
						
							|  |  |  | //--------------------------------------------------------------------+
 | 
					
						
							|  |  |  | #ifdef _TINY_USB_SOURCE_FILE_
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-09 11:15:13 +07:00
										 |  |  | extern osal_semaphore_handle_t usbd_control_xfer_sem_hdl; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  | tusb_error_t usbd_init(void); | 
					
						
							| 
									
										
										
										
											2013-11-18 17:29:12 +07:00
										 |  |  | OSAL_TASK_FUNCTION (usbd_task) (void* p_task_para); | 
					
						
							| 
									
										
										
										
											2013-12-09 11:15:13 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-16 12:43:17 +07:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  |  } | 
					
						
							| 
									
										
										
										
											2012-12-07 16:22:47 +07:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2013-05-23 13:22:46 +07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif /* _TUSB_USBD_H_ */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** @} */ |