OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

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
#if HELP_ENABLED
73 406 julius
int globals_cmd(int argc, char *argv[])
74 2 marcus.erl
{
75 406 julius
        const char *erase_method_desc[] =
76
            { "do not erase", "fully", "as needed" };
77
        if (argc)
78
                return -1;
79
        printf("src_addr = %08lx\n", global.src_addr);
80
        printf("dst_addr = %08lx\n", global.dst_addr);
81
        printf("start_addr = %08lx\n", global.start_addr);
82
        printf("length = %08lx\n", global.length);
83
        printf("ip = %08lx\n", global.ip);
84
        printf("srv_ip = %08lx\n", global.srv_ip);
85
        printf("erase_method = %i (%s)\n", (int)global.erase_method,
86
               erase_method_desc[global.erase_method]);
87
        return 0;
88 2 marcus.erl
}
89
#endif /* HELP_ENABLED */
90
 
91 406 julius
void module_global_init(void)
92 2 marcus.erl
{
93 406 julius
        register_command("src_addr", "<value>",
94
                         "sets global parameter source address", src_addr_cmd);
95
        register_command("dst_addr", "<value>",
96
                         "sets global parameter destination address",
97
                         dst_addr_cmd);
98
        register_command("start_addr", "<value>", "sets start address",
99
                         start_addr_cmd);
100
        register_command("length", "<value>", "sets global parameter length",
101
                         length_cmd);
102
        register_command("ip", "<value> <value> <value>",
103
                         "sets global parameter ip address", ip_cmd);
104
        register_command("srv_ip", "<value> <value> <value>",
105
                         "sets global parameter server ip address", srv_ip_cmd);
106
        register_command("erase_method", "<value> <value> <value>",
107
                         "sets flash erase method (0 = do not erase, 1 = fully, 2 = as needed)",
108
                         erase_method_cmd);
109
        if (HELP_ENABLED)
110
                register_command("globals", "", "show globals", globals_cmd);
111 2 marcus.erl
}

powered by: WebSVN 2.1.0

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