The preloaded firmware shipped on the mBot.

Dependencies:   mbed

Fork of Official_mBot by Fred Parker

Committer:
jeffknaggs
Date:
Tue Nov 25 14:49:40 2014 +0000
Revision:
1:ffd9a51e7d35
Parent:
0:865d42c46692
Initial commit.

Who changed what in which revision?

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