From a72e0c20bb28d382fc7377f270b4d9944baeaf97 Mon Sep 17 00:00:00 2001 From: henryk Date: Mon, 11 Feb 2008 12:25:41 +0000 Subject: Framework to support run-time hardware selection. Future hardware releases should be changed to be boot-time detectable (e.g. using the yet unused AD inputs) so that one image can be used for all releases git-svn-id: https://svn.openpcd.org:2342/trunk@411 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpicc/config/board.c | 40 ++++++++++++++++++++++++++++++++++++++++ openpicc/config/board.h | 41 +++++++++++++++++++++++++---------------- 2 files changed, 65 insertions(+), 16 deletions(-) create mode 100644 openpicc/config/board.c (limited to 'openpicc/config') diff --git a/openpicc/config/board.c b/openpicc/config/board.c new file mode 100644 index 0000000..aaa1163 --- /dev/null +++ b/openpicc/config/board.c @@ -0,0 +1,40 @@ +/* OpenPICC pin assignment array for dynamic run-time configuration for different board layouts + * (C) 2008 Henryk Plötz + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "board.h" +#include "lib_AT91SAM7.h" + +const struct openpicc_hardware OPENPICC_HARDWARE[] = { + [OPENPICC_v0_4] = {OPENPICC_v0_4, + "OpenPICC v0.4", // release name + {0, 0,}, // features: data_gating, clock_gating + AT91C_PIO_PA4, // PLL_LOCK + -1, // CLOCK_GATE + -1, // DATA_GATE + }, + [OPENPICC_v0_4_p1] = {OPENPICC_v0_4_p1, + "OpenPICC v0.4 patchlevel 1", + {1, 1,}, + AT91C_PIO_PA5, + AT91C_PIO_PA4, + AT91C_PIO_PA31, + }, +}; + +const struct openpicc_hardware *OPENPICC; diff --git a/openpicc/config/board.h b/openpicc/config/board.h index 0cfc9a5..428acd4 100644 --- a/openpicc/config/board.h +++ b/openpicc/config/board.h @@ -52,13 +52,30 @@ /*-----------------*/ /* Board version */ /*-----------------*/ -/* Modified board, routing PLL_LOCK to PA5 and a copy of FRAME to PA4, enabling the use of the T/C BURST feature. */ -#define OPENPICC_MODIFIED_BOARD - -#ifdef OPENPICC_MODIFIED_BOARD -#define OPENPICC_USE_SSC_DATA_GATING -#define OPENPICC_USE_CLOCK_GATING -#endif +enum openpicc_release { + OPENPICC_v0_4, /* Schematics v0.4, as sold in the shop */ + + OPENPICC_v0_4_p1, /* based on schematics v0.4; Modifications: + * + PLL_LOCK relocated from PA4 to PA5 + * + Copy of FRAME routed to PA4 + * + Connection between R18 and 3V3 removed, instead R18 is now connected to PA31*/ +}; +struct openpicc_hardware { + enum openpicc_release release; + char *release_name; + struct { + int data_gating:1; + int clock_gating:1; + } features; + + int PLL_LOCK; + + int CLOCK_GATE; + int DATA_GATE; +}; + +extern const struct openpicc_hardware OPENPICC_HARDWARE[]; +extern const struct openpicc_hardware *OPENPICC; /*-----------------*/ /* Pins */ @@ -70,11 +87,6 @@ #define OPENPICC_PIO_SS2_DT_THRESH AT91C_PIO_PA8 #define OPENPICC_PIO_PLL_INHIBIT AT91C_PIO_PA24 -#ifdef OPENPICC_MODIFIED_BOARD -#define OPENPICC_PIO_PLL_LOCK AT91C_PIO_PA5 -#else -#define OPENPICC_PIO_PLL_LOCK AT91C_PIO_PA4 -#endif #define OPENPICC_MOD_PWM AT91C_PA23_PWM0 #define OPENPICC_MOD_SSC AT91C_PA17_TD @@ -83,10 +95,7 @@ #define OPENPICC_SSC_TF AT91C_PIO_PA15 #define OPENPICC_PIO_FRAME AT91C_PIO_PA20 -#ifdef OPENPICC_MODIFIED_BOARD -#define OPENPICC_PIO_FRAME_BURST AT91C_PIO_PA4 -#define OPENPICC_PIO_SSC_DATA_GATE AT91C_PIO_PA31 -#endif + #define OPENPICC_PIO_SSC_DATA_CONTROL AT91C_PIO_PA21 #define OPENPICC_PIO_AB_DETECT AT91C_PIO_PA22 #define OPENPICC_PIO_PLL_INHIBIT AT91C_PIO_PA24 -- cgit v1.2.3