aboutsummaryrefslogtreecommitdiffstats
path: root/boards/OLIMEX_LPC_P2148
diff options
context:
space:
mode:
Diffstat (limited to 'boards/OLIMEX_LPC_P2148')
-rw-r--r--boards/OLIMEX_LPC_P2148/board.c95
-rw-r--r--boards/OLIMEX_LPC_P2148/board.h92
-rw-r--r--boards/OLIMEX_LPC_P2148/board.mk5
-rw-r--r--boards/OLIMEX_LPC_P2148/buzzer.c111
-rw-r--r--boards/OLIMEX_LPC_P2148/buzzer.h32
5 files changed, 0 insertions, 335 deletions
diff --git a/boards/OLIMEX_LPC_P2148/board.c b/boards/OLIMEX_LPC_P2148/board.c
deleted file mode 100644
index 1c0a00302..000000000
--- a/boards/OLIMEX_LPC_P2148/board.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- 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"
-
-#define VAL_TC0_PRESCALER 0
-
-/**
- * @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_PINSEL0,
- VAL_PINSEL1,
- VAL_PINSEL2,
- {VAL_FIO0PIN, VAL_FIO0DIR},
- {VAL_FIO1PIN, VAL_FIO1DIR}
-};
-#endif
-
-/*
- * Timer 0 IRQ handling here.
- */
-static CH_IRQ_HANDLER(T0IrqHandler) {
-
- CH_IRQ_PROLOGUE();
- T0IR = 1; /* Clear interrupt on match MR0. */
-
- chSysLockFromIsr();
- chSysTimerHandlerI();
- chSysUnlockFromIsr();
-
- VICVectAddr = 0;
- CH_IRQ_EPILOGUE();
-}
-
-/*
- * Early initialization code.
- * This initialization must be performed just after stack setup and before
- * any other initialization.
- */
-void __early_init(void) {
-
- lpc214x_clock_init();
-}
-
-#if HAL_USE_MMC_SPI
-/* Board-related functions related to the MMC_SPI driver.*/
-bool_t mmc_lld_is_card_inserted(MMCDriver *mmcp) {
-
- (void)mmcp;
- return !palReadPad(IOPORT2, PB_CP1);
-}
-
-bool_t mmc_lld_is_write_protected(MMCDriver *mmcp) {
-
- (void)mmcp;
- return palReadPad(IOPORT2, PB_WP1);
-}
-#endif
-
-/*
- * Board-specific initialization code.
- */
-void boardInit(void) {
-
- /*
- * System Timer initialization, 1ms intervals.
- */
- SetVICVector(T0IrqHandler, 0, SOURCE_Timer0);
- VICIntEnable = INTMASK(SOURCE_Timer0);
- TC *timer = T0Base;
- timer->TC_PR = VAL_TC0_PRESCALER;
- timer->TC_MR0 = (PCLK / CH_FREQUENCY) / (VAL_TC0_PRESCALER + 1);
- timer->TC_MCR = 3; /* Interrupt and clear TC on match MR0. */
- timer->TC_TCR = 2; /* Reset counter and prescaler. */
- timer->TC_TCR = 1; /* Timer enabled. */
-}
diff --git a/boards/OLIMEX_LPC_P2148/board.h b/boards/OLIMEX_LPC_P2148/board.h
deleted file mode 100644
index 17651b313..000000000
--- a/boards/OLIMEX_LPC_P2148/board.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- 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 the Olimex LPC-P2148 proto board.
- */
-
-/*
- * Board identifier.
- */
-#define BOARD_OLIMEX_LPC_P2148
-#define BOARD_NAME "Olimex LPC-P2148"
-
-/*
- * The following values are implementation dependent. You may change them in
- * order to match your HW.
- */
-#define FOSC 12000000
-#define CCLK 48000000
-#define PCLK 12000000
-
-/*
- * Pins configuration for Olimex LPC-P2148.
- *
- * PINSEL0
- * P0 P0 P0 P0 P0 P0 RXD TXD SSE MOS MIS SCK SDA SCL RXD TXD
- * 15 14 13 12 11 10 1 1 L0 I0 O0 0 0 0 0 0
- * 00 00 00 00 00 00 01 01 01 01 01 01 01 01 01 01
- * FIO0DIR (15...0)
- * IN IN OUT OUT OUT OUT -- -- -- -- -- -- -- -- -- --
- * 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0
- *
- * PINSEL1
- * P0 AD P0 P0 -- -- AO -- VB P0 P0 P0 MOS MIS SCK P0
- * 31 03 29 28 -- -- UT -- US 22 21 20 I1 O1 1 16
- * 00 01 00 00 00 00 10 00 01 00 00 00 10 10 10 00
- * FIO0DIR (31...16)
- * OUT -- OUT OUT -- -- -- -- -- OUT OUT OUT -- -- -- IN
- * 1 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0
- *
- * FIO1DIR (31...16)
- * -- -- -- -- -- IN IN OUT OUT OUT OUT OUT OUT OUT OUT OUT
- * 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
- */
-#define VAL_PINSEL0 0x00055555
-#define VAL_PINSEL1 0x100840A8
-#define VAL_PINSEL2 0x00000004 /* Do not modify */
-#define VAL_FIO0DIR 0xB0703C00
-#define VAL_FIO1DIR 0x01FF0000
-#define VAL_FIO0PIN 0xFFFFFFFF
-#define VAL_FIO1PIN 0xFFFFFFFF
-
-#define PA_LED1 10
-#define PA_LED2 11
-#define PA_BUZZ1 12
-#define PA_BUZZ2 13
-#define PA_BSL 14
-#define PA_BUTTON1 15
-#define PA_BUTTON2 16
-#define PA_SSEL1 20
-#define PA_LEDUSB 31
-
-#define PB_WP1 24
-#define PB_CP1 25
-
-#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/OLIMEX_LPC_P2148/board.mk b/boards/OLIMEX_LPC_P2148/board.mk
deleted file mode 100644
index 5d0937e6d..000000000
--- a/boards/OLIMEX_LPC_P2148/board.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-# List of all the mandatory board related files.
-BOARDSRC = ${CHIBIOS}/boards/OLIMEX_LPC_P2148/board.c
-
-# Required include directories
-BOARDINC = ${CHIBIOS}/boards/OLIMEX_LPC_P2148
diff --git a/boards/OLIMEX_LPC_P2148/buzzer.c b/boards/OLIMEX_LPC_P2148/buzzer.c
deleted file mode 100644
index cf2182f08..000000000
--- a/boards/OLIMEX_LPC_P2148/buzzer.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- 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.
-*/
-
-/*
- * Buzzer driver for Olimex LPC-P2148.
- * Uses the timer 1 for wave generation and a Virtual Timer for the sound
- * duration.
- * The driver also generates an event when the sound is done and the buzzer
- * goes silent.
- */
-
-#include "ch.h"
-#include "hal.h"
-
-#include "buzzer.h"
-
-EventSource BuzzerSilentEventSource;
-
-#define StartCounter(t) ((t)->TC_EMR = 0xF1, (t)->TC_TCR = 1)
-#define StopCounter(t) ((t)->TC_EMR = 0, (t)->TC_TCR = 2)
-
-/**
- * @brief Buzzer driver initialization.
- */
-void buzzInit(void) {
-
- chEvtInit(&BuzzerSilentEventSource);
-
- /*
- * Switches P0.12 and P0.13 to MAT1.0 and MAT1.1 functions.
- * Enables Timer1 clock.
- */
- PINSEL0 &= 0xF0FFFFFF;
- PINSEL0 |= 0x0A000000;
- PCONP = (PCONP & PCALL) | PCTIM1;
-
- /*
- * Timer setup.
- */
- TC *tc = T1Base;
- StopCounter(tc);
- tc->TC_CTCR = 0; /* Clock source is PCLK. */
- tc->TC_PR = 0; /* Prescaler disabled. */
- tc->TC_MCR = 2; /* Clear TC on match MR0. */
-}
-
-/**
- * @brief Stops the sound.
- *
- * @param[in] p pointer to the timer
- */
-static void stop(void *p) {
-
- StopCounter((TC *)p);
- chSysLockFromIsr();
- chEvtBroadcastI(&BuzzerSilentEventSource);
- chSysUnlockFromIsr();
-}
-
-/**
- * @brief Plays a tone asynchronously.
- *
- * @param[in] freq approximated tone frequency
- * @param[in] duration tone duration in systicks
- */
-void buzzPlay(uint32_t freq, systime_t duration) {
- static VirtualTimer bvt;
- TC *tc = T1Base;
-
- chSysLock();
-
- if (chVTIsArmedI(&bvt)) { /* If a sound is already being */
- chVTResetI(&bvt); /* played then aborts it. */
- StopCounter(tc);
- }
-
- tc->TC_MR0 = tc->TC_MR1 = (PCLK / (freq * 2));
- StartCounter(tc);
- chVTSetI(&bvt, duration, stop, tc);
-
- chSysUnlock();
-}
-
-/**
- * @brief Plays a tone.
- *
- * @param[in] freq approximated tone frequency
- * @param[in] duration tone duration in systicks
- */
-void buzzPlayWait(uint32_t freq, systime_t duration) {
- TC *tc = T1Base;
-
- StopCounter(tc);
- tc->TC_MR0 = tc->TC_MR1 = (PCLK / (freq * 2));
- StartCounter(tc);
- chThdSleep(duration);
- StopCounter(tc);
-}
diff --git a/boards/OLIMEX_LPC_P2148/buzzer.h b/boards/OLIMEX_LPC_P2148/buzzer.h
deleted file mode 100644
index 82f573902..000000000
--- a/boards/OLIMEX_LPC_P2148/buzzer.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- 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 _BUZZER_H_
-#define _BUZZER_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- void buzzInit(void);
- void buzzPlay(uint32_t freq, systime_t duration);
- void buzzPlayWait(uint32_t freq, systime_t duration);
-#ifdef __cplusplus
-}
-#endif
-
-extern EventSource BuzzerSilentEventSource;
-
-#endif /* _BUZZER_H_ */