-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2045 from haukepetersen/fix_board_mbed
board/mbed_lpc1768: remodeled to our board/cpu structure
- Loading branch information
Showing
33 changed files
with
1,285 additions
and
4,169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
MODULE =$(BOARD)_base | ||
# tell the Makefile.base which module to build | ||
MODULE = $(BOARD)_base | ||
|
||
include $(RIOTBASE)/Makefile.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright (C) 2014 Freie Universität Berlin | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser General | ||
* Public License v2.1. See the file LICENSE in the top level directory for more | ||
* details. | ||
*/ | ||
|
||
/** | ||
* @ingroup board_mbed_lpc1768 | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board specific implementations for the mbed LPC1768 board | ||
* | ||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> | ||
* | ||
* @} | ||
*/ | ||
|
||
#include "board.h" | ||
|
||
static void leds_init(void); | ||
extern void SystemInit(void); | ||
|
||
void board_init(void) | ||
{ | ||
/* initialize core clocks via CMSIS function */ | ||
SystemInit(); | ||
/* initialize the CPU */ | ||
cpu_init(); | ||
/* initialize the boards LEDs */ | ||
leds_init(); | ||
} | ||
|
||
/** | ||
* @brief Initialize the boards on-board LEDs (LED1 to LED4) | ||
* | ||
* The LED initialization is hard-coded in this function. As the LEDs are soldered | ||
* onto the board they are fixed to their CPU pins. | ||
* | ||
* The LEDs are connected to the following pins: | ||
* - LED1: P1.18 | ||
* - LED2: P1.20 | ||
* - LED3: P1.21 | ||
* - LED4: P1.23 | ||
*/ | ||
static void leds_init(void) | ||
{ | ||
/* configure LED pins as output */ | ||
LED_PORT->FIODIR |= (LED1_PIN | LED2_PIN | LED3_PIN | LED4_PIN); | ||
|
||
/* clear all LEDs */ | ||
LED_PORT->FIOCLR = (LED1_PIN | LED2_PIN | LED3_PIN | LED4_PIN); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,106 @@ | ||
/* | ||
* Copyright 2014 INRIA | ||
* Copyright (C) 2014 INRIA | ||
* Copyright (C) 2014 Freie Universität Berlin | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser | ||
* General Public License v2.1. See the file LICENSE in the top level | ||
* directory for more details. | ||
* This file is subject to the terms and conditions of the GNU Lesser General | ||
* Public License v2.1. See the file LICENSE in the top level directory for more | ||
* details. | ||
*/ | ||
|
||
#ifndef __BOARD_H | ||
#define __BOARD_H | ||
|
||
/** | ||
* @file | ||
* @author Oliver Hahm <oliver.hahm@inria.fr> | ||
* | ||
* @defgroup mbed_lpc1768 mbed NXP LPC1768 development kit | ||
* @defgroup board_mbed_lpc1768 mbed LPC1768 development kit | ||
* @ingroup boards | ||
* @brief Support for the mbed NXP LPC1768 board. | ||
* @brief Support for the mbed LPC1762 board | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board specific definitions for the mbed_lpc1768 board | ||
* | ||
* @author Oliver Hahm <oliver.hahm@inria.fr> | ||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> | ||
*/ | ||
|
||
#ifndef __BOARD_H | ||
#define __BOARD_H | ||
|
||
#include <stdint.h> | ||
|
||
#include "bitarithm.h" | ||
#include "cpu.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define F_CPU (96000000) | ||
/** | ||
* @name The nominal CPU core clock in this board | ||
*/ | ||
#define F_CPU (96000000) | ||
|
||
/** | ||
* @name Assign the peripheral timer to be used as hardware timer | ||
*/ | ||
#define HW_TIMER TIMER_0 | ||
|
||
#define PIN_LED1 (BIT18) | ||
#define PIN_LED2 (BIT20) | ||
#define PIN_LED3 (BIT21) | ||
#define PIN_LED4 (BIT23) | ||
/** | ||
* @name Assign the UART interface to be used for stdio | ||
* @{ | ||
*/ | ||
#define STDIO UART_0 | ||
#define STDIO_BAUDRATE (115200U) | ||
#define STDIO_RX_BUFSIZE (64U) | ||
/** @} */ | ||
|
||
#define LED_ON(led_nr) (LPC_GPIO1->FIOSET = PIN_LED##led_nr) | ||
#define LED_OFF(led_nr) (LPC_GPIO1->FIOCLR = PIN_LED##led_nr) | ||
#define LED_TOGGLE(led_nr) (LPC_GPIO1->FIOPIN ^= PIN_LED##led_nr) | ||
/** | ||
* @name LED pin definitions | ||
* @{ | ||
*/ | ||
#define LED_PORT LPC_GPIO1 | ||
#define LED1_PIN BIT18 | ||
#define LED2_PIN BIT20 | ||
#define LED3_PIN BIT21 | ||
#define LED4_PIN BIT23 | ||
/** @} */ | ||
|
||
/** | ||
* @name Macros for controlling the on-board LEDs. | ||
* @{ | ||
*/ | ||
#define LED1_ON (LED_PORT->FIOSET = LED1_PIN) | ||
#define LED1_OFF (LED_PORT->FIOCLR = LED1_PIN) | ||
#define LED1_TOGGLE (LED_PORT->FIOPIN ^= LED1_PIN) | ||
#define LED2_ON (LED_PORT->FIOSET = LED2_PIN) | ||
#define LED2_OFF (LED_PORT->FIOCLR = LED2_PIN) | ||
#define LED2_TOGGLE (LED_PORT->FIOPIN ^= LED2_PIN) | ||
#define LED3_ON (LED_PORT->FIOSET = LED3_PIN) | ||
#define LED3_OFF (LED_PORT->FIOCLR = LED3_PIN) | ||
#define LED3_TOGGLE (LED_PORT->FIOPIN ^= LED3_PIN) | ||
#define LED4_ON (LED_PORT->FIOSET = LED4_PIN) | ||
#define LED4_OFF (LED_PORT->FIOCLR = LED4_PIN) | ||
#define LED4_TOGGLE (LED_PORT->FIOPIN ^= LED4_PIN) | ||
|
||
/* for compatibility to other boards */ | ||
#define LED_GREEN_ON LED1_ON | ||
#define LED_GREEN_OFF LED1_OFF | ||
#define LED_GREEN_TOGGLE LED1_TOGGLE | ||
#define LED_RED_ON LED4_ON | ||
#define LED_RED_OFF LED4_OFF | ||
#define LED_RED_TOGGLE LED4_TOGGLE | ||
/** @} */ | ||
|
||
/** | ||
* @name define radio packet length | ||
*/ | ||
typedef uint8_t radio_packet_length_t; | ||
|
||
/** | ||
* @brief Busy waiting function (while hwtimer is not available at boot time) | ||
* | ||
* @param[in] t The waiting cycles | ||
* @brief Initialize board specific hardware, include clocks, LEDs and stdio | ||
*/ | ||
void loop_delay(uint32_t t); | ||
void board_init(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
/** @} */ | ||
#endif /* __BOARD_H */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (C) 2014 Freie Universität Berlin | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser General | ||
* Public License v2.1. See the file LICENSE in the top level directory for more | ||
* details. | ||
*/ | ||
|
||
/** | ||
* @ingroup board_mbed_lpc1768 | ||
* @{ | ||
* | ||
* @file | ||
* @brief Peripheral MCU configuration for the mbed LPC1768 board | ||
* | ||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> | ||
*/ | ||
|
||
#ifndef __PERIPH_CONF_H | ||
#define __PERIPH_CONF_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief Timer configuration | ||
* @{ | ||
*/ | ||
#define TIMER_NUMOF (1U) | ||
#define TIMER_0_EN 1 | ||
#define TIMER_1_EN 0 | ||
#define TIMER_IRQ_PRIO 1 | ||
|
||
/* Timer 0 configuration */ | ||
#define TIMER_0_DEV LPC_TIMER0 | ||
#define TIMER_0_CHANNELS 4 | ||
#define TIMER_0_PRESCALER (67U) | ||
#define TIMER_0_MAX_VALUE (0xffffffff) | ||
#define TIMER_0_CLKEN() | ||
#define TIMER_0_ISR isr_timer0 | ||
#define TIMER_0_IRQ_CHAN TIMER0_IRQn | ||
/** @} */ | ||
|
||
/** | ||
* @brief UART configuration | ||
* @{ | ||
*/ | ||
#define UART_NUMOF (1U) | ||
#define UART_0_EN 1 | ||
#define UART_1_EN 0 | ||
#define UART_IRQ_PRIO 1 | ||
|
||
/* UART 0 device configuration */ | ||
#define UART_0_DEV LPC_UART2 | ||
#define UART_0_CLKEN() | ||
#define UART_0_IRQ UART0_IRQn | ||
#define UART_0_ISR isr_uart0 | ||
/* UART 0 pin configuration */ | ||
#define UART_0_PORT | ||
#define UART_0_PORT_CLKEN() | ||
#define UART_0_RX_PIN | ||
#define UART_0_TX_PIN | ||
#define UART_0_AF | ||
/** @} */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __PERIPH_CONF_H */ | ||
/** @} */ |
Oops, something went wrong.