Nut/OS  4.10.3
API Reference
meminfo.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 by egnite GmbH
00003  *
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  * 2. Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  * 3. Neither the name of the copyright holders nor the names of
00016  *    contributors may be used to endorse or promote products derived
00017  *    from this software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00020  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00022  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00023  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00024  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00025  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00026  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00027  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00028  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00029  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00030  * SUCH DAMAGE.
00031  *
00032  * For additional information see http://www.ethernut.de/
00033  *
00034  */
00035 
00040 #include <dev/board.h>
00041 #include <sys/confnet.h>
00042 
00043 #if defined(NUT_CONFIG_X12RTC)
00044 #include <dev/x12rtc.h>
00045 #elif defined(NUT_CONFIG_AT45D)
00046 #include <dev/nvmem_at45d.h>
00047 #elif defined(NUT_CONFIG_AT45DB)
00048 #include <dev/at45db.h>
00049 #elif defined(NUT_CONFIG_AT49BV)
00050 #include <dev/at49bv.h>
00051 #elif defined(NUT_CONFIG_AT91EFC)
00052 #include <arch/arm/atmel/at91_efc.h>
00053 #elif defined(NUT_CONFIG_AT24)
00054 #include <dev/eeprom.h>
00055 #endif
00056 
00057 #include <stdio.h>
00058 #include "meminfo.h"
00059 
00060 /*
00061  * Print Nut Configuration.
00062  */
00063 void ShowHardwareConfiguration(void)
00064 {
00065     printf("Board   : ");
00066 #if defined(ARTHERNET1)
00067     puts("Arthernet 1");
00068 #elif defined(AT91SAM7X_EK)
00069     puts("AT91SAM7X(C)-EK");
00070 #elif defined(AT91SAM9260_EK)
00071     puts("AT91SAM9260-EK");
00072 #elif defined(CHARON2)
00073     puts("Charon II");
00074 #elif defined(ELEKTOR_IR1)
00075     puts("Elektor Internet Radio");
00076 #elif defined(ENET_SAM7X)
00077     puts("eNet-sam7X");
00078 #elif defined(ETHERNUT1)
00079     puts("Ethernut 1");
00080 #elif defined(ETHERNUT2)
00081     puts("Ethernut 2");
00082 #elif defined(ETHERNUT3)
00083 #if defined(NUT_CONFIG_X12RTC)
00084     puts("Ethernut 3.0");
00085 #else
00086     puts("Ethernut 3.1");
00087 #endif
00088 #elif defined(ETHERNUT5)
00089     puts("Ethernut 5");
00090 #elif defined(EVK1100)
00091     puts("EVK1100");
00092 #elif defined(EVK1104)
00093     puts("EVK1104");
00094 #elif defined(EVK1105)
00095     puts("EVK1105");
00096 #elif defined(GBAXPORT2)
00097     puts("GBA-XPORT2");
00098 #elif defined(MMNET01)
00099     puts("MMNet01");
00100 #elif defined(MMNET02)
00101     puts("MMNet02");
00102 #elif defined(MMNET03)
00103     puts("MMNet03");
00104 #elif defined(MMNET04)
00105     puts("MMNet04");
00106 #elif defined(MMNET101)
00107     puts("MMNet101");
00108 #elif defined(MMNET102)
00109     puts("MMNet102");
00110 #elif defined(MMNET103)
00111     puts("MMNet103");
00112 #elif defined(MMNET104)
00113     puts("MMNet104");
00114 #elif defined(MORPHOQ1)
00115     puts("Morphoq 1");
00116 #elif defined(OLIMEX_LPCE2294) 
00117     puts("Olimex LPCE2294");
00118 #elif defined(XNUT_100)
00119     puts("XNUT-100");
00120 #elif defined(XNUT_105)
00121     puts("XNUT-105");
00122 #elif defined(__arm__)
00123     puts("Generic ARM");
00124 #elif defined(__AVR32__)
00125     puts("Generic AVR32");
00126 #elif defined(__AVR__)
00127     puts("Generic AVR");
00128 #else
00129     puts("Unknown");
00130 #endif
00131 
00132     printf("Memory  : ");
00133 #if defined(NUT_CONFIG_X12RTC)
00134     puts("X12xx RTC EEPROM");
00135 
00136 #elif defined(NUT_CONFIG_AT45D)
00137     puts("AT45D DataFlash");
00138 #ifdef NUT_CONFIG_AT45D_PAGE
00139     printf("Page    : %d\n", NUT_CONFIG_AT45D_PAGE);
00140 #else
00141     puts("Page    : Last");
00142 #endif
00143     printf("Size    : %d\n", (int) SpiAt45dConfigSize());
00144 #ifdef DEV_SPIBUS
00145     if (DEV_SPIBUS.bus_base) {
00146         printf("SPI Base: 0x%08X\n", DEV_SPIBUS.bus_base);
00147     } else {
00148         puts("SPI     : Ext. or GPIO");
00149     }
00150 #else
00151     puts("SPI Base: Undefined", DEV_SPIBUS.bus_base);
00152 #endif
00153 #ifdef NUT_CONFIG_AT45D
00154     printf("Chip    : %d\n", NUT_CONFIG_AT45D);
00155 #else
00156     puts("Chip    : Undefined");
00157 #endif
00158 #ifdef NUT_CONFIG_AT45D_CS
00159     printf("Chip Sel: %d\n", NUT_CONFIG_AT45D_CS);
00160 #else
00161     puts("Chip Sel: Undefined");
00162 #endif
00163 
00164 #elif defined(NUT_CONFIG_AT45DB)
00165     puts("AT45D DataFlash (old, deprecated)");
00166 #ifdef AT45_CONF_SIZE
00167     printf("Size    : %d\n", AT45_CONF_SIZE);
00168 #else
00169     printf("Size    : %d\n", (int) At45dbPageSize());
00170 #endif
00171 #ifdef AT45_CONF_PAGE
00172     printf("Page    : %d\n", AT45_CONF_PAGE);
00173 #else
00174     puts("Page    : Last");
00175 #endif
00176 #ifdef AT45_CONF_DFSPI
00177     printf("SPI Base: 0x%08X\n", AT45_CONF_DFSPI);
00178 #else
00179     printf("SPI Base: 0x%08X\n", SPI0_BASE);
00180 #endif
00181 #ifdef AT45_CONF_DFPCS
00182     printf("Chip Sel: %d\n", AT45_CONF_DFPCS);
00183 #else
00184     puts("Chip Sel: 0");
00185 #endif
00186 
00187 #elif defined(NUT_CONFIG_AT49BV)
00188     puts("AT49BV NOR Flash");
00189 #ifdef FLASH_CONF_SIZE
00190     printf("Size    : %d\n", FLASH_CONF_SIZE);
00191 #else
00192     puts("Size    : 512");
00193 #endif
00194 #ifdef FLASH_CONF_SECTOR
00195     printf("Sector  : 0x%X\n", FLASH_CONF_SECTOR);
00196 #else
00197     puts("Sector  : 0x6000");
00198 #endif
00199 #ifdef FLASH_CHIP_BASE
00200     printf("NOR Base: 0x%08X\n", FLASH_CHIP_BASE);
00201 #else
00202     puts("NOR Base: 0x10000000");
00203 #endif
00204 
00205 #elif defined(__AVR__)
00206     puts("Internal EEPROM");
00207 
00208 #elif defined(NUT_CONFIG_AT91EFC)
00209     puts("AT91 Program Flash");
00210 #ifdef FLASH_CONF_SIZE
00211     printf("Size    : %d\n", FLASH_CONF_SIZE);
00212 #else
00213     puts("Size    : 256");
00214 #endif
00215 #ifdef FLASH_CONF_SECTOR
00216     printf("Sector  : 0x%X\n", FLASH_CONF_SECTOR);
00217 #elif defined(MCU_AT91SAM7S512) || defined(MCU_AT91SAM7SE512) || \
00218     defined(MCU_AT91SAM7X512) || defined(MCU_AT91SAM9XE512)
00219     puts("Sector  : 0x0007FF00");
00220 #else
00221     puts("Sector  : 0x0003FF00");
00222 #endif
00223 
00224 #elif defined(NUT_CONFIG_AT24)
00225     puts("AT24C32 EEPROM");
00226 #ifdef NUT_CONFIG_AT24_ADR
00227     printf("Address : 0x%02X\n", NUT_CONFIG_AT24_ADR);
00228 #else
00229     puts("Address : 0x50");
00230 #endif
00231 
00232 #else
00233     puts("Unknown");
00234 #endif
00235 }