1
2
3
4
5
6
7
8#include <common.h>
9
10#if defined (CONFIG_SYS_NIOS_SYSID_BASE)
11
12#include <command.h>
13#include <asm/io.h>
14#include <linux/time.h>
15
16typedef volatile struct {
17 unsigned id;
18 unsigned timestamp;
19} nios_sysid_t;
20
21void display_sysid (void)
22{
23 nios_sysid_t *sysid = (nios_sysid_t *)CONFIG_SYS_NIOS_SYSID_BASE;
24 struct tm t;
25 char asc[32];
26 time_t stamp;
27
28 stamp = readl (&sysid->timestamp);
29 localtime_r (&stamp, &t);
30 asctime_r (&t, asc);
31 printf ("SYSID : %08lx, %s", readl (&sysid->id), asc);
32
33}
34
35int do_sysid (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
36{
37 display_sysid ();
38 return (0);
39}
40
41U_BOOT_CMD(
42 sysid, 1, 1, do_sysid,
43 "display Nios-II system id",
44 ""
45);
46#endif
47