USBDevice library with Blue Pill STM32F103C8T6 board support.

Dependents:   STM32F103C8T6_USBSerial_Demo lightweight-weather-station

Fork of USBDevice by mbed official

Committer:
Konstantin Kochin
Date:
Fri Aug 04 11:17:37 2017 +0300
Revision:
73:da92595e61da
Parent:
71:53949e6131f6
Added support of the BLUEPILL_F103C8 board

Added files of the BLUEPILL_F103C8 board, based on the
copy of the NUCLEO_F103RB

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 71:53949e6131f6 1 /*******************************************************************************
Kojto 71:53949e6131f6 2 * Copyright (C) 2015 Maxim Integrated Products, Inc., All Rights Reserved.
Kojto 71:53949e6131f6 3 *
Kojto 71:53949e6131f6 4 * Permission is hereby granted, free of charge, to any person obtaining a
Kojto 71:53949e6131f6 5 * copy of this software and associated documentation files (the "Software"),
Kojto 71:53949e6131f6 6 * to deal in the Software without restriction, including without limitation
Kojto 71:53949e6131f6 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Kojto 71:53949e6131f6 8 * and/or sell copies of the Software, and to permit persons to whom the
Kojto 71:53949e6131f6 9 * Software is furnished to do so, subject to the following conditions:
Kojto 71:53949e6131f6 10 *
Kojto 71:53949e6131f6 11 * The above copyright notice and this permission notice shall be included
Kojto 71:53949e6131f6 12 * in all copies or substantial portions of the Software.
Kojto 71:53949e6131f6 13 *
Kojto 71:53949e6131f6 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Kojto 71:53949e6131f6 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Kojto 71:53949e6131f6 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Kojto 71:53949e6131f6 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
Kojto 71:53949e6131f6 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Kojto 71:53949e6131f6 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Kojto 71:53949e6131f6 20 * OTHER DEALINGS IN THE SOFTWARE.
Kojto 71:53949e6131f6 21 *
Kojto 71:53949e6131f6 22 * Except as contained in this notice, the name of Maxim Integrated
Kojto 71:53949e6131f6 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
Kojto 71:53949e6131f6 24 * Products, Inc. Branding Policy.
Kojto 71:53949e6131f6 25 *
Kojto 71:53949e6131f6 26 * The mere transfer of this software does not imply any licenses
Kojto 71:53949e6131f6 27 * of trade secrets, proprietary technology, copyrights, patents,
Kojto 71:53949e6131f6 28 * trademarks, maskwork rights, or any other form of intellectual
Kojto 71:53949e6131f6 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
Kojto 71:53949e6131f6 30 * ownership rights.
Kojto 71:53949e6131f6 31 *******************************************************************************
Kojto 71:53949e6131f6 32 */
Kojto 71:53949e6131f6 33
Kojto 71:53949e6131f6 34 #define NUMBER_OF_LOGICAL_ENDPOINTS (8)
Kojto 71:53949e6131f6 35 #define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS * 2)
Kojto 71:53949e6131f6 36
Kojto 71:53949e6131f6 37 #define DIR_OUT 0x00
Kojto 71:53949e6131f6 38 #define DIR_IN 0x01
Kojto 71:53949e6131f6 39 #define EP_NUM(ep) (ep >> 1)
Kojto 71:53949e6131f6 40 #define IN_EP(ep) (ep & DIR_IN)
Kojto 71:53949e6131f6 41 #define OUT_EP(ep) (!(ep & DIR_IN))
Kojto 71:53949e6131f6 42
Kojto 71:53949e6131f6 43 /* Define physical endpoint numbers */
Kojto 71:53949e6131f6 44
Kojto 71:53949e6131f6 45 /* Endpoint No. */
Kojto 71:53949e6131f6 46 /* ---------------- */
Kojto 71:53949e6131f6 47 #define EP0OUT ((0 << 1) | DIR_OUT)
Kojto 71:53949e6131f6 48 #define EP0IN ((0 << 1) | DIR_IN)
Kojto 71:53949e6131f6 49 #define EP1OUT ((1 << 1) | DIR_OUT)
Kojto 71:53949e6131f6 50 #define EP1IN ((1 << 1) | DIR_IN)
Kojto 71:53949e6131f6 51 #define EP2OUT ((2 << 1) | DIR_OUT)
Kojto 71:53949e6131f6 52 #define EP2IN ((2 << 1) | DIR_IN)
Kojto 71:53949e6131f6 53 #define EP3OUT ((3 << 1) | DIR_OUT)
Kojto 71:53949e6131f6 54 #define EP3IN ((3 << 1) | DIR_IN)
Kojto 71:53949e6131f6 55 #define EP4OUT ((4 << 1) | DIR_OUT)
Kojto 71:53949e6131f6 56 #define EP4IN ((4 << 1) | DIR_IN)
Kojto 71:53949e6131f6 57 #define EP5OUT ((5 << 1) | DIR_OUT)
Kojto 71:53949e6131f6 58 #define EP5IN ((5 << 1) | DIR_IN)
Kojto 71:53949e6131f6 59 #define EP6OUT ((6 << 1) | DIR_OUT)
Kojto 71:53949e6131f6 60 #define EP6IN ((6 << 1) | DIR_IN)
Kojto 71:53949e6131f6 61 #define EP7OUT ((7 << 1) | DIR_OUT)
Kojto 71:53949e6131f6 62 #define EP7IN ((7 << 1) | DIR_IN)
Kojto 71:53949e6131f6 63
Kojto 71:53949e6131f6 64 /* Maximum Packet sizes */
Kojto 71:53949e6131f6 65
Kojto 71:53949e6131f6 66 #define MAX_PACKET_SIZE_EP0 (64)
Kojto 71:53949e6131f6 67 #define MAX_PACKET_SIZE_EP1 (64)
Kojto 71:53949e6131f6 68 #define MAX_PACKET_SIZE_EP2 (64)
Kojto 71:53949e6131f6 69 #define MAX_PACKET_SIZE_EP3 (64)
Kojto 71:53949e6131f6 70 #define MAX_PACKET_SIZE_EP4 (64)
Kojto 71:53949e6131f6 71 #define MAX_PACKET_SIZE_EP5 (64)
Kojto 71:53949e6131f6 72 #define MAX_PACKET_SIZE_EP6 (64)
Kojto 71:53949e6131f6 73 #define MAX_PACKET_SIZE_EP7 (64)
Kojto 71:53949e6131f6 74
Kojto 71:53949e6131f6 75 /* Generic endpoints - intended to be portable accross devices */
Kojto 71:53949e6131f6 76 /* and be suitable for simple USB devices. */
Kojto 71:53949e6131f6 77
Kojto 71:53949e6131f6 78 /* Bulk endpoints */
Kojto 71:53949e6131f6 79 #define EPBULK_OUT (EP1OUT)
Kojto 71:53949e6131f6 80 #define EPBULK_IN (EP2IN)
Kojto 71:53949e6131f6 81 #define EPBULK_OUT_callback EP1_OUT_callback
Kojto 71:53949e6131f6 82 #define EPBULK_IN_callback EP2_IN_callback
Kojto 71:53949e6131f6 83 /* Interrupt endpoints */
Kojto 71:53949e6131f6 84 #define EPINT_OUT (EP3OUT)
Kojto 71:53949e6131f6 85 #define EPINT_IN (EP4IN)
Kojto 71:53949e6131f6 86 #define EPINT_OUT_callback EP3_OUT_callback
Kojto 71:53949e6131f6 87 #define EPINT_IN_callback EP4_IN_callback
Kojto 71:53949e6131f6 88 /* Isochronous endpoints */
Kojto 71:53949e6131f6 89 /* NOT SUPPORTED - use invalid endpoint number to prevent built errors */
Kojto 71:53949e6131f6 90 #define EPISO_OUT (EP0OUT)
Kojto 71:53949e6131f6 91 #define EPISO_IN (EP0IN)
Kojto 71:53949e6131f6 92
Kojto 71:53949e6131f6 93 #define MAX_PACKET_SIZE_EPBULK (64)
Kojto 71:53949e6131f6 94 #define MAX_PACKET_SIZE_EPINT (64)