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

Subversion Repositories de1_olpcl2294_system

[/] [de1_olpcl2294_system/] [trunk/] [sw/] [ecos/] [shell/] [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
//-----------------------------------------------------------------------------
59
// String functions. Some of these are duplicates of the same functions in
60
// the I18N package.
61
 
62
// Validate a hex character
63
__inline__ static bool
64
_is_hex(char c)
65
{
66
    return (((c >= '0') && (c <= '9')) ||
67
            ((c >= 'A') && (c <= 'F')) ||
68
            ((c >= 'a') && (c <= 'f')));
69
}
70
 
71
// Convert a single hex nibble
72
__inline__ static int
73
_from_hex(char c)
74
{
75
    int ret = 0;
76
 
77
    if ((c >= '0') && (c <= '9')) {
78
        ret = (c - '0');
79
    } else if ((c >= 'a') && (c <= 'f')) {
80
        ret = (c - 'a' + 0x0a);
81
    } else if ((c >= 'A') && (c <= 'F')) {
82
        ret = (c - 'A' + 0x0A);
83
    }
84
    return ret;
85
}
86
 
87
// Convert a character to lower case
88
__inline__ static char
89
_tolower(char c)
90
{
91
    if ((c >= 'A') && (c <= 'Z')) {
92
        c = (c - 'A') + 'a';
93
    }
94
    return c;
95
}
96
 
97
// Validate alpha
98
__inline__ static bool
99
isalpha(int c)
100
{
101
    return (((c >= 'a') && (c <= 'z')) ||
102
            ((c >= 'A') && (c <= 'Z')));
103
}
104
 
105
// Validate digit
106
__inline__ static bool
107
isdigit(int c)
108
{
109
    return ((c >= '0') && (c <= '9'));
110
}
111
 
112
// Validate alphanum
113
__inline__ static bool
114
isalnum(int c)
115
{
116
    return (isalpha(c) || isdigit(c));
117
}
118
 

powered by: WebSVN 2.1.0

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