Mbed OS Reference
Loading...
Searching...
No Matches
USBDevice_Types.h
1/*
2 * Copyright (c) 2018-2019, Arm Limited and affiliates.
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef USBDEVICE_TYPES_H
19#define USBDEVICE_TYPES_H
20
21/* Standard requests */
22#define GET_STATUS (0)
23#define CLEAR_FEATURE (1)
24#define SET_FEATURE (3)
25#define SET_ADDRESS (5)
26#define GET_DESCRIPTOR (6)
27#define SET_DESCRIPTOR (7)
28#define GET_CONFIGURATION (8)
29#define SET_CONFIGURATION (9)
30#define GET_INTERFACE (10)
31#define SET_INTERFACE (11)
32
33/* bmRequestType.dataTransferDirection */
34#define HOST_TO_DEVICE (0)
35#define DEVICE_TO_HOST (1)
36
37/* bmRequestType.Type*/
38#define STANDARD_TYPE (0)
39#define CLASS_TYPE (1)
40#define VENDOR_TYPE (2)
41#define RESERVED_TYPE (3)
42
43/* bmRequestType.Recipient */
44#define DEVICE_RECIPIENT (0)
45#define INTERFACE_RECIPIENT (1)
46#define ENDPOINT_RECIPIENT (2)
47#define OTHER_RECIPIENT (3)
48
49/* Descriptors */
50#define DESCRIPTOR_TYPE(wValue) (wValue >> 8)
51#define DESCRIPTOR_INDEX(wValue) (wValue & 0xff)
52
53#endif