mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Wed Jun 03 09:00:09 2015 +0100
Revision:
558:0880f51c4036
Child:
567:a97fd0eca828
Synchronized with git revision 927c31ab8457cfef0ee8a8316117b7a41fd79133

Full URL: https://github.com/mbedmicro/mbed/commit/927c31ab8457cfef0ee8a8316117b7a41fd79133/

Add WIZwiki-W7500

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 558:0880f51c4036 1 /* mbed Microcontroller Library
mbed_official 558:0880f51c4036 2 *******************************************************************************
mbed_official 558:0880f51c4036 3 * Copyright (c) 2015 WIZnet Co.,Ltd. All rights reserved.
mbed_official 558:0880f51c4036 4 * All rights reserved.
mbed_official 558:0880f51c4036 5 *
mbed_official 558:0880f51c4036 6 * Redistribution and use in source and binary forms, with or without
mbed_official 558:0880f51c4036 7 * modification, are permitted provided that the following conditions are met:
mbed_official 558:0880f51c4036 8 *
mbed_official 558:0880f51c4036 9 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 558:0880f51c4036 10 * this list of conditions and the following disclaimer.
mbed_official 558:0880f51c4036 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 558:0880f51c4036 12 * this list of conditions and the following disclaimer in the documentation
mbed_official 558:0880f51c4036 13 * and/or other materials provided with the distribution.
mbed_official 558:0880f51c4036 14 * 3. Neither the name of ARM Limited nor the names of its contributors
mbed_official 558:0880f51c4036 15 * may be used to endorse or promote products derived from this software
mbed_official 558:0880f51c4036 16 * without specific prior written permission.
mbed_official 558:0880f51c4036 17 *
mbed_official 558:0880f51c4036 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 558:0880f51c4036 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 558:0880f51c4036 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 558:0880f51c4036 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 558:0880f51c4036 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 558:0880f51c4036 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 558:0880f51c4036 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 558:0880f51c4036 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 558:0880f51c4036 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 558:0880f51c4036 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 558:0880f51c4036 28 *******************************************************************************
mbed_official 558:0880f51c4036 29 */
mbed_official 558:0880f51c4036 30
mbed_official 558:0880f51c4036 31 #ifndef MBED_PINNAMES_H
mbed_official 558:0880f51c4036 32 #define MBED_PINNAMES_H
mbed_official 558:0880f51c4036 33
mbed_official 558:0880f51c4036 34 #include "cmsis.h"
mbed_official 558:0880f51c4036 35
mbed_official 558:0880f51c4036 36 #ifdef __cplusplus
mbed_official 558:0880f51c4036 37 extern "C" {
mbed_official 558:0880f51c4036 38 #endif
mbed_official 558:0880f51c4036 39
mbed_official 558:0880f51c4036 40
mbed_official 558:0880f51c4036 41 // See W7500x_hal_gpio.h for values of MODE, PUPD and AFNUM
mbed_official 558:0880f51c4036 42 #define WIZ_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM) << 8) | ((PUPD) << 4) | ((MODE) << 0)))
mbed_official 558:0880f51c4036 43 #define WIZ_PIN_MODE(X) (((X) >> 0) & 0x0F)
mbed_official 558:0880f51c4036 44 #define WIZ_PIN_PUPD(X) (((X) >> 4) & 0x0F)
mbed_official 558:0880f51c4036 45 #define WIZ_PIN_AFNUM(X) (((X) >> 8) & 0x0F)
mbed_official 558:0880f51c4036 46 #define WIZ_MODE_INPUT (0)
mbed_official 558:0880f51c4036 47 #define WIZ_MODE_OUTPUT (1)
mbed_official 558:0880f51c4036 48 #define WIZ_MODE_AF (2)
mbed_official 558:0880f51c4036 49
mbed_official 558:0880f51c4036 50 #define WIZ_GPIO_NOPULL (0) /*!< No Pull-up or Pull-down activation */
mbed_official 558:0880f51c4036 51 #define WIZ_GPIO_PULLDOWN (1) /*!< Pull-down activation */
mbed_official 558:0880f51c4036 52 #define WIZ_GPIO_PULLUP (2) /*!< Pull-up activation */
mbed_official 558:0880f51c4036 53 #define WIZ_GPIO_OPEN_DRAIN (3) /*!< Open Drain activation */
mbed_official 558:0880f51c4036 54
mbed_official 558:0880f51c4036 55
mbed_official 558:0880f51c4036 56 #define WIZ_AFNUM(X)(((uint32_t)(X) >> 8) & 0xF) // AF number (0=AF0, 1=AF1, 2=AF2, 3=AF3)
mbed_official 558:0880f51c4036 57 #define WIZ_PORT(X) (((uint32_t)(X) >> 4) & 0xF) // port number (0=A, 1=B, 2=C, 3=D)
mbed_official 558:0880f51c4036 58 #define WIZ_PIN(X) ((uint32_t)(X) & 0xF) // pin number
mbed_official 558:0880f51c4036 59
mbed_official 558:0880f51c4036 60
mbed_official 558:0880f51c4036 61 typedef enum {
mbed_official 558:0880f51c4036 62 PIN_INPUT,
mbed_official 558:0880f51c4036 63 PIN_OUTPUT
mbed_official 558:0880f51c4036 64 } PinDirection;
mbed_official 558:0880f51c4036 65
mbed_official 558:0880f51c4036 66
mbed_official 558:0880f51c4036 67 typedef enum {
mbed_official 558:0880f51c4036 68 // W7500x Pin Names (AF[9:8] + PORT[5:4] + PIN[3:0])
mbed_official 558:0880f51c4036 69
mbed_official 558:0880f51c4036 70 PA_0 = 0x000,
mbed_official 558:0880f51c4036 71 PA_1 = 0x001,
mbed_official 558:0880f51c4036 72 PA_2 = 0x002,
mbed_official 558:0880f51c4036 73 PA_3 = 0x003,
mbed_official 558:0880f51c4036 74 PA_4 = 0x004,
mbed_official 558:0880f51c4036 75 PA_5 = 0x005,
mbed_official 558:0880f51c4036 76 PA_6 = 0x006,
mbed_official 558:0880f51c4036 77 PA_7 = 0x007,
mbed_official 558:0880f51c4036 78 PA_8 = 0x008,
mbed_official 558:0880f51c4036 79 PA_9 = 0x009,
mbed_official 558:0880f51c4036 80 PA_10 = 0x00A,
mbed_official 558:0880f51c4036 81 PA_11 = 0x00B,
mbed_official 558:0880f51c4036 82 PA_12 = 0x00C,
mbed_official 558:0880f51c4036 83 PA_13 = 0x00D,
mbed_official 558:0880f51c4036 84 PA_14 = 0x00E,
mbed_official 558:0880f51c4036 85 PA_15 = 0x00F,
mbed_official 558:0880f51c4036 86
mbed_official 558:0880f51c4036 87 PB_0 = 0x010, //SSEL1/SD_SEL
mbed_official 558:0880f51c4036 88 PB_1 = 0x011, //SCLK1/SD_CLK
mbed_official 558:0880f51c4036 89 PB_2 = 0x012, //MISO1/SD_MISO
mbed_official 558:0880f51c4036 90 PB_3 = 0x013, //MOSI1/SD_MOSI
mbed_official 558:0880f51c4036 91 PB_4 = 0x014,
mbed_official 558:0880f51c4036 92 PB_5 = 0x015,
mbed_official 558:0880f51c4036 93 PB_6 = 0x016,
mbed_official 558:0880f51c4036 94 PB_7 = 0x017,
mbed_official 558:0880f51c4036 95 PB_8 = 0x018,
mbed_official 558:0880f51c4036 96 PB_9 = 0x019,
mbed_official 558:0880f51c4036 97 PB_10 = 0x01A,
mbed_official 558:0880f51c4036 98 PB_11 = 0x01B,
mbed_official 558:0880f51c4036 99 PB_12 = 0x01C,
mbed_official 558:0880f51c4036 100 PB_13 = 0x01D,
mbed_official 558:0880f51c4036 101 PB_14 = 0x01E,
mbed_official 558:0880f51c4036 102 PB_15 = 0x01F,
mbed_official 558:0880f51c4036 103
mbed_official 558:0880f51c4036 104 PC_0 = 0x120, // 0xx:U_CTS1, 1xx:GPIOC_0, 2xx:PWM0
mbed_official 558:0880f51c4036 105 PC_1 = 0x121, // 0xx:U_RTS1, 1xx:GPIOC_1, 2xx:PWM1
mbed_official 558:0880f51c4036 106 PC_2 = 0x022,
mbed_official 558:0880f51c4036 107 PC_3 = 0x023,
mbed_official 558:0880f51c4036 108 PC_4 = 0x124, // 0xx:SDA1, 1xx:GPIOC_4, 2xx:PWM4
mbed_official 558:0880f51c4036 109 PC_5 = 0x025,
mbed_official 558:0880f51c4036 110 PC_6 = 0x026,
mbed_official 558:0880f51c4036 111 PC_7 = 0x027,
mbed_official 558:0880f51c4036 112 PC_8 = 0x128, // 0xx:PWM0, 1xx:GPIOC_8, 2xx:SCL0, 3xx:AIN7
mbed_official 558:0880f51c4036 113 PC_9 = 0x129, // 0xx:PWM1, 1xx:GPIOC_9, 2xx:SDA0, 3xx:AIN6
mbed_official 558:0880f51c4036 114
mbed_official 558:0880f51c4036 115 PC_10 = 0x32A, // 0xx:U_TXD2, 1xx:GPIOC_10, 2xx:PWM2, 3xx:AIN5
mbed_official 558:0880f51c4036 116 PC_11 = 0x32B, // 0xx:U_RXD2, 1xx:GPIOC_11, 2xx:PWM3, 3xx:AIN4
mbed_official 558:0880f51c4036 117 PC_12 = 0x32C, // 0xx:AIN3, 1xx:GPIOC_12, 2xx:SSEL0, 3xx:AIN3
mbed_official 558:0880f51c4036 118 PC_13 = 0x32D, // 0xx:AIN2, 1xx:GPIOC_13, 2xx:SCLK0, 3xx:AIN2
mbed_official 558:0880f51c4036 119 PC_14 = 0x32E, // 0xx:AIN1, 1xx:GPIOC_14, 2xx:MISO0, 3xx:AIN1
mbed_official 558:0880f51c4036 120 PC_15 = 0x32F, // 0xx:AIN0, 1xx:GPIOC_15, 2xx:MOSI0, 3xx:AIN0
mbed_official 558:0880f51c4036 121
mbed_official 558:0880f51c4036 122 PD_0 = 0x030,
mbed_official 558:0880f51c4036 123 PD_1 = 0x031,
mbed_official 558:0880f51c4036 124 PD_2 = 0x032,
mbed_official 558:0880f51c4036 125 PD_3 = 0x033,
mbed_official 558:0880f51c4036 126 PD_4 = 0x034,
mbed_official 558:0880f51c4036 127
mbed_official 558:0880f51c4036 128
mbed_official 558:0880f51c4036 129 // Arduino connector namings
mbed_official 558:0880f51c4036 130 A0 = PC_15, // AIN0
mbed_official 558:0880f51c4036 131 A1 = PC_14, // AIN1
mbed_official 558:0880f51c4036 132 A2 = PC_13, // AIN2
mbed_official 558:0880f51c4036 133 A3 = PC_12, // AIN3
mbed_official 558:0880f51c4036 134 A4 = PC_11, // AIN4
mbed_official 558:0880f51c4036 135 A5 = PC_10, // AIN5
mbed_official 558:0880f51c4036 136 D0 = PA_14, // U_TXD0
mbed_official 558:0880f51c4036 137 D1 = PA_13, // U_RXD0
mbed_official 558:0880f51c4036 138 D2 = PC_1, // GPIOC_1, EXTI
mbed_official 558:0880f51c4036 139 D3 = PC_0, // GPIOC_0, EXTI
mbed_official 558:0880f51c4036 140 D4 = PA_2, // GPIOA_2,
mbed_official 558:0880f51c4036 141 D5 = PA_1, // GPIOA_1,
mbed_official 558:0880f51c4036 142 D6 = PA_0, // GPIOA_0,
mbed_official 558:0880f51c4036 143 D7 = PC_6, // GPIOC_6, EXTI
mbed_official 558:0880f51c4036 144 D8 = PC_7, // GPIOC_7, EXTI
mbed_official 558:0880f51c4036 145 D9 = PC_4, // GPIOC_4, EXTI
mbed_official 558:0880f51c4036 146 D10 = PA_5, // SSEL0
mbed_official 558:0880f51c4036 147 D11 = PA_8, // MOSI0
mbed_official 558:0880f51c4036 148 D12 = PA_7, // MISO0
mbed_official 558:0880f51c4036 149 D13 = PA_6, // SCLK0
mbed_official 558:0880f51c4036 150 D14 = PA_10, // SDA0
mbed_official 558:0880f51c4036 151 D15 = PA_9, // SCL0
mbed_official 558:0880f51c4036 152
mbed_official 558:0880f51c4036 153 // Generic signals namings
mbed_official 558:0880f51c4036 154 LED_RED = PC_8,
mbed_official 558:0880f51c4036 155 LED_GREEN = PC_9,
mbed_official 558:0880f51c4036 156 LED_BLUE = PC_5,
mbed_official 558:0880f51c4036 157
mbed_official 558:0880f51c4036 158 LED1 = LED_RED,
mbed_official 558:0880f51c4036 159 LED2 = LED_GREEN,
mbed_official 558:0880f51c4036 160 LED3 = LED_BLUE,
mbed_official 558:0880f51c4036 161 LED4 = LED_BLUE,
mbed_official 558:0880f51c4036 162
mbed_official 558:0880f51c4036 163 // USER_BUTTON = PC_13,
mbed_official 558:0880f51c4036 164 SERIAL_TX = PC_2, // U_TXD1
mbed_official 558:0880f51c4036 165 SERIAL_RX = PC_3, // U_RXD1
mbed_official 558:0880f51c4036 166 USBTX = SERIAL_TX,
mbed_official 558:0880f51c4036 167 USBRX = SERIAL_RX,
mbed_official 558:0880f51c4036 168 I2C_SCL = PA_9, // SCL0
mbed_official 558:0880f51c4036 169 I2C_SDA = PA_10, // SDA0
mbed_official 558:0880f51c4036 170 SPI_MOSI = PA_8, // MISO0
mbed_official 558:0880f51c4036 171 SPI_MISO = PA_7, // MOSI0
mbed_official 558:0880f51c4036 172 SPI_SCK = PA_9, // SCL0
mbed_official 558:0880f51c4036 173 SPI_CS = PA_5, // SSEL0
mbed_official 558:0880f51c4036 174 SD_SEL = PB_0, // SSEL1
mbed_official 558:0880f51c4036 175 SD_CLK = PB_1, // SCL1
mbed_official 558:0880f51c4036 176 SD_MISO = PB_2, // MOSI1
mbed_official 558:0880f51c4036 177 SD_MOSI = PB_3, // MISO1
mbed_official 558:0880f51c4036 178 // PWM_OUT = PC_7,
mbed_official 558:0880f51c4036 179
mbed_official 558:0880f51c4036 180 // Not connected
mbed_official 558:0880f51c4036 181 NC = (int)0xFFFFFFFF
mbed_official 558:0880f51c4036 182 } PinName;
mbed_official 558:0880f51c4036 183
mbed_official 558:0880f51c4036 184 typedef enum {
mbed_official 558:0880f51c4036 185 PullNone = 0,
mbed_official 558:0880f51c4036 186 PullDown = 1,
mbed_official 558:0880f51c4036 187 PullUp = 2,
mbed_official 558:0880f51c4036 188 OpenDrain = 3,
mbed_official 558:0880f51c4036 189 PullDefault = PullNone
mbed_official 558:0880f51c4036 190 } PinMode;
mbed_official 558:0880f51c4036 191
mbed_official 558:0880f51c4036 192
mbed_official 558:0880f51c4036 193 #ifdef __cplusplus
mbed_official 558:0880f51c4036 194 }
mbed_official 558:0880f51c4036 195 #endif
mbed_official 558:0880f51c4036 196
mbed_official 558:0880f51c4036 197 #endif