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

Subversion Repositories de1_olpcl2294_system

[/] [de1_olpcl2294_system/] [trunk/] [sw/] [ecos/] [debug/] [lib_dbg_sh.h] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 qaztronic
//
2
//
3
//
4
 
5
 
6
#include <pkgconf/hal.h>
7
#include <cyg/hal/hal_if.h>
8
#include <cyg/hal/hal_tables.h>
9
 
10
 
11
// CLI support functions
12
// externC bool parse_num(char *s, unsigned long *val, char **es, char *delim);
13
// externC bool parse_bool(char *s, bool *val);
14
 
15
typedef void cmd_fun(int argc, char *argv[]);
16
struct cmd {
17
    char    *str;
18
    char    *help;
19
    char    *usage;
20
    cmd_fun *fun;
21
    struct cmd *sub_cmds, *sub_cmds_end;
22
} CYG_HAL_TABLE_TYPE;
23
// externC struct cmd *cmd_search(struct cmd *tab, struct cmd *tabend, char *arg);
24
// externC void        cmd_usage(struct cmd *tab, struct cmd *tabend, char *prefix);
25
#define RedBoot_cmd(_s_,_h_,_u_,_f_) cmd_entry(_s_,_h_,_u_,_f_,0,0,RedBoot_commands)
26
#define RedBoot_nested_cmd(_s_,_h_,_u_,_f_,_subs_,_sube_) cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,RedBoot_commands)
27
#define _cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_)                                   \
28
cmd_fun _f_;                                                      \
29
struct cmd _cmd_tab_##_f_ CYG_HAL_TABLE_QUALIFIED_ENTRY(_n_,_f_) = {_s_, _h_, _u_, _f_, _subs_, _sube_};
30
#define cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_)                                   \
31
extern _cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_)
32
#define local_cmd_entry(_s_,_h_,_u_,_f_,_n_)                             \
33
static _cmd_entry(_s_,_h_,_u_,_f_,0,0,_n_)
34
 
35
#define CYGBLD_REDBOOT_MAX_MEM_SEGMENTS 1
36
#define CYGNUM_REDBOOT_CMD_LINE_EDITING 16
37
 
38
#define MAX_ARGV 16
39
 
40
// Option processing support
41
 
42
struct option_info {
43
    char flag;
44
    bool takes_arg;
45
    int  arg_type;
46
    void *arg;
47
    bool *arg_set;
48
    char *name;
49
};
50
 
51
#define NUM_ELEMS(s) (sizeof(s)/sizeof(s[0]))
52
 
53
#define OPTION_ARG_TYPE_NUM 0    // Numeric data
54
#define OPTION_ARG_TYPE_STR 1    // Generic string
55
#define OPTION_ARG_TYPE_FLG 2    // Flag only
56
 
57
 
58
// Command line parsing
59
externC struct cmd *parse(char **line, int *argc, char **argv);
60
 
61
externC void init_opts(struct option_info *opts, char flag, bool takes_arg,
62
                       int arg_type, void *arg, bool *arg_set, char *name);
63
externC bool scan_opts(int argc, char *argv[], int first,
64
                       struct option_info *opts, int num_opts,
65
                       void *def_arg, int def_arg_type, char *def_descr);
66
 
67
 
68
// RedBoot_cmd(
69
//   "iopeek",
70
//   "Read I/O location",
71
//   "[-b <location>] [-1|2|4]",
72
//   do_iopeek
73
// );
74
 
75
// RedBoot_cmd(
76
//   "iopoke",
77
//   "Write I/O location",
78
//   "[-b <location>] [-1|2|4] -v <value>",
79
//   do_iopoke
80
// );
81
 
82
 
83
// static void do_memtest (int argc, char *argv[]);
84
//     
85
// RedBoot_cmd(
86
//   "memtest", 
87
//   "Manage do_memtest", 
88
//   "-b <location> -l <length>", 
89
//   do_memtest
90
// );
91
 
92
 

powered by: WebSVN 2.1.0

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