meminfo.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. * Copyright (C) 2011 by egnite GmbH
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the copyright holders nor the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. * For additional information see http://www.ethernut.de/
  33. *
  34. */
  35. /*!
  36. * $Id$
  37. */
  38. #include <dev/board.h>
  39. #include <sys/confnet.h>
  40. #include <cfg/memory.h>
  41. #if defined(NUT_CONFIG_X12RTC)
  42. #include <dev/x12rtc.h>
  43. #elif defined(NUT_CONFIG_AT45D)
  44. #include <dev/nvmem_at45d.h>
  45. #elif defined(NUT_CONFIG_AT45DB)
  46. #include <dev/at45db.h>
  47. #elif defined(NUT_CONFIG_AT49BV)
  48. #include <dev/at49bv.h>
  49. #elif defined(NUT_CONFIG_AT91EFC)
  50. #include <arch/arm/atmel/at91_efc.h>
  51. #elif defined(NUT_CONFIG_AT24)
  52. #include <dev/eeprom.h>
  53. #endif
  54. #include <stdio.h>
  55. #include "meminfo.h"
  56. /*
  57. * Print Nut Configuration.
  58. */
  59. void ShowHardwareConfiguration(void)
  60. {
  61. printf("Board : %s\n", BOARDNAME);
  62. printf("Memory : ");
  63. #if defined(NUT_CONFIG_X12RTC)
  64. puts("X12xx RTC EEPROM");
  65. #elif defined(NUT_CONFIG_AT45D)
  66. puts("AT45D DataFlash");
  67. #ifdef NUT_CONFIG_AT45D_PAGE
  68. printf("Page : %d\n", NUT_CONFIG_AT45D_PAGE);
  69. #else
  70. puts("Page : Last");
  71. #endif
  72. printf("Size : %d\n", (int) SpiAt45dConfigSize());
  73. #ifdef DEV_SPIBUS
  74. if (DEV_SPIBUS.bus_base) {
  75. printf("SPI Base: 0x%08X\n", DEV_SPIBUS.bus_base);
  76. } else {
  77. puts("SPI : Ext. or GPIO");
  78. }
  79. #else
  80. puts("SPI Base: Undefined", DEV_SPIBUS.bus_base);
  81. #endif
  82. #ifdef NUT_CONFIG_AT45D
  83. printf("Chip : %d\n", NUT_CONFIG_AT45D);
  84. #else
  85. puts("Chip : Undefined");
  86. #endif
  87. #ifdef NUT_CONFIG_AT45D_CS
  88. printf("Chip Sel: %d\n", NUT_CONFIG_AT45D_CS);
  89. #else
  90. puts("Chip Sel: Undefined");
  91. #endif
  92. #elif defined(NUT_CONFIG_AT45DB)
  93. puts("AT45D DataFlash (old, deprecated)");
  94. #ifdef AT45_CONF_SIZE
  95. printf("Size : %d\n", AT45_CONF_SIZE);
  96. #else
  97. printf("Size : %d\n", (int) At45dbPageSize());
  98. #endif
  99. #ifdef AT45_CONF_PAGE
  100. printf("Page : %d\n", AT45_CONF_PAGE);
  101. #else
  102. puts("Page : Last");
  103. #endif
  104. #ifdef AT45_CONF_DFSPI
  105. printf("SPI Base: 0x%08X\n", AT45_CONF_DFSPI);
  106. #else
  107. printf("SPI Base: 0x%08X\n", SPI0_BASE);
  108. #endif
  109. #ifdef AT45_CONF_DFPCS
  110. printf("Chip Sel: %d\n", AT45_CONF_DFPCS);
  111. #else
  112. puts("Chip Sel: 0");
  113. #endif
  114. #elif defined(NUT_CONFIG_AT49BV)
  115. puts("AT49BV NOR Flash");
  116. #ifdef FLASH_CONF_SIZE
  117. printf("Size : %d\n", FLASH_CONF_SIZE);
  118. #else
  119. puts("Size : 512");
  120. #endif
  121. #ifdef FLASH_CONF_SECTOR
  122. printf("Sector : 0x%X\n", FLASH_CONF_SECTOR);
  123. #else
  124. puts("Sector : 0x6000");
  125. #endif
  126. #ifdef FLASH_CHIP_BASE
  127. printf("NOR Base: 0x%08X\n", FLASH_CHIP_BASE);
  128. #else
  129. puts("NOR Base: 0x10000000");
  130. #endif
  131. #elif defined(__AVR__)
  132. puts("Internal EEPROM");
  133. #elif defined(NUT_CONFIG_AT91EFC)
  134. puts("AT91 Program Flash");
  135. #ifdef FLASH_CONF_SIZE
  136. printf("Size : %d\n", FLASH_CONF_SIZE);
  137. #else
  138. puts("Size : 256");
  139. #endif
  140. #ifdef FLASH_CONF_SECTOR
  141. printf("Sector : 0x%X\n", FLASH_CONF_SECTOR);
  142. #elif defined(MCU_AT91SAM7S512) || defined(MCU_AT91SAM7SE512) || \
  143. defined(MCU_AT91SAM7X512) || defined(MCU_AT91SAM9XE512)
  144. puts("Sector : 0x0007FF00");
  145. #else
  146. puts("Sector : 0x0003FF00");
  147. #endif
  148. #elif defined(NUT_CONFIG_AT24)
  149. puts("AT24C32 EEPROM");
  150. #ifdef NUT_CONFIG_AT24_ADR
  151. printf("Address : 0x%02X\n", NUT_CONFIG_AT24_ADR);
  152. #else
  153. puts("Address : 0x50");
  154. #endif
  155. #elif defined(NUT_CONFIG_STM32L1_EEPROM)
  156. puts("Internal EEPROM");
  157. #elif defined(NUT_CONFIG_STM32_IAP)
  158. puts("STM32F1/2/3/4 NOR Flash");
  159. printf("Size : %d\n", FLASH_CONF_SIZE);
  160. #else
  161. puts("Unknown");
  162. #endif
  163. }