SD card interface

Committer:
lharoon
Date:
Mon Oct 08 11:14:07 2012 +0000
Revision:
0:22612ae617a0
1st edition

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lharoon 0:22612ae617a0 1 /* mbed Microcontroller Library - PinNames
lharoon 0:22612ae617a0 2 * Copyright (C) 2008-2011 ARM Limited. All rights reserved.
lharoon 0:22612ae617a0 3 *
lharoon 0:22612ae617a0 4 * Provides the mapping of mbed DIP and LPC Pin Names
lharoon 0:22612ae617a0 5 */
lharoon 0:22612ae617a0 6
lharoon 0:22612ae617a0 7 #ifndef MBED_PINNAMES_H
lharoon 0:22612ae617a0 8 #define MBED_PINNAMES_H
lharoon 0:22612ae617a0 9
lharoon 0:22612ae617a0 10 #include "cmsis.h"
lharoon 0:22612ae617a0 11
lharoon 0:22612ae617a0 12 #ifdef __cplusplus
lharoon 0:22612ae617a0 13 extern "C" {
lharoon 0:22612ae617a0 14 #endif
lharoon 0:22612ae617a0 15
lharoon 0:22612ae617a0 16 #if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
lharoon 0:22612ae617a0 17
lharoon 0:22612ae617a0 18 enum PinName {
lharoon 0:22612ae617a0 19
lharoon 0:22612ae617a0 20 // LPC Pin Names
lharoon 0:22612ae617a0 21 P0_0 = LPC_GPIO0_BASE, P0_1, P0_2, P0_3, P0_4, P0_5, P0_6, P0_7
lharoon 0:22612ae617a0 22 , P0_8, P0_9, P0_10, P0_11, P0_12, P0_13, P0_14, P0_15
lharoon 0:22612ae617a0 23 , P0_16, P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23
lharoon 0:22612ae617a0 24 , P0_24, P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, P0_31
lharoon 0:22612ae617a0 25 , P1_0, P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7
lharoon 0:22612ae617a0 26 , P1_8, P1_9, P1_10, P1_11, P1_12, P1_13, P1_14, P1_15
lharoon 0:22612ae617a0 27 , P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23
lharoon 0:22612ae617a0 28 , P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31
lharoon 0:22612ae617a0 29 , P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7
lharoon 0:22612ae617a0 30 , P2_8, P2_9, P2_10, P2_11, P2_12, P2_13, P2_14, P2_15
lharoon 0:22612ae617a0 31 , P2_16, P2_17, P2_18, P2_19, P2_20, P2_21, P2_22, P2_23
lharoon 0:22612ae617a0 32 , P2_24, P2_25, P2_26, P2_27, P2_28, P2_29, P2_30, P2_31
lharoon 0:22612ae617a0 33 , P3_0, P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7
lharoon 0:22612ae617a0 34 , P3_8, P3_9, P3_10, P3_11, P3_12, P3_13, P3_14, P3_15
lharoon 0:22612ae617a0 35 , P3_16, P3_17, P3_18, P3_19, P3_20, P3_21, P3_22, P3_23
lharoon 0:22612ae617a0 36 , P3_24, P3_25, P3_26, P3_27, P3_28, P3_29, P3_30, P3_31
lharoon 0:22612ae617a0 37 , P4_0, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7
lharoon 0:22612ae617a0 38 , P4_8, P4_9, P4_10, P4_11, P4_12, P4_13, P4_14, P4_15
lharoon 0:22612ae617a0 39 , P4_16, P4_17, P4_18, P4_19, P4_20, P4_21, P4_22, P4_23
lharoon 0:22612ae617a0 40 , P4_24, P4_25, P4_26, P4_27, P4_28, P4_29, P4_30, P4_31
lharoon 0:22612ae617a0 41
lharoon 0:22612ae617a0 42 // mbed DIP Pin Names
lharoon 0:22612ae617a0 43 , p5 = P0_9
lharoon 0:22612ae617a0 44 , p6 = P0_8
lharoon 0:22612ae617a0 45 , p7 = P0_7
lharoon 0:22612ae617a0 46 , p8 = P0_6
lharoon 0:22612ae617a0 47 , p9 = P0_0
lharoon 0:22612ae617a0 48 , p10 = P0_1
lharoon 0:22612ae617a0 49 , p11 = P0_18
lharoon 0:22612ae617a0 50 , p12 = P0_17
lharoon 0:22612ae617a0 51 , p13 = P0_15
lharoon 0:22612ae617a0 52 , p14 = P0_16
lharoon 0:22612ae617a0 53 , p15 = P0_23
lharoon 0:22612ae617a0 54 , p16 = P0_24
lharoon 0:22612ae617a0 55 , p17 = P0_25
lharoon 0:22612ae617a0 56 , p18 = P0_26
lharoon 0:22612ae617a0 57 , p19 = P1_30
lharoon 0:22612ae617a0 58 , p20 = P1_31
lharoon 0:22612ae617a0 59 , p21 = P2_5
lharoon 0:22612ae617a0 60 , p22 = P2_4
lharoon 0:22612ae617a0 61 , p23 = P2_3
lharoon 0:22612ae617a0 62 , p24 = P2_2
lharoon 0:22612ae617a0 63 , p25 = P2_1
lharoon 0:22612ae617a0 64 , p26 = P2_0
lharoon 0:22612ae617a0 65 , p27 = P0_11
lharoon 0:22612ae617a0 66 , p28 = P0_10
lharoon 0:22612ae617a0 67 , p29 = P0_5
lharoon 0:22612ae617a0 68 , p30 = P0_4
lharoon 0:22612ae617a0 69
lharoon 0:22612ae617a0 70 // Other mbed Pin Names
lharoon 0:22612ae617a0 71 #ifdef MCB1700
lharoon 0:22612ae617a0 72 , LED1 = P1_28
lharoon 0:22612ae617a0 73 , LED2 = P1_29
lharoon 0:22612ae617a0 74 , LED3 = P1_31
lharoon 0:22612ae617a0 75 , LED4 = P2_2
lharoon 0:22612ae617a0 76 #else
lharoon 0:22612ae617a0 77 , LED1 = P1_18
lharoon 0:22612ae617a0 78 , LED2 = P1_20
lharoon 0:22612ae617a0 79 , LED3 = P1_21
lharoon 0:22612ae617a0 80 , LED4 = P1_23
lharoon 0:22612ae617a0 81 #endif
lharoon 0:22612ae617a0 82 , USBTX = P0_2
lharoon 0:22612ae617a0 83 , USBRX = P0_3
lharoon 0:22612ae617a0 84
lharoon 0:22612ae617a0 85 // Not connected
lharoon 0:22612ae617a0 86 , NC = (int)0xFFFFFFFF
lharoon 0:22612ae617a0 87
lharoon 0:22612ae617a0 88 };
lharoon 0:22612ae617a0 89 typedef enum PinName PinName;
lharoon 0:22612ae617a0 90
lharoon 0:22612ae617a0 91 enum PinMode {
lharoon 0:22612ae617a0 92 PullUp = 0
lharoon 0:22612ae617a0 93 , PullDown = 3
lharoon 0:22612ae617a0 94 , PullNone = 2
lharoon 0:22612ae617a0 95 , OpenDrain = 4
lharoon 0:22612ae617a0 96 };
lharoon 0:22612ae617a0 97 typedef enum PinMode PinMode;
lharoon 0:22612ae617a0 98
lharoon 0:22612ae617a0 99 // version of PINCON_TypeDef using register arrays
lharoon 0:22612ae617a0 100 typedef struct {
lharoon 0:22612ae617a0 101 __IO uint32_t PINSEL[11];
lharoon 0:22612ae617a0 102 uint32_t RESERVED0[5];
lharoon 0:22612ae617a0 103 __IO uint32_t PINMODE[10];
lharoon 0:22612ae617a0 104 #ifndef TARGET_LPC2368
lharoon 0:22612ae617a0 105 // Open drain mode is not available on LPC2368
lharoon 0:22612ae617a0 106 __IO uint32_t PINMODE_OD[5];
lharoon 0:22612ae617a0 107 #endif
lharoon 0:22612ae617a0 108 } PINCONARRAY_TypeDef;
lharoon 0:22612ae617a0 109
lharoon 0:22612ae617a0 110 #define PINCONARRAY ((PINCONARRAY_TypeDef *)LPC_PINCON_BASE)
lharoon 0:22612ae617a0 111
lharoon 0:22612ae617a0 112
lharoon 0:22612ae617a0 113 #elif defined(TARGET_LPC11U24)
lharoon 0:22612ae617a0 114
lharoon 0:22612ae617a0 115 enum PinName {
lharoon 0:22612ae617a0 116
lharoon 0:22612ae617a0 117 // LPC11U Pin Names
lharoon 0:22612ae617a0 118 P0_0 = 0
lharoon 0:22612ae617a0 119 , P0_1 = 1
lharoon 0:22612ae617a0 120 , P0_2 = 2
lharoon 0:22612ae617a0 121 , P0_3 = 3
lharoon 0:22612ae617a0 122 , P0_4 = 4
lharoon 0:22612ae617a0 123 , P0_5 = 5
lharoon 0:22612ae617a0 124 , P0_6 = 6
lharoon 0:22612ae617a0 125 , P0_7 = 7
lharoon 0:22612ae617a0 126 , P0_8 = 8
lharoon 0:22612ae617a0 127 , P0_9 = 9
lharoon 0:22612ae617a0 128 , P0_10 = 10
lharoon 0:22612ae617a0 129 , P0_11 = 11
lharoon 0:22612ae617a0 130 , P0_12 = 12
lharoon 0:22612ae617a0 131 , P0_13 = 13
lharoon 0:22612ae617a0 132 , P0_14 = 14
lharoon 0:22612ae617a0 133 , P0_15 = 15
lharoon 0:22612ae617a0 134 , P0_16 = 16
lharoon 0:22612ae617a0 135 , P0_17 = 17
lharoon 0:22612ae617a0 136 , P0_18 = 18
lharoon 0:22612ae617a0 137 , P0_19 = 19
lharoon 0:22612ae617a0 138 , P0_20 = 20
lharoon 0:22612ae617a0 139 , P0_21 = 21
lharoon 0:22612ae617a0 140 , P0_22 = 22
lharoon 0:22612ae617a0 141 , P0_23 = 23
lharoon 0:22612ae617a0 142 , P0_24 = 24
lharoon 0:22612ae617a0 143 , P0_25 = 25
lharoon 0:22612ae617a0 144 , P0_26 = 26
lharoon 0:22612ae617a0 145 , P0_27 = 27
lharoon 0:22612ae617a0 146
lharoon 0:22612ae617a0 147 , P1_0 = 32
lharoon 0:22612ae617a0 148 , P1_1 = 33
lharoon 0:22612ae617a0 149 , P1_2 = 34
lharoon 0:22612ae617a0 150 , P1_3 = 35
lharoon 0:22612ae617a0 151 , P1_4 = 36
lharoon 0:22612ae617a0 152 , P1_5 = 37
lharoon 0:22612ae617a0 153 , P1_6 = 38
lharoon 0:22612ae617a0 154 , P1_7 = 39
lharoon 0:22612ae617a0 155 , P1_8 = 40
lharoon 0:22612ae617a0 156 , P1_9 = 41
lharoon 0:22612ae617a0 157 , P1_10 = 42
lharoon 0:22612ae617a0 158 , P1_11 = 43
lharoon 0:22612ae617a0 159 , P1_12 = 44
lharoon 0:22612ae617a0 160 , P1_13 = 45
lharoon 0:22612ae617a0 161 , P1_14 = 46
lharoon 0:22612ae617a0 162 , P1_15 = 47
lharoon 0:22612ae617a0 163 , P1_16 = 48
lharoon 0:22612ae617a0 164 , P1_17 = 49
lharoon 0:22612ae617a0 165 , P1_18 = 50
lharoon 0:22612ae617a0 166 , P1_19 = 51
lharoon 0:22612ae617a0 167 , P1_20 = 52
lharoon 0:22612ae617a0 168 , P1_21 = 53
lharoon 0:22612ae617a0 169 , P1_22 = 54
lharoon 0:22612ae617a0 170 , P1_23 = 55
lharoon 0:22612ae617a0 171 , P1_24 = 56
lharoon 0:22612ae617a0 172 , P1_25 = 57
lharoon 0:22612ae617a0 173 , P1_26 = 58
lharoon 0:22612ae617a0 174 , P1_27 = 59
lharoon 0:22612ae617a0 175 , P1_28 = 60
lharoon 0:22612ae617a0 176 , P1_29 = 61
lharoon 0:22612ae617a0 177
lharoon 0:22612ae617a0 178 , P1_31 = 63
lharoon 0:22612ae617a0 179
lharoon 0:22612ae617a0 180 // mbed DIP Pin Names
lharoon 0:22612ae617a0 181 , p5 = P0_9
lharoon 0:22612ae617a0 182 , p6 = P0_8
lharoon 0:22612ae617a0 183 , p7 = P1_29
lharoon 0:22612ae617a0 184 , p8 = P0_2
lharoon 0:22612ae617a0 185 , p9 = P1_27
lharoon 0:22612ae617a0 186 , p10 = P1_26
lharoon 0:22612ae617a0 187 , p11 = P1_22
lharoon 0:22612ae617a0 188 , p12 = P1_21
lharoon 0:22612ae617a0 189 , p13 = P1_20
lharoon 0:22612ae617a0 190 , p14 = P1_23
lharoon 0:22612ae617a0 191 , p15 = P0_11
lharoon 0:22612ae617a0 192 , p16 = P0_12
lharoon 0:22612ae617a0 193 , p17 = P0_13
lharoon 0:22612ae617a0 194 , p18 = P0_14
lharoon 0:22612ae617a0 195 , p19 = P0_16
lharoon 0:22612ae617a0 196 , p20 = P0_22
lharoon 0:22612ae617a0 197 , p21 = P0_7
lharoon 0:22612ae617a0 198 , p22 = P0_17
lharoon 0:22612ae617a0 199 , p23 = P1_17
lharoon 0:22612ae617a0 200 , p24 = P1_18
lharoon 0:22612ae617a0 201 , p25 = P1_24
lharoon 0:22612ae617a0 202 , p26 = P1_25
lharoon 0:22612ae617a0 203 , p27 = P0_4
lharoon 0:22612ae617a0 204 , p28 = P0_5
lharoon 0:22612ae617a0 205 , p29 = P1_5
lharoon 0:22612ae617a0 206 , p30 = P1_2
lharoon 0:22612ae617a0 207
lharoon 0:22612ae617a0 208 , p33 = P0_3
lharoon 0:22612ae617a0 209 , p34 = P1_15
lharoon 0:22612ae617a0 210 , p35 = P0_20
lharoon 0:22612ae617a0 211 , p36 = P0_21
lharoon 0:22612ae617a0 212
lharoon 0:22612ae617a0 213 // Other mbed Pin Names
lharoon 0:22612ae617a0 214 , LED1 = P1_8
lharoon 0:22612ae617a0 215 , LED2 = P1_9
lharoon 0:22612ae617a0 216 , LED3 = P1_10
lharoon 0:22612ae617a0 217 , LED4 = P1_11
lharoon 0:22612ae617a0 218
lharoon 0:22612ae617a0 219 , USBTX = P0_19
lharoon 0:22612ae617a0 220 , USBRX = P0_18
lharoon 0:22612ae617a0 221
lharoon 0:22612ae617a0 222 // Not connected
lharoon 0:22612ae617a0 223 , NC = (int)0xFFFFFFFF
lharoon 0:22612ae617a0 224
lharoon 0:22612ae617a0 225 };
lharoon 0:22612ae617a0 226 typedef enum PinName PinName;
lharoon 0:22612ae617a0 227
lharoon 0:22612ae617a0 228 typedef enum {
lharoon 0:22612ae617a0 229 CHANNEL0=FLEX_INT0_IRQn,
lharoon 0:22612ae617a0 230 CHANNEL1=FLEX_INT1_IRQn,
lharoon 0:22612ae617a0 231 CHANNEL2=FLEX_INT2_IRQn,
lharoon 0:22612ae617a0 232 CHANNEL3=FLEX_INT3_IRQn,
lharoon 0:22612ae617a0 233 CHANNEL4=FLEX_INT4_IRQn,
lharoon 0:22612ae617a0 234 CHANNEL5=FLEX_INT5_IRQn,
lharoon 0:22612ae617a0 235 CHANNEL6=FLEX_INT6_IRQn,
lharoon 0:22612ae617a0 236 CHANNEL7=FLEX_INT7_IRQn
lharoon 0:22612ae617a0 237 } Channel;
lharoon 0:22612ae617a0 238
lharoon 0:22612ae617a0 239 enum PinMode {
lharoon 0:22612ae617a0 240 PullUp = 2
lharoon 0:22612ae617a0 241 , PullDown = 1
lharoon 0:22612ae617a0 242 , PullNone = 0
lharoon 0:22612ae617a0 243 , Repeater = 3
lharoon 0:22612ae617a0 244 , OpenDrain = 4
lharoon 0:22612ae617a0 245 };
lharoon 0:22612ae617a0 246 typedef enum PinMode PinMode;
lharoon 0:22612ae617a0 247 #endif
lharoon 0:22612ae617a0 248
lharoon 0:22612ae617a0 249
lharoon 0:22612ae617a0 250 #ifdef __cplusplus
lharoon 0:22612ae617a0 251 }
lharoon 0:22612ae617a0 252 #endif
lharoon 0:22612ae617a0 253
lharoon 0:22612ae617a0 254 #endif