Nut/OS  4.10.3
API Reference
board.h
Go to the documentation of this file.
00001 #ifndef _DEV_BOARD_H_
00002 #define _DEV_BOARD_H_
00003 
00004 /*
00005  * Copyright (C) 2001-2007 by egnite Software GmbH. All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. Neither the name of the copyright holders nor the names of
00017  *    contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00024  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00027  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00028  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00030  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  * For additional information see http://www.ethernut.de/
00034  */
00035 
00036 /*
00037  * $Log$
00038  * Revision 1.20  2009/09/20 13:24:58  ulrichprinz
00039  * Added limited USART support for DBGU.
00040  *
00041  * Revision 1.19  2009/03/08 20:19:34  haraldkipp
00042  * Fixed missing UART device for AVR.
00043  *
00044  * Revision 1.18  2009/03/05 22:16:57  freckle
00045  * use __NUT_EMULATION instead of __APPLE__, __linux__, or __CYGWIN__
00046  *
00047  * Revision 1.17  2009/01/09 17:54:28  haraldkipp
00048  * Added SPI bus controller for AVR and AT91.
00049  *
00050  * Revision 1.16  2008/10/23 08:56:56  haraldkipp
00051  * Added default MMC interfaces.
00052  *
00053  * Revision 1.15  2008/08/27 07:01:10  thornen
00054  * Added:
00055  *  - RTL          support for MMnet01..04
00056  *  - LANC111 support for MMnet101..104
00057  *  - RTC         support for MMnet02..04 and MMnet102..104
00058  *
00059  * Revision 1.14  2008/08/26 17:36:45  haraldkipp
00060  * Revoked changes 2008/08/26 by thornen.
00061  *
00062  * Revision 1.12  2008/08/06 12:51:12  haraldkipp
00063  * Added support for Ethernut 5 (AT91SAM9XE reference design).
00064  *
00065  * Revision 1.11  2008/02/15 17:09:44  haraldkipp
00066  * Added support for the Elektor Internet Radio.
00067  *
00068  * Revision 1.10  2007/10/08 06:37:51  hwmaier
00069  * Added RTC DS1307 for XNUT-100 and XNUT-105 units
00070  *
00071  * Revision 1.9  2007/10/04 20:32:24  olereinhardt
00072  * Support for SAM7S256 added
00073  *
00074  * Revision 1.8  2007/06/03 08:51:30  haraldkipp
00075  * RTC_CHIP definition now visible for ETHERNUT3 and MMNET02 only.
00076  *
00077  * Revision 1.7  2006/10/05 17:18:49  haraldkipp
00078  * Hardware independant RTC layer added.
00079  *
00080  * Revision 1.6  2006/08/31 19:01:08  haraldkipp
00081  * Using devDebug2 for the DBGU output was a bad idea. Some AT91 chips
00082  * provide more than two UARTs. We now use devDebug to specify the DBGU
00083  * device. Baudrate calculations failed on CPUs running on a processor
00084  * clock, which differs from a futher divided main clock. This had been
00085  * fixed.
00086  *
00087  * Revision 1.5  2006/07/05 07:45:29  haraldkipp
00088  * Split on-chip interface definitions.
00089  *
00090  * Revision 1.4  2006/06/28 17:17:50  haraldkipp
00091  * Added initial support for Atmel's AT91SAM7X-EK.
00092  *
00093  * Revision 1.3  2006/02/23 15:34:00  haraldkipp
00094  * Support for Philips LPC2xxx Family and LPC-E2294 Board from Olimex added.
00095  * Many thanks to Michael Fischer for this port.
00096  *
00097  * Revision 1.2  2005/11/22 09:19:03  haraldkipp
00098  * Include condition corrected.
00099  *
00100  * Revision 1.1  2005/11/20 14:43:38  haraldkipp
00101  * First check-in
00102  *
00103  */
00104 
00105 #include <cfg/arch.h>
00106 #include <cfg/uart.h>
00107 
00108 #if defined(ELEKTOR_IR1)
00109 #include <arch/arm/board/elektor_ir1.h>
00110 #elif defined(ETHERNUT1)
00111 #include <arch/avr/board/ethernut1.h>
00112 #elif defined(ETHERNUT2)
00113 #include <arch/avr/board/ethernut2.h>
00114 #elif defined(ETHERNUT3)
00115 #include <arch/arm/board/ethernut3.h>
00116 #elif defined(ETHERNUT5)
00117 #include <arch/arm/board/ethernut5.h>
00118 #endif
00119 
00120 /*
00121  * Debug device.
00122  */
00123 #include <dev/debug.h>
00124 
00125 #ifndef DEV_DEBUG
00126 #if defined(OLIMEX_LPCE2294) || defined(HHOPEN_63F) || defined(EVK1104)
00127 #define DEV_DEBUG       devDebug1
00128 #elif defined(DBGU_BASE)
00129 #define DEV_DEBUG       devDebug
00130 #else
00131 #define DEV_DEBUG       devDebug0
00132 #endif
00133 #endif
00134 
00135 #ifndef DEV_DEBUG_NAME
00136 #if defined(GBAXPORT2)
00137 #define DEV_DEBUG_NAME  "con"
00138 #elif defined(OLIMEX_LPCE2294) || defined(HHOPEN_63F) || defined(EVK1104)
00139 #define DEV_DEBUG_NAME  "uart1"
00140 #elif defined(DBGU_BASE)
00141 #define DEV_DEBUG_NAME  "dbgu"
00142 #else
00143 #define DEV_DEBUG_NAME  "uart0"
00144 #endif
00145 #endif
00146 
00147 /*
00148  * UART device.
00149  */
00150 #if defined(__AVR__) || defined(__NUT_EMULATION__)
00151 
00152 #include <dev/usartavr.h>
00153 
00154 #ifndef DEV_UART0
00155 #define DEV_UART0       devUsartAvr0
00156 #endif
00157 
00158 #ifndef DEV_UART1
00159 #define DEV_UART1       devUsartAvr1
00160 #endif
00161 
00162 #define DEV_UART1_NAME  "uart1"
00163 
00164 #elif defined(MCU_AT91)
00165 
00166 #include <dev/usartat91.h>
00167 
00168 #ifndef DEV_UART0
00169 #define DEV_UART0       devUsartAt910
00170 #endif
00171 
00172 #ifndef DEV_UART1
00173 #define DEV_UART1       devUsartAt911
00174 #endif
00175 
00176 #ifndef DEV_UARTD
00177 #define DEV_UARTD       devDbguAt91
00178 #endif
00179 
00180 #elif defined(__AVR32__)
00181 
00182 #include <dev/usartavr32.h>
00183 
00184 #ifndef DEV_UART0
00185 #define DEV_UART0       devUsartAvr320
00186 #endif
00187 
00188 #ifndef DEV_UART1
00189 #define DEV_UART1       devUsartAvr321
00190 #endif
00191 
00192 #ifndef DEV_UART2
00193 #define DEV_UART2       devUsartAvr322
00194 #endif
00195 
00196 #if defined(EVK1104) && !defined(DEV_UART)
00197 #define DEV_UART        DEV_UART1
00198 #define DEV_UART_NAME   DEV_UART1_NAME
00199 #endif
00200 
00201 #elif defined(GBAXPORT2)
00202 
00203 #define DEV_UART        DEV_DEBUG
00204 #define DEV_UART_NAME   DEV_DEBUG_NAME
00205 
00206 #endif
00207 
00208 #ifndef DEV_UART0
00209 #define DEV_UART0       devUart0
00210 #endif
00211 #ifndef DEV_UART0_NAME
00212 #define DEV_UART0_NAME  "uart0"
00213 #endif
00214 
00215 #if defined(DEV_UART1) && !defined(DEV_UART1_NAME)
00216 #define DEV_UART1_NAME  "uart1"
00217 #endif
00218 
00219 #if defined(DEV_UART2) && !defined(DEV_UART2_NAME)
00220 #define DEV_UART2_NAME  "uart2"
00221 #endif
00222 
00223 #if defined(DEV_UARTD) && !defined(DEV_UARTD_NAME)
00224 #define DEV_UARTD_NAME  "uartd"
00225 #endif
00226 
00227 #ifndef DEV_UART
00228 #define DEV_UART        DEV_UART0
00229 #endif
00230 #ifndef DEV_UART_NAME
00231 #define DEV_UART_NAME   DEV_UART0_NAME
00232 #endif
00233 
00234 /*
00235  * Console devices.
00236  */
00237 #ifndef DEV_CONSOLE
00238 #ifdef NUT_DEV_DEBUG_READ
00239 #define DEV_CONSOLE      DEV_DEBUG
00240 #ifndef DEV_CONSOLE_NAME
00241 #define DEV_CONSOLE_NAME DEV_DEBUG_NAME
00242 #endif
00243 #else
00244 #define DEV_CONSOLE      DEV_UART
00245 #ifndef DEV_CONSOLE_NAME
00246 #define DEV_CONSOLE_NAME DEV_UART_NAME
00247 #endif
00248 #endif
00249 #endif
00250 
00251 /*
00252  * Ethernet device.
00253  */
00254 #if defined(CHARON2) || defined(XNUT_100) || defined(XNUT_105) ||\
00255         defined(MMNET01) || defined(MMNET02) || defined(MMNET03) || defined(MMNET04) ||\
00256     defined(ARTHERNET1)
00257 #include <dev/nicrtl.h>
00258 #elif defined(MMNET101) || defined(MMNET102) || defined(MMNET103) || defined(MMNET104)
00259 #include <dev/lanc111.h>
00260 #elif defined(OLIMEX_LPCE2294)
00261 #include <dev/cs8900a.h>
00262 #elif defined(AT91SAM7X_EK) || defined(AT91SAM9260_EK) || defined(MORPHOQ1) || defined(ENET_SAM7X)
00263 #include <dev/at91_emac.h>
00264 #elif defined(EVK1100) || defined(EVK1105)
00265 #include <dev/avr32_macb.h>
00266 #endif
00267 
00268 #ifndef DEV_ETHER
00269 #include <dev/null_ether.h>
00270 #endif
00271 #ifndef DEV_ETHER_NAME
00272 #define DEV_ETHER_NAME  "eth0"
00273 #endif
00274 
00275 /*
00276  * SPI bus.
00277  */
00278 #ifndef DEV_SPIBUS
00279 #if defined(__AVR__)
00280 #include <dev/spibus_avr.h>
00281 #define DEV_SPIBUS0     spiBus0Avr
00282 #elif defined(MCU_AT91) && defined(SPI0_BASE)
00283 #include <dev/spibus_at91.h>
00284 #define DEV_SPIBUS0     spiBus0At91
00285 #elif defined(__AVR32__)
00286 #include <dev/spibus_avr32.h>
00287 #define DEV_SPIBUS0             spiBus0Avr32
00288 #define DEV_SPIBUS1             spiBus1Avr32
00289 #endif
00290 #endif /* DEV_SPIBUS */
00291 #ifndef DEV_SPIBUS
00292 #if defined(DEV_SPIBUS0)
00293 #define DEV_SPIBUS      DEV_SPIBUS0
00294 #elif defined(DEV_SPIBUS1)
00295 #define DEV_SPIBUS      DEV_SPIBUS1
00296 #endif
00297 #endif
00298 
00299 /*
00300  * RTC chip.
00301  */
00302 #if defined(XNUT_100) || defined(XNUT_105) ||\
00303           defined(MMNET102) || defined(MMNET103) || defined(MMNET104) ||\
00304           defined(MMNET02)  || defined(MMNET03)  || defined(MMNET04)
00305 #define RTC_CHIP0 rtcDs1307
00306 #include <dev/ds1307rtc.h>
00307 #elif defined(ENET_SAM7X)
00308 #define RTC_CHIP0 rtcPcf8563
00309 #include <dev/pcf8563.h>
00310 #endif
00311 
00312 #ifdef RTC_CHIP0
00313 #ifndef RTC_CHIP
00314 #define RTC_CHIP RTC_CHIP0
00315 #endif
00316 #endif
00317 
00318 /*
00319  * MultiMedia Card.
00320  */
00321 #if defined(AT91SAM7X_EK)
00322 #define DEV_MMCARD0         devAt91SpiMmc0
00323 #include <dev/spimmc_at91.h>
00324 #elif defined(AT91SAM9260_EK)
00325 #define DEV_MMCARD0         devAt91Mci0
00326 #define DEV_MMCARD0_NAME    "MCI0"
00327 #include <dev/at91_mci.h>
00328 #elif defined (ENET_SAM7X)
00329 #include <dev/spi_mmc_gpio.h>
00330 #define DEV_MMCARD0         devSpiMmcGpio
00331 #endif
00332 
00333 #if defined(DEV_MMCARD0)
00334 #ifndef DEV_MMCARD
00335 #define DEV_MMCARD          DEV_MMCARD0
00336 #endif
00337 #ifndef DEV_MMCARD0_NAME
00338 #define DEV_MMCARD0_NAME    "MMC0"
00339 #endif
00340 #ifndef DEV_MMCARD_NAME
00341 #define DEV_MMCARD_NAME     DEV_MMCARD0_NAME
00342 #endif
00343 #endif
00344 
00345 __BEGIN_DECLS
00346 /* Prototypes */
00347 
00348 extern void NutBoardInit(void);
00349 extern void NutIdleInit(void);
00350 extern void NutMainInit(void);
00351 
00352 __END_DECLS
00353 /* End of prototypes */
00354 
00355 #endif
00356