diff options
Diffstat (limited to 'boards')
-rw-r--r-- | boards/EA_LPCXPRESSO_LPC1769/board.c | 68 | ||||
-rw-r--r-- | boards/EA_LPCXPRESSO_LPC1769/board.h | 91 | ||||
-rw-r--r-- | boards/EA_LPCXPRESSO_LPC1769/board.mk | 5 |
3 files changed, 164 insertions, 0 deletions
diff --git a/boards/EA_LPCXPRESSO_LPC1769/board.c b/boards/EA_LPCXPRESSO_LPC1769/board.c new file mode 100644 index 000000000..216b9e813 --- /dev/null +++ b/boards/EA_LPCXPRESSO_LPC1769/board.c @@ -0,0 +1,68 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include "ch.h" +#include "hal.h" + +/** + * @brief PAL setup. + * @details Digital I/O ports static configuration as defined in @p board.h. + * This variable is used by the HAL when initializing the PAL driver. + */ +#if HAL_USE_PAL || defined(__DOXYGEN__) +const PALConfig pal_default_config = { + {VAL_GPIO0DATA, VAL_GPIO0DIR}, + {VAL_GPIO1DATA, VAL_GPIO1DIR}, + {VAL_GPIO2DATA, VAL_GPIO2DIR}, + {VAL_GPIO3DATA, VAL_GPIO3DIR}, + {VAL_GPIO4DATA, VAL_GPIO4DIR} +}; +#endif + +/* + * Early initialization code. + * This initialization must be performed just after stack setup and before + * any other initialization. + */ +void __early_init(void) { + + LPC17xx_clock_init(); +} + +/* + * Board-specific initialization code. + */ +void boardInit(void) { + + /* + * Extra, board-specific, initializations. + */ + LPC_PINCON->PINSEL0 |= (1UL << 4) | (1UL << 6); /* Set UART0 TXD0 P0.2 and RXD0 P0.3 pins.*/ + LPC_PINCON->PINMODE0 |= (2UL << 4) | (2UL << 6); /* Disable pull-up on UART0 TXD0 and RXD0 pins.*/ + + LPC_PINCON->PINSEL3 |= (1UL << 22); /* Set CLKOUT P1.27 pin.*/ + LPC_PINCON->PINMODE3 |= (2UL << 22); /* Disable pull-up on CLKOUT pin. */ + + /* I2C1 config */ + LPC_PINCON->PINSEL1 |= (3UL << 8) | (3UL << 6); /* Set I2C1 SCL1 P0.20, SDA1 P0.19 pins. */ + LPC_PINCON->PINMODE1 |= (2UL << 8) | (2UL << 6); /* Disable pull-up on I2C1 SCL1 P0.20, SDA1 P0.19 pins. */ + LPC_PINCON->PINMODE_OD0 |= (1UL << 20) | (1UL << 19); /* Set I2C1 SCL1 P0.20, SDA1 P0.19 as open drain pins. */ + + /* ADC config */ + LPC_PINCON->PINMODE1 |= (2UL << 16) | (2UL << 14); /* Disable pull-up on AD0.1 P0.24 and AD0.0 P0.23 pins.*/ + LPC_PINCON->PINSEL1 |= (1UL << 16) | (1UL << 14); /* Set AD0.1 P0.24 and AD0.0 P0.23 pins.*/ + +} diff --git a/boards/EA_LPCXPRESSO_LPC1769/board.h b/boards/EA_LPCXPRESSO_LPC1769/board.h new file mode 100644 index 000000000..7d26cbc7c --- /dev/null +++ b/boards/EA_LPCXPRESSO_LPC1769/board.h @@ -0,0 +1,91 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +/* + * Setup for Embedded Artists LPCXpresso LPC1769. + */ + +/* + * Board identifiers. + */ +#define BOARD_EA_LPCXPRESSO_1769 +#define BOARD_NAME "Embedded Artists LPCXpresso LPC1769" + +/* + * Ethernet PHY type. + */ +#define MII_LAN8720_ID 0x0007C0F0 +#define BOARD_PHY_ID MII_LAN8720_ID +#define BOARD_PHY_RMII + +//#define BOARD_PHY_ADDRESS +/* + * Board frequencies. + */ +#define MAINOSCCLK 12000000UL +#define RTCOSCCLK 32768UL + +/* + * GPIO 0 initial setup. + */ +#define VAL_GPIO0DIR PAL_PORT_BIT(GPIO0_LED2_RED) +#define VAL_GPIO0DATA 0x00000000 + +/* + * GPIO 1 initial setup. + */ +#define VAL_GPIO1DIR 0x00000000 +#define VAL_GPIO1DATA 0x00000000 + +/* + * GPIO 2 initial setup. + */ +#define VAL_GPIO2DIR 0x00000000 +#define VAL_GPIO2DATA 0x00000000 + +/* + * GPIO 3 initial setup. + */ +#define VAL_GPIO3DIR 0x00000000 +#define VAL_GPIO3DATA 0x00000000 + +/* + * GPIO 4 initial setup. + */ +#define VAL_GPIO4DIR 0x00000000 +#define VAL_GPIO4DATA 0x00000000 + +/* + * Pin definitions. + */ +#define GPIO0_LED2_RED 22 + +#define GPIO2_SW_TO_GND 12 + +#if !defined(_FROM_ASM_) +#ifdef __cplusplus +extern "C" { +#endif + void boardInit(void); +#ifdef __cplusplus +} +#endif +#endif /* _FROM_ASM_ */ + +#endif /* _BOARD_H_ */ diff --git a/boards/EA_LPCXPRESSO_LPC1769/board.mk b/boards/EA_LPCXPRESSO_LPC1769/board.mk new file mode 100644 index 000000000..66113f032 --- /dev/null +++ b/boards/EA_LPCXPRESSO_LPC1769/board.mk @@ -0,0 +1,5 @@ +# List of all the board related files. +BOARDSRC = ${CHIBIOS}/boards/EA_LPCXPRESSO_LPC1769/board.c + +# Required include directories +BOARDINC = ${CHIBIOS}/boards/EA_LPCXPRESSO_LPC1769 |