OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [cmds/] [global.c] - Blame information for rev 478

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 marcus.erl
#include "common.h"
2
#include "support.h"
3
 
4
global_struct global;
5
 
6 406 julius
int src_addr_cmd(int argc, char *argv[])
7 2 marcus.erl
{
8 406 julius
        if (argc == 1) {
9
                global.src_addr = strtoul(argv[0], 0, 0);
10
                return 0;
11
        } else
12
                return -1;
13 2 marcus.erl
}
14
 
15 406 julius
int dst_addr_cmd(int argc, char *argv[])
16 2 marcus.erl
{
17 406 julius
        if (argc == 1) {
18
                global.dst_addr = strtoul(argv[0], 0, 0);
19
                return 0;
20
        } else
21
                return -1;
22 2 marcus.erl
}
23
 
24 406 julius
int length_cmd(int argc, char *argv[])
25 2 marcus.erl
{
26 406 julius
        if (argc == 1) {
27
                global.length = strtoul(argv[0], 0, 0);
28
                return 0;
29
        } else
30
                return -1;
31 2 marcus.erl
}
32
 
33 406 julius
int ip_cmd(int argc, char *argv[])
34 2 marcus.erl
{
35 406 julius
        if (argc == 1) {
36
                global.ip = parse_ip(argv[0]);
37
                return 0;
38
        } else
39
                return -1;
40 2 marcus.erl
}
41
 
42 406 julius
int srv_ip_cmd(int argc, char *argv[])
43 2 marcus.erl
{
44 406 julius
        if (argc == 1) {
45
                global.srv_ip = parse_ip(argv[0]);
46
                return 0;
47
        } else
48
                return -1;
49 2 marcus.erl
}
50
 
51 406 julius
int erase_method_cmd(int argc, char *argv[])
52 2 marcus.erl
{
53 406 julius
        if (argc == 1) {
54
                int a = strtoul(argv[0], 0, 0);
55
                if (a < 0 || a > 2)
56
                        return -1;
57
                global.erase_method = a;
58
                return 0;
59
        } else
60
                return -1;
61 2 marcus.erl
}
62
 
63 406 julius
int start_addr_cmd(int argc, char *argv[])
64 2 marcus.erl
{
65 406 julius
        if (argc == 1) {
66
                global.start_addr = strtoul(argv[0], 0, 0);
67
                return 0;
68
        } else
69
                return -1;
70 2 marcus.erl
}
71
 
72 467 julius
 
73 406 julius
int globals_cmd(int argc, char *argv[])
74 2 marcus.erl
{
75 467 julius
#if HELP_ENABLED
76 406 julius
        const char *erase_method_desc[] =
77
            { "do not erase", "fully", "as needed" };
78
        if (argc)
79
                return -1;
80
        printf("src_addr = %08lx\n", global.src_addr);
81
        printf("dst_addr = %08lx\n", global.dst_addr);
82
        printf("start_addr = %08lx\n", global.start_addr);
83
        printf("length = %08lx\n", global.length);
84
        printf("ip = %08lx\n", global.ip);
85
        printf("srv_ip = %08lx\n", global.srv_ip);
86
        printf("erase_method = %i (%s)\n", (int)global.erase_method,
87
               erase_method_desc[global.erase_method]);
88 467 julius
#endif /* HELP_ENABLED */
89 406 julius
        return 0;
90 467 julius
 
91 2 marcus.erl
}
92
 
93 467 julius
 
94
 
95 406 julius
void module_global_init(void)
96 2 marcus.erl
{
97 406 julius
        register_command("src_addr", "<value>",
98
                         "sets global parameter source address", src_addr_cmd);
99
        register_command("dst_addr", "<value>",
100
                         "sets global parameter destination address",
101
                         dst_addr_cmd);
102
        register_command("start_addr", "<value>", "sets start address",
103
                         start_addr_cmd);
104
        register_command("length", "<value>", "sets global parameter length",
105
                         length_cmd);
106
        register_command("ip", "<value> <value> <value>",
107
                         "sets global parameter ip address", ip_cmd);
108
        register_command("srv_ip", "<value> <value> <value>",
109
                         "sets global parameter server ip address", srv_ip_cmd);
110
        register_command("erase_method", "<value> <value> <value>",
111
                         "sets flash erase method (0 = do not erase, 1 = fully, 2 = as needed)",
112
                         erase_method_cmd);
113
        if (HELP_ENABLED)
114
                register_command("globals", "", "show globals", globals_cmd);
115 2 marcus.erl
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.