Il y avait des problèmes dans la libraire...

Fork of USBDEVICE by ST

Committer:
qroche
Date:
Sun Sep 03 23:19:21 2017 +0000
Branch:
master
Revision:
5:3329e56e51d7
Parent:
1:2a3ae13b45ef
fin;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 2 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 4 * and associated documentation files (the "Software"), to deal in the Software without
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 7 * Software is furnished to do so, subject to the following conditions:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 8 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 9 * The above copyright notice and this permission notice shall be included in all copies or
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 10 * substantial portions of the Software.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 11 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 17 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 18
qroche 5:3329e56e51d7 19 #include "mbed.h"
qroche 5:3329e56e51d7 20
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 21 #ifndef USBDEVICE_TYPES_H
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 22 #define USBDEVICE_TYPES_H
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 23
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 24 /* Standard requests */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 25 #define GET_STATUS (0)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 26 #define CLEAR_FEATURE (1)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 27 #define SET_FEATURE (3)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 28 #define SET_ADDRESS (5)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 29 #define GET_DESCRIPTOR (6)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 30 #define SET_DESCRIPTOR (7)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 31 #define GET_CONFIGURATION (8)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 32 #define SET_CONFIGURATION (9)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 33 #define GET_INTERFACE (10)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 34 #define SET_INTERFACE (11)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 35
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 36 /* bmRequestType.dataTransferDirection */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 37 #define HOST_TO_DEVICE (0)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 38 #define DEVICE_TO_HOST (1)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 39
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 40 /* bmRequestType.Type*/
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 41 #define STANDARD_TYPE (0)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 42 #define CLASS_TYPE (1)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 43 #define VENDOR_TYPE (2)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 44 #define RESERVED_TYPE (3)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 45
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 46 /* bmRequestType.Recipient */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 47 #define DEVICE_RECIPIENT (0)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 48 #define INTERFACE_RECIPIENT (1)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 49 #define ENDPOINT_RECIPIENT (2)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 50 #define OTHER_RECIPIENT (3)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 51
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 52 /* Descriptors */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 53 #define DESCRIPTOR_TYPE(wValue) (wValue >> 8)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 54 #define DESCRIPTOR_INDEX(wValue) (wValue & 0xff)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 55
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 56 typedef struct {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 57 struct {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 58 uint8_t dataTransferDirection;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 59 uint8_t Type;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 60 uint8_t Recipient;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 61 } bmRequestType;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 62 uint8_t bRequest;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 63 uint16_t wValue;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 64 uint16_t wIndex;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 65 uint16_t wLength;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 66 } SETUP_PACKET;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 67
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 68 typedef struct {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 69 SETUP_PACKET setup;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 70 uint8_t *ptr;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 71 uint32_t remaining;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 72 uint8_t direction;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 73 bool zlp;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 74 bool notify;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 75 } CONTROL_TRANSFER;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 76
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 77 typedef enum {ATTACHED, POWERED, DEFAULT, ADDRESS, CONFIGURED} DEVICE_STATE;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 78
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 79 typedef struct {
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 80 volatile DEVICE_STATE state;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 81 uint8_t configuration;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 82 bool suspended;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 83 } USB_DEVICE;
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 84
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 85 #endif