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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [orpmon/] [cmds/] [global.c] - Blame information for rev 1767

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

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

powered by: WebSVN 2.1.0

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