source: azure_iot_hub_f767zi/trunk/asp_baseplatform/usb/device/SERIAL/tusbd_serial.h@ 457

Last change on this file since 457 was 457, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 5.8 KB
Line 
1/*
2 * TOPPERS BASE PLATFORM MIDDLEWARE
3 *
4 * Copyright (C) 2017-2017 by TOPPERS PROJECT
5 * Educational Working Group.
6 *
7 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
8 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
9 * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
10 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
11 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
12 * スコード中に含まれていること.
13 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
14 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
15 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
16 * の無保証規定を掲載すること.
17 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
18 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
19 * と.
20 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
21 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
22 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
23 * 報告すること.
24 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
25 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
26 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
27 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
28 * 免責すること.
29 *
30 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
31 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
32 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
33 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
34 * の責任を負わない.
35 *
36 * @(#) $Id$
37 */
38/* Copyright (c) 2010-2011 mbed.org, MIT License
39 *
40 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
41 * and associated documentation files (the "Software"), to deal in the Software without
42 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
43 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
44 * Software is furnished to do so, subject to the following conditions:
45 *
46 * The above copyright notice and this permission notice shall be included in all copies or
47 * substantial portions of the Software.
48 *
49 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
50 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
51 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
52 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
53 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
54 */
55
56/*
57 * USB Device CDC SERIAL CLASSS部定義
58 */
59
60#ifndef _TUSBD_SERIAL_H_
61#define _TUSBD_SERIAL_H_
62
63#ifdef __cplusplus
64 extern "C" {
65#endif
66
67#include "tusbd_base.h"
68
69
70#define CDC_EPBULKIN_ADDR 0x81
71#define CDC_EPBULKOUT_ADDR 0x01
72#define CDC_EPINT_ADDR 0x82
73
74#define TOTAL_CDC_DESCRIPTOR_LENGTH ((1 * CONFIGURATION_DESCRIPTOR_LENGTH) \
75 + (2 * INTERFACE_DESCRIPTOR_LENGTH) \
76 + (5 + 5 + 5 + 4) \
77 + (3 * ENDPOINT_DESCRIPTOR_LENGTH))
78
79#define CDC_PACKET_SIZE_EPINT 8
80#define CDC_LINE_CODE_SIZE 7
81
82/*
83 * CDC要求定義
84 */
85#define CDC_SEND_ENCAPSULATED_COMMAND 0x00
86#define CDC_GET_ENCAPSULATED_RESPONSE 0x01
87#define CDC_SET_COMM_FEATURE 0x02
88#define CDC_GET_COMM_FEATURE 0x03
89#define CDC_CLEAR_COMM_FEATURE 0x04
90#define CDC_SET_LINE_CODING 0x20
91#define CDC_GET_LINE_CODING 0x21
92#define CDC_SET_CONTROL_LINE_STATE 0x22
93#define CDC_SEND_BREAK 0x23
94
95#define CDC_RECEIVED 0x40
96
97
98typedef struct
99{
100 uint8_t rxdata[MAX_PACKET_SIZE_HS_EPBULK];
101 uint8_t cmddata[64];
102 uint8_t CmdCode;
103 uint8_t CmdLength;
104 uint16_t packetsize;
105 uint32_t RxLength;
106 uint8_t *TxBuffer;
107 uint32_t TxLength;
108 volatile uint32_t TxState;
109} TUSBD_CDC_Handle_t;
110
111extern uint8_t configurationCdcHsDescriptor[];
112extern uint8_t configurationCdcFsDescriptor[];
113extern uint8_t configurationCdcOtrDescriptor[];
114
115
116TUSBD_ERCODE tusbdCdcSetReceivePacket(TUSBD_Handle_t *pdevice);
117TUSBD_ERCODE tusbdCdcStartTransmit(TUSBD_Handle_t *pdevice, uint8_t *pbuff, uint32_t length);
118
119
120TUSBD_ERCODE tusbdCdcInit(TUSBD_Handle_t *pdevice, uint8_t idx);
121TUSBD_ERCODE tusbdCdcDeInit(TUSBD_Handle_t *pdevice, uint8_t idx);
122void tusbdCdcEP0RxReady(TUSBD_Handle_t *pdevice);
123void tusbdCdcSetup(TUSBD_Handle_t *pdevice, UsbSetupRequest *req);
124void tusbdCdcDataIn(TUSBD_Handle_t *pdevice, uint8_t epnum);
125void tusbdCdcDataOut(TUSBD_Handle_t *pdevice, uint8_t epnum);
126
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif /* _TUSBD_SERIAL_H_ */
133
Note: See TracBrowser for help on using the repository browser.