source: umon/main/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.6 KB
Line 
1/**************************************************************************
2 *
3 * Copyright (c) 2013 Alcatel-Lucent
4 *
5 * Alcatel Lucent licenses this file to You under the Apache License,
6 * Version 2.0 (the "License"); you may not use this file except in
7 * compliance with the License.  A copy of the License is contained the
8 * file LICENSE at the top level of this repository.
9 * You may also obtain a copy of the License at:
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 **************************************************************************
20 *
21 * monlib.h:
22 *
23 * This header file is used by both the monitor and the application that
24 * may reside on top of the monitor.
25 *
26 * Original author:     Ed Sutter (ed.sutter@alcatel-lucent.com)
27 *
28 */
29#ifndef _MONLIB_H_
30#define _MONLIB_H_
31
32#include "tfs.h"
33#include "cli.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#ifndef SHOWVARARGS
40#define SHOWVARARGS 1
41#endif
42
43
44extern int monConnect(int (*monptr)(int,void *,void *,void *),
45                void (*lock)(void),void (*unlock)(void));
46extern void mon_getargv(int *argc,char ***argv);
47extern void mon_intsrestore(unsigned long oldval);
48extern void mon_appexit(int exit_value);
49extern void mon_free(char *buffer);
50extern void mon_profiler(void *pdata);
51extern void mon_bbc(char *filename, int linenum);
52extern void mon_warmstart(unsigned long mask);
53extern void mon_delay(long msec);
54extern void mon_printpkt(char *buf, int size, int incoming);
55extern void mon_printmem(char *mem, int size, int ascii);
56
57
58extern int mon_com(int cmd,void *arg1,void *arg2,void *arg3);
59extern int mon_timer(int cmd, void * arg);
60extern int mon_setenv(char *varname,char *value);
61extern int mon_putchar(char c);
62extern int mon_getchar(void);
63extern int mon_gotachar(void);
64extern int mon_getbytes(char *buf,int count,int block);
65extern int mon_restart(int restart_value);
66extern int mon_tfsinit(void);
67extern int mon_tfsunlink(char *filename);
68extern int mon_tfslink(char *source, char *target);
69extern int mon_tfsrun(char **arglist,int verbosity);
70extern int mon_tfsfstat(char *filename,struct tfshdr *tfp);
71extern int mon_tfseof(int file_descriptor);
72extern int mon_tfstruncate(int file_descriptor,long length);
73extern int mon_tfsread(int file_descriptor,char *buffer,int size);
74extern int mon_tfswrite(int file_descriptor,char *buffer,int size);
75extern int mon_tfsopen(char *filename,long mode,char *buffer);
76extern int mon_tfsclose(int file_descriptor,char *info);
77extern int mon_tfsseek(int file_descriptor,int offset,int whence);
78extern int mon_tfsgetline(int file_descriptor,char *buffer,int bufsize);
79extern int mon_tfsipmod(char *name,char *buffer,int offset,int size);
80extern int mon_addcommand(struct monCommand *command_list,char *);
81extern int mon_docommand(char *cmdline,int verbosity);
82extern int mon_getline(char *buffer,int max,int ledit);
83extern int mon_decompress(char *src,int srcsize,char *dest);
84extern int mon_heapextend(char *base,int size);
85extern int mon_pcicfgwrite(int interface,int bus,int dev,int func,int reg,
86                unsigned long val);
87extern int mon_tfsadd(char *filename, char *info, char *flags,
88                unsigned char *src, int size);
89extern int mon_i2cwrite(int interface, int bigaddr, unsigned char *data,
90                int len);
91extern int mon_i2cread(int interface, int bigaddr, unsigned char *data,
92                int len);
93extern int mon_sendenetpkt(char *pkt, int len);
94extern int mon_recvenetpkt(char *pkt, int len);
95extern int mon_flashoverride(void *flashinfo, int get, int bank);
96extern int mon_flasherase(int snum);
97extern int mon_flashwrite(char *dest,char *src, int bytecnt);
98extern int mon_flashinfo(int snum,int *size, char **base);
99extern int mon_watchdog(void);
100extern int mon_timeofday(int cmd, void *arg);
101
102extern char *mon_getsym(char *symname, char *buf, int bufsize);
103extern char *mon_getenv(char *varname);
104extern char *mon_getenvp(void);
105extern char *mon_version(void);
106#ifdef MALLOC_DEBUG
107extern char *mon_malloc(int size,char *file, int line);
108extern char *mon_realloc(char *buf,int size,char *file, int line);
109#else
110extern char *mon_malloc(int size);
111extern char *mon_realloc(char *buf,int size);
112#endif
113
114extern long mon_tfsctrl(int command,long arg1,long arg2);
115extern long mon_tfstell(int file_descriptor);
116extern long mon_portcmd(int cmd, void *arg);
117
118extern unsigned short mon_xcrc16(char *buffer,long length);
119extern unsigned long mon_crc32(char *buffer,long length);
120
121extern unsigned long mon_intsoff(void);
122
123extern unsigned long mon_pcicfgread(int interface,int bus,int dev,
124                int func,int reg);
125
126extern unsigned long mon_pcictrl(int interface, int cmd,
127                unsigned long arg1, unsigned long arg2);
128
129extern unsigned long mon_i2cctrl(int interface, int cmd,
130                unsigned long arg1, unsigned long arg2);
131
132extern unsigned long mon_assignhandler(long hnum,
133                unsigned long arg1,unsigned long arg2);
134
135extern struct tfshdr *mon_tfsnext(struct tfshdr *tfp);
136extern struct tfshdr *mon_tfsstat(char *filename);
137
138#if SHOWVARARGS
139extern void mon_memtrace(char *fmt, ...);
140extern int mon_printf(char *fmt, ...);
141extern int mon_cprintf(char *fmt, ...);
142extern int mon_sprintf(char *,char *fmt, ...);
143#else
144extern void mon_memtrace();
145extern int mon_printf();
146extern int mon_cprintf();
147extern int mon_sprintf();
148#endif
149
150#ifdef __cplusplus
151}
152#endif
153
154
155/* defines used by monConnect():
156 */
157#define GETMONFUNC_PUTCHAR                              1
158#define GETMONFUNC_GETCHAR                              2
159#define GETMONFUNC_GOTACHAR                             3
160#define GETMONFUNC_GETBYTES                             4
161#define GETMONFUNC_PRINTF                               5
162#define GETMONFUNC_CPRINTF                              6
163#define GETMONFUNC_SPRINTF                              7
164#define GETMONFUNC_RESTART                              8
165#define GETMONFUNC_GETENV                               9
166#define GETMONFUNC_SETENV                               10
167#define GETMONFUNC_TFSINIT                              11
168#define GETMONFUNC_TFSADD                               12
169#define GETMONFUNC_TFSUNLINK                    13
170#define GETMONFUNC_TFSRUN                               14
171#define GETMONFUNC_TFSNEXT                              15
172#define GETMONFUNC_TFSSTAT                              16
173#define GETMONFUNC_TFSREAD                              17
174#define GETMONFUNC_TFSWRITE                             18
175#define GETMONFUNC_TFSOPEN                              19
176#define GETMONFUNC_TFSCLOSE                             20
177#define GETMONFUNC_TFSSEEK                              21
178#define GETMONFUNC_TFSGETLINE                   22
179#define GETMONFUNC_TFSIPMOD                             23
180#define GETMONFUNC_TFSCTRL                              24
181#define GETMONFUNC_ADDCOMMAND                   25
182#define GETMONFUNC_DOCOMMAND                    26
183#define GETMONFUNC_GETARGV                              27
184#define GETMONFUNC_CRC16                                28
185#define GETMONFUNC_CRC32                                29
186#define GETMONFUNC_PIOGET                               30      /* NA (removed as of 1.0) */
187#define GETMONFUNC_PIOSET                               31      /* NA (removed as of 1.0) */
188#define GETMONFUNC_PIOCLR                               32      /* NA (removed as of 1.0) */
189#define GETMONFUNC_INTSOFF                              33
190#define GETMONFUNC_INTSRESTORE                  34
191#define GETMONFUNC_APPEXIT                              35
192#define GETMONFUNC_MALLOC                               36
193#define GETMONFUNC_FREE                                 37
194#define GETMONFUNC_GETLINE                              38
195#define GETMONFUNC_TFSFSTAT                             39
196#define GETMONFUNC_TFSEOF                               40
197#define GETMONFUNC_DECOMPRESS                   41
198#define GETMONFUNC_TFSTRUNCATE                  42
199#define GETMONFUNC_HEAPXTEND                    43
200#define GETMONFUNC_PROFILER                             44
201#define GETMONFUNC_TFSLINK                              45
202#define GETMONFUNC_BBC                                  46
203#define GETMONFUNC_MEMTRACE                             47
204#define GETMONFUNC_TFSTELL                              48
205#define GETMONFUNC_VERSION                              49
206#define GETMONFUNC_WARMSTART                    50
207#define GETMONFUNC_PCICFGREAD                   51
208#define GETMONFUNC_PCICFGWRITE                  52
209#define GETMONFUNC_PCICONTROL                   53
210#define GETMONFUNC_I2CREAD                              54
211#define GETMONFUNC_I2CWRITE                             55
212#define GETMONFUNC_I2CCONTROL                   56
213#define GETMONFUNC_MONDELAY                             57
214#define GETMONFUNC_GETENVP                              58
215#define GETMONFUNC_REALLOC                              59
216#define GETMONFUNC_SENDENETPKT                  60
217#define GETMONFUNC_RECVENETPKT                  61
218#define GETMONFUNC_GETSYM                               62
219#define GETMONFUNC_PRINTPKT                             63
220#define GETMONFUNC_FLASHWRITE                   64
221#define GETMONFUNC_FLASHERASE                   65
222#define GETMONFUNC_FLASHINFO                    66
223#define GETMONFUNC_ASSIGNHDLR                   67
224#define GETMONFUNC_WATCHDOG                             68
225#define GETMONFUNC_PRINTMEM                             69
226#define GETMONFUNC_PORTCMD                              70
227#define GETMONFUNC_TIMEOFDAY                    71
228#define GETMONFUNC_TIMER                                72
229#define GETMONFUNC_FLASHOVRRD                   73
230
231#define CACHEFTYPE_DFLUSH                               200
232#define CACHEFTYPE_IINVALIDATE                  201
233
234#define CHARFUNC_PUTCHAR                                300
235#define CHARFUNC_GETCHAR                                301
236#define CHARFUNC_GOTACHAR                               302
237#define CHARFUNC_RAWMODEON                              303
238#define CHARFUNC_RAWMODEOFF                             304
239
240#define ASSIGNFUNC_GETUSERLEVEL                 400
241#define ASSIGNFUNC_WATCHDOG                             401
242
243
244/* Defines used by mon_warmstart():
245 */
246#define WARMSTART_IOINIT                        0x00000001
247#define WARMSTART_BSSINIT                       0x00000002
248#define WARMSTART_RUNMONRC                      0x00000004
249#define WARMSTART_MONHEADER                     0x00000008
250#define WARMSTART_TFSAUTOBOOT           0x00000010
251#define WARMSTART_BOARDINFO                     0x00000020
252#define WARMSTART_ALL                           0xffffffff
253#endif
Note: See TracBrowser for help on using the repository browser.