- fix F411 F334 systeminit when HSI used - portinout always read IDR regardless of port direction

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Tue Apr 08 09:15:06 2014 +0100
Revision:
155:8435094ec241
Synchronized with git revision d616c415fc62f490b915ff0ff39c8d24b2917c0f

Full URL: https://github.com/mbedmicro/mbed/commit/d616c415fc62f490b915ff0ff39c8d24b2917c0f/

[STM32F3XX] Initial port

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 155:8435094ec241 1 /* mbed Microcontroller Library
mbed_official 155:8435094ec241 2 *******************************************************************************
mbed_official 155:8435094ec241 3 * Copyright (c) 2014, STMicroelectronics
mbed_official 155:8435094ec241 4 * All rights reserved.
mbed_official 155:8435094ec241 5 *
mbed_official 155:8435094ec241 6 * Redistribution and use in source and binary forms, with or without
mbed_official 155:8435094ec241 7 * modification, are permitted provided that the following conditions are met:
mbed_official 155:8435094ec241 8 *
mbed_official 155:8435094ec241 9 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 155:8435094ec241 10 * this list of conditions and the following disclaimer.
mbed_official 155:8435094ec241 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 155:8435094ec241 12 * this list of conditions and the following disclaimer in the documentation
mbed_official 155:8435094ec241 13 * and/or other materials provided with the distribution.
mbed_official 155:8435094ec241 14 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 155:8435094ec241 15 * may be used to endorse or promote products derived from this software
mbed_official 155:8435094ec241 16 * without specific prior written permission.
mbed_official 155:8435094ec241 17 *
mbed_official 155:8435094ec241 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 155:8435094ec241 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 155:8435094ec241 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 155:8435094ec241 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 155:8435094ec241 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 155:8435094ec241 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 155:8435094ec241 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 155:8435094ec241 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 155:8435094ec241 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 155:8435094ec241 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 155:8435094ec241 28 *******************************************************************************
mbed_official 155:8435094ec241 29 */
mbed_official 155:8435094ec241 30 #ifndef MBED_PINNAMES_H
mbed_official 155:8435094ec241 31 #define MBED_PINNAMES_H
mbed_official 155:8435094ec241 32
mbed_official 155:8435094ec241 33 #include "cmsis.h"
mbed_official 155:8435094ec241 34
mbed_official 155:8435094ec241 35 #ifdef __cplusplus
mbed_official 155:8435094ec241 36 extern "C" {
mbed_official 155:8435094ec241 37 #endif
mbed_official 155:8435094ec241 38
mbed_official 155:8435094ec241 39 // MODE (see GPIOMode_TypeDef structure)
mbed_official 155:8435094ec241 40 // OTYPE (see GPIOOType_TypeDef structure)
mbed_official 155:8435094ec241 41 // PUPD (see GPIOPuPd_TypeDef structure)
mbed_official 155:8435094ec241 42 // AFNUM (see AF_mapping constant table, 0xFF is not used)
mbed_official 155:8435094ec241 43 #define STM_PIN_DATA(MODE, OTYPE, PUPD, AFNUM) (((AFNUM)<<8)|((PUPD)<<4)|((OTYPE)<<2)|((MODE)<<0))
mbed_official 155:8435094ec241 44 #define STM_PIN_MODE(X) (((X)>>0) & 0x3)
mbed_official 155:8435094ec241 45 #define STM_PIN_OTYPE(X) (((X)>>2) & 0x1)
mbed_official 155:8435094ec241 46 #define STM_PIN_PUPD(X) (((X)>>4) & 0x3)
mbed_official 155:8435094ec241 47 #define STM_PIN_AFNUM(X) (((X)>>8) & 0xF)
mbed_official 155:8435094ec241 48
mbed_official 155:8435094ec241 49 // High nibble = port number (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, 6=G, 7=H)
mbed_official 155:8435094ec241 50 // Low nibble = pin number
mbed_official 155:8435094ec241 51 #define STM_PORT(X) (((uint32_t)(X) >> 4) & 0xF)
mbed_official 155:8435094ec241 52 #define STM_PIN(X) ((uint32_t)(X) & 0xF)
mbed_official 155:8435094ec241 53
mbed_official 155:8435094ec241 54 typedef enum {
mbed_official 155:8435094ec241 55 PIN_INPUT,
mbed_official 155:8435094ec241 56 PIN_OUTPUT
mbed_official 155:8435094ec241 57 } PinDirection;
mbed_official 155:8435094ec241 58
mbed_official 155:8435094ec241 59 typedef enum {
mbed_official 155:8435094ec241 60 PA_0 = 0x00,
mbed_official 155:8435094ec241 61 PA_1 = 0x01,
mbed_official 155:8435094ec241 62 PA_2 = 0x02,
mbed_official 155:8435094ec241 63 PA_3 = 0x03,
mbed_official 155:8435094ec241 64 PA_4 = 0x04,
mbed_official 155:8435094ec241 65 PA_5 = 0x05,
mbed_official 155:8435094ec241 66 PA_6 = 0x06,
mbed_official 155:8435094ec241 67 PA_7 = 0x07,
mbed_official 155:8435094ec241 68 PA_8 = 0x08,
mbed_official 155:8435094ec241 69 PA_9 = 0x09,
mbed_official 155:8435094ec241 70 PA_10 = 0x0A,
mbed_official 155:8435094ec241 71 PA_11 = 0x0B,
mbed_official 155:8435094ec241 72 PA_12 = 0x0C,
mbed_official 155:8435094ec241 73 PA_13 = 0x0D,
mbed_official 155:8435094ec241 74 PA_14 = 0x0E,
mbed_official 155:8435094ec241 75 PA_15 = 0x0F,
mbed_official 155:8435094ec241 76
mbed_official 155:8435094ec241 77 PB_0 = 0x10,
mbed_official 155:8435094ec241 78 PB_1 = 0x11,
mbed_official 155:8435094ec241 79 PB_2 = 0x12,
mbed_official 155:8435094ec241 80 PB_3 = 0x13,
mbed_official 155:8435094ec241 81 PB_4 = 0x14,
mbed_official 155:8435094ec241 82 PB_5 = 0x15,
mbed_official 155:8435094ec241 83 PB_6 = 0x16,
mbed_official 155:8435094ec241 84 PB_7 = 0x17,
mbed_official 155:8435094ec241 85 PB_8 = 0x18,
mbed_official 155:8435094ec241 86 PB_9 = 0x19,
mbed_official 155:8435094ec241 87 PB_10 = 0x1A,
mbed_official 155:8435094ec241 88 PB_11 = 0x1B,
mbed_official 155:8435094ec241 89 PB_12 = 0x1C,
mbed_official 155:8435094ec241 90 PB_13 = 0x1D,
mbed_official 155:8435094ec241 91 PB_14 = 0x1E,
mbed_official 155:8435094ec241 92 PB_15 = 0x1F,
mbed_official 155:8435094ec241 93
mbed_official 155:8435094ec241 94 PC_0 = 0x20,
mbed_official 155:8435094ec241 95 PC_1 = 0x21,
mbed_official 155:8435094ec241 96 PC_2 = 0x22,
mbed_official 155:8435094ec241 97 PC_3 = 0x23,
mbed_official 155:8435094ec241 98 PC_4 = 0x24,
mbed_official 155:8435094ec241 99 PC_5 = 0x25,
mbed_official 155:8435094ec241 100 PC_6 = 0x26,
mbed_official 155:8435094ec241 101 PC_7 = 0x27,
mbed_official 155:8435094ec241 102 PC_8 = 0x28,
mbed_official 155:8435094ec241 103 PC_9 = 0x29,
mbed_official 155:8435094ec241 104 PC_10 = 0x2A,
mbed_official 155:8435094ec241 105 PC_11 = 0x2B,
mbed_official 155:8435094ec241 106 PC_12 = 0x2C,
mbed_official 155:8435094ec241 107 PC_13 = 0x2D,
mbed_official 155:8435094ec241 108 PC_14 = 0x2E,
mbed_official 155:8435094ec241 109 PC_15 = 0x2F,
mbed_official 155:8435094ec241 110
mbed_official 155:8435094ec241 111 PD_0 = 0x30,
mbed_official 155:8435094ec241 112 PD_1 = 0x31,
mbed_official 155:8435094ec241 113 PD_2 = 0x32,
mbed_official 155:8435094ec241 114 PD_3 = 0x33,
mbed_official 155:8435094ec241 115 PD_4 = 0x34,
mbed_official 155:8435094ec241 116 PD_5 = 0x35,
mbed_official 155:8435094ec241 117 PD_6 = 0x36,
mbed_official 155:8435094ec241 118 PD_7 = 0x37,
mbed_official 155:8435094ec241 119 PD_8 = 0x38,
mbed_official 155:8435094ec241 120 PD_9 = 0x39,
mbed_official 155:8435094ec241 121 PD_10 = 0x3A,
mbed_official 155:8435094ec241 122 PD_11 = 0x3B,
mbed_official 155:8435094ec241 123 PD_12 = 0x3C,
mbed_official 155:8435094ec241 124 PD_13 = 0x3D,
mbed_official 155:8435094ec241 125 PD_14 = 0x3E,
mbed_official 155:8435094ec241 126 PD_15 = 0x3F,
mbed_official 155:8435094ec241 127
mbed_official 155:8435094ec241 128 PE_0 = 0x40,
mbed_official 155:8435094ec241 129 PE_1 = 0x41,
mbed_official 155:8435094ec241 130 PE_2 = 0x42,
mbed_official 155:8435094ec241 131 PE_3 = 0x43,
mbed_official 155:8435094ec241 132 PE_4 = 0x44,
mbed_official 155:8435094ec241 133 PE_5 = 0x45,
mbed_official 155:8435094ec241 134 PE_6 = 0x46,
mbed_official 155:8435094ec241 135 PE_7 = 0x47,
mbed_official 155:8435094ec241 136 PE_8 = 0x48,
mbed_official 155:8435094ec241 137 PE_9 = 0x49,
mbed_official 155:8435094ec241 138 PE_10 = 0x4A,
mbed_official 155:8435094ec241 139 PE_11 = 0x4B,
mbed_official 155:8435094ec241 140 PE_12 = 0x4C,
mbed_official 155:8435094ec241 141 PE_13 = 0x4D,
mbed_official 155:8435094ec241 142 PE_14 = 0x4E,
mbed_official 155:8435094ec241 143 PE_15 = 0x4F,
mbed_official 155:8435094ec241 144
mbed_official 155:8435094ec241 145 PF_0 = 0x50,
mbed_official 155:8435094ec241 146 PF_1 = 0x51,
mbed_official 155:8435094ec241 147 PF_2 = 0x52,
mbed_official 155:8435094ec241 148 PF_3 = 0x53,
mbed_official 155:8435094ec241 149 PF_4 = 0x54,
mbed_official 155:8435094ec241 150 PF_5 = 0x55,
mbed_official 155:8435094ec241 151 PF_6 = 0x56,
mbed_official 155:8435094ec241 152 PF_7 = 0x57,
mbed_official 155:8435094ec241 153 PF_8 = 0x58,
mbed_official 155:8435094ec241 154 PF_9 = 0x59,
mbed_official 155:8435094ec241 155 PF_10 = 0x5A,
mbed_official 155:8435094ec241 156 PF_11 = 0x5B,
mbed_official 155:8435094ec241 157 PF_12 = 0x5C,
mbed_official 155:8435094ec241 158 PF_13 = 0x5D,
mbed_official 155:8435094ec241 159 PF_14 = 0x5E,
mbed_official 155:8435094ec241 160 PF_15 = 0x5F,
mbed_official 155:8435094ec241 161
mbed_official 155:8435094ec241 162 LED1 = PE_9,
mbed_official 155:8435094ec241 163
mbed_official 155:8435094ec241 164 // Not connected
mbed_official 155:8435094ec241 165 NC = (int)0xFFFFFFFF
mbed_official 155:8435094ec241 166 } PinName;
mbed_official 155:8435094ec241 167
mbed_official 155:8435094ec241 168 typedef enum {
mbed_official 155:8435094ec241 169 PullNone = 0,
mbed_official 155:8435094ec241 170 PullUp = 1,
mbed_official 155:8435094ec241 171 PullDown = 2,
mbed_official 155:8435094ec241 172 OpenDrain = 3,
mbed_official 155:8435094ec241 173 PullDefault = PullNone
mbed_official 155:8435094ec241 174 } PinMode;
mbed_official 155:8435094ec241 175
mbed_official 155:8435094ec241 176 #ifdef __cplusplus
mbed_official 155:8435094ec241 177 }
mbed_official 155:8435094ec241 178 #endif
mbed_official 155:8435094ec241 179
mbed_official 155:8435094ec241 180 #endif