tests.c 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /*
  2. * (C) Copyright 2002
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. *
  23. * Be sure to mark tests to be run before relocation as such with the
  24. * CONFIG_SYS_POST_PREREL flag so that logging is done correctly if the
  25. * logbuffer support is enabled.
  26. */
  27. #include <common.h>
  28. #include <config.h>
  29. #include <post.h>
  30. #define CONFIG_SYS_POST_FLASH 0x00004000
  31. #define CONFIG_SYS_POST_LED 0x00008000
  32. #define CONFIG_SYS_POST_BUTTON 0x00010000
  33. extern int cache_post_test(int flags);
  34. extern int watchdog_post_test(int flags);
  35. extern int i2c_post_test(int flags);
  36. extern int rtc_post_test(int flags);
  37. extern int memory_post_test(int flags);
  38. extern int cpu_post_test(int flags);
  39. extern int uart_post_test(int flags);
  40. extern int ether_post_test(int flags);
  41. extern int spi_post_test(int flags);
  42. extern int usb_post_test(int flags);
  43. extern int spr_post_test(int flags);
  44. extern int sysmon_post_test(int flags);
  45. extern int dsp_post_test(int flags);
  46. extern int codec_post_test(int flags);
  47. extern int sysmon_init_f(void);
  48. extern void sysmon_reloc(void);
  49. extern int flash_post_test(int flags);
  50. extern int led_post_test(int flags);
  51. extern int button_post_test(int flags);
  52. struct post_test post_list[] = {
  53. #if CONFIG_POST & CONFIG_SYS_POST_CACHE
  54. {
  55. "Cache test",
  56. "cache",
  57. "This test verifies the CPU cache operation.",
  58. POST_RAM | POST_ALWAYS,
  59. &cache_post_test,
  60. NULL,
  61. NULL,
  62. CONFIG_SYS_POST_CACHE},
  63. #endif
  64. #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
  65. {
  66. "Watchdog timer test",
  67. "watchdog",
  68. "This test checks the watchdog timer.",
  69. POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
  70. &watchdog_post_test,
  71. NULL,
  72. NULL,
  73. CONFIG_SYS_POST_WATCHDOG},
  74. #endif
  75. #if CONFIG_POST & CONFIG_SYS_POST_I2C
  76. {
  77. "I2C test",
  78. "i2c",
  79. "This test verifies the I2C operation.",
  80. POST_RAM | POST_ALWAYS,
  81. &i2c_post_test,
  82. NULL,
  83. NULL,
  84. CONFIG_SYS_POST_I2C},
  85. #endif
  86. #if CONFIG_POST & CONFIG_SYS_POST_RTC
  87. {
  88. "RTC test",
  89. "rtc",
  90. "This test verifies the RTC operation.",
  91. POST_RAM | POST_SLOWTEST | POST_MANUAL,
  92. &rtc_post_test,
  93. NULL,
  94. NULL,
  95. CONFIG_SYS_POST_RTC},
  96. #endif
  97. #if CONFIG_POST & CONFIG_SYS_POST_MEMORY
  98. {
  99. "Memory test",
  100. "memory",
  101. "This test checks RAM.",
  102. POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
  103. &memory_post_test,
  104. NULL,
  105. NULL,
  106. CONFIG_SYS_POST_MEMORY},
  107. #endif
  108. #if CONFIG_POST & CONFIG_SYS_POST_CPU
  109. {
  110. "CPU test",
  111. "cpu",
  112. "This test verifies the arithmetic logic unit of" " CPU.",
  113. POST_RAM | POST_ALWAYS,
  114. &cpu_post_test,
  115. NULL,
  116. NULL,
  117. CONFIG_SYS_POST_CPU},
  118. #endif
  119. #if CONFIG_POST & CONFIG_SYS_POST_UART
  120. {
  121. "UART test",
  122. "uart",
  123. "This test verifies the UART operation.",
  124. POST_RAM | POST_SLOWTEST | POST_MANUAL,
  125. &uart_post_test,
  126. NULL,
  127. NULL,
  128. CONFIG_SYS_POST_UART},
  129. #endif
  130. #if CONFIG_POST & CONFIG_SYS_POST_ETHER
  131. {
  132. "ETHERNET test",
  133. "ethernet",
  134. "This test verifies the ETHERNET operation.",
  135. POST_RAM | POST_ALWAYS | POST_MANUAL,
  136. &ether_post_test,
  137. NULL,
  138. NULL,
  139. CONFIG_SYS_POST_ETHER},
  140. #endif
  141. #if CONFIG_POST & CONFIG_SYS_POST_SPI
  142. {
  143. "SPI test",
  144. "spi",
  145. "This test verifies the SPI operation.",
  146. POST_RAM | POST_ALWAYS | POST_MANUAL,
  147. &spi_post_test,
  148. NULL,
  149. NULL,
  150. CONFIG_SYS_POST_SPI},
  151. #endif
  152. #if CONFIG_POST & CONFIG_SYS_POST_USB
  153. {
  154. "USB test",
  155. "usb",
  156. "This test verifies the USB operation.",
  157. POST_RAM | POST_ALWAYS | POST_MANUAL,
  158. &usb_post_test,
  159. NULL,
  160. NULL,
  161. CONFIG_SYS_POST_USB},
  162. #endif
  163. #if CONFIG_POST & CONFIG_SYS_POST_SPR
  164. {
  165. "SPR test",
  166. "spr",
  167. "This test checks SPR contents.",
  168. POST_ROM | POST_ALWAYS | POST_PREREL,
  169. &spr_post_test,
  170. NULL,
  171. NULL,
  172. CONFIG_SYS_POST_SPR},
  173. #endif
  174. #if CONFIG_POST & CONFIG_SYS_POST_SYSMON
  175. {
  176. "SYSMON test",
  177. "sysmon",
  178. "This test monitors system hardware.",
  179. POST_RAM | POST_ALWAYS,
  180. &sysmon_post_test,
  181. &sysmon_init_f,
  182. &sysmon_reloc,
  183. CONFIG_SYS_POST_SYSMON},
  184. #endif
  185. #if CONFIG_POST & CONFIG_SYS_POST_DSP
  186. {
  187. "DSP test",
  188. "dsp",
  189. "This test checks any connected DSP(s).",
  190. POST_RAM | POST_MANUAL,
  191. &dsp_post_test,
  192. NULL,
  193. NULL,
  194. CONFIG_SYS_POST_DSP},
  195. #endif
  196. #if CONFIG_POST & CONFIG_SYS_POST_CODEC
  197. {
  198. "CODEC test",
  199. "codec",
  200. "This test checks any connected codec(s).",
  201. POST_RAM | POST_MANUAL,
  202. &codec_post_test,
  203. NULL,
  204. NULL,
  205. CONFIG_SYS_POST_CODEC},
  206. #endif
  207. #if CONFIG_POST & CONFIG_SYS_POST_FLASH
  208. {
  209. "FLASH test",
  210. "flash",
  211. "This test checks flash.",
  212. POST_RAM | POST_ALWAYS | POST_MANUAL,
  213. &flash_post_test,
  214. NULL,
  215. NULL,
  216. CONFIG_SYS_POST_FLASH},
  217. #endif
  218. #if CONFIG_POST & CONFIG_SYS_POST_LED
  219. {
  220. "LED test",
  221. "LED",
  222. "This test checks LED ",
  223. POST_RAM | POST_ALWAYS | POST_MANUAL,
  224. &led_post_test,
  225. NULL,
  226. NULL,
  227. CONFIG_SYS_POST_LED},
  228. #endif
  229. #if CONFIG_POST & CONFIG_SYS_POST_BUTTON
  230. {
  231. "Button test",
  232. "button",
  233. "This test checks Button ",
  234. POST_RAM | POST_ALWAYS | POST_MANUAL,
  235. &button_post_test,
  236. NULL,
  237. NULL,
  238. CONFIG_SYS_POST_BUTTON},
  239. #endif
  240. };
  241. unsigned int post_list_size = sizeof(post_list) / sizeof(struct post_test);