rename tests to obsolete
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, training, latest versions, license
|
||||
and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*
|
||||
* The following #error directive is to remind users that a batch file must be
|
||||
* executed prior to this project being built. The batch file *cannot* be
|
||||
* executed from within the IDE! Once it has been executed, re-open or refresh
|
||||
* the Eclipse project and remove the #error line below.
|
||||
*/
|
||||
//#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above.
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configTICK_RATE_HZ ( 50 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 20 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) 0 ) /* This parameter has no effect when heap_3.c is included in the project. */
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
|
||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 7 )
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,342 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (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.
|
||||
*/
|
||||
|
||||
#include "tusb_option.h"
|
||||
#include "descriptor_test.h"
|
||||
|
||||
CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4)
|
||||
const uint8_t keyboard_report_descriptor[] = {
|
||||
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
|
||||
HID_USAGE ( HID_USAGE_DESKTOP_KEYBOARD ),
|
||||
HID_COLLECTION ( HID_COLLECTION_APPLICATION ),
|
||||
HID_USAGE_PAGE ( HID_USAGE_PAGE_KEYBOARD ),
|
||||
HID_USAGE_MIN ( 224 ),
|
||||
HID_USAGE_MAX ( 231 ),
|
||||
HID_LOGICAL_MIN ( 0 ),
|
||||
HID_LOGICAL_MAX ( 1 ),
|
||||
|
||||
HID_REPORT_COUNT ( 8 ), /* 8 bits */
|
||||
HID_REPORT_SIZE ( 1 ),
|
||||
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ), /* maskable modifier key */
|
||||
|
||||
HID_REPORT_COUNT ( 1 ),
|
||||
HID_REPORT_SIZE ( 8 ),
|
||||
HID_INPUT ( HID_CONSTANT ), /* reserved */
|
||||
|
||||
HID_USAGE_PAGE ( HID_USAGE_PAGE_LED ),
|
||||
HID_USAGE_MIN ( 1 ),
|
||||
HID_USAGE_MAX ( 5 ),
|
||||
HID_REPORT_COUNT ( 5 ),
|
||||
HID_REPORT_SIZE ( 1 ),
|
||||
HID_OUTPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ), /* 5-bit Led report */
|
||||
|
||||
HID_REPORT_COUNT ( 1 ),
|
||||
HID_REPORT_SIZE ( 3 ), /* led padding */
|
||||
HID_OUTPUT ( HID_CONSTANT ),
|
||||
|
||||
HID_USAGE_PAGE (HID_USAGE_PAGE_KEYBOARD),
|
||||
HID_USAGE_MIN ( 0 ),
|
||||
HID_USAGE_MAX ( 101 ),
|
||||
HID_LOGICAL_MIN ( 0 ),
|
||||
HID_LOGICAL_MAX ( 101 ),
|
||||
|
||||
HID_REPORT_COUNT ( 6 ),
|
||||
HID_REPORT_SIZE ( 8 ),
|
||||
HID_INPUT ( HID_DATA | HID_ARRAY | HID_ABSOLUTE ), /* keycodes array 6 items */
|
||||
HID_COLLECTION_END
|
||||
};
|
||||
|
||||
CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4)
|
||||
const uint8_t mouse_report_descriptor[] = {
|
||||
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
|
||||
HID_USAGE ( HID_USAGE_DESKTOP_MOUSE ),
|
||||
HID_COLLECTION ( HID_COLLECTION_APPLICATION ),
|
||||
HID_USAGE (HID_USAGE_DESKTOP_POINTER),
|
||||
|
||||
HID_COLLECTION ( HID_COLLECTION_PHYSICAL ),
|
||||
HID_USAGE_PAGE ( HID_USAGE_PAGE_BUTTON ),
|
||||
HID_USAGE_MIN ( 1 ),
|
||||
HID_USAGE_MAX ( 3 ),
|
||||
HID_LOGICAL_MIN ( 0 ),
|
||||
HID_LOGICAL_MAX ( 1 ),
|
||||
|
||||
HID_REPORT_COUNT ( 3 ), /* Left, Right and Middle mouse*/
|
||||
HID_REPORT_SIZE ( 1 ),
|
||||
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ),
|
||||
|
||||
HID_REPORT_COUNT ( 1 ),
|
||||
HID_REPORT_SIZE ( 5 ),
|
||||
HID_INPUT ( HID_CONSTANT ), /* reserved */
|
||||
|
||||
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
|
||||
HID_USAGE ( HID_USAGE_DESKTOP_X ),
|
||||
HID_USAGE ( HID_USAGE_DESKTOP_Y ),
|
||||
HID_LOGICAL_MIN ( 0x81 ), /* -127 */
|
||||
HID_LOGICAL_MAX ( 0x7f ), /* 127 */
|
||||
|
||||
HID_REPORT_COUNT ( 2 ), /* X, Y position */
|
||||
HID_REPORT_SIZE ( 8 ),
|
||||
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ), /* relative values */
|
||||
HID_COLLECTION_END,
|
||||
|
||||
HID_COLLECTION_END
|
||||
};
|
||||
|
||||
|
||||
CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4)
|
||||
tusb_desc_device_t const desc_device =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_device_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_DEVICE,
|
||||
.bcdUSB = 0x0200,
|
||||
.bDeviceClass = 0x00,
|
||||
.bDeviceSubClass = 0x00,
|
||||
.bDeviceProtocol = 0x00,
|
||||
|
||||
.bMaxPacketSize0 = 64,
|
||||
|
||||
.idVendor = 0x1FC9,
|
||||
.idProduct = 0x4000,
|
||||
.bcdDevice = 0x0100,
|
||||
|
||||
.iManufacturer = 0x01,
|
||||
.iProduct = 0x02,
|
||||
.iSerialNumber = 0x03,
|
||||
|
||||
.bNumConfigurations = 0x02
|
||||
} ;
|
||||
|
||||
|
||||
CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4)
|
||||
const app_configuration_desc_t desc_configuration =
|
||||
{
|
||||
.configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_configuration_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_CONFIGURATION,
|
||||
|
||||
.wTotalLength = sizeof(app_configuration_desc_t) - 1, // exclude termination
|
||||
.bNumInterfaces = 5,
|
||||
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = 0x00,
|
||||
.bmAttributes = TUSB_DESC_CONFIG_ATT_BUS_POWER,
|
||||
.bMaxPower = TUSB_DESC_CONFIG_POWER_MA(100)
|
||||
},
|
||||
|
||||
//------------- HID Keyboard -------------//
|
||||
.keyboard_interface =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
|
||||
.bInterfaceNumber = 1,
|
||||
.bAlternateSetting = 0x00,
|
||||
.bNumEndpoints = 1,
|
||||
.bInterfaceClass = TUSB_CLASS_HID,
|
||||
.bInterfaceSubClass = HID_SUBCLASS_BOOT,
|
||||
.bInterfaceProtocol = HID_PROTOCOL_KEYBOARD,
|
||||
.iInterface = 0x00
|
||||
},
|
||||
|
||||
.keyboard_hid =
|
||||
{
|
||||
.bLength = sizeof(tusb_hid_descriptor_hid_t),
|
||||
.bDescriptorType = HID_DESC_TYPE_HID,
|
||||
.bcdHID = 0x0111,
|
||||
.bCountryCode = HID_LOCAL_NotSupported,
|
||||
.bNumDescriptors = 1,
|
||||
.bReportType = HID_DESC_TYPE_REPORT,
|
||||
.wReportLength = sizeof(keyboard_report_descriptor)
|
||||
},
|
||||
|
||||
.keyboard_endpoint =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = 0x81,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
|
||||
.wMaxPacketSize = 0x08,
|
||||
.bInterval = 0x0A
|
||||
},
|
||||
|
||||
//------------- HID Mouse -------------//
|
||||
.mouse_interface =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
|
||||
.bInterfaceNumber = 2,
|
||||
.bAlternateSetting = 0x00,
|
||||
.bNumEndpoints = 1,
|
||||
.bInterfaceClass = TUSB_CLASS_HID,
|
||||
.bInterfaceSubClass = HID_SUBCLASS_BOOT,
|
||||
.bInterfaceProtocol = HID_PROTOCOL_MOUSE,
|
||||
.iInterface = 0x00
|
||||
},
|
||||
|
||||
.mouse_hid =
|
||||
{
|
||||
.bLength = sizeof(tusb_hid_descriptor_hid_t),
|
||||
.bDescriptorType = HID_DESC_TYPE_HID,
|
||||
.bcdHID = 0x0111,
|
||||
.bCountryCode = HID_LOCAL_NotSupported,
|
||||
.bNumDescriptors = 1,
|
||||
.bReportType = HID_DESC_TYPE_REPORT,
|
||||
.wReportLength = sizeof(mouse_report_descriptor)
|
||||
},
|
||||
|
||||
.mouse_endpoint =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = 0x82,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
|
||||
.wMaxPacketSize = 0x08,
|
||||
.bInterval = 0x0A
|
||||
},
|
||||
|
||||
//------------- Mass Storage -------------//
|
||||
.msc_interface =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
|
||||
.bInterfaceNumber = 3,
|
||||
.bAlternateSetting = 0x00,
|
||||
.bNumEndpoints = 2,
|
||||
.bInterfaceClass = TUSB_CLASS_MSC,
|
||||
.bInterfaceSubClass = MSC_SUBCLASS_SCSI,
|
||||
.bInterfaceProtocol = MSC_PROTOCOL_BOT,
|
||||
.iInterface = 0x00
|
||||
},
|
||||
|
||||
.msc_endpoint_in =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = 0x83,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||
.wMaxPacketSize = 512,
|
||||
.bInterval = 1
|
||||
},
|
||||
|
||||
.msc_endpoint_out =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = 0x03,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||
.wMaxPacketSize = 512,
|
||||
.bInterval = 1
|
||||
},
|
||||
|
||||
//------------- CDC Serial -------------//
|
||||
.cdc_comm_interface =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
|
||||
.bInterfaceNumber = 4,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 1,
|
||||
.bInterfaceClass = TUSB_CLASS_CDC,
|
||||
.bInterfaceSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL,
|
||||
.bInterfaceProtocol = CDC_COMM_PROTOCOL_ATCOMMAND,
|
||||
.iInterface = 0x00
|
||||
},
|
||||
|
||||
.cdc_header =
|
||||
{
|
||||
.bLength = sizeof(cdc_desc_func_header_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = CDC_FUNC_DESC_HEADER,
|
||||
.bcdCDC = 0x0120
|
||||
},
|
||||
|
||||
.cdc_acm =
|
||||
{
|
||||
.bLength = sizeof(cdc_desc_func_acm_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT,
|
||||
.bmCapabilities = { // 0x06
|
||||
.support_line_request = 1,
|
||||
.support_send_break = 1
|
||||
}
|
||||
},
|
||||
|
||||
.cdc_union =
|
||||
{
|
||||
.bLength = sizeof(cdc_desc_func_union_t), // plus number of
|
||||
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = CDC_FUNC_DESC_UNION,
|
||||
.bControlInterface = 1,
|
||||
.bSubordinateInterface = 2,
|
||||
},
|
||||
|
||||
.cdc_endpoint_notification =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = 0x84,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
|
||||
.wMaxPacketSize = 8,
|
||||
.bInterval = 0x0a // lowest polling rate
|
||||
},
|
||||
|
||||
//------------- CDC Data Interface -------------//
|
||||
.cdc_data_interface =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
|
||||
.bInterfaceNumber = 5,
|
||||
.bAlternateSetting = 0x00,
|
||||
.bNumEndpoints = 2,
|
||||
.bInterfaceClass = TUSB_CLASS_CDC_DATA,
|
||||
.bInterfaceSubClass = 0,
|
||||
.bInterfaceProtocol = 0,
|
||||
.iInterface = 0x00
|
||||
},
|
||||
|
||||
.cdc_endpoint_out =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = 5,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||
.wMaxPacketSize = 64,
|
||||
.bInterval = 0
|
||||
},
|
||||
|
||||
.cdc_endpoint_in =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = 0x85,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||
.wMaxPacketSize = 64,
|
||||
.bInterval = 0
|
||||
},
|
||||
|
||||
// TODO CDC & RNDIS
|
||||
.ConfigDescTermination = 0,
|
||||
};
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (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.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief TBD
|
||||
*
|
||||
* \note TBD
|
||||
*/
|
||||
|
||||
/** \ingroup TBD
|
||||
* \defgroup TBD
|
||||
* \brief TBD
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _TUSB_TEST_DESCRIPTOR_H_
|
||||
#define _TUSB_TEST_DESCRIPTOR_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "common/common.h"
|
||||
#include "class/hid.h"
|
||||
#include "class/msc.h"
|
||||
#include "class/cdc.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
tusb_desc_configuration_t configuration;
|
||||
|
||||
#if 0 //&& IAD_DESC_REQUIRED
|
||||
tusb_desc_interface_assoc_t CDC_IAD;
|
||||
#endif
|
||||
|
||||
#if 0 //&& CFG_TUD_CDC
|
||||
//CDC - Serial
|
||||
//CDC Control Interface
|
||||
tusb_desc_interface_t CDC_CCI_Interface;
|
||||
CDC_HEADER_DESCRIPTOR CDC_Header;
|
||||
CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR CDC_ACM;
|
||||
CDC_UNION_1SLAVE_DESCRIPTOR CDC_Union;
|
||||
tusb_desc_endpoint_t CDC_NotificationEndpoint;
|
||||
|
||||
//CDC Data Interface
|
||||
tusb_desc_interface_t CDC_DCI_Interface;
|
||||
tusb_desc_endpoint_t CDC_DataOutEndpoint;
|
||||
tusb_desc_endpoint_t CDC_DataInEndpoint;
|
||||
#endif
|
||||
|
||||
//------------- HID Keyboard -------------//
|
||||
tusb_desc_interface_t keyboard_interface;
|
||||
tusb_hid_descriptor_hid_t keyboard_hid;
|
||||
tusb_desc_endpoint_t keyboard_endpoint;
|
||||
|
||||
//------------- HID Mouse -------------//
|
||||
tusb_desc_interface_t mouse_interface;
|
||||
tusb_hid_descriptor_hid_t mouse_hid;
|
||||
tusb_desc_endpoint_t mouse_endpoint;
|
||||
|
||||
//------------- Mass Storage -------------//
|
||||
tusb_desc_interface_t msc_interface;
|
||||
tusb_desc_endpoint_t msc_endpoint_in;
|
||||
tusb_desc_endpoint_t msc_endpoint_out;
|
||||
|
||||
//------------- CDC Serial -------------//
|
||||
//CDC Control Interface
|
||||
tusb_desc_interface_t cdc_comm_interface;
|
||||
cdc_desc_func_header_t cdc_header;
|
||||
cdc_desc_func_acm_t cdc_acm;
|
||||
cdc_desc_func_union_t cdc_union;
|
||||
tusb_desc_endpoint_t cdc_endpoint_notification;
|
||||
|
||||
//CDC Data Interface
|
||||
tusb_desc_interface_t cdc_data_interface;
|
||||
tusb_desc_endpoint_t cdc_endpoint_out;
|
||||
tusb_desc_endpoint_t cdc_endpoint_in;
|
||||
|
||||
|
||||
unsigned char ConfigDescTermination;
|
||||
} app_configuration_desc_t;
|
||||
|
||||
extern tusb_desc_device_t const desc_device;
|
||||
extern app_configuration_desc_t const desc_configuration;
|
||||
extern const uint8_t keyboard_report_descriptor[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_TEST_DESCRIPTOR_H_ */
|
||||
|
||||
/** @} */
|
||||
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (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.
|
||||
*/
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
#include "unity.h"
|
||||
#include "common/common.h"
|
||||
#include "hal.h"
|
||||
#include "usbh_hcd.h"
|
||||
#include "ehci.h"
|
||||
|
||||
#include "ehci_controller_fake.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
LPC_USB0_Type lpc_usb0;
|
||||
LPC_USB1_Type lpc_usb1;
|
||||
|
||||
extern usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// IMPLEMENTATION
|
||||
//--------------------------------------------------------------------+
|
||||
void ehci_controller_init(void)
|
||||
{
|
||||
tu_memclr(&lpc_usb0, sizeof(LPC_USB0_Type));
|
||||
tu_memclr(&lpc_usb1, sizeof(LPC_USB1_Type));
|
||||
}
|
||||
|
||||
void ehci_controller_control_xfer_proceed(uint8_t dev_addr, uint8_t p_data[])
|
||||
{
|
||||
ehci_registers_t* const regs = get_operational_register( _usbh_devices[dev_addr].rhport );
|
||||
ehci_qhd_t * p_qhd = get_control_qhd(dev_addr);
|
||||
ehci_qtd_t * p_qtd_setup = get_control_qtds(dev_addr);
|
||||
ehci_qtd_t * p_qtd_data = p_qtd_setup + 1;
|
||||
ehci_qtd_t * p_qtd_status = p_qtd_setup + 2;
|
||||
|
||||
tusb_control_request_t const *p_request = (tusb_control_request_t *) p_qtd_setup->buffer[0];
|
||||
|
||||
if (p_request->wLength > 0 && p_request->bmRequestType_bit.direction == TUSB_DIR_DEV_TO_HOST)
|
||||
{
|
||||
memcpy(p_qtd_data, p_data, p_request->wLength);
|
||||
}
|
||||
|
||||
//------------- retire all QTDs -------------//
|
||||
p_qtd_setup->active = p_qtd_data->active = p_qtd_status->active = 0;
|
||||
p_qhd->qtd_overlay = *p_qtd_status;
|
||||
|
||||
regs->usb_sts = EHCI_INT_MASK_NXP_ASYNC | EHCI_INT_MASK_NXP_PERIODIC;
|
||||
|
||||
hcd_isr( _usbh_devices[dev_addr].rhport );
|
||||
}
|
||||
|
||||
void complete_qtd_in_qhd(ehci_qhd_t *p_qhd)
|
||||
{
|
||||
if ( !p_qhd->qtd_overlay.halted )
|
||||
{
|
||||
while(!p_qhd->qtd_overlay.next.terminate)
|
||||
{
|
||||
ehci_qtd_t* p_qtd = (ehci_qtd_t*) tu_align32(p_qhd->qtd_overlay.next.address);
|
||||
p_qtd->active = 0;
|
||||
p_qtd->total_bytes = 0;
|
||||
p_qhd->qtd_overlay = *p_qtd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool complete_all_qtd_in_async(ehci_qhd_t *head)
|
||||
{
|
||||
ehci_qhd_t *p_qhd = head;
|
||||
|
||||
do
|
||||
{
|
||||
complete_qtd_in_qhd(p_qhd);
|
||||
p_qhd = (ehci_qhd_t*) tu_align32(p_qhd->next.address);
|
||||
}while(p_qhd != head); // stop if loop around
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool complete_all_qtd_in_period(ehci_link_t *head)
|
||||
{
|
||||
while(!head->terminate)
|
||||
{
|
||||
uint32_t queue_type = head->type;
|
||||
head = (ehci_link_t*) tu_align32(head->address);
|
||||
|
||||
if ( queue_type == EHCI_QUEUE_ELEMENT_QHD)
|
||||
{
|
||||
complete_qtd_in_qhd( (ehci_qhd_t*) head );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ehci_controller_run(uint8_t hostid)
|
||||
{
|
||||
//------------- Async List -------------//
|
||||
ehci_registers_t* const regs = get_operational_register(hostid);
|
||||
complete_all_qtd_in_async((ehci_qhd_t*) regs->async_list_base);
|
||||
|
||||
//------------- Period List -------------//
|
||||
for(uint8_t i=1; i <= EHCI_FRAMELIST_SIZE; i *= 2)
|
||||
{
|
||||
complete_all_qtd_in_period( get_period_head(hostid, i) );
|
||||
}
|
||||
regs->usb_sts = EHCI_INT_MASK_NXP_ASYNC | EHCI_INT_MASK_NXP_PERIODIC;
|
||||
|
||||
hcd_isr(hostid);
|
||||
}
|
||||
|
||||
void complete_1st_qtd_with_error(ehci_qhd_t* p_qhd, bool halted, bool xact_err)
|
||||
{
|
||||
if ( !p_qhd->qtd_overlay.halted )
|
||||
{
|
||||
if(!p_qhd->qtd_overlay.next.terminate) // TODO add active check
|
||||
{
|
||||
ehci_qtd_t* p_qtd = (ehci_qtd_t*) tu_align32(p_qhd->qtd_overlay.next.address);
|
||||
p_qtd->active = 0;
|
||||
p_qtd->halted = halted ? 1 : 0;
|
||||
p_qtd->xact_err = xact_err ? 1 : 0;
|
||||
|
||||
p_qhd->qtd_overlay = *p_qtd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void complete_list_with_error(uint8_t hostid, bool halted, bool xact_err)
|
||||
{
|
||||
//------------- Async List -------------//
|
||||
ehci_registers_t* const regs = get_operational_register(hostid);
|
||||
|
||||
ehci_qhd_t *p_qhd = (ehci_qhd_t*) regs->async_list_base;
|
||||
do
|
||||
{
|
||||
complete_1st_qtd_with_error(p_qhd, halted, xact_err);
|
||||
p_qhd = (ehci_qhd_t*) tu_align32(p_qhd->next.address);
|
||||
}while(p_qhd != get_async_head(hostid)); // stop if loop around
|
||||
|
||||
//------------- Period List -------------//
|
||||
for(uint8_t i=1; i <= EHCI_FRAMELIST_SIZE; i *= 2)
|
||||
{
|
||||
ehci_link_t *head = get_period_head(hostid, i);
|
||||
|
||||
while(!head->terminate)
|
||||
{
|
||||
uint32_t queue_type = head->type;
|
||||
head = (ehci_link_t*) tu_align32(head->address);
|
||||
|
||||
if ( queue_type == EHCI_QUEUE_ELEMENT_QHD)
|
||||
{
|
||||
complete_1st_qtd_with_error((ehci_qhd_t*) head, halted, xact_err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
regs->usb_sts = EHCI_INT_MASK_ERROR;
|
||||
|
||||
hcd_isr(hostid);
|
||||
}
|
||||
|
||||
void ehci_controller_run_stall(uint8_t hostid)
|
||||
{
|
||||
complete_list_with_error(hostid, true, false);
|
||||
}
|
||||
|
||||
void ehci_controller_run_error(uint8_t hostid)
|
||||
{
|
||||
complete_list_with_error(hostid, true, true);
|
||||
}
|
||||
|
||||
void ehci_controller_device_plug(uint8_t hostid, tusb_speed_t speed)
|
||||
{
|
||||
ehci_registers_t* const regs = get_operational_register(hostid);
|
||||
|
||||
regs->usb_sts_bit.port_change_detect = 1;
|
||||
regs->portsc_bit.connect_status_change = 1;
|
||||
regs->portsc_bit.current_connect_status = 1;
|
||||
regs->portsc_bit.nxp_port_speed = speed;
|
||||
|
||||
hcd_isr(hostid);
|
||||
}
|
||||
|
||||
void ehci_controller_device_unplug(uint8_t hostid)
|
||||
{
|
||||
ehci_registers_t* const regs = get_operational_register(hostid);
|
||||
|
||||
regs->usb_sts_bit.port_change_detect = 1;
|
||||
regs->portsc_bit.connect_status_change = 1;
|
||||
regs->portsc_bit.current_connect_status = 0;
|
||||
|
||||
hcd_isr(hostid);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (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.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief TBD
|
||||
*
|
||||
* \note TBD
|
||||
*/
|
||||
|
||||
/** \ingroup TBD
|
||||
* \defgroup TBD
|
||||
* \brief TBD
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _TUSB_EHCI_CONTROLLER_H_
|
||||
#define _TUSB_EHCI_CONTROLLER_H_
|
||||
|
||||
#include "host/hcd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern ehci_data_t ehci_data;
|
||||
|
||||
void ehci_controller_init(void);
|
||||
void ehci_controller_run(uint8_t hostid);
|
||||
void ehci_controller_run_error(uint8_t hostid);
|
||||
void ehci_controller_control_xfer_proceed(uint8_t dev_addr, uint8_t p_data[]);
|
||||
void ehci_controller_device_plug(uint8_t hostid, tusb_speed_t speed);
|
||||
void ehci_controller_device_unplug(uint8_t hostid);
|
||||
|
||||
ehci_registers_t* get_operational_register(uint8_t hostid);
|
||||
ehci_link_t* get_period_frame_list(uint8_t hostid);
|
||||
ehci_qhd_t* get_async_head(uint8_t hostid);
|
||||
ehci_link_t* get_period_head(uint8_t hostid, uint8_t interval_ms);
|
||||
ehci_qhd_t* get_control_qhd(uint8_t dev_addr);
|
||||
ehci_qtd_t* get_control_qtds(uint8_t dev_addr);
|
||||
ehci_qhd_t* qhd_get_from_pipe_handle(pipe_handle_t pipe_hdl);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_EHCI_CONTROLLER_H_ */
|
||||
|
||||
/** @} */
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (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.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief TBD
|
||||
*
|
||||
* \note TBD
|
||||
*/
|
||||
|
||||
/** \ingroup TBD
|
||||
* \defgroup TBD
|
||||
* \brief TBD
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _TUSB_TUSB_CALLBACK_H_
|
||||
#define _TUSB_TUSB_CALLBACK_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "common/common.h"
|
||||
#include "usbh.h"
|
||||
|
||||
//------------- core -------------//
|
||||
uint8_t tusbh_device_attached_cb (tusb_desc_device_t const *p_desc_device) TU_ATTR_WEAK;
|
||||
void tusbh_device_mount_succeed_cb (uint8_t dev_addr) TU_ATTR_WEAK;
|
||||
void tusbh_device_mount_failed_cb(tusb_error_t error, tusb_desc_device_t const *p_desc_device) TU_ATTR_WEAK;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_TUSB_CALLBACK_H_ */
|
||||
|
||||
/** @} */
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (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.
|
||||
*/
|
||||
|
||||
#ifndef _TUSB_CONFIG_H_
|
||||
#define _TUSB_CONFIG_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// CONTROLLER CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_HOST | OPT_MODE_DEVICE)
|
||||
#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_NONE)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// HOST CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUSB_HOST_DEVICE_MAX 5 // TODO be a part of HUB config
|
||||
|
||||
//------------- CLASS -------------//
|
||||
#define CFG_TUH_HUB 1
|
||||
#define CFG_TUH_HID_KEYBOARD 1
|
||||
#define CFG_TUH_HID_MOUSE 1
|
||||
#define CFG_TUH_MSC 1
|
||||
#define CFG_TUSB_HOST_HID_GENERIC 0
|
||||
#define CFG_TUH_CDC 1
|
||||
#define CFG_TUH_CDC_RNDIS 0
|
||||
|
||||
// Test support
|
||||
#define TEST_CONTROLLER_HOST_START_INDEX \
|
||||
( ((CONTROLLER_HOST_NUMBER == 1) && (CFG_TUSB_RHPORT1_MODE & OPT_MODE_HOST)) ? 1 : 0)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// DEVICE CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define CFG_TUD_ENDOINT0_SIZE 64
|
||||
|
||||
//------------- CLASS -------------//
|
||||
#define CFG_TUD_CDC 1
|
||||
#define CFG_TUD_MSC 1
|
||||
#define CFG_TUD_HID_KEYBOARD 1
|
||||
#define CFG_TUD_HID_MOUSE 1
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// COMMON CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
#define CFG_TUSB_DEBUG 1
|
||||
|
||||
#define CFG_TUSB_OS OPT_OS_NONE
|
||||
#define CFG_TUSB_MEM_SECTION
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#define RANDOM(n) (rand()%(n))
|
||||
|
||||
#endif /* _TUSB_CONFIG_H_ */
|
||||
|
||||
/** @} */
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (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.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief TBD
|
||||
*
|
||||
* \note TBD
|
||||
*/
|
||||
|
||||
/** \ingroup TBD
|
||||
* \defgroup TBD
|
||||
* \brief TBD
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _TUSB_TYPE_HELPER_H_
|
||||
#define _TUSB_TYPE_HELPER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define TEST_ASSERT_PIPE_HANDLE(expected, actual)\
|
||||
TEST_ASSERT_EQUAL(expected.dev_addr, actual.dev_addr);\
|
||||
TEST_ASSERT_EQUAL(expected.xfer_type, actual.xfer_type);\
|
||||
TEST_ASSERT_EQUAL(expected.index, actual.index);\
|
||||
|
||||
#define TEST_ASSERT_MEM_ZERO(buffer, size)\
|
||||
do{\
|
||||
for (uint32_t i=0; i<size; i++)\
|
||||
TEST_ASSERT_EQUAL_HEX8(0, ((uint8_t*)buffer)[i]);\
|
||||
}while(0)
|
||||
|
||||
#define TEST_ASSERT_STATUS( actual )\
|
||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, (actual) )
|
||||
|
||||
// tu_log2 a value is equivalent to its highest set bit's position
|
||||
#define BITFIELD_OFFSET_OF_MEMBER(struct_type, member, bitfield_member) \
|
||||
({\
|
||||
uint32_t value=0;\
|
||||
struct_type str;\
|
||||
tu_memclr((void*)&str, sizeof(struct_type));\
|
||||
str.member.bitfield_member = 1;\
|
||||
memcpy(&value, (void*)&str.member, sizeof(str.member));\
|
||||
tu_log2( value );\
|
||||
})
|
||||
|
||||
#define BITFIELD_OFFSET_OF_UINT32(struct_type, offset, bitfield_member) \
|
||||
({\
|
||||
struct_type str;\
|
||||
tu_memclr(&str, sizeof(struct_type));\
|
||||
str.bitfield_member = 1;\
|
||||
tu_log2( ((uint32_t*) &str)[offset] );\
|
||||
})
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_TYPE_HELPER_H_ */
|
||||
|
||||
/** @} */
|
||||
Reference in New Issue
Block a user