From 7fa885a2010dbb800cb56ddff2b110f647f77bff Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 19 Nov 2012 08:42:07 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4828 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- boards/GENERIC_SPC560B/board.c | 73 +++++++++++++++++++++++++++++++++++++++++ boards/GENERIC_SPC560B/board.h | 72 ++++++++++++++++++++++++++++++++++++++++ boards/GENERIC_SPC560B/board.mk | 5 +++ boards/GENERIC_SPC560P/board.c | 8 ++--- boards/GENERIC_SPC560P/board.h | 2 +- 5 files changed, 155 insertions(+), 5 deletions(-) create mode 100644 boards/GENERIC_SPC560B/board.c create mode 100644 boards/GENERIC_SPC560B/board.h create mode 100644 boards/GENERIC_SPC560B/board.mk (limited to 'boards') diff --git a/boards/GENERIC_SPC560B/board.c b/boards/GENERIC_SPC560B/board.c new file mode 100644 index 000000000..bdcddbf2a --- /dev/null +++ b/boards/GENERIC_SPC560B/board.c @@ -0,0 +1,73 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "ch.h" +#include "hal.h" + +#if HAL_USE_PAL || defined(__DOXYGEN__) +/* Initial setup of all defined pads, the list is terminated by a {0, 0}.*/ +static const spc_siu_init_t spc_siu_init[] = { + {PCR(PB, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)}, + {PCR(PB, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT}, + {PCR(PD, PD_BUTTON1), PAL_LOW, PAL_MODE_INPUT}, + {PCR(PD, PD_BUTTON2), PAL_LOW, PAL_MODE_INPUT}, + {PCR(PD, PD_BUTTON3), PAL_LOW, PAL_MODE_INPUT}, + {PCR(PD, PD_BUTTON4), PAL_LOW, PAL_MODE_INPUT}, + {PCR(PD, PD_LED1), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, + {PCR(PD, PD_LED2), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, + {PCR(PD, PD_LED3), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, + {PCR(PD, PD_LED4), PAL_HIGH, PAL_MODE_OUTPUT_PUSHPULL}, + {0, 0, 0} +}; + +/* Initialization array for the PSMI registers.*/ +static const uint8_t spc_padsels_init[SPC5_SIU_NUM_PADSELS] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; + +/** + * @brief PAL setup. + */ +const PALConfig pal_default_config = +{ + PAL_MODE_UNCONNECTED, /* Default mode for all undefined pads. */ + spc_siu_init, + spc_padsels_init +}; +#endif + +/* + * Early initialization code. + * This initialization must be performed just after stack setup and before + * any other initialization. + */ +void __early_init(void) { + + spc560bc_clock_init(); +} + +/* + * Board-specific initialization code. + */ +void boardInit(void) { + +} diff --git a/boards/GENERIC_SPC560B/board.h b/boards/GENERIC_SPC560B/board.h new file mode 100644 index 000000000..afaaab95d --- /dev/null +++ b/boards/GENERIC_SPC560B/board.h @@ -0,0 +1,72 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +/* + * Setup for a generic SPC560Pxx proto board. + */ + +/* + * Board identifiers. + */ +#define BOARD_GENERIC_SPC560BC +#define BOARD_NAME "Generic SPC560B/C" + +/* + * Board frequencies. + */ +#if !defined(SPC5_XOSC_CLK) +#define SPC5_XOSC_CLK 40000000 +#endif + +/* + * I/O definitions. + */ +#define PB_LIN0_TDX 2 +#define PB_LIN0_RDX 3 + +#define PD_BUTTON1 0 +#define PD_BUTTON2 1 +#define PD_BUTTON3 2 +#define PD_BUTTON4 3 + +#define PD_LED1 4 +#define PD_LED2 5 +#define PD_LED3 6 +#define PD_LED4 7 + +/* + * Support macros. + */ +#define PCR(port, pin) (((port) * 16) + (pin)) + +#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/GENERIC_SPC560B/board.mk b/boards/GENERIC_SPC560B/board.mk new file mode 100644 index 000000000..26a9dc606 --- /dev/null +++ b/boards/GENERIC_SPC560B/board.mk @@ -0,0 +1,5 @@ +# List of all the board related files. +BOARDSRC = ${CHIBIOS}/boards/GENERIC_SPC560B/board.c + +# Required include directories +BOARDINC = ${CHIBIOS}/boards/GENERIC_SPC560B diff --git a/boards/GENERIC_SPC560P/board.c b/boards/GENERIC_SPC560P/board.c index 23154bf8d..caa317ec5 100644 --- a/boards/GENERIC_SPC560P/board.c +++ b/boards/GENERIC_SPC560P/board.c @@ -23,7 +23,7 @@ #if HAL_USE_PAL || defined(__DOXYGEN__) /* Initial setup of all defined pads, the list is terminated by a {0, 0}.*/ -static const spc560p_siu_init_t spc560p_siu_init[] = { +static const spc_siu_init_t spc_siu_init[] = { {PCR(PB, PB_LIN0_TDX), PAL_HIGH, PAL_MODE_OUTPUT_ALTERNATE(1)}, {PCR(PB, PB_LIN0_RDX), PAL_HIGH, PAL_MODE_INPUT}, {PCR(PD, PD_BUTTON1), PAL_LOW, PAL_MODE_INPUT}, @@ -38,7 +38,7 @@ static const spc560p_siu_init_t spc560p_siu_init[] = { }; /* Initialization array for the PSMI registers.*/ -static const uint8_t spc560p_padsels_init[SPC5_SIU_NUM_PADSELS] = { +static const uint8_t spc_padsels_init[SPC5_SIU_NUM_PADSELS] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 @@ -50,8 +50,8 @@ static const uint8_t spc560p_padsels_init[SPC5_SIU_NUM_PADSELS] = { const PALConfig pal_default_config = { PAL_MODE_UNCONNECTED, /* Default mode for all undefined pads. */ - spc560p_siu_init, - spc560p_padsels_init + spc_siu_init, + spc_padsels_init }; #endif diff --git a/boards/GENERIC_SPC560P/board.h b/boards/GENERIC_SPC560P/board.h index 60edcddec..48a49efc2 100644 --- a/boards/GENERIC_SPC560P/board.h +++ b/boards/GENERIC_SPC560P/board.h @@ -34,7 +34,7 @@ /* * Board frequencies. */ -#if !defined(SPC560P_XOSC_CLK) +#if !defined(SPC5_XOSC_CLK) #define SPC5_XOSC_CLK 40000000 #endif -- cgit v1.2.3