From f7cd9b461ca33845339f4a11f49bdc142696827a Mon Sep 17 00:00:00 2001 From: Dominik Sliwa Date: Tue, 28 Jun 2016 09:51:29 +0200 Subject: Apalis_TK1_K20: SPI Communication, ADC, TSC, GPIO Support for Communication between TK1 SoC and K20 MCU This patch includes ADC, TSC and GPIO functionality. Signed-off-by: Dominik Sliwa --- usb_1.1.0/host/class/usb_host_cdc.h | 518 ++++++++++++++++++++++++++++++++++++ 1 file changed, 518 insertions(+) create mode 100644 usb_1.1.0/host/class/usb_host_cdc.h (limited to 'usb_1.1.0/host/class/usb_host_cdc.h') diff --git a/usb_1.1.0/host/class/usb_host_cdc.h b/usb_1.1.0/host/class/usb_host_cdc.h new file mode 100644 index 0000000..0acc181 --- /dev/null +++ b/usb_1.1.0/host/class/usb_host_cdc.h @@ -0,0 +1,518 @@ +/* + * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o 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. + * + * o Neither the name of Freescale Semiconductor, Inc. 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 AND CONTRIBUTORS "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 OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __USB_HOST_CDC_H__ +#define __USB_HOST_CDC_H__ + +/*! + * @addtogroup usb_host_cdc_drv + * @{ + */ + +/******************************************************************************* + * Definitions + ******************************************************************************/ + +/* Class-specific request PSTN*/ +/*! @brief CDC class-specific request (SET_LINE_CODING) */ +#define USB_HOST_CDC_SET_LINE_CODING 0x20U +/*! @brief CDC class-specific request (GET_LINE_CODING) */ +#define USB_HOST_CDC_GET_LINE_CODING 0x21U +/*! @brief CDC class-specific request (SET_CONTROL_LINE_STATE) */ +#define USB_HOST_CDC_SET_CONTROL_LINE_STATE 0x22U + +/*! @brief CDC class-specific notifications(SerialState) bitmap*/ +#define USB_HOST_ACM_UART_STATE_BITMAP_BTXCARRITER 0x01U +/*! @brief CDC class-specific notifications(SerialState) bitmap*/ +#define USB_HOST_ACM_UART_STATE_BITMAP_BRXCARRITER 0x02U +/*! @brief CDC class-specific notifications(SerialState) bitmap*/ +#define USB_HOST_ACM_UART_STATE_BITMAP_BBREAK 0x04U +/*! @brief CDC class-specific notifications(SerialState) bitmap*/ +#define USB_HOST_ACM_UART_STATE_BITMAP_BBRINGSIGNAL 0x10U + +/*! @brief CDC class-specific request (SET_CONTROL_LINE_STATE) bitmap*/ +#define USB_HOST_CDC_CONTROL_LINE_STATE_DTR 0x01U +/*! @brief CDC class-specific request (SET_CONTROL_LINE_STATE) bitmap*/ +#define USB_HOST_CDC_CONTROL_LINE_STATE_RTS 0x02U + +/*CDC SPEC*/ +/*! @brief CDC class-specific bDescriptor SubType in functional descriptors*/ +#define USB_HOST_DESC_SUBTYPE_HEADER 0x00U +/*! @brief CDC class-specific bDescriptor SubType in functional descriptors*/ +#define USB_HOST_DESC_SUBTYPE_CM 0x01U +/*! @brief CDC class-specific bDescriptor SubType in functional descriptors*/ +#define USB_HOST_DESC_SUBTYPE_ACM 0x02U +/*! @brief CDC class-specific bDescriptor SubType in functional descriptors*/ +#define USB_HOST_DESC_SUBTYPE_DLM 0x03U +/*! @brief CDC class-specific bDescriptor SubType in functional descriptors*/ +#define USB_HOST_DESC_SUBTYPE_TR 0x04U +/*! @brief CDC class-specific bDescriptor SubType in functional descriptors*/ +#define USB_HOST_DESC_SUBTYPE_TC_LSR 0x05U +/*! @brief CDC class-specific bDescriptor SubType in functional descriptors*/ +#define USB_HOST_DESC_SUBTYPE_UNION 0x06U +/*! @brief CDC class-specific bDescriptor SubType in functional descriptors*/ +#define USB_HOST_DESC_SUBTYPE_CS 0x07U +/*! @brief CDC class-specific bDescriptor SubType in functional descriptors*/ +#define USB_HOST_DESC_SUBTYPE_TOM 0x08U + +/*See the CDC specification page20*/ +/*! @brief CDC class-specific code, Communications Interface Class Code*/ +#define USB_HOST_CDC_COMMUNICATIONS_CLASS_CODE 0x02U +/*! @brief CDC class-specific code,Communications Class Subclass Codes*/ +#define USB_HOST_CDC_SUBCLASS_ACM_CODE 0x02U +/*No class specific protocol required. See the CDC specification page22*/ +#define USB_HOST_CDC_PROTOCOL_CODE 0x00U +/*! @brief CDC class-specific code,Data Class Interface Codes*/ +#define USB_HOST_CDC_DATA_CLASS_CODE 0x0AU +/* This field is unused for Data Class interfaces and should have a value of 00h.*/ +#define USB_HOST_CDC_DATA_SUBCLASS_CODE 0x00U +/*No class-specific protocol required. See the CDC specification page22*/ +#define USB_HOST_CDC_DATA_PROTOCOL_CODE 0x00U + +/*! @brief CDC GetLineCoding structure according to the 6.3 in PSTN specification */ +typedef struct _usb_host_cdc_line_coding_struct +{ + uint32_t dwDTERate; /*!< Data terminal rate, in bits per second*/ + uint8_t bCharFormat; /*!< Stop bits*/ + uint8_t bParityType; /*!< Parity*/ + uint8_t bDataBits; /*!< Data bits (5, 6, 7, 8 or 16).*/ +} usb_host_cdc_line_coding_struct_t; + +/*! @brief CDC GetLineCoding structure according to the 6.3 in PSTN specification */ +typedef struct _usb_host_cdc_control_line_state_struct +{ + uint16_t line_state; /*!< D1, This signal corresponds to V.24 signal 105 and RS-232 signal RTS*/ + /*!< D0, This signal corresponds to V.24 signal 108/2 and RS-232 signal DTR*/ +} usb_host_cdc_control_line_state_struct_t; + +/*! @brief CDC SerialState structure according to the 6.5.4 in PSTN specification */ +typedef struct _usb_host_cdc_acm_state_struct +{ + uint8_t reserved[8]; /*!< Notify response by the device, this is used as notification header, which is returned by the + device */ + uint8_t bmstate; /*!< UART State Bitmap Values*/ + uint8_t reserved1[1]; /*!< Fix 4B align issue*/ + uint8_t reserved2[2]; /*!< Fix 4B align issue*/ +} usb_host_cdc_acm_state_struct_t; + +/*! @brief CDC Header Functional Descriptor structure according to the 5.2.3 in CDC specification */ +typedef struct _usb_host_cdc_head_function_desc_struct +{ + uint8_t bFunctionLength; /*!