添加了牛皮藓,主要方便不知情的人联系我。有洁癖者自己去除代码,在
[ddnasgpl.git] / diag / main.c
blob4fa38c791c4183d4f6252d40dc3db3008af6d380
2 #include <common.h>
3 #include <diag.h>
5 diag_func_t *diag_sequence[] =
7 mem_data_bus_test, /* DRAM Data bus test */
8 mem_address_bus_test, /* DRAM Address bus test */
9 mem_device_test, /* DRAM device test */
10 mvNandDetectTest,
11 mvNandBadBlockTest,
12 gbe_link_detect_test,
13 //gbe_mac_loopback_test,
14 //gbe_external_loopback_test,
15 mvNandReadWriteTest,
16 rtc_test, /* RTC test */
17 NULL,
20 unsigned int *mem_test_start_offset;
21 unsigned int *mem_test_end_offset;
23 void run_diag(void)
25 char board_name[30];
26 diag_func_t **diag_func_ptr;
28 printf("\n\nRunning diagnostics ...\n");
30 /* Get the start and the end memory address offset for memory test */
31 diag_get_mem_detail(&mem_test_start_offset, &mem_test_end_offset);
33 for (diag_func_ptr = diag_sequence; *diag_func_ptr; ++diag_func_ptr)
35 printf("\n");
36 if((*diag_func_ptr)())
37 break;
40 if(*diag_func_ptr == NULL)
41 printf("\nDiag completed\n");
42 else
43 printf("\nDiag FAILED\n");
46 void diag_init(char *board_name)
48 /* Init interrupts - we would need this as we use timer interrupt in udelay */
49 interrupt_init();
51 /* Initialize board so that all the GPIO are set & we are good to init serial */
52 diag_board_init(board_name);
54 /* Get the start and the end memory address offset for memory test */
55 diag_get_mem_detail(&mem_test_start_offset, &mem_test_end_offset);
57 /* Serial init */
58 diag_serial_init(DIAG_SERIAL_CONSOLE_PORT, DIAG_BAUD_RATE);