source: umon/apps/common/monlib.h @ 87db514

Last change on this file since 87db514 was 87db514, checked in by Amar Takhar <amar@…>, on 04/16/15 at 19:26:21

Initial commit of the umon repository.

Prior to this three changes were made:

  • Remove umon_ prefix from parent directories.
  • Collapse main/target/ into main/
  • Remove ports/template/flashtest.scr.ucon script.
  • Property mode set to 100644
File size: 8.3 KB
Line 
1/* monlib.h:
2 *      This header file is used by both the monitor and the application that
3 *      may reside on top of the monitor.
4 *      General notice:
5 *      This code is part of a boot-monitor package developed as a generic base
6 *      platform for embedded system designs.  As such, it is likely to be
7 *      distributed to various projects beyond the control of the original
8 *      author.  Please notify the author of any enhancements made or bugs found
9 *      so that all may benefit from the changes.  In addition, notification back
10 *      to the author will allow the new user to pick up changes that may have
11 *      been made by other users after this version of the code was distributed.
12 *
13 *      Note1: the majority of this code was edited with 4-space tabs.
14 *      Note2: as more and more contributions are accepted, the term "author"
15 *                 is becoming a mis-representation of credit.
16 *
17 *      Original author:        Ed Sutter
18 *      Email:                          esutter@lucent.com
19 *      Phone:                          908-582-2351
20 */
21#ifndef _MONLIB_H_
22#define _MONLIB_H_
23
24#include "tfs.h"
25#include "cli.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31
32extern int monConnect(int (*monptr)(int,void *,void *,void *),
33                void (*lock)(void),void (*unlock)(void));
34extern void mon_getargv(int *argc,char ***argv);
35extern void mon_intsrestore(unsigned long oldval);
36extern void mon_appexit(int exit_value);
37extern void mon_free(char *buffer);
38extern void mon_profiler(void *pdata);
39extern void mon_bbc(char *filename, int linenum);
40extern void mon_warmstart(unsigned long mask);
41extern void mon_delay(long msec);
42extern void mon_printpkt(char *buf, int size, int incoming);
43extern void mon_printmem(char *mem, int size, int ascii);
44
45
46extern int mon_com(int cmd,void *arg1,void *arg2,void *arg3);
47extern int mon_timer(int cmd, void * arg);
48extern int mon_setenv(char *varname,char *value);
49extern int mon_putchar(char c);
50extern int mon_getchar(void);
51extern int mon_gotachar(void);
52extern int mon_getbytes(char *buf,int count,int block);
53extern int mon_restart(int restart_value);
54extern int mon_tfsinit(void);
55extern int mon_tfsunlink(char *filename);
56extern int mon_tfslink(char *source, char *target);
57extern int mon_tfsrun(char **arglist,int verbosity);
58extern int mon_tfsfstat(char *filename,struct tfshdr *tfp);
59extern int mon_tfseof(int file_descriptor);
60extern int mon_tfstruncate(int file_descriptor,long length);
61extern int mon_tfsread(int file_descriptor,char *buffer,int size);
62extern int mon_tfswrite(int file_descriptor,char *buffer,int size);
63extern int mon_tfsopen(char *filename,long mode,char *buffer);
64extern int mon_tfsclose(int file_descriptor,char *info);
65extern int mon_tfsseek(int file_descriptor,int offset,int whence);
66extern int mon_tfsgetline(int file_descriptor,char *buffer,int bufsize);
67extern int mon_tfsipmod(char *name,char *buffer,int offset,int size);
68extern int mon_addcommand(struct monCommand *command_list,char *);
69extern int mon_docommand(char *cmdline,int verbosity);
70extern int mon_getline(char *buffer,int max,int ledit);
71extern int mon_decompress(char *src,int srcsize,char *dest);
72extern int mon_heapextend(char *base,int size);
73extern int mon_pcicfgwrite(int interface,int bus,int dev,int func,int reg,
74                unsigned long val);
75extern int mon_tfsadd(char *filename, char *info, char *flags,
76                unsigned char *src, int size);
77extern int mon_i2cwrite(int interface, int bigaddr, unsigned char *data,
78                int len);
79extern int mon_i2cread(int interface, int bigaddr, unsigned char *data,
80                int len);
81extern int mon_sendenetpkt(char *pkt, int len);
82extern int mon_recvenetpkt(char *pkt, int len);
83extern int mon_flashoverride(void *flashinfo, int get, int bank);
84extern int mon_flasherase(int snum);
85extern int mon_flashwrite(char *dest,char *src, int bytecnt);
86extern int mon_flashinfo(int snum,int *size, char **base);
87extern int mon_watchdog(void);
88extern int mon_timeofday(int cmd, void *arg);
89
90extern char *mon_getsym(char *symname, char *buf, int bufsize);
91extern char *mon_getenv(char *varname);
92extern char *mon_getenvp(void);
93extern char *mon_version(void);
94#ifdef MALLOC_DEBUG
95extern char *mon_malloc(int size,char *file, int line);
96extern char *mon_realloc(char *buf,int size,char *file, int line);
97#else
98extern char *mon_malloc(int size);
99extern char *mon_realloc(char *buf,int size);
100#endif
101
102extern long mon_tfsctrl(int command,long arg1,long arg2);
103extern long mon_tfstell(int file_descriptor);
104extern long mon_portcmd(int cmd, void *arg);
105
106extern unsigned short mon_xcrc16(char *buffer,long length);
107
108extern unsigned long mon_intsoff(void);
109
110extern unsigned long mon_pcicfgread(int interface,int bus,int dev,
111                int func,int reg);
112
113extern unsigned long mon_pcictrl(int interface, int cmd,
114                unsigned long arg1, unsigned long arg2);
115
116extern unsigned long mon_i2cctrl(int interface, int cmd,
117                unsigned long arg1, unsigned long arg2);
118
119extern unsigned long mon_assignhandler(long hnum,
120                unsigned long arg1,unsigned long arg2);
121
122extern struct tfshdr *mon_tfsnext(struct tfshdr *tfp);
123extern struct tfshdr *mon_tfsstat(char *filename);
124
125#if SHOWVARARGS
126extern void mon_memtrace(char *fmt, ...);
127extern int mon_printf(char *fmt, ...);
128extern int mon_cprintf(char *fmt, ...);
129extern int mon_sprintf(char *,char *fmt, ...);
130#else
131extern void mon_memtrace();
132extern int mon_printf();
133extern int mon_cprintf();
134extern int mon_sprintf();
135#endif
136
137#ifdef __cplusplus
138}
139#endif
140
141
142/* defines used by monConnect():
143 */
144#define GETMONFUNC_PUTCHAR                              1
145#define GETMONFUNC_GETCHAR                              2
146#define GETMONFUNC_GOTACHAR                             3
147#define GETMONFUNC_GETBYTES                             4
148#define GETMONFUNC_PRINTF                               5
149#define GETMONFUNC_CPRINTF                              6
150#define GETMONFUNC_SPRINTF                              7
151#define GETMONFUNC_RESTART                              8
152#define GETMONFUNC_GETENV                               9
153#define GETMONFUNC_SETENV                               10
154#define GETMONFUNC_TFSINIT                              11
155#define GETMONFUNC_TFSADD                               12
156#define GETMONFUNC_TFSUNLINK                    13
157#define GETMONFUNC_TFSRUN                               14
158#define GETMONFUNC_TFSNEXT                              15
159#define GETMONFUNC_TFSSTAT                              16
160#define GETMONFUNC_TFSREAD                              17
161#define GETMONFUNC_TFSWRITE                             18
162#define GETMONFUNC_TFSOPEN                              19
163#define GETMONFUNC_TFSCLOSE                             20
164#define GETMONFUNC_TFSSEEK                              21
165#define GETMONFUNC_TFSGETLINE                   22
166#define GETMONFUNC_TFSIPMOD                             23
167#define GETMONFUNC_TFSCTRL                              24
168#define GETMONFUNC_ADDCOMMAND                   25
169#define GETMONFUNC_DOCOMMAND                    26
170#define GETMONFUNC_GETARGV                              27
171#define GETMONFUNC_CRC16                                28
172#define GETMONFUNC_CRC32                                29
173#define GETMONFUNC_PIOGET                               30      /* NA (removed as of 1.0) */
174#define GETMONFUNC_PIOSET                               31      /* NA (removed as of 1.0) */
175#define GETMONFUNC_PIOCLR                               32      /* NA (removed as of 1.0) */
176#define GETMONFUNC_INTSOFF                              33
177#define GETMONFUNC_INTSRESTORE                  34
178#define GETMONFUNC_APPEXIT                              35
179#define GETMONFUNC_MALLOC                               36
180#define GETMONFUNC_FREE                                 37
181#define GETMONFUNC_GETLINE                              38
182#define GETMONFUNC_TFSFSTAT                             39
183#define GETMONFUNC_TFSEOF                               40
184#define GETMONFUNC_DECOMPRESS                   41
185#define GETMONFUNC_TFSTRUNCATE                  42
186#define GETMONFUNC_HEAPXTEND                    43
187#define GETMONFUNC_PROFILER                             44
188#define GETMONFUNC_TFSLINK                              45
189#define GETMONFUNC_BBC                                  46
190#define GETMONFUNC_MEMTRACE                             47
191#define GETMONFUNC_TFSTELL                              48
192#define GETMONFUNC_VERSION                              49
193#define GETMONFUNC_WARMSTART                    50
194#define GETMONFUNC_PCICFGREAD                   51
195#define GETMONFUNC_PCICFGWRITE                  52
196#define GETMONFUNC_PCICONTROL                   53
197#define GETMONFUNC_I2CREAD                              54
198#define GETMONFUNC_I2CWRITE                             55
199#define GETMONFUNC_I2CCONTROL                   56
200#define GETMONFUNC_MONDELAY                             57
201#define GETMONFUNC_GETENVP                              58
202#define GETMONFUNC_REALLOC                              59
203#define GETMONFUNC_SENDENETPKT                  60
204#define GETMONFUNC_RECVENETPKT                  61
205#define GETMONFUNC_GETSYM                               62
206#define GETMONFUNC_PRINTPKT                             63
207#define GETMONFUNC_FLASHWRITE                   64
208#define GETMONFUNC_FLASHERASE                   65
209#define GETMONFUNC_FLASHINFO                    66
210#define GETMONFUNC_ASSIGNHDLR                   67
211#define GETMONFUNC_WATCHDOG                             68
212#define GETMONFUNC_PRINTMEM                             69
213#define GETMONFUNC_PORTCMD                              70
214#define GETMONFUNC_TIMEOFDAY                    71
215#define GETMONFUNC_TIMER                                72
216#define GETMONFUNC_FLASHOVRRD                   73
217
218#define CACHEFTYPE_DFLUSH                               200
219#define CACHEFTYPE_IINVALIDATE                  201
220
221#define CHARFUNC_PUTCHAR                                300
222#define CHARFUNC_GETCHAR                                301
223#define CHARFUNC_GOTACHAR                               302
224#define CHARFUNC_RAWMODEON                              303
225#define CHARFUNC_RAWMODEOFF                             304
226
227#define ASSIGNFUNC_GETUSERLEVEL                 400
228
229
230/* Defines used by mon_warmstart():
231 */
232#define WARMSTART_IOINIT                        0x00000001
233#define WARMSTART_BSSINIT                       0x00000002
234#define WARMSTART_RUNMONRC                      0x00000004
235#define WARMSTART_MONHEADER                     0x00000008
236#define WARMSTART_TFSAUTOBOOT           0x00000010
237#define WARMSTART_BOARDINFO                     0x00000020
238#define WARMSTART_ALL                           0xffffffff
239#endif
Note: See TracBrowser for help on using the repository browser.