usb: move headers to include/usb/class
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
05609bd6fc
commit
71a927955e
5 changed files with 5 additions and 5 deletions
133
include/usb/class/cdc_acm.h
Normal file
133
include/usb/class/cdc_acm.h
Normal file
|
@ -0,0 +1,133 @@
|
|||
/***************************************************************************
|
||||
*
|
||||
* Copyright(c) 2015,2016 Intel Corporation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * 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.
|
||||
* * Neither the name of Intel Corporation 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
|
||||
* OWNER 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.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief CDC ACM device class driver header file
|
||||
*
|
||||
* Header file for USB CDC ACM device class driver
|
||||
*/
|
||||
|
||||
#ifndef __CDC_ACM_H__
|
||||
#define __CDC_ACM_H__
|
||||
|
||||
/* Data structure for GET_LINE_CODING / SET_LINE_CODING class requests */
|
||||
struct cdc_acm_line_coding {
|
||||
u32_t dwDTERate;
|
||||
u8_t bCharFormat;
|
||||
u8_t bParityType;
|
||||
u8_t bDataBits;
|
||||
} __packed;
|
||||
|
||||
struct cdc_acm_notification {
|
||||
u8_t bmRequestType;
|
||||
u8_t bNotificationType;
|
||||
u16_t wValue;
|
||||
u16_t wIndex;
|
||||
u16_t wLength;
|
||||
u16_t data;
|
||||
} __packed;
|
||||
|
||||
/* Intel vendor ID */
|
||||
#define CDC_VENDOR_ID 0x8086
|
||||
|
||||
/* Product Id, random value */
|
||||
#define CDC_PRODUCT_ID 0xF8A1
|
||||
|
||||
|
||||
/* Max packet size for Bulk endpoints */
|
||||
#define CDC_BULK_EP_MPS 64
|
||||
|
||||
/* Max packet size for Interrupt endpoints */
|
||||
#define CDC_INTERRUPT_EP_MPS 16
|
||||
|
||||
/* Max CDC ACM class request max data size */
|
||||
#define CDC_CLASS_REQ_MAX_DATA_SIZE 8
|
||||
|
||||
/* Number of configurations for the USB Device */
|
||||
#define CDC_NUM_CONF 0x01
|
||||
/* Number of interfaces in the configuration */
|
||||
#define CDC_NUM_ITF 0x02
|
||||
/* Number of Endpoints in the first interface */
|
||||
#define CDC1_NUM_EP 0x01
|
||||
/* Number of Endpoints in the second interface */
|
||||
#define CDC2_NUM_EP 0x02
|
||||
|
||||
#define CDC_ENDP_INT 0x81
|
||||
#define CDC_ENDP_OUT 0x03
|
||||
#define CDC_ENDP_IN 0x82
|
||||
|
||||
/* Decriptor size in bytes */
|
||||
#define USB_HFUNC_DESC_SIZE 5 /* Header Functional Descriptor */
|
||||
#define USB_CMFUNC_DESC_SIZE 5 /* Call Management Functional Descriptor */
|
||||
#define USB_ACMFUNC_DESC_SIZE 4 /* ACM Functional Descriptor */
|
||||
#define USB_UFUNC_DESC_SIZE 5 /* Union Functional Descriptor */
|
||||
#define USB_NETFUNC_DESC_SIZE 13 /* Networking Functional Descriptor */
|
||||
|
||||
/* Descriptor type */
|
||||
#define CS_INTERFACE 0x24
|
||||
#define CS_ENDPOINT 0x25
|
||||
|
||||
/* Descriptor subtype */
|
||||
#define USB_HFUNC_SUBDESC 0x00
|
||||
#define USB_CMFUNC_SUBDESC 0x01
|
||||
#define USB_ACMFUNC_SUBDESC 0x02
|
||||
#define USB_UFUNC_SUBDESC 0x06
|
||||
#define USB_NETFUNC_SUBDESC 0x0F
|
||||
|
||||
/* Class specific request */
|
||||
#define CDC_SEND_ENC_CMD 0x00
|
||||
#define CDC_GET_ENC_RSP 0x01
|
||||
#define CDC_SET_LINE_CODING 0x20
|
||||
#define CDC_GET_LINE_CODING 0x21
|
||||
#define CDC_SET_CONTROL_LINE_STATE 0x22
|
||||
|
||||
/* Control line state signal bitmap */
|
||||
#define CDC_CONTROL_LINE_STATE_DTR 0x1
|
||||
#define CDC_CONTROL_LINE_STATE_RTS 0x2
|
||||
|
||||
/* Serial state notification bitmap*/
|
||||
#define CDC_CONTROL_SERIAL_STATE_DCD 0x1
|
||||
#define CDC_CONTROL_SERIAL_STATE_DSR 0x2
|
||||
|
||||
/* Serial state notification timeout */
|
||||
#define CDC_CONTROL_SERIAL_STATE_TIMEOUT_US 100000
|
||||
|
||||
/* Size in bytes of the configuration sent to
|
||||
* the Host on GetConfiguration() request
|
||||
* For Communication Device: CONF + (2 x ITF) +
|
||||
* (3 x EP) + HF + CMF + ACMF + UF -> 67 bytes
|
||||
*/
|
||||
#define CDC_CONF_SIZE (USB_CONFIGURATION_DESC_SIZE + \
|
||||
(2 * USB_INTERFACE_DESC_SIZE) + (3 * USB_ENDPOINT_DESC_SIZE) + 19)
|
||||
|
||||
#endif /* __CDC_ACM_H__ */
|
109
include/usb/class/mass_storage.h
Normal file
109
include/usb/class/mass_storage.h
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Certain structures and defines in this file are from mbed's implementation.
|
||||
*
|
||||
* Copyright (c) 2010-2011 mbed.org, MIT License
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Mass Storage device class driver header file
|
||||
*
|
||||
* Header file for USB Mass Storage device class driver
|
||||
*/
|
||||
|
||||
#ifndef __MASS_STORAGE_H__
|
||||
#define __MASS_STORAGE_H__
|
||||
|
||||
/* Bulk-only Command Block Wrapper (CBW) */
|
||||
struct CBW {
|
||||
u32_t Signature;
|
||||
u32_t Tag;
|
||||
u32_t DataLength;
|
||||
u8_t Flags;
|
||||
u8_t LUN;
|
||||
u8_t CBLength;
|
||||
u8_t CB[16];
|
||||
} __packed;
|
||||
|
||||
/* Bulk-only Command Status Wrapper (CSW) */
|
||||
struct CSW {
|
||||
u32_t Signature;
|
||||
u32_t Tag;
|
||||
u32_t DataResidue;
|
||||
u8_t Status;
|
||||
} __packed;
|
||||
|
||||
/* Intel vendor ID */
|
||||
#define MASS_STORAGE_VENDOR_ID 0x8086
|
||||
|
||||
/* Product Id, random value */
|
||||
#define MASS_STORAGE_PRODUCT_ID 0xF8A1
|
||||
|
||||
/* Max packet size for Bulk endpoints */
|
||||
#define MASS_STORAGE_BULK_EP_MPS 64
|
||||
|
||||
/* Number of configurations for the USB Device */
|
||||
#define MASS_NUM_CONF 0x01
|
||||
/* Number of interfaces in the configuration */
|
||||
#define MASS_NUM_ITF 0x01
|
||||
|
||||
#define EPBULK_OUT 0x03
|
||||
#define EPBULK_IN 0x84
|
||||
|
||||
/* Size in bytes of the configuration sent to
|
||||
* the Host on GetConfiguration() request
|
||||
* For Mass Storage Device: CONF + (1 x ITF) + (2 x EP)
|
||||
*/
|
||||
#define MASS_CONF_SIZE (USB_CONFIGURATION_DESC_SIZE + \
|
||||
(1 * USB_INTERFACE_DESC_SIZE) + (2 * USB_ENDPOINT_DESC_SIZE))
|
||||
|
||||
#define CBW_Signature 0x43425355
|
||||
#define CSW_Signature 0x53425355
|
||||
|
||||
/*SCSI Commands*/
|
||||
#define TEST_UNIT_READY 0x00
|
||||
#define REQUEST_SENSE 0x03
|
||||
#define FORMAT_UNIT 0x04
|
||||
#define INQUIRY 0x12
|
||||
#define MODE_SELECT6 0x15
|
||||
#define MODE_SENSE6 0x1A
|
||||
#define START_STOP_UNIT 0x1B
|
||||
#define MEDIA_REMOVAL 0x1E
|
||||
#define READ_FORMAT_CAPACITIES 0x23
|
||||
#define READ_CAPACITY 0x25
|
||||
#define READ10 0x28
|
||||
#define WRITE10 0x2A
|
||||
#define VERIFY10 0x2F
|
||||
#define READ12 0xA8
|
||||
#define WRITE12 0xAA
|
||||
#define MODE_SELECT10 0x55
|
||||
#define MODE_SENSE10 0x5A
|
||||
|
||||
/*MSC class specific requests*/
|
||||
#define MSC_REQUEST_RESET 0xFF
|
||||
#define MSC_REQUEST_GET_MAX_LUN 0xFE
|
||||
|
||||
#define THREAD_OP_READ_QUEUED 1
|
||||
#define THREAD_OP_WRITE_QUEUED 3
|
||||
#define THREAD_OP_WRITE_DONE 4
|
||||
|
||||
#endif /* __MASS_STORAGE_H__ */
|
Loading…
Add table
Add a link
Reference in a new issue