usb/usb_conf.h@0:8f0d870509fe, 2017-09-04 (annotated)
- Committer:
- Sergunb
- Date:
- Mon Sep 04 12:04:13 2017 +0000
- Revision:
- 0:8f0d870509fe
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sergunb | 0:8f0d870509fe | 1 | /******************** (C) COPYRIGHT 2011 STMicroelectronics ******************** |
Sergunb | 0:8f0d870509fe | 2 | * File Name : usb_conf.h |
Sergunb | 0:8f0d870509fe | 3 | * Author : MCD Application Team |
Sergunb | 0:8f0d870509fe | 4 | * Version : V3.3.0 |
Sergunb | 0:8f0d870509fe | 5 | * Date : 21-March-2011 |
Sergunb | 0:8f0d870509fe | 6 | * Description : Virtual COM Port Demo configuration header |
Sergunb | 0:8f0d870509fe | 7 | ******************************************************************************** |
Sergunb | 0:8f0d870509fe | 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
Sergunb | 0:8f0d870509fe | 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
Sergunb | 0:8f0d870509fe | 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
Sergunb | 0:8f0d870509fe | 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
Sergunb | 0:8f0d870509fe | 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING |
Sergunb | 0:8f0d870509fe | 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
Sergunb | 0:8f0d870509fe | 14 | *******************************************************************************/ |
Sergunb | 0:8f0d870509fe | 15 | |
Sergunb | 0:8f0d870509fe | 16 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Sergunb | 0:8f0d870509fe | 17 | #ifndef __USB_CONF_H |
Sergunb | 0:8f0d870509fe | 18 | #define __USB_CONF_H |
Sergunb | 0:8f0d870509fe | 19 | |
Sergunb | 0:8f0d870509fe | 20 | /* Includes ------------------------------------------------------------------*/ |
Sergunb | 0:8f0d870509fe | 21 | /* Exported types ------------------------------------------------------------*/ |
Sergunb | 0:8f0d870509fe | 22 | /* Exported constants --------------------------------------------------------*/ |
Sergunb | 0:8f0d870509fe | 23 | /* Exported macro ------------------------------------------------------------*/ |
Sergunb | 0:8f0d870509fe | 24 | /* Exported functions ------------------------------------------------------- */ |
Sergunb | 0:8f0d870509fe | 25 | /* External variables --------------------------------------------------------*/ |
Sergunb | 0:8f0d870509fe | 26 | |
Sergunb | 0:8f0d870509fe | 27 | /*-------------------------------------------------------------*/ |
Sergunb | 0:8f0d870509fe | 28 | /* EP_NUM */ |
Sergunb | 0:8f0d870509fe | 29 | /* defines how many endpoints are used by the device */ |
Sergunb | 0:8f0d870509fe | 30 | /*-------------------------------------------------------------*/ |
Sergunb | 0:8f0d870509fe | 31 | |
Sergunb | 0:8f0d870509fe | 32 | #define EP_NUM (4) |
Sergunb | 0:8f0d870509fe | 33 | |
Sergunb | 0:8f0d870509fe | 34 | |
Sergunb | 0:8f0d870509fe | 35 | #ifndef STM32F10X_CL |
Sergunb | 0:8f0d870509fe | 36 | /*-------------------------------------------------------------*/ |
Sergunb | 0:8f0d870509fe | 37 | /* -------------- Buffer Description Table -----------------*/ |
Sergunb | 0:8f0d870509fe | 38 | /*-------------------------------------------------------------*/ |
Sergunb | 0:8f0d870509fe | 39 | /* buffer table base address */ |
Sergunb | 0:8f0d870509fe | 40 | /* buffer table base address */ |
Sergunb | 0:8f0d870509fe | 41 | #define BTABLE_ADDRESS (0x00) |
Sergunb | 0:8f0d870509fe | 42 | |
Sergunb | 0:8f0d870509fe | 43 | /* EP0 */ |
Sergunb | 0:8f0d870509fe | 44 | /* rx/tx buffer base address */ |
Sergunb | 0:8f0d870509fe | 45 | #define ENDP0_RXADDR (0x40) |
Sergunb | 0:8f0d870509fe | 46 | #define ENDP0_TXADDR (0x80) |
Sergunb | 0:8f0d870509fe | 47 | |
Sergunb | 0:8f0d870509fe | 48 | /* EP1 */ |
Sergunb | 0:8f0d870509fe | 49 | /* tx buffer base address */ |
Sergunb | 0:8f0d870509fe | 50 | #define ENDP1_TXADDR (0xC0) |
Sergunb | 0:8f0d870509fe | 51 | #define ENDP2_TXADDR (0x100) |
Sergunb | 0:8f0d870509fe | 52 | #define ENDP3_RXADDR (0x110) |
Sergunb | 0:8f0d870509fe | 53 | |
Sergunb | 0:8f0d870509fe | 54 | |
Sergunb | 0:8f0d870509fe | 55 | /*-------------------------------------------------------------*/ |
Sergunb | 0:8f0d870509fe | 56 | /* ------------------- ISTR events -------------------------*/ |
Sergunb | 0:8f0d870509fe | 57 | /*-------------------------------------------------------------*/ |
Sergunb | 0:8f0d870509fe | 58 | /* IMR_MSK */ |
Sergunb | 0:8f0d870509fe | 59 | /* mask defining which events has to be handled */ |
Sergunb | 0:8f0d870509fe | 60 | /* by the device application software */ |
Sergunb | 0:8f0d870509fe | 61 | #define IMR_MSK (CNTR_CTRM | CNTR_SOFM | CNTR_RESETM ) |
Sergunb | 0:8f0d870509fe | 62 | |
Sergunb | 0:8f0d870509fe | 63 | /*#define CTR_CALLBACK*/ |
Sergunb | 0:8f0d870509fe | 64 | /*#define DOVR_CALLBACK*/ |
Sergunb | 0:8f0d870509fe | 65 | /*#define ERR_CALLBACK*/ |
Sergunb | 0:8f0d870509fe | 66 | /*#define WKUP_CALLBACK*/ |
Sergunb | 0:8f0d870509fe | 67 | /*#define SUSP_CALLBACK*/ |
Sergunb | 0:8f0d870509fe | 68 | /*#define RESET_CALLBACK*/ |
Sergunb | 0:8f0d870509fe | 69 | #define SOF_CALLBACK |
Sergunb | 0:8f0d870509fe | 70 | /*#define ESOF_CALLBACK*/ |
Sergunb | 0:8f0d870509fe | 71 | #endif /* STM32F10X_CL */ |
Sergunb | 0:8f0d870509fe | 72 | |
Sergunb | 0:8f0d870509fe | 73 | #ifdef STM32F10X_CL |
Sergunb | 0:8f0d870509fe | 74 | /******************************************************************************* |
Sergunb | 0:8f0d870509fe | 75 | * FIFO Size Configuration |
Sergunb | 0:8f0d870509fe | 76 | * |
Sergunb | 0:8f0d870509fe | 77 | * (i) Dedicated data FIFO SPRAM of 1.25 Kbytes = 1280 bytes = 320 32-bits words |
Sergunb | 0:8f0d870509fe | 78 | * available for the endpoints IN and OUT. |
Sergunb | 0:8f0d870509fe | 79 | * Device mode features: |
Sergunb | 0:8f0d870509fe | 80 | * -1 bidirectional CTRL EP 0 |
Sergunb | 0:8f0d870509fe | 81 | * -3 IN EPs to support any kind of Bulk, Interrupt or Isochronous transfer |
Sergunb | 0:8f0d870509fe | 82 | * -3 OUT EPs to support any kind of Bulk, Interrupt or Isochronous transfer |
Sergunb | 0:8f0d870509fe | 83 | * |
Sergunb | 0:8f0d870509fe | 84 | * ii) Receive data FIFO size = RAM for setup packets + |
Sergunb | 0:8f0d870509fe | 85 | * OUT endpoint control information + |
Sergunb | 0:8f0d870509fe | 86 | * data OUT packets + miscellaneous |
Sergunb | 0:8f0d870509fe | 87 | * Space = ONE 32-bits words |
Sergunb | 0:8f0d870509fe | 88 | * --> RAM for setup packets = 4 * n + 6 space |
Sergunb | 0:8f0d870509fe | 89 | * (n is the nbr of CTRL EPs the device core supports) |
Sergunb | 0:8f0d870509fe | 90 | * --> OUT EP CTRL info = 1 space |
Sergunb | 0:8f0d870509fe | 91 | * (one space for status information written to the FIFO along with each |
Sergunb | 0:8f0d870509fe | 92 | * received packet) |
Sergunb | 0:8f0d870509fe | 93 | * --> data OUT packets = (Largest Packet Size / 4) + 1 spaces |
Sergunb | 0:8f0d870509fe | 94 | * (MINIMUM to receive packets) |
Sergunb | 0:8f0d870509fe | 95 | * --> OR data OUT packets = at least 2*(Largest Packet Size / 4) + 1 spaces |
Sergunb | 0:8f0d870509fe | 96 | * (if high-bandwidth EP is enabled or multiple isochronous EPs) |
Sergunb | 0:8f0d870509fe | 97 | * --> miscellaneous = 1 space per OUT EP |
Sergunb | 0:8f0d870509fe | 98 | * (one space for transfer complete status information also pushed to the |
Sergunb | 0:8f0d870509fe | 99 | * FIFO with each endpoint's last packet) |
Sergunb | 0:8f0d870509fe | 100 | * |
Sergunb | 0:8f0d870509fe | 101 | * (iii)MINIMUM RAM space required for each IN EP Tx FIFO = MAX packet size for |
Sergunb | 0:8f0d870509fe | 102 | * that particular IN EP. More space allocated in the IN EP Tx FIFO results |
Sergunb | 0:8f0d870509fe | 103 | * in a better performance on the USB and can hide latencies on the AHB. |
Sergunb | 0:8f0d870509fe | 104 | * |
Sergunb | 0:8f0d870509fe | 105 | * (iv) TXn min size = 16 words. (n : Transmit FIFO index) |
Sergunb | 0:8f0d870509fe | 106 | * (v) When a TxFIFO is not used, the Configuration should be as follows: |
Sergunb | 0:8f0d870509fe | 107 | * case 1 : n > m and Txn is not used (n,m : Transmit FIFO indexes) |
Sergunb | 0:8f0d870509fe | 108 | * --> Txm can use the space allocated for Txn. |
Sergunb | 0:8f0d870509fe | 109 | * case2 : n < m and Txn is not used (n,m : Transmit FIFO indexes) |
Sergunb | 0:8f0d870509fe | 110 | * --> Txn should be configured with the minimum space of 16 words |
Sergunb | 0:8f0d870509fe | 111 | * (vi) The FIFO is used optimally when used TxFIFOs are allocated in the top |
Sergunb | 0:8f0d870509fe | 112 | * of the FIFO.Ex: use EP1 and EP2 as IN instead of EP1 and EP3 as IN ones. |
Sergunb | 0:8f0d870509fe | 113 | *******************************************************************************/ |
Sergunb | 0:8f0d870509fe | 114 | |
Sergunb | 0:8f0d870509fe | 115 | #define RX_FIFO_SIZE 128 |
Sergunb | 0:8f0d870509fe | 116 | #define TX0_FIFO_SIZE 64 |
Sergunb | 0:8f0d870509fe | 117 | #define TX1_FIFO_SIZE 64 |
Sergunb | 0:8f0d870509fe | 118 | #define TX2_FIFO_SIZE 16 |
Sergunb | 0:8f0d870509fe | 119 | #define TX3_FIFO_SIZE 16 |
Sergunb | 0:8f0d870509fe | 120 | |
Sergunb | 0:8f0d870509fe | 121 | /* OTGD-FS-DEVICE IP interrupts Enable definitions */ |
Sergunb | 0:8f0d870509fe | 122 | /* Uncomment the define to enable the selected interrupt */ |
Sergunb | 0:8f0d870509fe | 123 | //#define INTR_MODEMISMATCH |
Sergunb | 0:8f0d870509fe | 124 | #define INTR_SOFINTR |
Sergunb | 0:8f0d870509fe | 125 | #define INTR_RXSTSQLVL /* Mandatory */ |
Sergunb | 0:8f0d870509fe | 126 | //#define INTR_NPTXFEMPTY |
Sergunb | 0:8f0d870509fe | 127 | //#define INTR_GINNAKEFF |
Sergunb | 0:8f0d870509fe | 128 | //#define INTR_GOUTNAKEFF |
Sergunb | 0:8f0d870509fe | 129 | //#define INTR_ERLYSUSPEND |
Sergunb | 0:8f0d870509fe | 130 | #define INTR_USBSUSPEND /* Mandatory */ |
Sergunb | 0:8f0d870509fe | 131 | #define INTR_USBRESET /* Mandatory */ |
Sergunb | 0:8f0d870509fe | 132 | #define INTR_ENUMDONE /* Mandatory */ |
Sergunb | 0:8f0d870509fe | 133 | //#define INTR_ISOOUTDROP |
Sergunb | 0:8f0d870509fe | 134 | //#define INTR_EOPFRAME |
Sergunb | 0:8f0d870509fe | 135 | //#define INTR_EPMISMATCH |
Sergunb | 0:8f0d870509fe | 136 | #define INTR_INEPINTR /* Mandatory */ |
Sergunb | 0:8f0d870509fe | 137 | #define INTR_OUTEPINTR /* Mandatory */ |
Sergunb | 0:8f0d870509fe | 138 | //#define INTR_INCOMPLISOIN |
Sergunb | 0:8f0d870509fe | 139 | //#define INTR_INCOMPLISOOUT |
Sergunb | 0:8f0d870509fe | 140 | #define INTR_WKUPINTR /* Mandatory */ |
Sergunb | 0:8f0d870509fe | 141 | |
Sergunb | 0:8f0d870509fe | 142 | /* OTGD-FS-DEVICE IP interrupts subroutines */ |
Sergunb | 0:8f0d870509fe | 143 | /* Comment the define to enable the selected interrupt subroutine and replace it |
Sergunb | 0:8f0d870509fe | 144 | by user code */ |
Sergunb | 0:8f0d870509fe | 145 | #define INTR_MODEMISMATCH_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 146 | /* #define INTR_SOFINTR_Callback NOP_Process */ |
Sergunb | 0:8f0d870509fe | 147 | #define INTR_RXSTSQLVL_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 148 | #define INTR_NPTXFEMPTY_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 149 | #define INTR_NPTXFEMPTY_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 150 | #define INTR_GINNAKEFF_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 151 | #define INTR_GOUTNAKEFF_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 152 | #define INTR_ERLYSUSPEND_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 153 | #define INTR_USBSUSPEND_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 154 | #define INTR_USBRESET_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 155 | #define INTR_ENUMDONE_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 156 | #define INTR_ISOOUTDROP_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 157 | #define INTR_EOPFRAME_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 158 | #define INTR_EPMISMATCH_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 159 | #define INTR_INEPINTR_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 160 | #define INTR_OUTEPINTR_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 161 | #define INTR_INCOMPLISOIN_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 162 | #define INTR_INCOMPLISOOUT_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 163 | #define INTR_WKUPINTR_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 164 | |
Sergunb | 0:8f0d870509fe | 165 | /* Isochronous data update */ |
Sergunb | 0:8f0d870509fe | 166 | #define INTR_RXSTSQLVL_ISODU_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 167 | |
Sergunb | 0:8f0d870509fe | 168 | /* Isochronous transfer parameters */ |
Sergunb | 0:8f0d870509fe | 169 | /* Size of a single Isochronous buffer (size of a single transfer) */ |
Sergunb | 0:8f0d870509fe | 170 | #define ISOC_BUFFER_SZE 1 |
Sergunb | 0:8f0d870509fe | 171 | /* Number of sub-buffers (number of single buffers/transfers), should be even */ |
Sergunb | 0:8f0d870509fe | 172 | #define NUM_SUB_BUFFERS 2 |
Sergunb | 0:8f0d870509fe | 173 | |
Sergunb | 0:8f0d870509fe | 174 | #endif /* STM32F10X_CL */ |
Sergunb | 0:8f0d870509fe | 175 | |
Sergunb | 0:8f0d870509fe | 176 | |
Sergunb | 0:8f0d870509fe | 177 | /* CTR service routines */ |
Sergunb | 0:8f0d870509fe | 178 | /* associated to defined endpoints */ |
Sergunb | 0:8f0d870509fe | 179 | /*#define EP1_IN_Callback NOP_Process*/ |
Sergunb | 0:8f0d870509fe | 180 | #define EP2_IN_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 181 | #define EP3_IN_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 182 | #define EP4_IN_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 183 | #define EP5_IN_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 184 | #define EP6_IN_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 185 | #define EP7_IN_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 186 | |
Sergunb | 0:8f0d870509fe | 187 | #define EP1_OUT_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 188 | #define EP2_OUT_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 189 | /*#define EP3_OUT_Callback NOP_Process*/ |
Sergunb | 0:8f0d870509fe | 190 | #define EP4_OUT_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 191 | #define EP5_OUT_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 192 | #define EP6_OUT_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 193 | #define EP7_OUT_Callback NOP_Process |
Sergunb | 0:8f0d870509fe | 194 | |
Sergunb | 0:8f0d870509fe | 195 | #endif /* __USB_CONF_H */ |
Sergunb | 0:8f0d870509fe | 196 | |
Sergunb | 0:8f0d870509fe | 197 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |