summaryrefslogtreecommitdiff
path: root/cleopatre/u-boot-1.1.6/common/cmd_test.c
blob: 25588c597570cf2bb99c632be5898e1207bcb6f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <common.h>
#include <command.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>

int timer_init (void);

#define  TIMER_CUR_VAL      (  *( (volatile unsigned int *)(0xc0000000 + 0x04) )  )

#if (CONFIG_COMMANDS & CFG_CMD_TEST)

int do_test (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
    ulong nowtime = 0;

    printf("\n--- START ---\n");
    timer_init();

#if 0
    while( TIMER_CUR_VAL > ( 0xffffffff -  5*CFG_HZ ) )
        ;
#endif

    nowtime = get_timer(0);

    while (1)
    {

        if ( get_timer(nowtime) > 10*CFG_HZ )
        {
            break;
        }
    }

    printf("\n === END ===\n");

    return 0;
}

U_BOOT_CMD(
	test,	3,	2,	do_test,
	"test\t- user defined function to test U-Boot status\n",
    "user defined\n"
);

#endif	/* CFG_CMD_TEST */