USBDevice for STM support
Dependents: Nucleo_Usb_JoyMouse Nucleo_usbmouse ELEC350_1-referral-2018-usb-hid USBJoystick_HelloWorld2_wip ... more
This library contains all mbed usb device library (mbed-os\features\unsupported\USBDevice).
USBDevice/TARGET_Silicon_Labs/inc/em_usb.h@1:2a3ae13b45ef, 2016-12-15 (annotated)
- Committer:
- frq08711@LMECWL0871.LME.ST.COM
- Date:
- Thu Dec 15 17:40:59 2016 +0100
- Revision:
- 1:2a3ae13b45ef
copy of git hub directory unsupported/USBDevice
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 2 | * @file em_usb.h |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 3 | * @brief USB protocol stack library API for EFM32. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 4 | * @version 3.20.14 |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 5 | ******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 6 | * @section License |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 7 | * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b> |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 8 | ******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 9 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 10 | * Licensed under the Apache License, Version 2.0 (the "License"); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 11 | * you may not use this file except in compliance with the License. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 12 | * You may obtain a copy of the License at |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 13 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 15 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 16 | * Unless required by applicable law or agreed to in writing, software |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 17 | * distributed under the License is distributed on an "AS IS" BASIS, |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 19 | * See the License for the specific language governing permissions and |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 20 | * limitations under the License. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 21 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 22 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 23 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 24 | #ifndef __EM_USB_H |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 25 | #define __EM_USB_H |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 26 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 27 | #include "em_device.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 28 | #include "em_assert.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 29 | #if defined( USB_PRESENT ) && ( USB_COUNT == 1 ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 30 | #include "usbconfig.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 31 | #if defined( USB_DEVICE ) || defined( USB_HOST ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 32 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 33 | #include <string.h> |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 34 | #include <stddef.h> |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 35 | #include "em_common.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 36 | /* Workaround for em_common naming change so that we don't need to rework the |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 37 | entire USB HAL */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 38 | #define EFM32_PACK_START(x) SL_PACK_START(x) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 39 | #define EFM32_PACK_END() SL_PACK_END() |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 40 | #define EFM32_MIN(a, b) SL_MIN(a, b) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 41 | #define EFM32_MAX(a, b) SL_MAX(a, b) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 42 | #define EFM32_ATTRIBUTE_PACKED SL_ATTRIBUTE_PACKED |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 43 | #define EFM32_ATTRIBUTE_ALIGN(X) SL_ATTRIBUTE_ALIGN(X) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 44 | #define EFM32_ALIGN(X) SL_ALIGN(X) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 45 | #define EFM32_WEAK SL_WEAK |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 46 | #define EFM32_ATTRIBUTE_SECTION(X) SL_ATTRIBUTE_SECTION(X) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 47 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 48 | #include "em_int.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 49 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 50 | #if defined( USB_USE_PRINTF ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 51 | #include <stdio.h> |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 52 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 53 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 54 | #ifdef __cplusplus |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 55 | extern "C" { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 56 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 57 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 58 | #ifdef __CC_ARM |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 59 | #pragma anon_unions |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 60 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 61 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 62 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 63 | * @addtogroup USB |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 64 | * @brief USB HOST and DEVICE protocol stacks. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 65 | * @{ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 66 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 67 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 68 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 69 | * @addtogroup USB_COMMON |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 70 | * @brief Common parts for both HOST and DEVICE USB stacks, see @ref usb_device |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 71 | * and @ref usb_host pages for device and host library documentation. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 72 | * @{ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 73 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 74 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 75 | #define SILABS_USB_VID 0x10C4 /**< Silicon Labs Vendor ID, supplied by USB-IF. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 76 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 77 | /* SETUP request, direction of data stage */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 78 | #define USB_SETUP_DIR_OUT 0 /**< Setup request data stage OUT direction value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 79 | #define USB_SETUP_DIR_IN 1 /**< Setup request data stage IN direction value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 80 | #define USB_SETUP_DIR_MASK 0x80 /**< Setup request data stage direction mask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 81 | #define USB_SETUP_DIR_D2H 0x80 /**< Setup request data stage IN direction mask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 82 | #define USB_SETUP_DIR_H2D 0x00 /**< Setup request data stage OUT direction mask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 83 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 84 | /* SETUP request type */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 85 | #define USB_SETUP_TYPE_STANDARD 0 /**< Standard setup request value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 86 | #define USB_SETUP_TYPE_CLASS 1 /**< Class setup request value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 87 | #define USB_SETUP_TYPE_VENDOR 2 /**< Vendor setup request value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 88 | #define USB_SETUP_TYPE_STANDARD_MASK 0x00 /**< Standard setup request mask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 89 | #define USB_SETUP_TYPE_CLASS_MASK 0x20 /**< Class setup request mask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 90 | #define USB_SETUP_TYPE_VENDOR_MASK 0x40 /**< Vendor setup request mask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 91 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 92 | /* SETUP request recipient */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 93 | #define USB_SETUP_RECIPIENT_DEVICE 0 /**< Setup request device recipient value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 94 | #define USB_SETUP_RECIPIENT_INTERFACE 1 /**< Setup request interface recipient value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 95 | #define USB_SETUP_RECIPIENT_ENDPOINT 2 /**< Setup request endpoint recipient value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 96 | #define USB_SETUP_RECIPIENT_OTHER 3 /**< Setup request other recipient value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 97 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 98 | /* SETUP standard request codes for Full Speed devices */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 99 | #define GET_STATUS 0 /**< Standard setup request GET_STATUS. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 100 | #define CLEAR_FEATURE 1 /**< Standard setup request CLEAR_FEATURE. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 101 | #define SET_FEATURE 3 /**< Standard setup request SET_FEATURE. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 102 | #define SET_ADDRESS 5 /**< Standard setup request SET_ADDRESS. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 103 | #define GET_DESCRIPTOR 6 /**< Standard setup request GET_DESCRIPTOR. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 104 | #define SET_DESCRIPTOR 7 /**< Standard setup request SET_DESCRIPTOR. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 105 | #define GET_CONFIGURATION 8 /**< Standard setup request GET_CONFIGURATION. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 106 | #define SET_CONFIGURATION 9 /**< Standard setup request SET_CONFIGURATION. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 107 | #define GET_INTERFACE 10 /**< Standard setup request GET_INTERFACE. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 108 | #define SET_INTERFACE 11 /**< Standard setup request SET_INTERFACE. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 109 | #define SYNCH_FRAME 12 /**< Standard setup request SYNCH_FRAME. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 110 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 111 | /* SETUP class request codes */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 112 | #define USB_HID_GET_REPORT 0x01 /**< HID class setup request GET_REPORT. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 113 | #define USB_HID_GET_IDLE 0x02 /**< HID class setup request GET_IDLE. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 114 | #define USB_HID_SET_REPORT 0x09 /**< HID class setup request SET_REPORT. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 115 | #define USB_HID_SET_IDLE 0x0A /**< HID class setup request SET_IDLE. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 116 | #define USB_HID_SET_PROTOCOL 0x0B /**< HID class setup request SET_PROTOCOL. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 117 | #define USB_CDC_SETLINECODING 0x20 /**< CDC class setup request SET_LINE_CODING. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 118 | #define USB_CDC_GETLINECODING 0x21 /**< CDC class setup request GET_LINE_CODING. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 119 | #define USB_CDC_SETCTRLLINESTATE 0x22 /**< CDC class setup request SET_CONTROL_LINE_STATE. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 120 | #define USB_MSD_BOTRESET 0xFF /**< MSD class setup request Bulk only transfer reset. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 121 | #define USB_MSD_GETMAXLUN 0xFE /**< MSD class setup request Get Max LUN. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 122 | #define USB_AUDIO_GET_CUR 0x81 /**< Audio class setup request GET_CUR. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 123 | #define USB_AUDIO_SET_CUR 0x01 /**< Audio class setup request SET_CUR. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 124 | #define USB_AUDIO_GET_CUR 0x81 /**< Audio class setup request GET_CUR. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 125 | #define USB_AUDIO_SET_MIN 0x02 /**< Audio class setup request SET_MIN. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 126 | #define USB_AUDIO_GET_MIN 0x82 /**< Audio class setup request GET_MIN. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 127 | #define USB_AUDIO_SET_MAX 0x03 /**< Audio class setup request SET_MAX. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 128 | #define USB_AUDIO_GET_MAX 0x83 /**< Audio class setup request GET_MAX. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 129 | #define USB_AUDIO_SET_RES 0x04 /**< Audio class setup request SET_RES. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 130 | #define USB_AUDIO_GET_RES 0x84 /**< Audio class setup request GET_RES. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 131 | #define USB_AUDIO_SET_MEM 0x05 /**< Audio class setup request SET_MEM. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 132 | #define USB_AUDIO_GET_MEM 0x85 /**< Audio class setup request GET_MEM. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 133 | #define USB_AUDIO_GET_STAT 0xFF /**< Audio class setup request GET_STAT. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 134 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 135 | /* SETUP command GET/SET_DESCRIPTOR decriptor types */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 136 | #define USB_DEVICE_DESCRIPTOR 1 /**< DEVICE descriptor value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 137 | #define USB_CONFIG_DESCRIPTOR 2 /**< CONFIGURATION descriptor value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 138 | #define USB_STRING_DESCRIPTOR 3 /**< STRING descriptor value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 139 | #define USB_MAX_STRING_DESCRIPTOR_CHARS 126 /**< Maximum STRING descriptor bString length. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 140 | #define USB_INTERFACE_DESCRIPTOR 4 /**< INTERFACE descriptor value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 141 | #define USB_ENDPOINT_DESCRIPTOR 5 /**< ENDPOINT descriptor value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 142 | #define USB_DEVICE_QUALIFIER_DESCRIPTOR 6 /**< DEVICE_QUALIFIER descriptor value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 143 | #define USB_OTHER_SPEED_CONFIG_DESCRIPTOR 7 /**< OTHER_SPEED_CONFIGURATION descriptor value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 144 | #define USB_INTERFACE_POWER_DESCRIPTOR 8 /**< INTERFACE_POWER descriptor value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 145 | #define USB_INTERFACE_ASSOCIATION_DESCRIPTOR 11 /**< INTERFACE_ASSOCIATION descriptor value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 146 | #define USB_HID_DESCRIPTOR 0x21 /**< HID descriptor value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 147 | #define USB_SMARTCARD_DESCRIPTOR 0x21 /**< Smartcard usb-ccid-specific Descriptor Type. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 148 | #define USB_HID_REPORT_DESCRIPTOR 0x22 /**< HID REPORT descriptor value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 149 | #define USB_CS_INTERFACE_DESCRIPTOR 0x24 /**< Audio Class-specific interface Descriptor Type. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 150 | #define USB_CS_ENDPOINT_DESCRIPTOR 0x25 /**< Audio Class-specific endpoint Descriptor Type. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 151 | #define USB_HUB_DESCRIPTOR 0x29 /**< HUB descriptor value. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 152 | #define USB_CA_HEADER_DESCRIPTOR 1 /**< Audio Class-Specific AC Interface Header descriptor.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 153 | #define USB_CA_INPUT_TERMINAL_DESCRIPTOR 2 /**< Audio Class-Specific AC Interface Input Terminal desc. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 154 | #define USB_CA_OUTPUT_TERMINAL_DESCRIPTOR 3 /**< Audio Class-Specific AC Interface Output Terminal desc.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 155 | #define USB_CA_MIXER_UNIT_DESCRIPTOR 4 /**< Audio Class-Specific AC Interface Mixer descriptor.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 156 | #define USB_CA_SELECTOR_UNIT_DESCRIPTOR 5 /**< Audio Class-Specific AC Interface Selector desc. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 157 | #define USB_CA_FEATURE_UNIT_DESCRIPTOR 6 /**< Audio Class-Specific AC Interface Feature desc. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 158 | #define USB_CA_PROCESSING_UNIT_DESCRIPTOR 7 /**< Audio Class-Specific AC Interface Processing desc.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 159 | #define USB_CA_EXTENSION_UNIT_DESCRIPTOR 8 /**< Audio Class-Specific AC Interface Extension desc. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 160 | #define USB_CA_EP_GENERAL_DESCRIPTOR 1 /**< Audio Class-Specific general descriptor subtype code.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 161 | #define USB_CA_AS_GENERAL_DESCRIPTOR 1 /**< Audio Class-Specific AS Interface General descriptor.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 162 | #define USB_CA_FORMAT_TYPE_DESCRIPTOR 2 /**< Audio Class-Specific AS Interface Format Type desc. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 163 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 164 | #define USB_DEVICE_DESCSIZE 18 /**< Device descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 165 | #define USB_CONFIG_DESCSIZE 9 /**< Configuration descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 166 | #define USB_INTERFACE_DESCSIZE 9 /**< Interface descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 167 | #define USB_ENDPOINT_DESCSIZE 7 /**< Endpoint descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 168 | #define USB_DEVICE_QUALIFIER_DESCSIZE 10 /**< Device qualifier descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 169 | #define USB_OTHER_SPEED_CONFIG_DESCSIZE 9 /**< Device other speed configuration descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 170 | #define USB_INTERFACE_ASSOCIATION_DESCSIZE 8 /**< INTERFACE_ASSOCIATION descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 171 | #define USB_HID_DESCSIZE 9 /**< HID descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 172 | #define USB_SMARTCARD_DESCSIZE 54 /**< CCID descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 173 | #define USB_CDC_HEADER_FND_DESCSIZE 5 /**< CDC Header functional descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 174 | #define USB_CDC_CALLMNG_FND_DESCSIZE 5 /**< CDC Call Management functional descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 175 | #define USB_CDC_ACM_FND_DESCSIZE 4 /**< CDC Abstract Control Management functional descriptor size.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 176 | #define USB_CA_INPUT_TERMINAL_DESCSIZE 12 /**< Audio Input Terminal descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 177 | #define USB_CA_OUTPUT_TERMINAL_DESCSIZE 9 /**< Audio Output Terminal descriptor size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 178 | #define USB_CA_EP_GENERAL_DESCSIZE 7 /**< Audio Class-Specific general descriptor subtype size.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 179 | #define USB_CA_AS_GENERAL_DESCSIZE 7 /**< Audio Class-Specific AS Interface General desc size.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 180 | #define USB_CA_STD_AS_ENDPOINT_DESCSZIE 9 /**< Audio-class standard audio stream descriptor size.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 181 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 182 | /* Misc. USB definitions */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 183 | #define USB_LS_CTRL_EP_MAXSIZE 8 /**< The max size of low speed control endpoints. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 184 | #define USB_LS_INTR_EP_MAXSIZE 8 /**< The max size of low speed interrupt endpoints. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 185 | #define USB_FS_CTRL_EP_MAXSIZE 64 /**< The max size of full speed control endpoints. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 186 | #define USB_FS_INTR_EP_MAXSIZE 64 /**< The max size of full speed interrupt endpoints. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 187 | #define USB_FS_BULK_EP_MAXSIZE 64 /**< The max size of full speed bulk endpoints. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 188 | #define USB_FS_ISOC_EP_MAXSIZE 1023 /**< The max size of full speed isochronous endpoints. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 189 | #define USB_EPTYPE_CTRL 0 /**< Endpoint type control. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 190 | #define USB_EPTYPE_ISOC 1 /**< Endpoint type isochron. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 191 | #define USB_EPTYPE_BULK 2 /**< Endpoint type bulk. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 192 | #define USB_EPTYPE_INTR 3 /**< Endpoint type interrupt. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 193 | #define USB_EPSYNC_NO (0 << 2) /**< Endpoint synchronization type, none. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 194 | #define USB_EPSYNC_ASYNC (1 << 2) /**< Endpoint synchronization type, asynchronous. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 195 | #define USB_EPSYNC_ADAPTIVE (2 << 2) /**< Endpoint synchronization type, adaptive. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 196 | #define USB_EPSYNC_SYNC (3 << 2) /**< Endpoint synchronization type, synchronous. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 197 | #define USB_EP_DIR_IN 0x80 /**< Endpoint direction mask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 198 | #define USB_SETUP_PKT_SIZE 8 /**< Setup request packet size. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 199 | #define USB_EPNUM_MASK 0x0F /**< Endpoint number mask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 200 | #define USB_LANGID_ENUS 0x0409 /**< English-United States language id. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 201 | #define USB_MAX_DEVICE_ADDRESS 127 /**< Maximum allowable device address. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 202 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 203 | #define CONFIG_DESC_BM_REMOTEWAKEUP 0x20 /**< Configuration descriptor attribute macro. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 204 | #define CONFIG_DESC_BM_SELFPOWERED 0x40 /**< Configuration descriptor attribute macro. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 205 | #define CONFIG_DESC_BM_RESERVED_D7 0x80 /**< Configuration descriptor attribute macro. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 206 | #define CONFIG_DESC_BM_TRANSFERTYPE 0x03 /**< Configuration descriptor transfer type bitmask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 207 | #define CONFIG_DESC_MAXPOWER_mA(x) (((x)+1)/2) /**< Configuration descriptor power macro. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 208 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 209 | #define DEVICE_IS_SELFPOWERED 0x0001 /**< Standard request GET_STATUS bitmask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 210 | #define REMOTE_WAKEUP_ENABLED 0x0002 /**< Standard request GET_STATUS bitmask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 211 | #define USB_FEATURE_ENDPOINT_HALT 0 /**< Standard request CLEAR/SET_FEATURE bitmask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 212 | #define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1 /**< Standard request CLEAR/SET_FEATURE bitmask. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 213 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 214 | #define HUB_FEATURE_PORT_RESET 4 /**< HUB class request CLEAR/SET_PORT_FEATURE feature selector. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 215 | #define HUB_FEATURE_PORT_POWER 8 /**< HUB class request CLEAR/SET_PORT_FEATURE feature selector. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 216 | #define HUB_FEATURE_C_PORT_CONNECTION 16 /**< HUB class request CLEAR/SET_PORT_FEATURE feature selector. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 217 | #define HUB_FEATURE_C_PORT_RESET 20 /**< HUB class request CLEAR/SET_PORT_FEATURE feature selector. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 218 | #define HUB_FEATURE_PORT_INDICATOR 22 /**< HUB class request CLEAR/SET_PORT_FEATURE feature selector. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 219 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 220 | #define USB_CLASS_CDC 2 /**< CDC device/interface class code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 221 | #define USB_CLASS_CDC_DATA 0x0A /**< CDC Data interface class code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 222 | #define USB_CLASS_CDC_ACM 2 /**< CDC Abstract Control Model interface subclass code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 223 | #define USB_CLASS_CDC_HFN 0 /**< CDC class Header Functional Descriptor subtype. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 224 | #define USB_CLASS_CDC_CMNGFN 1 /**< CDC class Call Management Functional Descriptor subtype.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 225 | #define USB_CLASS_CDC_ACMFN 2 /**< CDC class Abstract Control Management Functional Descriptor subtype.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 226 | #define USB_CLASS_CDC_UNIONFN 6 /**< CDC class Union Functional Descriptor subtype. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 227 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 228 | #define USB_CLASS_HID 3 /**< HID device/interface class code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 229 | #define USB_CLASS_HID_KEYBOARD 1 /**< HID keyboard interface protocol code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 230 | #define USB_CLASS_HID_MOUSE 2 /**< HID mouse interface protocol code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 231 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 232 | #define USB_CLASS_HUB 9 /**< HUB device/interface class code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 233 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 234 | #define USB_CLASS_MSD 8 /**< MSD device/interface class code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 235 | #define USB_CLASS_MSD_BOT_TRANSPORT 0x50 /**< MSD Bulk Only Transport protocol. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 236 | #define USB_CLASS_MSD_SCSI_CMDSET 6 /**< MSD Subclass SCSI transparent command set. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 237 | #define USB_CLASS_MSD_CSW_CMDPASSED 0 /**< MSD BOT Command status wrapper command passed code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 238 | #define USB_CLASS_MSD_CSW_CMDFAILED 1 /**< MSD BOT Command status wrapper command failed code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 239 | #define USB_CLASS_MSD_CSW_PHASEERROR 2 /**< MSD BOT Command status wrapper cmd phase error code.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 240 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 241 | #define USB_CLASS_AUDIO 1 /**< Audio interface class code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 242 | #define USB_CLASS_AUDIO_CONTROL 1 /**< Audio subclass code for control interface. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 243 | #define USB_CLASS_AUDIO_STREAMING 2 /**< Audio subclass code for streaming interface. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 244 | #define USB_CLASS_AUDIO_MIDISTREAMING 3 /**< Audio subclass code for midi streaming interface. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 245 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 246 | /*** Triplet for the device descriptor of a composite device using IAD descriptors. ***/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 247 | #define USB_CLASS_MISCELLANEOUS 0xEF /**< MISCELLANEOUS device class code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 248 | #define USB_CLASS_MISC_COMMON_SUBCLASS 2 /**< MISCELLANEOUS Common sub class code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 249 | #define USB_CLASS_MISC_IAD_PROTOCOL 1 /**< MISCELLANEOUS Interface Association Descriptor protocol code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 250 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 251 | #define PORT_FULL_SPEED 1 /**< Full speed return value for USBH_GetPortSpeed(). */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 252 | #define PORT_LOW_SPEED 2 /**< Low speed return value for USBH_GetPortSpeed(). */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 253 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 254 | #if defined( __GNUC__ ) /* GCC compilers */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 255 | #if defined( __CHAR16_TYPE__ ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 256 | typedef __CHAR16_TYPE__ char16_t; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 257 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 258 | typedef unsigned short char16_t; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 259 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 260 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 261 | #elif defined( __ICCARM__ ) /* IAR compiler */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 262 | #include <uchar.h> |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 263 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 264 | #elif defined( __CC_ARM ) /* MDK-ARM compiler */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 265 | typedef unsigned short char16_t; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 266 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 267 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 268 | /** Macro for creating USB compliant UTF-16LE UNICODE string descriptors. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 269 | * @n Example: STATIC_CONST_STRING_DESC( iManufacturer, 'E','n','e','r','g','y',' ','M','i','c','r','o',' ','A','S' ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 270 | * @note The size of the resulting struct will be two byte larger than a USB string |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 271 | * descriptor. This is to accommodate a terminating null char for the string. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 272 | * The value assigned to the 'len' member does not take this into account |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 273 | * and is therefore correct usb wise. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 274 | */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 275 | #define STATIC_CONST_STRING_DESC( _name, ... ) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 276 | EFM32_PACK_START( 1 ) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 277 | typedef struct \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 278 | { \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 279 | uint8_t len; \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 280 | uint8_t type; \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 281 | char16_t name[ 1 + sizeof( (char16_t[]){__VA_ARGS__} ) / 2]; \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 282 | } __attribute__ ((packed)) _##_name; \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 283 | EFM32_PACK_END() \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 284 | EFM32_ALIGN( 4 ) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 285 | EFM32_PACK_START( 1 ) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 286 | static const _##_name _name __attribute__ ((aligned(4)))= \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 287 | { \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 288 | .len = sizeof( _##_name ) - 2, \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 289 | .type = USB_STRING_DESCRIPTOR, \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 290 | .name = {__VA_ARGS__}, \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 291 | .name[ ( ( sizeof( _##_name ) - 2 ) / 2 ) - 1 ] = '\0' \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 292 | } \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 293 | EFM32_PACK_END() |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 294 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 295 | /** Macro for creating USB compliant language string descriptors. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 296 | * @n Example: STATIC_CONST_STRING_DESC_LANGID( langID, 0x04, 0x09 ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 297 | */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 298 | #define STATIC_CONST_STRING_DESC_LANGID( _name, x, y ) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 299 | EFM32_PACK_START( 1 ) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 300 | typedef struct \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 301 | { \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 302 | uint8_t len; \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 303 | uint8_t type; \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 304 | uint8_t name[ 2 ]; \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 305 | } __attribute__ ((packed)) _##_name; \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 306 | EFM32_PACK_END() \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 307 | EFM32_ALIGN( 4 ) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 308 | EFM32_PACK_START( 1 ) \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 309 | static const _##_name _name __attribute__ ((aligned(4)))= \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 310 | { \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 311 | .len = 4, \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 312 | .type = USB_STRING_DESCRIPTOR, \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 313 | .name = { y, x } \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 314 | } \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 315 | EFM32_PACK_END() |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 316 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 317 | /** Macro for creating WORD (4 byte) aligned uint8_t array with size which |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 318 | * is a multiple of WORD size. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 319 | * @n Example: @n UBUF( rxBuffer, 37 ); => uint8_t rxBuffer[ 40 ]; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 320 | */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 321 | #if !defined(__GNUC__) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 322 | #define UBUF( x, y ) EFM32_ALIGN( 4 ) uint8_t x[((y)+3)&~3] |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 323 | #define STATIC_UBUF( x, y ) EFM32_ALIGN( 4 ) static uint8_t x[((y)+3)&~3] |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 324 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 325 | #define UBUF( x, y ) uint8_t x[((y)+3)&~3] __attribute__ ((aligned(4))) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 326 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 327 | /** Macro for creating WORD (4 byte) aligned static uint8_t arrays with size which |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 328 | * is a multiple of WORD size. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 329 | * @n Example: @n STATIC_UBUF( rxBuffer, 37 ); => static uint8_t rxBuffer[ 40 ]; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 330 | */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 331 | #define STATIC_UBUF( x, y ) static uint8_t x[((y)+3)&~3] __attribute__ ((aligned(4))) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 332 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 333 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 334 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 335 | /** @brief USB transfer status enumerator. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 336 | typedef enum |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 337 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 338 | /* NOTE: Please keep in sync with table errMsg[] in em_usbhal.c */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 339 | USB_STATUS_OK = 0, /**< No errors detected. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 340 | USB_STATUS_REQ_ERR = -1, /**< Setup request error. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 341 | USB_STATUS_EP_BUSY = -2, /**< Endpoint is busy. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 342 | USB_STATUS_REQ_UNHANDLED = -3, /**< Setup request not handled. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 343 | USB_STATUS_ILLEGAL = -4, /**< Illegal operation attempted. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 344 | USB_STATUS_EP_STALLED = -5, /**< Endpoint is stalled. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 345 | USB_STATUS_EP_ABORTED = -6, /**< Endpoint transfer was aborted. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 346 | USB_STATUS_EP_ERROR = -7, /**< Endpoint transfer error. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 347 | USB_STATUS_EP_NAK = -8, /**< Endpoint NAK'ed transfer request. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 348 | USB_STATUS_DEVICE_UNCONFIGURED = -9, /**< Device is unconfigured. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 349 | USB_STATUS_DEVICE_SUSPENDED = -10, /**< Device is suspended. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 350 | USB_STATUS_DEVICE_RESET = -11, /**< Device is/was reset. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 351 | USB_STATUS_TIMEOUT = -12, /**< Transfer timeout. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 352 | USB_STATUS_DEVICE_REMOVED = -13, /**< Device was removed. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 353 | USB_STATUS_HC_BUSY = -14, /**< Host channel is busy. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 354 | USB_STATUS_DEVICE_MALFUNCTION = -15, /**< Malfunctioning device attached. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 355 | USB_STATUS_PORT_OVERCURRENT = -16, /**< VBUS shortcircuit/overcurrent failure. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 356 | } USB_Status_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 357 | /** @} (end addtogroup USB_COMMON) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 358 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 359 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 360 | #if defined( USB_DEVICE ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 361 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 362 | * @addtogroup USB_DEVICE |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 363 | * @brief USB DEVICE protocol stack, see @ref usb_device page for detailed documentation. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 364 | * @{ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 365 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 366 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 367 | #define USB_PWRSAVE_MODE_OFF 0 /**< No energy saving mode selected. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 368 | #define USB_PWRSAVE_MODE_ONSUSPEND 1 /**< Enter USB power-save mode on suspend. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 369 | #define USB_PWRSAVE_MODE_ONVBUSOFF 2 /**< Enter USB power-save mode when not attached to host. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 370 | #define USB_PWRSAVE_MODE_ENTEREM2 4 /**< Enter EM2 while in power-save mode. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 371 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 372 | #define USB_USBC_32kHz_CLK_LFXO 0 /**< Use 32kHz LFXO clock while in powersave mode. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 373 | #define USB_USBC_32kHz_CLK_LFRCO 1 /**< Use 32kHz LFRCO clock while in powersave mode. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 374 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 375 | /** @brief USB device state enumerator. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 376 | typedef enum |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 377 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 378 | USBD_STATE_NONE = 0, /**< Device state is undefined/unknown. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 379 | USBD_STATE_ATTACHED = 1, /**< Device state is ATTACHED. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 380 | USBD_STATE_POWERED = 2, /**< Device state is POWERED. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 381 | USBD_STATE_DEFAULT = 3, /**< Device state is DEFAULT. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 382 | USBD_STATE_ADDRESSED = 4, /**< Device state is ADDRESSED. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 383 | USBD_STATE_CONFIGURED = 5, /**< Device state is CONFIGURED. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 384 | USBD_STATE_SUSPENDED = 6, /**< Device state is SUSPENDED. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 385 | USBD_STATE_LASTMARKER = 7, /**< Device state enum end marker. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 386 | } USBD_State_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 387 | /** @} (end addtogroup USB_DEVICE) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 388 | #endif /* defined( USB_DEVICE ) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 389 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 390 | /** @addtogroup USB_COMMON |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 391 | * @{*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 392 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 393 | /** @brief USB Setup request package. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 394 | EFM32_PACK_START( 1 ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 395 | typedef struct |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 396 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 397 | union |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 398 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 399 | struct |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 400 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 401 | union |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 402 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 403 | struct |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 404 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 405 | uint8_t Recipient : 5; /**< Request recipient (device, interface, endpoint or other).*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 406 | uint8_t Type : 2; /**< Request type (standard, class or vendor). */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 407 | uint8_t Direction : 1; /**< Transfer direction of SETUP data phase. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 408 | }; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 409 | uint8_t bmRequestType; /**< Request characteristics. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 410 | }; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 411 | uint8_t bRequest; /**< Request code. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 412 | uint16_t wValue; /**< Varies according to request. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 413 | uint16_t wIndex; /**< Index or offset, varies according to request. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 414 | uint16_t wLength; /**< Number of bytes to transfer if there is a data stage.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 415 | }; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 416 | uint32_t dw[2]; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 417 | }; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 418 | } __attribute__ ((packed)) USB_Setup_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 419 | EFM32_PACK_END() |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 420 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 421 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 422 | /** @brief USB Device Descriptor. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 423 | EFM32_PACK_START( 1 ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 424 | typedef struct |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 425 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 426 | uint8_t bLength; /**< Size of this descriptor in bytes */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 427 | uint8_t bDescriptorType; /**< Constant DEVICE Descriptor Type */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 428 | uint16_t bcdUSB; /**< USB Specification Release Number in Binary-Coded |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 429 | Decimal */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 430 | uint8_t bDeviceClass; /**< Class code (assigned by the USB-IF) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 431 | uint8_t bDeviceSubClass; /**< Subclass code (assigned by the USB-IF) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 432 | uint8_t bDeviceProtocol; /**< Protocol code (assigned by the USB-IF) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 433 | uint8_t bMaxPacketSize0; /**< Maximum packet size for endpoint zero */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 434 | uint16_t idVendor; /**< Vendor ID (assigned by the USB-IF) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 435 | uint16_t idProduct; /**< Product ID (assigned by the manufacturer) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 436 | uint16_t bcdDevice; /**< Device release number in binary-coded decimal */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 437 | uint8_t iManufacturer; /**< Index of string descriptor describing manufacturer*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 438 | uint8_t iProduct; /**< Index of string descriptor describing product */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 439 | uint8_t iSerialNumber; /**< Index of string descriptor describing the device |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 440 | serialnumber */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 441 | uint8_t bNumConfigurations; /**< Number of possible configurations */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 442 | } __attribute__ ((packed)) USB_DeviceDescriptor_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 443 | EFM32_PACK_END() |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 444 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 445 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 446 | /** @brief USB Configuration Descriptor. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 447 | EFM32_PACK_START( 1 ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 448 | typedef struct |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 449 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 450 | uint8_t bLength; /**< Size of this descriptor in bytes */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 451 | uint8_t bDescriptorType; /**< Constant CONFIGURATION Descriptor Type */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 452 | uint16_t wTotalLength; /**< Total length of data returned for this |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 453 | configuration. Includes the combined length of all |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 454 | descriptors (configuration, interface, endpoint, |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 455 | and class- or vendor-specific) returned for this |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 456 | configuration. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 457 | uint8_t bNumInterfaces; /**< Number of interfaces supported by this |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 458 | configuration */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 459 | uint8_t bConfigurationValue; /**< Value to use as an argument to the |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 460 | SetConfiguration request to select this |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 461 | configuration. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 462 | uint8_t iConfiguration; /**< Index of string descriptor describing this |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 463 | configuration. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 464 | uint8_t bmAttributes; /**< Configuration characteristics. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 465 | @n D7: Reserved (set to one) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 466 | @n D6: Self-powered |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 467 | @n D5: Remote Wakeup |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 468 | @n D4...0: Reserved (reset to zero) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 469 | uint8_t bMaxPower; /**< Maximum power consumption of the USB device, unit |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 470 | is 2mA per LSB */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 471 | } __attribute__ ((packed)) USB_ConfigurationDescriptor_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 472 | EFM32_PACK_END() |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 473 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 474 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 475 | /** @brief USB Interface Descriptor. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 476 | EFM32_PACK_START( 1 ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 477 | typedef struct |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 478 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 479 | uint8_t bLength; /**< Size of this descriptor in bytes. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 480 | uint8_t bDescriptorType; /**< Constant INTERFACE Descriptor Type. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 481 | uint8_t bInterfaceNumber; /**< Number of this interface. Zero-based value |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 482 | identifying the index in the array of concurrent |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 483 | interfaces supported by this configuration. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 484 | uint8_t bAlternateSetting; /**< Value used to select this alternate setting for |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 485 | the interface identified in the prior field. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 486 | uint8_t bNumEndpoints; /**< Number of endpoints used by this interface |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 487 | (excluding endpoint zero). If this value is zero, |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 488 | this interface only uses the Default Control Pipe.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 489 | uint8_t bInterfaceClass; /**< Class code (assigned by the USB-IF). A value |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 490 | of zero is reserved for future standardization. If |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 491 | this field is set to FFH, the interface class is |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 492 | vendor-specific. All other values are reserved for |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 493 | assignment by the USB-IF. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 494 | uint8_t bInterfaceSubClass; /**< Subclass code (assigned by the USB-IF). These codes |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 495 | are qualified by the value of the bInterfaceClass |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 496 | field. If the bInterfaceClass field is reset to |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 497 | zero, this field must also be reset to zero. If |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 498 | the bInterfaceClass field is not set to FFH, all |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 499 | values are reserved forassignment by the USB-IF. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 500 | uint8_t bInterfaceProtocol; /**< Protocol code (assigned by the USB). These codes |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 501 | are qualified by the value of the bInterfaceClass |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 502 | and the bInterfaceSubClass fields. If an interface |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 503 | supports class-specific requests, this code |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 504 | identifies the protocols that the device uses as |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 505 | defined by the specification of the device class. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 506 | If this field is reset to zero, the device does |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 507 | not use a class-specific protocol on this |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 508 | interface. If this field is set to FFH, the device |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 509 | uses a vendor-specific protocol for this interface*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 510 | uint8_t iInterface; /**< Index of string descriptor describing this |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 511 | interface. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 512 | } __attribute__ ((packed)) USB_InterfaceDescriptor_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 513 | EFM32_PACK_END() |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 514 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 515 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 516 | /** @brief USB Endpoint Descriptor. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 517 | EFM32_PACK_START( 1 ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 518 | typedef struct |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 519 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 520 | uint8_t bLength; /**< Size of this descriptor in bytes */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 521 | uint8_t bDescriptorType; /**< Constant ENDPOINT Descriptor Type */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 522 | uint8_t bEndpointAddress; /**< The address of the endpoint */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 523 | uint8_t bmAttributes; /**< This field describes the endpoint attributes */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 524 | uint16_t wMaxPacketSize; /**< Maximum packet size for the endpoint */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 525 | uint8_t bInterval; /**< Interval for polling EP for data transfers */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 526 | } __attribute__ ((packed)) USB_EndpointDescriptor_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 527 | EFM32_PACK_END() |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 528 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 529 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 530 | /** @brief USB String Descriptor. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 531 | EFM32_PACK_START( 1 ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 532 | typedef struct |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 533 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 534 | uint8_t len; /**< Size of this descriptor in bytes. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 535 | uint8_t type; /**< Constant STRING Descriptor Type. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 536 | char16_t name[]; /**< The string encoded with UTF-16LE UNICODE charset. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 537 | } __attribute__ ((packed)) USB_StringDescriptor_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 538 | EFM32_PACK_END() |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 539 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 540 | /** @} (end addtogroup USB_COMMON) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 541 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 542 | /*** -------------------- Serial port debug configuration ---------------- ***/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 543 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 544 | #if defined( DOXY_DOC_ONLY ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 545 | /** @addtogroup USB_COMMON |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 546 | * @{*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 547 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 548 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 549 | * @brief |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 550 | * Transmit a single char on the debug serial port. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 551 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 552 | * @note |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 553 | * This function is enabled with \#define DEBUG_USB_API when configuring the |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 554 | * protocol stack in "usbconfig.h". |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 555 | * This is convenient when debugging code, no need to remove use of this |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 556 | * function when debugging has completed. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 557 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 558 | * @param[in] c |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 559 | * Char to transmit. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 560 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 561 | * @return |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 562 | * The char transmitted. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 563 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 564 | int USB_PUTCHAR( char c ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 565 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 566 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 567 | * @brief |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 568 | * Transmit a zero terminated string on the debug serial port. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 569 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 570 | * @note |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 571 | * This function is enabled with \#define DEBUG_USB_API when configuring the |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 572 | * protocol stack in "usbconfig.h". |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 573 | * This is convenient when debugging code, no need to remove use of this |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 574 | * function when debugging has completed. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 575 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 576 | * @param[in] p |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 577 | * Pointer to string to transmit. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 578 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 579 | void USB_PUTS( const char *p ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 580 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 581 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 582 | * @brief |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 583 | * Transmit "printf" formated data on the debug serial port. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 584 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 585 | * @note |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 586 | * This function is enabled with \#define USB_USE_PRINTF when configuring the |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 587 | * protocol stack in "usbconfig.h". |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 588 | * This is convenient when debugging code, no need to remove use of this |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 589 | * function when debugging has completed. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 590 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 591 | * @param[in] format |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 592 | * Format string (as in printf). No floating point format support. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 593 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 594 | int USB_PRINTF( const char *format, ... ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 595 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 596 | /** @} (end addtogroup USB_COMMON) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 597 | #endif /* defined( DOXY_DOC_ONLY ) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 598 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 599 | /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 600 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 601 | /* Hardware constraint, do not change. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 602 | #define MAX_NUM_HOSTCHANNELS 14 |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 603 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 604 | /* The DMA engine use one FIFO ram word for each host channel. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 605 | #define MAX_HOST_FIFO_SIZE_INWORDS (512-MAX_NUM_HOSTCHANNELS)/*Unit is 4 bytes*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 606 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 607 | #if defined ( USER_PUTCHAR ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 608 | void USB_Puts( const char *p ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 609 | #define USB_PUTS( s ) USB_Puts( s ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 610 | #define USB_PUTCHAR( c ) USER_PUTCHAR( c ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 611 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 612 | #define USB_PUTS( s ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 613 | #define USB_PUTCHAR( c ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 614 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 615 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 616 | #if defined( USB_USE_PRINTF ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 617 | /* Use a printf which don't support floating point formatting */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 618 | #if defined(__ICCARM__) || defined (__CC_ARM) || defined (__CROSSWORKS_ARM) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 619 | #define USB_PRINTF printf |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 620 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 621 | #define USB_PRINTF iprintf |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 622 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 623 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 624 | #define USB_PRINTF(...) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 625 | #endif /* defined( USB_USE_PRINTF ) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 626 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 627 | #if defined( DEBUG_USB_API ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 628 | #define DEBUG_USB_API_PUTS( s ) USB_PUTS( s ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 629 | #define DEBUG_USB_API_PUTCHAR( c ) USB_PUTCHAR( c ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 630 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 631 | #define DEBUG_USB_API_PUTS( s ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 632 | #define DEBUG_USB_API_PUTCHAR( c ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 633 | #endif /* defined( DEBUG_USB_API ) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 634 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 635 | /** @endcond */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 636 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 637 | /*** -------------------- Common API definitions ------------------------- ***/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 638 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 639 | /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 640 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 641 | #if defined( USB_HOST ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 642 | #if defined( NUM_APP_TIMERS ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 643 | #define NUM_QTIMERS ( NUM_HC_USED + 2 + NUM_APP_TIMERS + 1 ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 644 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 645 | #define NUM_QTIMERS ( NUM_HC_USED + 2 + 1 ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 646 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 647 | /* + 2 for default ctrl. host ch. 0 & 1, + 1 for host port timer */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 648 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 649 | #if defined( NUM_APP_TIMERS ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 650 | #define NUM_QTIMERS ( NUM_APP_TIMERS ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 651 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 652 | #define NUM_QTIMERS 0 |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 653 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 654 | #endif /* defined( USB_HOST ) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 655 | /** @endcond */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 656 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 657 | /** @addtogroup USB_COMMON |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 658 | * @{*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 659 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 660 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 661 | * @brief |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 662 | * USB transfer callback function. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 663 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 664 | * @details |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 665 | * The callback function is called when a transfer has completed. An application |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 666 | * should check the status, xferred and optionally the remaining parameters |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 667 | * before deciding if the transfer is usable. In the case where the transfer |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 668 | * is part of a control request data stage, the callback function should |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 669 | * return an appropriate @ref USB_Status_TypeDef status. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 670 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 671 | * @param[in] status |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 672 | * The transfer status. See @ref USB_Status_TypeDef. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 673 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 674 | * @param[in] xferred |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 675 | * Number of bytes actually transferred. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 676 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 677 | * @param[in] remaining |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 678 | * Number of bytes not transferred. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 679 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 680 | * @return |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 681 | * @ref USB_STATUS_OK on success, else an appropriate error code. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 682 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 683 | typedef int (*USB_XferCompleteCb_TypeDef)( USB_Status_TypeDef status, uint32_t xferred, uint32_t remaining ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 684 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 685 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 686 | * @brief |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 687 | * USBTIMER callback function. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 688 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 689 | * @details |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 690 | * The callback function is called when an USBTIMER has expired. The callback |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 691 | * is done with interrupts disabled. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 692 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 693 | typedef void (*USBTIMER_Callback_TypeDef)( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 694 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 695 | char *USB_GetErrorMsgString( int error ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 696 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 697 | #if defined( USB_USE_PRINTF ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 698 | void USB_PrintErrorMsgString( char *pre, int error ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 699 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 700 | #define USB_PrintErrorMsgString( pre, error ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 701 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 702 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 703 | void USBTIMER_DelayMs( uint32_t msec ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 704 | void USBTIMER_DelayUs( uint32_t usec ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 705 | void USBTIMER_Init( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 706 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 707 | #if ( NUM_QTIMERS > 0 ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 708 | void USBTIMER_Start( uint32_t id, uint32_t timeout, USBTIMER_Callback_TypeDef callback ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 709 | void USBTIMER_Stop( uint32_t id ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 710 | #endif /* ( NUM_QTIMERS > 0 ) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 711 | /** @} (end addtogroup USB_COMMON) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 712 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 713 | #if defined( USB_DEVICE ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 714 | /** @addtogroup USB_DEVICE |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 715 | * @{*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 716 | /*** -------------------- DEVICE mode API definitions -------------------- ***/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 717 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 718 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 719 | * @brief |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 720 | * USB Reset callback function. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 721 | * @details |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 722 | * Called whenever USB reset signalling is detected on the USB port. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 723 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 724 | typedef void (*USBD_UsbResetCb_TypeDef)( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 725 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 726 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 727 | * @brief |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 728 | * USB Start Of Frame (SOF) interrupt callback function. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 729 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 730 | * @details |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 731 | * Called at each SOF interrupt (if enabled), |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 732 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 733 | * @param[in] sofNr |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 734 | * Current frame number. The value rolls over to 0 after 16383 (0x3FFF). |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 735 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 736 | typedef void (*USBD_SofIntCb_TypeDef)( uint16_t sofNr ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 737 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 738 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 739 | * @brief |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 740 | * USB State change callback function. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 741 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 742 | * @details |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 743 | * Called whenever the device change state. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 744 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 745 | * @param[in] oldState |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 746 | * The device USB state just leaved. See @ref USBD_State_TypeDef. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 747 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 748 | * @param[in] newState |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 749 | * New (the current) USB device state. See @ref USBD_State_TypeDef. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 750 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 751 | typedef void (*USBD_DeviceStateChangeCb_TypeDef)( USBD_State_TypeDef oldState, USBD_State_TypeDef newState ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 752 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 753 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 754 | * @brief |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 755 | * USB power mode callback function. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 756 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 757 | * @details |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 758 | * Called whenever the device stack needs to query if the device is currently |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 759 | * self- or bus-powered. Typically when host has issued an @ref GET_STATUS |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 760 | * setup command. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 761 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 762 | * @return |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 763 | * True if self-powered, false otherwise. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 764 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 765 | typedef bool (*USBD_IsSelfPoweredCb_TypeDef)( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 766 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 767 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 768 | * @brief |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 769 | * USB setup request callback function. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 770 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 771 | * @details |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 772 | * Called on each setup request received from host. This gives the application a |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 773 | * possibility to extend or override standard requests, and to implement class |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 774 | * or vendor specific requests. Return @ref USB_STATUS_OK if the request is |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 775 | * handled, return @ref USB_STATUS_REQ_ERR if it is an illegal request or |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 776 | * return @ref USB_STATUS_REQ_UNHANDLED to pass the request on to the default |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 777 | * request handler. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 778 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 779 | * @param[in] setup |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 780 | * Pointer to an USB setup packet. See @ref USB_Setup_TypeDef. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 781 | * |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 782 | * @return |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 783 | * An appropriate status/error code. See @ref USB_Status_TypeDef. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 784 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 785 | typedef int (*USBD_SetupCmdCb_TypeDef)( const USB_Setup_TypeDef *setup ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 786 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 787 | /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 788 | struct USBD_Callbacks_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 789 | typedef struct USBD_Callbacks_TypeDef const *USBD_Callbacks_TypeDef_Pointer; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 790 | /** @endcond */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 791 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 792 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 793 | /** @brief USB Device stack initialization structure. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 794 | * @details This structure is passed to @ref USBD_Init() when starting up |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 795 | * the device. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 796 | typedef struct |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 797 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 798 | const USB_DeviceDescriptor_TypeDef *deviceDescriptor; /**< Pointer to a device descriptor. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 799 | const uint8_t *configDescriptor; /**< Pointer to a configuration descriptor. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 800 | const void * const *stringDescriptors; /**< Pointer to an array of string descriptor pointers.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 801 | const uint8_t numberOfStrings; /**< Number of strings in string descriptor array. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 802 | const uint8_t *bufferingMultiplier; /**< Pointer to an array defining the size of the |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 803 | endpoint buffers. The size is given in |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 804 | multiples of endpoint size. Generally a value |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 805 | of 1 (single) or 2 (double) buffering should be |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 806 | used. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 807 | USBD_Callbacks_TypeDef_Pointer callbacks; /**< Pointer to struct with callbacks |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 808 | (@ref USBD_Callbacks_TypeDef). These callbacks |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 809 | are used by the device stack to signal events |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 810 | to or query the application. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 811 | const uint32_t reserved; /**< Reserved for future use. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 812 | } USBD_Init_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 813 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 814 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 815 | /** @brief USB Device stack callback structure. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 816 | * @details Callback functions used by the device stack to signal events or |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 817 | * query status to/from the application. See @ref USBD_Init_TypeDef. Assign |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 818 | * members to NULL if your application don't need a specific callback. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 819 | typedef struct USBD_Callbacks_TypeDef |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 820 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 821 | const USBD_UsbResetCb_TypeDef usbReset; /**< Called whenever USB reset signalling is detected |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 822 | on the USB port. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 823 | const USBD_DeviceStateChangeCb_TypeDef usbStateChange; /**< Called whenever the device change state. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 824 | const USBD_SetupCmdCb_TypeDef setupCmd; /**< Called on each setup request received from host.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 825 | const USBD_IsSelfPoweredCb_TypeDef isSelfPowered; /**< Called whenever the device stack needs to query |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 826 | if the device is currently self- or bus-powered. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 827 | Applies to devices which can operate in both modes.*/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 828 | const USBD_SofIntCb_TypeDef sofInt; /**< Called at each SOF interrupt. If NULL, the device |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 829 | stack will not enable the SOF interrupt. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 830 | } USBD_Callbacks_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 831 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 832 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 833 | /*** -------------------- DEVICE mode API -------------------------------- ***/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 834 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 835 | void USBD_AbortAllTransfers( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 836 | int USBD_AbortTransfer( int epAddr ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 837 | void USBD_Connect( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 838 | void USBD_Disconnect( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 839 | bool USBD_EpIsBusy( int epAddr ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 840 | USBD_State_TypeDef USBD_GetUsbState( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 841 | const char * USBD_GetUsbStateName( USBD_State_TypeDef state ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 842 | int USBD_Init( const USBD_Init_TypeDef *p ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 843 | int USBD_Read( int epAddr, void *data, int byteCount, USB_XferCompleteCb_TypeDef callback ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 844 | int USBD_RemoteWakeup( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 845 | bool USBD_SafeToEnterEM2( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 846 | int USBD_StallEp( int epAddr ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 847 | void USBD_Stop( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 848 | int USBD_UnStallEp( int epAddr ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 849 | int USBD_Write( int epAddr, void *data, int byteCount, USB_XferCompleteCb_TypeDef callback ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 850 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 851 | #ifdef __MBED__ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 852 | int USBD_SetAddress( uint8_t addr ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 853 | int USBD_AddEndpoint( int epAddr, int transferType, int maxPacketSize, int bufferMult ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 854 | int USBD_EpIsStalled( int epAddr ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 855 | void USBD_StallEp0( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 856 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 857 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 858 | /** @} (end addtogroup USB_DEVICE) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 859 | #endif /* defined( USB_DEVICE ) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 860 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 861 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 862 | #if defined( USB_HOST ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 863 | /***************************************************************************//** |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 864 | * @addtogroup USB_HOST |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 865 | * @brief USB HOST protocol stack, see @ref usb_host page for detailed documentation. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 866 | * @{ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 867 | ******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 868 | /*** -------------------- HOST mode API definitions ---------------------- ***/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 869 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 870 | #define USB_VBUSOVRCUR_PORT_NONE -1 /**< No overcurrent flag functionality. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 871 | #define USB_VBUSOVRCUR_POLARITY_LOW 0 /**< Overcurrent flag pin polarity is low. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 872 | #define USB_VBUSOVRCUR_POLARITY_HIGH 1 /**< Overcurrent flag pin polarity is high. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 873 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 874 | /** USB HOST endpoint status enumerator. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 875 | typedef enum |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 876 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 877 | H_EP_IDLE = 0, /**< The endpoint is idle. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 878 | H_EP_SETUP = 1, /**< The endpoint is in SETUP stage. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 879 | H_EP_DATA_IN = 2, /**< The endpoint is in DATA IN stage. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 880 | H_EP_DATA_OUT = 3, /**< The endpoint is in DATA OUT stage. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 881 | H_EP_STATUS_IN = 4, /**< The endpoint is in STATUS IN stage. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 882 | H_EP_STATUS_OUT = 5, /**< The endpoint is in STATUS OUT stage. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 883 | } USBH_EpState_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 884 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 885 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 886 | /** @brief USB HOST endpoint status data. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 887 | * @details A host application should not manipulate the contents of |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 888 | * this struct. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 889 | typedef struct |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 890 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 891 | USB_Setup_TypeDef setup; /**< A SETUP package. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 892 | uint8_t setupErrCnt; /**< Error counter for SETUP transfers. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 893 | USB_EndpointDescriptor_TypeDef epDesc; /**< Endpoint descriptor. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 894 | struct USBH_Device_TypeDef *parentDevice; /**< The device the endpoint belongs to. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 895 | uint8_t type; /**< Endpoint type. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 896 | uint16_t packetSize; /**< Packet size, current transfer. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 897 | uint8_t hcOut; /**< Host channel number assigned for OUT transfers. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 898 | uint8_t hcIn; /**< Host channel number assigned for IN transfers. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 899 | bool in; /**< Endpoint direction. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 900 | uint8_t toggle; /**< Endpoint data toggle. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 901 | USBH_EpState_TypeDef state; /**< Endpoint state. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 902 | uint8_t addr; /**< Endpoint address. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 903 | uint8_t *buf; /**< Transfer buffer. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 904 | volatile bool xferCompleted; /**< Transfer completion flag. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 905 | USB_Status_TypeDef xferStatus; /**< Transfer status. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 906 | USB_XferCompleteCb_TypeDef xferCompleteCb; /**< Transfer completion callback function. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 907 | uint32_t xferred; /**< Number of bytes transferred. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 908 | uint32_t remaining; /**< Number of bytes remaining. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 909 | uint32_t timeout; /**< Transfer timeout. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 910 | } USBH_Ep_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 911 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 912 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 913 | /** @brief USB HOST device definition. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 914 | * @details A host application should not manipulate the contents of |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 915 | * this struct. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 916 | typedef struct USBH_Device_TypeDef |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 917 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 918 | USB_DeviceDescriptor_TypeDef devDesc; /**< The device device descriptor. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 919 | USB_ConfigurationDescriptor_TypeDef confDesc; /**< The device configuration descriptor. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 920 | USB_InterfaceDescriptor_TypeDef itfDesc; /**< The device interface descriptor. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 921 | USBH_Ep_TypeDef ep0; /**< Endpoint 0 status data. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 922 | USBH_Ep_TypeDef *ep; /**< Array of endpoint status data. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 923 | int numEp; /**< Number of endpoints. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 924 | uint8_t addr; /**< The device address. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 925 | uint8_t speed; /**< The device speed (low or full speed). */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 926 | } USBH_Device_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 927 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 928 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 929 | /** @brief USB Host stack initialization structure. |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 930 | * @details This structure is passed to @ref USBH_Init() when starting up the |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 931 | * device. Max accumulated FIFO size is 2K bytes. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 932 | typedef struct |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 933 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 934 | uint32_t rxFifoSize; /**< Number of FIFO bytes set aside for IN endpoints. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 935 | uint32_t nptxFifoSize; /**< Number of FIFO bytes set aside for OUT CTRL/BULK endoints. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 936 | uint32_t ptxFifoSize; /**< Number of FIFO bytes set aside for OUT INTR/ISO endoints. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 937 | uint32_t reserved; /**< Reserved for future use. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 938 | } USBH_Init_TypeDef; |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 939 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 940 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 941 | /** Default @ref USBH_Init_TypeDef values, provides reasonable Tx/Rx FIFO |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 942 | * partitioning. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 943 | /* In DMA mode the total available FIFO space is smaller. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 944 | /* The DMA controller use one FIFO word pr. channel for status. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 945 | /* The unit in the table is byte. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 946 | #define USBH_INIT_DEFAULT \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 947 | { \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 948 | MAX_HOST_FIFO_SIZE_INWORDS * 2,/* 1024 bytes Rx FIFO size. */ \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 949 | MAX_HOST_FIFO_SIZE_INWORDS, /* 512 bytes non-periodic Tx FIFO size. */ \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 950 | MAX_HOST_FIFO_SIZE_INWORDS, /* 512 bytes periodic Tx FIFO size. */ \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 951 | 0 /* Reserved. */ \ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 952 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 953 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 954 | /*** -------------------- HOST mode API ---------------------------------- ***/ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 955 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 956 | int USBH_AssignHostChannel( USBH_Ep_TypeDef *ep, uint8_t hcnum ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 957 | int USBH_ControlMsg( USBH_Ep_TypeDef *ep, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength, void *data, int timeout, USB_XferCompleteCb_TypeDef callback ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 958 | int USBH_ControlMsgB( USBH_Ep_TypeDef *ep, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength, void *data, int timeout ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 959 | bool USBH_DeviceConnected( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 960 | int USBH_GetConfigurationDescriptorB( USBH_Device_TypeDef *device, void *buf, int len, uint8_t configIndex ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 961 | int USBH_GetDeviceDescriptorB( USBH_Device_TypeDef *device, void *buf, int len ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 962 | uint8_t USBH_GetPortSpeed( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 963 | int USBH_GetStringB( USBH_Device_TypeDef *device, uint8_t *buf, int bufLen, uint8_t stringIndex, uint16_t langID ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 964 | int USBH_Init( const USBH_Init_TypeDef *p ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 965 | int USBH_InitDeviceData( USBH_Device_TypeDef *device, const uint8_t *buf, USBH_Ep_TypeDef *ep, int numEp, uint8_t deviceSpeed ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 966 | int USBH_PortReset( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 967 | int USBH_PortResume( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 968 | void USBH_PortSuspend( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 969 | void USBH_PrintString( const char *pre, const USB_StringDescriptor_TypeDef *s, const char *post ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 970 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 971 | #if defined( USB_USE_PRINTF ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 972 | int USBH_PrintConfigurationDescriptor( const USB_ConfigurationDescriptor_TypeDef *config, int maxLen ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 973 | int USBH_PrintDeviceDescriptor( const USB_DeviceDescriptor_TypeDef *device ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 974 | int USBH_PrintEndpointDescriptor( const USB_EndpointDescriptor_TypeDef *endpoint ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 975 | int USBH_PrintInterfaceDescriptor( const USB_InterfaceDescriptor_TypeDef *interface ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 976 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 977 | #define USBH_PrintConfigurationDescriptor( config, maxLen ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 978 | #define USBH_PrintDeviceDescriptor( device ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 979 | #define USBH_PrintEndpointDescriptor( endpoint ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 980 | #define USBH_PrintInterfaceDescriptor( interface ) |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 981 | #endif /* defined( USB_USE_PRINTF ) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 982 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 983 | int USBH_QueryDeviceB( uint8_t *buf, size_t bufsize, uint8_t deviceSpeed ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 984 | USB_ConfigurationDescriptor_TypeDef* USBH_QGetConfigurationDescriptor( const uint8_t *buf, int configIndex ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 985 | USB_DeviceDescriptor_TypeDef* USBH_QGetDeviceDescriptor( const uint8_t *buf ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 986 | USB_EndpointDescriptor_TypeDef* USBH_QGetEndpointDescriptor( const uint8_t *buf, int configIndex, int interfaceIndex, int endpointIndex ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 987 | USB_InterfaceDescriptor_TypeDef* USBH_QGetInterfaceDescriptor( const uint8_t *buf, int configIndex, int interfaceIndex ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 988 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 989 | int USBH_Read( USBH_Ep_TypeDef *ep, void *data, int byteCount, int timeout, USB_XferCompleteCb_TypeDef callback ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 990 | int USBH_ReadB( USBH_Ep_TypeDef *ep, void *data, int byteCount, int timeout ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 991 | int USBH_SetAddressB( USBH_Device_TypeDef *device, uint8_t deviceAddress ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 992 | int USBH_SetAltInterfaceB( USBH_Device_TypeDef *device, uint8_t interfaceIndex, uint8_t alternateSetting ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 993 | int USBH_SetConfigurationB( USBH_Device_TypeDef *device, uint8_t configValue ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 994 | int USBH_StallEpB( USBH_Ep_TypeDef *ep ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 995 | void USBH_Stop( void ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 996 | int USBH_UnStallEpB( USBH_Ep_TypeDef *ep ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 997 | int USBH_WaitForDeviceConnectionB( uint8_t *buf, int timeoutInSeconds ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 998 | int USBH_Write( USBH_Ep_TypeDef *ep, void *data, int byteCount, int timeout, USB_XferCompleteCb_TypeDef callback ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 999 | int USBH_WriteB( USBH_Ep_TypeDef *ep, void *data, int byteCount, int timeout ); |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1000 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1001 | /** @} (end addtogroup USB_HOST) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1002 | #endif /* defined( USB_HOST ) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1003 | /** @} (end addtogroup USB) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1004 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1005 | #ifdef __cplusplus |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1006 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1007 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1008 | |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1009 | #endif /* defined( USB_DEVICE ) || defined( USB_HOST ) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1010 | #endif /* defined( USB_PRESENT ) && ( USB_COUNT == 1 ) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:2a3ae13b45ef | 1011 | #endif /* __EM_USB_H */ |