huangcm
2025-09-01 53d8e046ac1bf2ebe94f671983e3d3be059df91a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
*********************************************************************************************************
*                                                AR100 System
*                                     AR100 Software System Develop Kits
*                                               Debugger Module
*
*                                    (c) Copyright 2012-2016, Sunny China
*                                             All Rights Reserved
*
* File    : debugger.h
* By      : Sunny
* Version : v1.0
* Date    : 2012-4-25
* Descript: debugger public header.
* Update  : date                auther      ver     notes
*           2012-4-25 16:19:40  Sunny       1.0     Create this file.
*********************************************************************************************************
*/
 
#ifndef __DEBUGGER_H__
#define __DEBUGGER_H__
 
#include <sys/errno.h>
/* extern u32 debug_level; */
 
 
#ifdef CFG_DEBUGGER_PRINTF
/*
*********************************************************************************************************
*                                           INITIALIZE DEBUGGER
*
* Description:  initialize debugger.
*
* Arguments  :  none.
*
* Returns    :  OK if initialize debugger succeeded, others if failed.
*********************************************************************************************************
*/
s32 debugger_init(void);
 
/*
*********************************************************************************************************
*                                           EXIT DEBUGGER
*
* Description:  exit debugger.
*
* Arguments  :  none.
*
* Returns    :  OK if exit debugger succeeded, others if failed.
*********************************************************************************************************
*/
s32 debugger_exit(void);
 
/*
*********************************************************************************************************
*                                           PUT A CHARSET
*
* Description:  put out a charset.
*
* Arguments  :  ch  : the charset which we want to put out.
*
* Returns    :  OK if put out charset succeeded, others if failed.
*********************************************************************************************************
*/
s32 debugger_putc(char ch);
 
/*
*********************************************************************************************************
*                                           GET A CHARSET
*
* Description:  get a charset.
*
* Arguments  :  none.
*
* Returns    :  the charset we read from uart.
*********************************************************************************************************
*/
u32 debugger_get(char *buf);
extern s32 debugger_puts(char *string);
 
/*
*********************************************************************************************************
*                                           FORMATTED PRINTF
*
* Description:  print out a formatted string, similar to ANSI-C function
*printf(). This function can support and only support the following conversion
*specifiers: %d  signed decimal integer. %u  unsigned decimal integer. %x
*unsigned hexadecimal integer, using hex digits 0x. %c  single character. %s
*character string.
*
* Arguments  :  format  : format control.
*               ...     : arguments.
*
* Returns    :  the number of characters printed out.
*
* Note       :  the usage refer to ANSI-C function printf().
*********************************************************************************************************
*/
s32 debugger_printf(u32 level, const char *format, ...);
s32 vprintk(u32 level, const char *format, va_list args);
 
/*
*********************************************************************************************************
*                                           SET DEBUG LEVEL
*
* Description:  set debug level.
*
* Arguments  :  para level.
*
* Returns    :  OK if set the debug level succeeded.
*********************************************************************************************************
*/
s32 set_debug_level(u32 level);
 
#else
static inline s32 debugger_init(void)
{
   return -ENOSYS;
}
 
static inline s32 debugger_exit(void)
{
   return -ENOSYS;
}
 
static inline s32 debugger_putc(char ch)
{
   return -ENOSYS;
}
 
static inline u32 debugger_get(char *buf)
{
   return -ENOSYS;
}
 
static inline s32 debugger_puts(char *string)
{
   return -ENOSYS;
}
 
static inline s32 debugger_printf(u32 level, const char *format, ...)
{
   return -ENOSYS;
}
 
static inline s32 vprintk(u32 level, const char *format, va_list args)
{
   return -ENOSYS;
}
 
static inline s32 set_debug_level(u32 level)
{
   return -ENOSYS;
}
 
#endif
 
#ifdef CFG_SHELL_USED
extern s32 getcmd(void *parg, u32 intno);
#else
static inline s32 getcmd(void *parg __attribute__((__unused__)),
            u32 intno __attribute__((__unused__)))
{
   return 0;
}
#endif
 
#endif /* __DEBUGGER_H__ */