|
| 1 | +/* |
| 2 | + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio |
| 3 | +
|
| 4 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + you may not use this file except in compliance with the License. |
| 6 | + You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | + Unless required by applicable law or agreed to in writing, software |
| 11 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + See the License for the specific language governing permissions and |
| 14 | + limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +#ifndef _BOARD_H_ |
| 18 | +#define _BOARD_H_ |
| 19 | + |
| 20 | +/* |
| 21 | + * Setup for Renesas RPBRX62N board |
| 22 | + */ |
| 23 | + |
| 24 | +/* |
| 25 | + * Board identifiers. |
| 26 | + */ |
| 27 | +#define BOARD_RPBRX62N |
| 28 | +#define BOARD_NAME "Renesas RPBRX62N" |
| 29 | + |
| 30 | +/* |
| 31 | + * Board frequencies. |
| 32 | + */ |
| 33 | +#define EXTALCLK 12000000 |
| 34 | +#define SUBCLK 32768 |
| 35 | + |
| 36 | +/* |
| 37 | + * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. |
| 38 | + */ |
| 39 | +#define RX62NXBDFP |
| 40 | + |
| 41 | +/* TODO: move this to hal/include/mii.h */ |
| 42 | +#define MII_LAN8700_ID 0x0007C0C4 |
| 43 | + |
| 44 | +/* |
| 45 | + * Ethernet PHY type. |
| 46 | + */ |
| 47 | +#define BOARD_PHY_ID MII_LAN8700_ID |
| 48 | + |
| 49 | +/* |
| 50 | + * Ethernet PHY address. |
| 51 | + */ |
| 52 | +#define BOARD_PHY_ADDRESS 31 |
| 53 | + |
| 54 | +#define RX62N_MAC_PHY_TIMEOUT 0 |
| 55 | + |
| 56 | +/* |
| 57 | + * Use ethernet PHY RMII interface (if defined). |
| 58 | + */ |
| 59 | +/*#define BOARD_PHY_RMII*/ |
| 60 | + |
| 61 | +/* |
| 62 | + * Ethernet PHY hardware reset |
| 63 | + * PORTA_ETH_RESETOUT must be held low for at least 100us. |
| 64 | + */ |
| 65 | +#define BOARD_PHY_RESET() do { \ |
| 66 | + palClearPad(GPIO10, PORTA_ETH_RESETOUT); \ |
| 67 | + asm volatile ("mov.l #2640,r2 \n\t" \ |
| 68 | + "1: \n\t" \ |
| 69 | + "sub #1,r2 \n\t" \ |
| 70 | + "bne.b 1b \n\t"); \ |
| 71 | + palSetPad(GPIO10, PORTA_ETH_RESETOUT); \ |
| 72 | +} while(0) |
| 73 | + |
| 74 | +/* |
| 75 | + * PORT 0 initial setup. |
| 76 | + */ |
| 77 | +#define VAL_PORT0DIR 0x00 |
| 78 | +#define VAL_PORT0DATA 0x00 |
| 79 | +#define VAL_PORT0ICR 0x00 |
| 80 | +#define VAL_PORT0ODR 0x00 |
| 81 | + |
| 82 | +/* |
| 83 | + * PORT 1 initial setup. |
| 84 | + */ |
| 85 | +#define VAL_PORT1DIR 0x00 |
| 86 | +#define VAL_PORT1DATA 0x00 |
| 87 | +#define VAL_PORT1ICR 0x00 |
| 88 | +#define VAL_PORT1ODR 0x00 |
| 89 | + |
| 90 | +/* |
| 91 | + * PORT 2 initial setup. |
| 92 | + */ |
| 93 | +#define VAL_PORT2DIR 0x00 |
| 94 | +#define VAL_PORT2DATA 0x00 |
| 95 | +#define VAL_PORT2ICR 0x00 |
| 96 | +#define VAL_PORT2ODR 0x00 |
| 97 | + |
| 98 | +/* |
| 99 | + * PORT 3 initial setup. |
| 100 | + */ |
| 101 | +#define VAL_PORT3DIR 0x00 |
| 102 | +#define VAL_PORT3DATA 0x00 |
| 103 | +#define VAL_PORT3ICR 0x00 |
| 104 | +#define VAL_PORT3ODR 0x00 |
| 105 | + |
| 106 | +/* |
| 107 | + * PORT 4 initial setup. |
| 108 | + */ |
| 109 | +#define VAL_PORT4DIR 0x00 |
| 110 | +#define VAL_PORT4DATA 0x00 |
| 111 | +#define VAL_PORT4ICR 0x00 |
| 112 | + |
| 113 | +/* |
| 114 | + * PORT 5 initial setup. |
| 115 | + */ |
| 116 | +#define VAL_PORT5DIR 0x00 |
| 117 | +#define VAL_PORT5DATA 0x00 |
| 118 | +#define VAL_PORT5ICR 0x00 |
| 119 | + |
| 120 | +/* |
| 121 | + * GPIO A initial setup. |
| 122 | + */ |
| 123 | +#define VAL_PORTADIR PAL_PORT_BIT(PORTA_LED0) | \ |
| 124 | + PAL_PORT_BIT(PORTA_LED1) | \ |
| 125 | + PAL_PORT_BIT(PORTA_LED2) | \ |
| 126 | + PAL_PORT_BIT(PORTA_MII_MDIO) | \ |
| 127 | + PAL_PORT_BIT(PORTA_MII_MDC) | \ |
| 128 | + PAL_PORT_BIT(PORTA_ETH_LINKSTA) | \ |
| 129 | + PAL_PORT_BIT(PORTA_ETH_RESETOUT) |
| 130 | +#define VAL_PORTADATA PAL_PORT_BIT(PORTA_LED0) | \ |
| 131 | + PAL_PORT_BIT(PORTA_LED1) | \ |
| 132 | + PAL_PORT_BIT(PORTA_LED2) | \ |
| 133 | + PAL_PORT_BIT(PORTA_ETH_RESETOUT) |
| 134 | +#define VAL_PORTAICR PAL_PORT_BIT(PORTA_MII_MDIO) | \ |
| 135 | + PAL_PORT_BIT(PORTA_ETH_LINKSTA) |
| 136 | +#define VAL_PORTAPCR 0x00 |
| 137 | + |
| 138 | +/* |
| 139 | + * PORT B initial setup. |
| 140 | + */ |
| 141 | +#define VAL_PORTBDIR PAL_PORT_BIT(PORTB_MII_TXD1) | \ |
| 142 | + PAL_PORT_BIT(PORTB_MII_TXD0) | \ |
| 143 | + PAL_PORT_BIT(PORTB_MII_TXEN) |
| 144 | +#define VAL_PORTBDATA 0x00 |
| 145 | +#define VAL_PORTBICR PAL_PORT_BIT(PORTB_MII_CRS) | \ |
| 146 | + PAL_PORT_BIT(PORTB_MII_RXER) | \ |
| 147 | + PAL_PORT_BIT(PORTB_MII_RXCLK) | \ |
| 148 | + PAL_PORT_BIT(PORTB_MII_RXD0) | \ |
| 149 | + PAL_PORT_BIT(PORTB_MII_RXD1) |
| 150 | +#define VAL_PORTBPCR 0x00 |
| 151 | + |
| 152 | +/* |
| 153 | + * PORT C initial setup. |
| 154 | + */ |
| 155 | +#define VAL_PORTCDIR PAL_PORT_BIT(PORTC_MII_TXD3) | \ |
| 156 | + PAL_PORT_BIT(PORTC_MII_TXD2) | \ |
| 157 | + PAL_PORT_BIT(PORTC_MII_TXER) |
| 158 | +#define VAL_PORTCDATA 0x00 |
| 159 | +#define VAL_PORTCICR PAL_PORT_BIT(PORTC_MII_COL) | \ |
| 160 | + PAL_PORT_BIT(PORTC_MII_TXCLK) | \ |
| 161 | + PAL_PORT_BIT(PORTC_MII_TXER) | \ |
| 162 | + PAL_PORT_BIT(PORTC_MII_RXDV) | \ |
| 163 | + PAL_PORT_BIT(PORTC_MII_RXD2) | \ |
| 164 | + PAL_PORT_BIT(PORTC_MII_RXD3) |
| 165 | +#define VAL_PORTCODR 0x00 |
| 166 | +#define VAL_PORTCPCR 0x00 |
| 167 | + |
| 168 | +/* |
| 169 | + * PORT D initial setup. |
| 170 | + */ |
| 171 | +#define VAL_PORTDDIR 0x00 |
| 172 | +#define VAL_PORTDDATA 0x00 |
| 173 | +#define VAL_PORTDICR 0x00 |
| 174 | +#define VAL_PORTDPCR 0x00 |
| 175 | + |
| 176 | +/* |
| 177 | + * PORT E initial setup. |
| 178 | + */ |
| 179 | +#define VAL_PORTEDIR 0x00 |
| 180 | +#define VAL_PORTEDATA 0x00 |
| 181 | +#define VAL_PORTEICR 0x00 |
| 182 | +#define VAL_PORTEPCR 0x00 |
| 183 | + |
| 184 | + |
| 185 | +/* |
| 186 | + * Pin definitions. |
| 187 | + */ |
| 188 | +#define PORTA_ETH_RESETOUT 7 |
| 189 | +#define PORTA_ETH_LINKSTA 5 |
| 190 | +#define PORTA_MII_MDC 4 |
| 191 | +#define PORTA_MII_MDIO 3 |
| 192 | +#define PORTA_LED0 2 |
| 193 | +#define PORTA_LED1 1 |
| 194 | +#define PORTA_LED2 0 |
| 195 | + |
| 196 | +#define PORTB_MII_CRS 7 |
| 197 | +#define PORTB_MII_TXD1 6 |
| 198 | +#define PORTB_MII_TXD0 5 |
| 199 | +#define PORTB_MII_TXEN 4 |
| 200 | +#define PORTB_MII_RXER 3 |
| 201 | +#define PORTB_MII_RXCLK 2 |
| 202 | +#define PORTB_MII_RXD0 1 |
| 203 | +#define PORTB_MII_RXD1 0 |
| 204 | + |
| 205 | +#define PORTC_MII_COL 7 |
| 206 | +#define PORTC_MII_TXD3 6 |
| 207 | +#define PORTC_MII_TXD2 5 |
| 208 | +#define PORTC_MII_TXCLK 4 |
| 209 | +#define PORTC_MII_TXER 3 |
| 210 | +#define PORTC_MII_RXDV 2 |
| 211 | +#define PORTC_MII_RXD2 1 |
| 212 | +#define PORTC_MII_RXD3 0 |
| 213 | + |
| 214 | +#if !defined(_FROM_ASM_) |
| 215 | +#ifdef __cplusplus |
| 216 | +extern "C" { |
| 217 | +#endif |
| 218 | + void boardInit(void); |
| 219 | +#ifdef __cplusplus |
| 220 | +} |
| 221 | +#endif |
| 222 | +#endif /* _FROM_ASM_ */ |
| 223 | + |
| 224 | +#endif /* _BOARD_H_ */ |
0 commit comments