Fork of https://developer.mbed.org/users/bscott/code/STM32_USBDevice/
Fork of STM32_USBDevice by
USBDevice/USBEndpoints_STM32L1.h@77:a98f786d05d4, 2018-07-24 (annotated)
- Committer:
- Troels Nilsson
- Date:
- Tue Jul 24 13:08:29 2018 +0200
- Branch:
- feature_WebUSB
- Revision:
- 77:a98f786d05d4
- Parent:
- 76:eef92651f52f
Changed USBWebUSBSerial to use non-blocking writes
USBWebUSBSerial now uses an internal buffer to do non-blocking, async writes
Expanded CircBuffer to be able to queue/dequeue a block of data (to avoid looping a lot)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 57:b6b2296460db | 1 | /* Copyright (c) 2010-2015 mbed.org, MIT License |
va009039 | 57:b6b2296460db | 2 | * |
va009039 | 57:b6b2296460db | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
va009039 | 57:b6b2296460db | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
va009039 | 57:b6b2296460db | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
va009039 | 57:b6b2296460db | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
va009039 | 57:b6b2296460db | 7 | * Software is furnished to do so, subject to the following conditions: |
va009039 | 57:b6b2296460db | 8 | * |
va009039 | 57:b6b2296460db | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
va009039 | 57:b6b2296460db | 10 | * substantial portions of the Software. |
va009039 | 57:b6b2296460db | 11 | * |
va009039 | 57:b6b2296460db | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
va009039 | 57:b6b2296460db | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
va009039 | 57:b6b2296460db | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
va009039 | 57:b6b2296460db | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
va009039 | 57:b6b2296460db | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
va009039 | 57:b6b2296460db | 17 | */ |
va009039 | 57:b6b2296460db | 18 | |
va009039 | 57:b6b2296460db | 19 | #define NUMBER_OF_LOGICAL_ENDPOINTS (4) |
va009039 | 57:b6b2296460db | 20 | #define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS * 2) |
va009039 | 57:b6b2296460db | 21 | |
va009039 | 57:b6b2296460db | 22 | /* Define physical endpoint numbers */ |
va009039 | 57:b6b2296460db | 23 | |
va009039 | 57:b6b2296460db | 24 | /* Endpoint No. Type(s) MaxPacket DoubleBuffer */ |
va009039 | 57:b6b2296460db | 25 | /* ---------------- ------------ ---------- --- */ |
va009039 | 57:b6b2296460db | 26 | #define EP0OUT (0) /* Control 64 No */ |
va009039 | 57:b6b2296460db | 27 | #define EP0IN (1) /* Control 64 No */ |
va009039 | 57:b6b2296460db | 28 | #define EP1OUT (2) /* Int/Bulk/Iso 64/64/1023 Yes */ |
va009039 | 57:b6b2296460db | 29 | #define EP1IN (3) /* Int/Bulk/Iso 64/64/1023 Yes */ |
va009039 | 57:b6b2296460db | 30 | #define EP2OUT (4) /* Int/Bulk/Iso 64/64/1023 Yes */ |
va009039 | 57:b6b2296460db | 31 | #define EP2IN (5) /* Int/Bulk/Iso 64/64/1023 Yes */ |
va009039 | 57:b6b2296460db | 32 | #define EP3OUT (6) /* Int/Bulk/Iso 64/64/1023 Yes */ |
va009039 | 57:b6b2296460db | 33 | #define EP3IN (7) /* Int/Bulk/Iso 64/64/1023 Yes */ |
va009039 | 57:b6b2296460db | 34 | |
va009039 | 57:b6b2296460db | 35 | /* Maximum Packet sizes */ |
va009039 | 57:b6b2296460db | 36 | |
va009039 | 57:b6b2296460db | 37 | #define MAX_PACKET_SIZE_EP0 (64) |
va009039 | 57:b6b2296460db | 38 | #define MAX_PACKET_SIZE_EP1 (64) /* Int/Bulk */ |
va009039 | 57:b6b2296460db | 39 | #define MAX_PACKET_SIZE_EP2 (64) /* Int/Bulk */ |
va009039 | 57:b6b2296460db | 40 | #define MAX_PACKET_SIZE_EP3 (64) /* Int/Bulk */ |
va009039 | 57:b6b2296460db | 41 | |
va009039 | 57:b6b2296460db | 42 | #define MAX_PACKET_SIZE_EP1_ISO (192) /* Isochronous */ |
va009039 | 57:b6b2296460db | 43 | #define MAX_PACKET_SIZE_EP2_ISO (192) /* Isochronous */ |
va009039 | 57:b6b2296460db | 44 | #define MAX_PACKET_SIZE_EP3_ISO (192) /* Isochronous */ |
va009039 | 57:b6b2296460db | 45 | |
va009039 | 57:b6b2296460db | 46 | /* Generic endpoints - intended to be portable accross devices */ |
va009039 | 57:b6b2296460db | 47 | /* and be suitable for simple USB devices. */ |
va009039 | 57:b6b2296460db | 48 | |
Troels Nilsson |
76:eef92651f52f | 49 | /* Bulk/CDC endpoint */ |
va009039 | 57:b6b2296460db | 50 | #define EPBULK_OUT (EP2OUT) |
va009039 | 57:b6b2296460db | 51 | #define EPBULK_IN (EP2IN) |
va009039 | 57:b6b2296460db | 52 | #define EPBULK_OUT_callback EP2_OUT_callback |
va009039 | 57:b6b2296460db | 53 | #define EPBULK_IN_callback EP2_IN_callback |
Troels Nilsson |
76:eef92651f52f | 54 | #define EPCDC_OUT (EP2OUT) |
Troels Nilsson |
76:eef92651f52f | 55 | #define EPCDC_IN (EP2IN) |
Troels Nilsson |
76:eef92651f52f | 56 | #define EPCDC_OUT_callback EP2_OUT_callback |
Troels Nilsson |
76:eef92651f52f | 57 | #define EPCDC_IN_callback EP2_IN_callback |
va009039 | 57:b6b2296460db | 58 | /* Interrupt endpoint */ |
va009039 | 57:b6b2296460db | 59 | #define EPINT_OUT (EP1OUT) |
va009039 | 57:b6b2296460db | 60 | #define EPINT_IN (EP1IN) |
va009039 | 57:b6b2296460db | 61 | #define EPINT_OUT_callback EP1_OUT_callback |
va009039 | 57:b6b2296460db | 62 | #define EPINT_IN_callback EP1_IN_callback |
Troels Nilsson |
76:eef92651f52f | 63 | /* Isochronous endpoint - not used, replaced by WebUSB endpoint */ |
Troels Nilsson |
76:eef92651f52f | 64 | /*#define EPISO_OUT (EP3OUT) |
va009039 | 57:b6b2296460db | 65 | #define EPISO_IN (EP3IN) |
va009039 | 57:b6b2296460db | 66 | #define EPISO_OUT_callback EP3_OUT_callback |
Troels Nilsson |
76:eef92651f52f | 67 | #define EPISO_IN_callback EP3_IN_callback*/ |
Troels Nilsson |
76:eef92651f52f | 68 | |
Troels Nilsson |
76:eef92651f52f | 69 | /* WebUSB endpoint (bulk) */ |
Troels Nilsson |
76:eef92651f52f | 70 | #define EPWEBUSB_OUT (EP3OUT) |
Troels Nilsson |
76:eef92651f52f | 71 | #define EPWEBUSB_IN (EP3IN) |
Troels Nilsson |
76:eef92651f52f | 72 | #define EPWEBUSB_OUT_callback EP3_OUT_callback |
Troels Nilsson |
76:eef92651f52f | 73 | #define EPWEBUSB_IN_callback EP3_IN_callback |
va009039 | 57:b6b2296460db | 74 | |
va009039 | 57:b6b2296460db | 75 | #define MAX_PACKET_SIZE_EPBULK (MAX_PACKET_SIZE_EP2) |
Troels Nilsson |
76:eef92651f52f | 76 | #define MAX_PACKET_SIZE_EPCDC (MAX_PACKET_SIZE_EP2) |
va009039 | 57:b6b2296460db | 77 | #define MAX_PACKET_SIZE_EPINT (MAX_PACKET_SIZE_EP1) |
va009039 | 57:b6b2296460db | 78 | #define MAX_PACKET_SIZE_EPISO (MAX_PACKET_SIZE_EP3_ISO) |
Troels Nilsson |
77:a98f786d05d4 | 79 | #define MAX_PACKET_SIZE_EPWEBUSB (MAX_PACKET_SIZE_EP3) |