USB device stack

Dependents:   USBMSD_step1 USBMSD_step1_5 picossd_step1_2cs

Committer:
Kojto
Date:
Thu Jul 27 12:14:04 2017 +0100
Revision:
71:53949e6131f6
Update libraries

Fixes the previous commmit, as some devices were not copied. USBDevice contains
now targets directory with all targets implementations

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 71:53949e6131f6 1 /***************************************************************************//**
Kojto 71:53949e6131f6 2 * @file usbconfig.h
Kojto 71:53949e6131f6 3 * @brief USB protocol stack library, application supplied configuration options.
Kojto 71:53949e6131f6 4 * @version 3.20.12
Kojto 71:53949e6131f6 5 *******************************************************************************
Kojto 71:53949e6131f6 6 * @section License
Kojto 71:53949e6131f6 7 * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
Kojto 71:53949e6131f6 8 *******************************************************************************
Kojto 71:53949e6131f6 9 *
Kojto 71:53949e6131f6 10 * Licensed under the Apache License, Version 2.0 (the "License");
Kojto 71:53949e6131f6 11 * you may not use this file except in compliance with the License.
Kojto 71:53949e6131f6 12 * You may obtain a copy of the License at
Kojto 71:53949e6131f6 13 *
Kojto 71:53949e6131f6 14 * http://www.apache.org/licenses/LICENSE-2.0
Kojto 71:53949e6131f6 15 *
Kojto 71:53949e6131f6 16 * Unless required by applicable law or agreed to in writing, software
Kojto 71:53949e6131f6 17 * distributed under the License is distributed on an "AS IS" BASIS,
Kojto 71:53949e6131f6 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Kojto 71:53949e6131f6 19 * See the License for the specific language governing permissions and
Kojto 71:53949e6131f6 20 * limitations under the License.
Kojto 71:53949e6131f6 21 *
Kojto 71:53949e6131f6 22 ******************************************************************************/
Kojto 71:53949e6131f6 23
Kojto 71:53949e6131f6 24 #ifndef __USBCONFIG_H
Kojto 71:53949e6131f6 25 #define __USBCONFIG_H
Kojto 71:53949e6131f6 26
Kojto 71:53949e6131f6 27 #ifdef __cplusplus
Kojto 71:53949e6131f6 28 extern "C" {
Kojto 71:53949e6131f6 29 #endif
Kojto 71:53949e6131f6 30
Kojto 71:53949e6131f6 31 /* Compile stack for device mode. */
Kojto 71:53949e6131f6 32 #define USB_DEVICE
Kojto 71:53949e6131f6 33
Kojto 71:53949e6131f6 34 /* Maximum number of endpoint used, EP0 excluded. If you change this, you must
Kojto 71:53949e6131f6 35 also change USBEndpoints_EFM32.h to match. */
Kojto 71:53949e6131f6 36 #define NUM_EP_USED 6
Kojto 71:53949e6131f6 37
Kojto 71:53949e6131f6 38 /* Power management modes. The following can be or'd toghether. See comments in
Kojto 71:53949e6131f6 39 em_usbd.c under "Energy-saving modes" for more details.
Kojto 71:53949e6131f6 40
Kojto 71:53949e6131f6 41 USB_PWRSAVE_MODE_ONSUSPEND Set USB peripheral in low power mode on suspend
Kojto 71:53949e6131f6 42
Kojto 71:53949e6131f6 43 USB_PWRSAVE_MODE_ONVBUSOFF Set USB peripheral in low power mode when not
Kojto 71:53949e6131f6 44 attached to a host. While this mode assumes that the internal voltage regulator
Kojto 71:53949e6131f6 45 is used and that the VREGI pin of the chip is connected to VBUS it should
Kojto 71:53949e6131f6 46 be safe to use given that VREGOSEN is always enabled. If you disable VREGOSEN
Kojto 71:53949e6131f6 47 you must turn this off.
Kojto 71:53949e6131f6 48
Kojto 71:53949e6131f6 49 USB_PWRSAVE_MODE_ENTEREM2 Enter EM2 when USB peripheral is in low power mode.
Kojto 71:53949e6131f6 50 On Mbed this allows the sleep() and deepsleep() calls to enter EM2, but
Kojto 71:53949e6131f6 51 does not automatically enter any sleep states. Entering EM1 is always allowed.
Kojto 71:53949e6131f6 52
Kojto 71:53949e6131f6 53 Note for Happy Gecko, errata USB_E111: Entering EM2 when both the system clock
Kojto 71:53949e6131f6 54 (HFCLK) and the USB core clock (USBCCLK) is running on USHFRCO will result in
Kojto 71:53949e6131f6 55 a lock-up.
Kojto 71:53949e6131f6 56 */
Kojto 71:53949e6131f6 57 #define USB_PWRSAVE_MODE (USB_PWRSAVE_MODE_ONSUSPEND|USB_PWRSAVE_MODE_ONVBUSOFF|USB_PWRSAVE_MODE_ENTEREM2)
Kojto 71:53949e6131f6 58
Kojto 71:53949e6131f6 59 /* Use dynamic memory to allocate rx/tx buffers in the HAL. Saves memory
Kojto 71:53949e6131f6 60 as buffers are only allocated for used endpoints. The system malloc
Kojto 71:53949e6131f6 61 must return memory that is aligned by 4.
Kojto 71:53949e6131f6 62
Kojto 71:53949e6131f6 63 Note: if you disable this, using isochronous endpoints with packet
Kojto 71:53949e6131f6 64 sizes that are larger than the maximum for other EP types (64) will
Kojto 71:53949e6131f6 65 not work. */
Kojto 71:53949e6131f6 66 #define USB_USE_DYNAMIC_MEMORY
Kojto 71:53949e6131f6 67
Kojto 71:53949e6131f6 68 /* When the USB peripheral is set in low power mode, it must be clocked by a 32kHz
Kojto 71:53949e6131f6 69 clock. Both LFXO and LFRCO can be used, but only LFXO guarantee USB specification
Kojto 71:53949e6131f6 70 compliance. */
Kojto 71:53949e6131f6 71 #define USB_USBC_32kHz_CLK USB_USBC_32kHz_CLK_LFXO
Kojto 71:53949e6131f6 72
Kojto 71:53949e6131f6 73 /* Uncomment to get some debugging information. Default value for USER_PUTCHAR
Kojto 71:53949e6131f6 74 should work for SiLabs Gecko boards. Printf requires a working retarget
Kojto 71:53949e6131f6 75 implementation for write(). */
Kojto 71:53949e6131f6 76 //#define DEBUG_USB_API
Kojto 71:53949e6131f6 77 //#define USB_USE_PRINTF
Kojto 71:53949e6131f6 78 //#define USER_PUTCHAR ITM_SendChar
Kojto 71:53949e6131f6 79 //#define DEBUG_USB_INT_HI
Kojto 71:53949e6131f6 80 //#define DEBUG_USB_INT_LO
Kojto 71:53949e6131f6 81
Kojto 71:53949e6131f6 82
Kojto 71:53949e6131f6 83
Kojto 71:53949e6131f6 84 #ifdef __cplusplus
Kojto 71:53949e6131f6 85 }
Kojto 71:53949e6131f6 86 #endif
Kojto 71:53949e6131f6 87
Kojto 71:53949e6131f6 88 #endif /* __USBCONFIG_H */