tests.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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. * CFG_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. #ifdef CONFIG_POST
  30. #include <post.h>
  31. #define CFG_POST_FLASH 0x00004000
  32. #define CFG_POST_LED 0x00008000
  33. #define CFG_POST_BUTTON 0x00010000
  34. extern int cache_post_test(int flags);
  35. extern int watchdog_post_test(int flags);
  36. extern int i2c_post_test(int flags);
  37. extern int rtc_post_test(int flags);
  38. extern int memory_post_test(int flags);
  39. extern int cpu_post_test(int flags);
  40. extern int uart_post_test(int flags);
  41. extern int ether_post_test(int flags);
  42. extern int spi_post_test(int flags);
  43. extern int usb_post_test(int flags);
  44. extern int spr_post_test(int flags);
  45. extern int sysmon_post_test(int flags);
  46. extern int dsp_post_test(int flags);
  47. extern int codec_post_test(int flags);
  48. extern int sysmon_init_f(void);
  49. extern void sysmon_reloc(void);
  50. extern int flash_post_test(int flags);
  51. extern int led_post_test(int flags);
  52. extern int button_post_test(int flags);
  53. struct post_test post_list[] = {
  54. #if CONFIG_POST & CFG_POST_CACHE
  55. {
  56. "Cache test",
  57. "cache",
  58. "This test verifies the CPU cache operation.",
  59. POST_RAM | POST_ALWAYS,
  60. &cache_post_test,
  61. NULL,
  62. NULL,
  63. CFG_POST_CACHE},
  64. #endif
  65. #if CONFIG_POST & CFG_POST_WATCHDOG
  66. {
  67. "Watchdog timer test",
  68. "watchdog",
  69. "This test checks the watchdog timer.",
  70. POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
  71. &watchdog_post_test,
  72. NULL,
  73. NULL,
  74. CFG_POST_WATCHDOG},
  75. #endif
  76. #if CONFIG_POST & CFG_POST_I2C
  77. {
  78. "I2C test",
  79. "i2c",
  80. "This test verifies the I2C operation.",
  81. POST_RAM | POST_ALWAYS,
  82. &i2c_post_test,
  83. NULL,
  84. NULL,
  85. CFG_POST_I2C},
  86. #endif
  87. #if CONFIG_POST & CFG_POST_RTC
  88. {
  89. "RTC test",
  90. "rtc",
  91. "This test verifies the RTC operation.",
  92. POST_RAM | POST_SLOWTEST | POST_MANUAL,
  93. &rtc_post_test,
  94. NULL,
  95. NULL,
  96. CFG_POST_RTC},
  97. #endif
  98. #if CONFIG_POST & CFG_POST_MEMORY
  99. {
  100. "Memory test",
  101. "memory",
  102. "This test checks RAM.",
  103. POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
  104. &memory_post_test,
  105. NULL,
  106. NULL,
  107. CFG_POST_MEMORY},
  108. #endif
  109. #if CONFIG_POST & CFG_POST_CPU
  110. {
  111. "CPU test",
  112. "cpu",
  113. "This test verifies the arithmetic logic unit of" " CPU.",
  114. POST_RAM | POST_ALWAYS,
  115. &cpu_post_test,
  116. NULL,
  117. NULL,
  118. CFG_POST_CPU},
  119. #endif
  120. #if CONFIG_POST & CFG_POST_UART
  121. {
  122. "UART test",
  123. "uart",
  124. "This test verifies the UART operation.",
  125. POST_RAM | POST_SLOWTEST | POST_MANUAL,
  126. &uart_post_test,
  127. NULL,
  128. NULL,
  129. CFG_POST_UART},
  130. #endif
  131. #if CONFIG_POST & CFG_POST_ETHER
  132. {
  133. "ETHERNET test",
  134. "ethernet",
  135. "This test verifies the ETHERNET operation.",
  136. POST_RAM | POST_ALWAYS | POST_MANUAL,
  137. &ether_post_test,
  138. NULL,
  139. NULL,
  140. CFG_POST_ETHER},
  141. #endif
  142. #if CONFIG_POST & CFG_POST_SPI
  143. {
  144. "SPI test",
  145. "spi",
  146. "This test verifies the SPI operation.",
  147. POST_RAM | POST_ALWAYS | POST_MANUAL,
  148. &spi_post_test,
  149. NULL,
  150. NULL,
  151. CFG_POST_SPI},
  152. #endif
  153. #if CONFIG_POST & CFG_POST_USB
  154. {
  155. "USB test",
  156. "usb",
  157. "This test verifies the USB operation.",
  158. POST_RAM | POST_ALWAYS | POST_MANUAL,
  159. &usb_post_test,
  160. NULL,
  161. NULL,
  162. CFG_POST_USB},
  163. #endif
  164. #if CONFIG_POST & CFG_POST_SPR
  165. {
  166. "SPR test",
  167. "spr",
  168. "This test checks SPR contents.",
  169. POST_ROM | POST_ALWAYS | POST_PREREL,
  170. &spr_post_test,
  171. NULL,
  172. NULL,
  173. CFG_POST_SPR},
  174. #endif
  175. #if CONFIG_POST & CFG_POST_SYSMON
  176. {
  177. "SYSMON test",
  178. "sysmon",
  179. "This test monitors system hardware.",
  180. POST_RAM | POST_ALWAYS,
  181. &sysmon_post_test,
  182. &sysmon_init_f,
  183. &sysmon_reloc,
  184. CFG_POST_SYSMON},
  185. #endif
  186. #if CONFIG_POST & CFG_POST_DSP
  187. {
  188. "DSP test",
  189. "dsp",
  190. "This test checks any connected DSP(s).",
  191. POST_RAM | POST_MANUAL,
  192. &dsp_post_test,
  193. NULL,
  194. NULL,
  195. CFG_POST_DSP},
  196. #endif
  197. #if CONFIG_POST & CFG_POST_CODEC
  198. {
  199. "CODEC test",
  200. "codec",
  201. "This test checks any connected codec(s).",
  202. POST_RAM | POST_MANUAL,
  203. &codec_post_test,
  204. NULL,
  205. NULL,
  206. CFG_POST_CODEC},
  207. #endif
  208. #if CONFIG_POST & CFG_POST_FLASH
  209. {
  210. "FLASH test",
  211. "flash",
  212. "This test checks flash.",
  213. POST_RAM | POST_ALWAYS | POST_MANUAL,
  214. &flash_post_test,
  215. NULL,
  216. NULL,
  217. CFG_POST_FLASH},
  218. #endif
  219. #if CONFIG_POST & CFG_POST_LED
  220. {
  221. "LED test",
  222. "LED",
  223. "This test checks LED ",
  224. POST_RAM | POST_ALWAYS | POST_MANUAL,
  225. &led_post_test,
  226. NULL,
  227. NULL,
  228. CFG_POST_LED},
  229. #endif
  230. #if CONFIG_POST & CFG_POST_BUTTON
  231. {
  232. "Button test",
  233. "button",
  234. "This test checks Button ",
  235. POST_RAM | POST_ALWAYS | POST_MANUAL,
  236. &button_post_test,
  237. NULL,
  238. NULL,
  239. CFG_POST_BUTTON},
  240. #endif
  241. };
  242. unsigned int post_list_size = sizeof(post_list) / sizeof(struct post_test);
  243. #endif /* CONFIG_POST */