summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/common/cli.h126
-rw-r--r--apps/common/crt0_arm.S16
-rw-r--r--apps/common/crt0_bfin.S58
-rw-r--r--apps/common/crt0_cf.S14
-rw-r--r--apps/common/crt0_mb.S16
-rw-r--r--apps/common/crt0_ppc.S24
-rw-r--r--apps/common/cygprof.c10
-rw-r--r--apps/common/monlib.c1158
-rw-r--r--apps/common/monlib.h234
-rw-r--r--apps/common/tfs.h290
-rw-r--r--apps/common/timer.h40
-rw-r--r--apps/demo/main.c325
-rw-r--r--apps/demo/strace.c46
13 files changed, 1179 insertions, 1178 deletions
diff --git a/apps/common/cli.h b/apps/common/cli.h
index 6384816..ac85ffa 100644
--- a/apps/common/cli.h
+++ b/apps/common/cli.h
@@ -1,22 +1,22 @@
/* cli.h:
* Header file for Command Line Interface related stuff.
*
- * General notice:
- * This code is part of a boot-monitor package developed as a generic base
- * platform for embedded system designs. As such, it is likely to be
- * distributed to various projects beyond the control of the original
- * author. Please notify the author of any enhancements made or bugs found
- * so that all may benefit from the changes. In addition, notification back
- * to the author will allow the new user to pick up changes that may have
- * been made by other users after this version of the code was distributed.
+ * General notice:
+ * This code is part of a boot-monitor package developed as a generic base
+ * platform for embedded system designs. As such, it is likely to be
+ * distributed to various projects beyond the control of the original
+ * author. Please notify the author of any enhancements made or bugs found
+ * so that all may benefit from the changes. In addition, notification back
+ * to the author will allow the new user to pick up changes that may have
+ * been made by other users after this version of the code was distributed.
*
- * Note1: the majority of this code was edited with 4-space tabs.
- * Note2: as more and more contributions are accepted, the term "author"
- * is becoming a mis-representation of credit.
+ * Note1: the majority of this code was edited with 4-space tabs.
+ * Note2: as more and more contributions are accepted, the term "author"
+ * is becoming a mis-representation of credit.
*
- * Original author: Ed Sutter
- * Email: esutter@lucent.com
- * Phone: 908-582-2351
+ * Original author: Ed Sutter
+ * Email: esutter@lucent.com
+ * Phone: 908-582-2351
*/
#ifndef _cli_h
#define _cli_h
@@ -27,12 +27,12 @@ extern "C" {
/* Command table structure used by the monitor:
*/
-struct monCommand {
- char *name; /* Name of command seen by user. */
- int (*func)(int,char **); /* Called when command is invoked. */
- char **helptxt; /* Help text (see notes below). */
- long flags; /* Single-bit flags for various uses */
- /* (see the CMDFLAG_XXX macros). */
+struct monCommand {
+ char *name; /* Name of command seen by user. */
+ int (*func)(int,char **); /* Called when command is invoked. */
+ char **helptxt; /* Help text (see notes below). */
+ long flags; /* Single-bit flags for various uses */
+ /* (see the CMDFLAG_XXX macros). */
};
#ifdef __cplusplus
@@ -42,17 +42,17 @@ struct monCommand {
/* Bits currently assigned to command flags used in the monCommand
* structure...
*/
-#define CMDFLAG_NOMONRC 1
+#define CMDFLAG_NOMONRC 1
/* Maximum size of a command line:
*/
#ifndef CMDLINESIZE
-#define CMDLINESIZE 128
+#define CMDLINESIZE 128
#endif
/* Maximum number of arguments in a command line:
*/
-#define ARGCNT 24
+#define ARGCNT 24
/* Definitions for docommand() return values:
*
@@ -61,42 +61,42 @@ struct monCommand {
* (CMD_LINE_ERROR, CMD_ULVL_DENIED and CMD_NOT_FOUND) are used only by
# the docommand() function.
*
- * CMD_SUCCESS:
- * Everything worked ok.
- * CMD_FAILURE:
- * Command parameters were valid, but command itself failed for some other
- * reason. The docommand() function does not print a message here, it
- * is assumed that the error message was printed by the local function.
- * CMD_PARAM_ERROR:
- * Command line did not parse properly. Control was passed to a
- * local command function, but argument syntax caused it to choke.
- * In this case docommand() will print out the generic CLI syntax error
- * message.
- * CMD_LINE_ERROR:
- * Command line itself was invalid. Too many args, invalid shell var
- * syntax, etc.. Somekind of command line error prior to checking for
- * the command name-to-function match.
- * CMD_ULVL_DENIED:
- * Command's user level is higher than current user level, so access
- * is denied.
- * CMD_NOT_FOUND:
- * Since these same return values are used for each command function
- * plus the docommand() function, this error indicates that docommand()
- * could not even find the command in the command table.
- * CMD_MONRC_DENIED:
- * The command cannot execute because it is considered illegal
- * when run from within the monrc file.
+ * CMD_SUCCESS:
+ * Everything worked ok.
+ * CMD_FAILURE:
+ * Command parameters were valid, but command itself failed for some other
+ * reason. The docommand() function does not print a message here, it
+ * is assumed that the error message was printed by the local function.
+ * CMD_PARAM_ERROR:
+ * Command line did not parse properly. Control was passed to a
+ * local command function, but argument syntax caused it to choke.
+ * In this case docommand() will print out the generic CLI syntax error
+ * message.
+ * CMD_LINE_ERROR:
+ * Command line itself was invalid. Too many args, invalid shell var
+ * syntax, etc.. Somekind of command line error prior to checking for
+ * the command name-to-function match.
+ * CMD_ULVL_DENIED:
+ * Command's user level is higher than current user level, so access
+ * is denied.
+ * CMD_NOT_FOUND:
+ * Since these same return values are used for each command function
+ * plus the docommand() function, this error indicates that docommand()
+ * could not even find the command in the command table.
+ * CMD_MONRC_DENIED:
+ * The command cannot execute because it is considered illegal
+ * when run from within the monrc file.
*/
-#define CMD_SUCCESS 0
-#define CMD_FAILURE -1
-#define CMD_PARAM_ERROR -2
-#define CMD_LINE_ERROR -3
-#define CMD_ULVL_DENIED -4
-#define CMD_NOT_FOUND -5
-#define CMD_MONRC_DENIED -6
+#define CMD_SUCCESS 0
+#define CMD_FAILURE -1
+#define CMD_PARAM_ERROR -2
+#define CMD_LINE_ERROR -3
+#define CMD_ULVL_DENIED -4
+#define CMD_NOT_FOUND -5
+#define CMD_MONRC_DENIED -6
/* Notes on help text array:
- * The monitor's CLI processor assumes that every command's help text
+ * The monitor's CLI processor assumes that every command's help text
* array abides by a few basic rules...
* First of all, it assumes that every array has AT LEAST two strings.
* The first string in the array of strings is assumed to be a one-line
@@ -111,13 +111,13 @@ struct monCommand {
* know where the end is.
* Following is an example help text array...
*
- * char *HelpHelp[] = {
- * "Display command set",
- * "-[d] [commandname]",
- * "Options:",
- * " -d list commands and descriptions",
- * 0,
- * };
+ * char *HelpHelp[] = {
+ * "Display command set",
+ * "-[d] [commandname]",
+ * "Options:",
+ * " -d list commands and descriptions",
+ * 0,
+ * };
*
*/
#endif
diff --git a/apps/common/crt0_arm.S b/apps/common/crt0_arm.S
index 6e49597..58a23bf 100644
--- a/apps/common/crt0_arm.S
+++ b/apps/common/crt0_arm.S
@@ -1,13 +1,13 @@
#include "cfg.h"
- .extern AppStack
- .extern Cstart
- .global start
+.extern AppStack
+.extern Cstart
+.global start
- /* Set stack pointer to end of AppStack and jump to Cstart:
- */
+/* Set stack pointer to end of AppStack and jump to Cstart:
+ */
start:
- ldr sp, =(AppStack + APPSTACKSIZE - 4)
+ldr sp, =(AppStack + APPSTACKSIZE - 4)
-jump_to_c:
- bl Cstart
+ jump_to_c:
+ bl Cstart
diff --git a/apps/common/crt0_bfin.S b/apps/common/crt0_bfin.S
index dda3a82..2cac2b9 100644
--- a/apps/common/crt0_bfin.S
+++ b/apps/common/crt0_bfin.S
@@ -1,34 +1,34 @@
#include "cfg.h"
-
- .extern _AppStack
- .extern _Cstart
- .global start
- .text
+.extern _AppStack
+.extern _Cstart
+.global start
+
+.text
start:
- /* Clear all DAG registers:
- */
- R0 = 0
- I0 = R0
- I1 = R0
- I2 = R0
- I3 = R0
- L0 = R0
- L1 = R0
- L2 = R0
- L3 = R0
- B0 = R0
- B1 = R0
- B2 = R0
- B3 = R0
- M0 = R0
- M1 = R0
- M2 = R0
- M3 = R0
- LC0 = R0;
- LC1 = R0;
+/* Clear all DAG registers:
+ */
+R0 = 0
+ I0 = R0
+ I1 = R0
+ I2 = R0
+ I3 = R0
+ L0 = R0
+ L1 = R0
+ L2 = R0
+ L3 = R0
+ B0 = R0
+ B1 = R0
+ B2 = R0
+ B3 = R0
+ M0 = R0
+ M1 = R0
+ M2 = R0
+ M3 = R0
+ LC0 = R0;
+LC1 = R0;
- sp.h = _AppStack+(APPSTACKSIZE-32)
- sp.l = _AppStack+(APPSTACKSIZE-32)
- jump _Cstart
+sp.h = _AppStack+(APPSTACKSIZE-32)
+ sp.l = _AppStack+(APPSTACKSIZE-32)
+ jump _Cstart
diff --git a/apps/common/crt0_cf.S b/apps/common/crt0_cf.S
index 929c7ce..0caa049 100644
--- a/apps/common/crt0_cf.S
+++ b/apps/common/crt0_cf.S
@@ -1,11 +1,11 @@
#include "cfg.h"
-
- .extern AppStack
- .extern Cstart
- .global start
- .text
+.extern AppStack
+.extern Cstart
+.global start
+
+.text
start:
- move.l #AppStack+(APPSTACKSIZE-32),%sp
- jsr Cstart
+move.l #AppStack+(APPSTACKSIZE-32),%sp
+jsr Cstart
diff --git a/apps/common/crt0_mb.S b/apps/common/crt0_mb.S
index 9894b9a..fc93dcf 100644
--- a/apps/common/crt0_mb.S
+++ b/apps/common/crt0_mb.S
@@ -1,14 +1,14 @@
#include "cfg.h"
- .extern AppStack
- .extern Cstart
- .global start
+.extern AppStack
+.extern Cstart
+.global start
- /* Set stack pointer to end of AppStack and jump to Cstart:
- */
+/* Set stack pointer to end of AppStack and jump to Cstart:
+ */
start:
- addi r1, r0, AppStack
- addi r1, r1, (APPSTACKSIZE-16)
+addi r1, r0, AppStack
+addi r1, r1, (APPSTACKSIZE-16)
jump_to_c:
- brai Cstart
+brai Cstart
diff --git a/apps/common/crt0_ppc.S b/apps/common/crt0_ppc.S
index 80ef3db..ef16a09 100644
--- a/apps/common/crt0_ppc.S
+++ b/apps/common/crt0_ppc.S
@@ -1,16 +1,16 @@
#include "cfg.h"
-#define sp 1
-#define r0 0
-#define r7 7
+#define sp 1
+#define r0 0
+#define r7 7
- .extern AppStack
- .extern Cstart
- .globl start
+.extern AppStack
+.extern Cstart
+.globl start
start:
- lis sp, (AppStack+(APPSTACKSIZE-4))@h
- addi sp, sp, (AppStack+(APPSTACKSIZE-4))@l
- addi r7, r0, -8
- and sp, sp, r7 /* 8-byte aligned (EABI spec) */
- ba Cstart
- nop
+lis sp, (AppStack+(APPSTACKSIZE-4))@h
+addi sp, sp, (AppStack+(APPSTACKSIZE-4))@l
+addi r7, r0, -8
+and sp, sp, r7 /* 8-byte aligned (EABI spec) */
+ba Cstart
+nop
diff --git a/apps/common/cygprof.c b/apps/common/cygprof.c
index b10bff2..a4182e6 100644
--- a/apps/common/cygprof.c
+++ b/apps/common/cygprof.c
@@ -10,17 +10,17 @@
int cyg_prof_on;
void
-__cyg_profile_func_enter (void *this_fn, void *call_site)
+__cyg_profile_func_enter(void *this_fn, void *call_site)
{
- if (cyg_prof_on) {
+ if(cyg_prof_on) {
mon_memtrace("IN: %x %x\n", this_fn, call_site);
}
}
void
-__cyg_profile_func_exit (void *this_fn, void *call_site)
+__cyg_profile_func_exit(void *this_fn, void *call_site)
{
- if (cyg_prof_on) {
- mon_memtrace("OUT: %x %x\n", this_fn, call_site);
+ if(cyg_prof_on) {
+ mon_memtrace("OUT: %x %x\n", this_fn, call_site);
}
}
diff --git a/apps/common/monlib.c b/apps/common/monlib.c
index 33c05e4..f329658 100644
--- a/apps/common/monlib.c
+++ b/apps/common/monlib.c
@@ -1,125 +1,125 @@
/* monlib.c:
- * This file is part of the monitor code, but it is actually linked into
- * the application. It is built with (but not linked with) the monitor,
- * then the monlib.o file is linked with the application.
- * The only requirement on the application is that it know where the address
- * of the monCom function is in the monitor's space.
- * The monCom function will be accessible in some "well-known" way (processor
- * and platform dependent) so that this will not be a problem.
+ * This file is part of the monitor code, but it is actually linked into
+ * the application. It is built with (but not linked with) the monitor,
+ * then the monlib.o file is linked with the application.
+ * The only requirement on the application is that it know where the address
+ * of the monCom function is in the monitor's space.
+ * The monCom function will be accessible in some "well-known" way (processor
+ * and platform dependent) so that this will not be a problem.
*
- * This monlib.c file is a replacement for the older mechanism that was
- * a bit more error-prone... A table of function pointers existed at some
- * well-known location in the monitor, and the content of that table was
- * assumed to also be "well-known". This new version only assumes that the
- * pointer to monCom is well-known; everything else will work based on the
- * fact that the monitor and application will share the monlib.h header
- * file.
+ * This monlib.c file is a replacement for the older mechanism that was
+ * a bit more error-prone... A table of function pointers existed at some
+ * well-known location in the monitor, and the content of that table was
+ * assumed to also be "well-known". This new version only assumes that the
+ * pointer to monCom is well-known; everything else will work based on the
+ * fact that the monitor and application will share the monlib.h header
+ * file.
*
- * General notice:
- * This code is part of a boot-monitor package developed as a generic base
- * platform for embedded system designs. As such, it is likely to be
- * distributed to various projects beyond the control of the original
- * author. Please notify the author of any enhancements made or bugs found
- * so that all may benefit from the changes. In addition, notification back
- * to the author will allow the new user to pick up changes that may have
- * been made by other users after this version of the code was distributed.
+ * General notice:
+ * This code is part of a boot-monitor package developed as a generic base
+ * platform for embedded system designs. As such, it is likely to be
+ * distributed to various projects beyond the control of the original
+ * author. Please notify the author of any enhancements made or bugs found
+ * so that all may benefit from the changes. In addition, notification back
+ * to the author will allow the new user to pick up changes that may have
+ * been made by other users after this version of the code was distributed.
*
- * Note1: the majority of this code was edited with 4-space tabs.
- * Note2: as more and more contributions are accepted, the term "author"
- * is becoming a mis-representation of credit.
+ * Note1: the majority of this code was edited with 4-space tabs.
+ * Note2: as more and more contributions are accepted, the term "author"
+ * is becoming a mis-representation of credit.
*
- * Original author: Ed Sutter
- * Email: esutter@lucent.com
- * Phone: 908-582-2351
+ * Original author: Ed Sutter
+ * Email: esutter@lucent.com
+ * Phone: 908-582-2351
*/
#include "monlib.h"
-static int (*_tfsseek)(int,int,int);
-static int (*_tfsgetline)(int,char *,int);
-static int (*_tfsipmod)(char *,char *,int,int);
-static int (*_tfsinit)(void);
-static int (*_tfsadd)(char *,char *,char *,unsigned char *,int);
-static int (*_tfsunlink)(char *);
-static int (*_tfsrun)(char **,int);
-static int (*_tfsread)(int,char *,int);
-static int (*_tfswrite)(int,char *,int);
-static int (*_tfsopen)(char *,long,char *);
-static int (*_tfsclose)(int,char *);
-static int (*_printf)();
-static int (*_cprintf)();
-static int (*_sprintf)();
-static int (*_monrestart)(int);
-static int (*_rputchar)(unsigned char c);
-static int (*_getchar)(void);
-static int (*_gotachar)(void);
-static int (*_getbytes)(char *,int,int);
-static int (*_addcommand)(struct monCommand *,char *);
-static int (*_docommand)(char *,int);
-static int (*_getline)(char *,int,int);
-static int (*_tfsfstat)(char *,struct tfshdr *);
-static int (*_tfseof)(int);
-static int (*_decompress)(char *,int,char *);
-static int (*_tfstruncate)(int,long);
-static int (*_heapextend)(char *,int);
-static int (*_tfslink)(char *,char *);
-static int (*_pcicfgwrite)(int,int,int,int,int,unsigned long);
-static int (*_i2cwrite)(int,int,unsigned char *,int);
-static int (*_i2cread)(int,int,unsigned char *,int);
-static int (*_flashwrite)(char *,char *,int);
-static int (*_flasherase)(int);
-static int (*_flashinfo)(int,int *,char **);
-static int (*_flashoverride)(void *,int,int);
-static int (*_sendenet)(char *,int);
-static int (*_recvenet)(char *,int);
-static int (*_printpkt)(char *,int,int);
-static int (*_setenv)(char *,char *);
-static int (*_watchdog)(void);
-static int (*_timeofday)(int,void *);
-static int (*_montimer)(int cmd, void *arg);
-
-static char *(*_getenv)(char *);
-static char *(*_version)(void);
-static char *(*_getenvp)(void);
+static int (*_tfsseek)(int,int,int);
+static int (*_tfsgetline)(int,char *,int);
+static int (*_tfsipmod)(char *,char *,int,int);
+static int (*_tfsinit)(void);
+static int (*_tfsadd)(char *,char *,char *,unsigned char *,int);
+static int (*_tfsunlink)(char *);
+static int (*_tfsrun)(char **,int);
+static int (*_tfsread)(int,char *,int);
+static int (*_tfswrite)(int,char *,int);
+static int (*_tfsopen)(char *,long,char *);
+static int (*_tfsclose)(int,char *);
+static int (*_printf)();
+static int (*_cprintf)();
+static int (*_sprintf)();
+static int (*_monrestart)(int);
+static int (*_rputchar)(unsigned char c);
+static int (*_getchar)(void);
+static int (*_gotachar)(void);
+static int (*_getbytes)(char *,int,int);
+static int (*_addcommand)(struct monCommand *,char *);
+static int (*_docommand)(char *,int);
+static int (*_getline)(char *,int,int);
+static int (*_tfsfstat)(char *,struct tfshdr *);
+static int (*_tfseof)(int);
+static int (*_decompress)(char *,int,char *);
+static int (*_tfstruncate)(int,long);
+static int (*_heapextend)(char *,int);
+static int (*_tfslink)(char *,char *);
+static int (*_pcicfgwrite)(int,int,int,int,int,unsigned long);
+static int (*_i2cwrite)(int,int,unsigned char *,int);
+static int (*_i2cread)(int,int,unsigned char *,int);
+static int (*_flashwrite)(char *,char *,int);
+static int (*_flasherase)(int);
+static int (*_flashinfo)(int,int *,char **);
+static int (*_flashoverride)(void *,int,int);
+static int (*_sendenet)(char *,int);
+static int (*_recvenet)(char *,int);
+static int (*_printpkt)(char *,int,int);
+static int (*_setenv)(char *,char *);
+static int (*_watchdog)(void);
+static int (*_timeofday)(int,void *);
+static int (*_montimer)(int cmd, void *arg);
+
+static char *(*_getenv)(char *);
+static char *(*_version)(void);
+static char *(*_getenvp)(void);
#ifdef MALLOC_DEBUG
-static char *(*_malloc)(int,char *,int);
-static char *(*_realloc)(char *buf,int,char *,int);
+static char *(*_malloc)(int,char *,int);
+static char *(*_realloc)(char *buf,int,char *,int);
#else
-static char *(*_malloc)(int);
-static char *(*_realloc)(char *,int);
+static char *(*_malloc)(int);
+static char *(*_realloc)(char *,int);
#endif
-static char *(*_getsym)(char *,char *,int);
+static char *(*_getsym)(char *,char *,int);
-static void (*_intsrestore)(unsigned long);
-static void (*_appexit)(int);
-static void (*_free)(char *);
-static void (*_getargv)(int *,char ***);
-static void (*_profiler)(void *);
-static void (*_bbc)(char *,int);
-static void (*_memtrace)();
-static void (*_appwarmstart)(unsigned long);
-static void (*_mondelay)(long);
-static void (*_printmem)(char *,int,int);
+static void (*_intsrestore)(unsigned long);
+static void (*_appexit)(int);
+static void (*_free)(char *);
+static void (*_getargv)(int *,char ** *);
+static void (*_profiler)(void *);
+static void (*_bbc)(char *,int);
+static void (*_memtrace)();
+static void (*_appwarmstart)(unsigned long);
+static void (*_mondelay)(long);
+static void (*_printmem)(char *,int,int);
-static long (*_tfsctrl)(int,long,long);
-static long (*_tfstell)(int);
-static long (*_portcmd)(int,void *);
+static long (*_tfsctrl)(int,long,long);
+static long (*_tfstell)(int);
+static long (*_portcmd)(int,void *);
-static struct tfshdr *(*_tfsnext)(struct tfshdr *);
-static struct tfshdr *(*_tfsstat)(char *);
+static struct tfshdr *(*_tfsnext)(struct tfshdr *);
+static struct tfshdr *(*_tfsstat)(char *);
-static unsigned long (*_i2cctrl)(int,int,unsigned long,unsigned long);
-static unsigned long (*_pcicfgread)(int,int,int,int,int);
-static unsigned long (*_pcictrl)(int,int,unsigned long,unsigned long);
-static unsigned long (*_crc32)(unsigned char *,unsigned long);
-static unsigned long (*_intsoff)(void);
-static unsigned long (*_assign_handler)(long,unsigned long,unsigned long);
+static unsigned long (*_i2cctrl)(int,int,unsigned long,unsigned long);
+static unsigned long (*_pcicfgread)(int,int,int,int,int);
+static unsigned long (*_pcictrl)(int,int,unsigned long,unsigned long);
+static unsigned long (*_crc32)(unsigned char *,unsigned long);
+static unsigned long (*_intsoff)(void);
+static unsigned long (*_assign_handler)(long,unsigned long,unsigned long);
-static unsigned short (*_xcrc16)(unsigned char *,unsigned long);
+static unsigned short(*_xcrc16)(unsigned char *,unsigned long);
static void (*_monlock)(void);
static void (*_monunlock)(void);
-static int (*_moncom)(int,void *,void *, void *);
+static int (*_moncom)(int,void *,void *, void *);
/**************************************************************************
*
@@ -128,151 +128,151 @@ static int (*_moncom)(int,void *,void *, void *);
* is to be used, then simply redefine them here. Refer to the monitor
* app note that discusses multi-tasking access to the monitor API for more
* information.
- *
+ *
* TFS_MONLOCK/UNLOCK:
* Lock/unlock for functions that access TFS flash space:
*/
-#define TFS_MONLOCK monLock
-#define TFS_MONUNLOCK monUnlock
+#define TFS_MONLOCK monLock
+#define TFS_MONUNLOCK monUnlock
/* ENV_MONLOCK/UNLOCK:
* Lock/unlock for functions that access monitor shell variables:
*/
-#define ENV_MONLOCK monLock
-#define ENV_MONUNLOCK monUnlock
+#define ENV_MONLOCK monLock
+#define ENV_MONUNLOCK monUnlock
/* CONSOLE_MONLOCK/UNLOCK:
* Lock/unlock for functions in the monitor that deal with console output.
*/
-#define CONSOLE_MONLOCK monLock
-#define CONSOLE_MONUNLOCK monUnlock
+#define CONSOLE_MONLOCK monLock
+#define CONSOLE_MONUNLOCK monUnlock
/* HEAP_MONLOCK/UNLOCK:
* Lock/unlock for functions in the monitor that deal with the heap.
*/
-#define HEAP_MONLOCK monLock
-#define HEAP_MONUNLOCK monUnlock
+#define HEAP_MONLOCK monLock
+#define HEAP_MONUNLOCK monUnlock
/* BLOCKING_MONLOCK/UNLOCK:
- * Lock/unlock for functions in the monitor that block waiting for
+ * Lock/unlock for functions in the monitor that block waiting for
* console input.
*/
-#define BLOCKING_MONLOCK monLock
-#define BLOCKING_MONUNLOCK monUnlock
+#define BLOCKING_MONLOCK monLock
+#define BLOCKING_MONUNLOCK monUnlock
/* GENERIC_MONLOCK/UNLOCK:
* Lock/unlock for all functions not covered by the above macros.
*/
-#define GENERIC_MONLOCK monLock
-#define GENERIC_MONUNLOCK monUnlock
+#define GENERIC_MONLOCK monLock
+#define GENERIC_MONUNLOCK monUnlock
/**************************************************************************
*
* monConnect():
- * This must be the first call by the application code to talk to the
- * monitor. It is expecting three incoming function pointers:
+ * This must be the first call by the application code to talk to the
+ * monitor. It is expecting three incoming function pointers:
*
- * mon: Points to the monitor's _moncom function;
- * This is a "well-known" address because the monitor and
- * application code (two separately linked binaries) must
- * know it.
- * lock: Points to a function in the application code that will be
- * used by the monitor as a lock-out function (some kind of
- * semaphore in the application).
- * unlock: Points to a function in the application code that will be
- * used by the monitor as an un-lock-out function (undo whatever
- * lock-out mechanism was done by lock).
+ * mon: Points to the monitor's _moncom function;
+ * This is a "well-known" address because the monitor and
+ * application code (two separately linked binaries) must
+ * know it.
+ * lock: Points to a function in the application code that will be
+ * used by the monitor as a lock-out function (some kind of
+ * semaphore in the application).
+ * unlock: Points to a function in the application code that will be
+ * used by the monitor as an un-lock-out function (undo whatever
+ * lock-out mechanism was done by lock).
*/
int
monConnect(int (*mon)(int,void *,void *,void *),
- void (*lock)(void), void (*unlock)(void))
-{
- int rc = 0;
-
- /* Assign incoming lock and unlock functions... */
- _monlock = lock;
- _monunlock = unlock;
-
- /* If the mon pointer is non-zero, then make the mon_ connections... */
- if (mon) {
-
- _moncom = mon;
-
- /* Make the connections between "mon_" functions that are */
- /* symbolically accessible by the application and the corresponding */
- /* functions that exists in the monitor. */
- rc += _moncom(GETMONFUNC_PUTCHAR,&_rputchar,0,0);
- rc += _moncom(GETMONFUNC_GETCHAR,&_getchar,0,0);
- rc += _moncom(GETMONFUNC_GOTACHAR,&_gotachar,0,0);
- rc += _moncom(GETMONFUNC_GETBYTES,&_getbytes,0,0);
- rc += _moncom(GETMONFUNC_PRINTF,&_printf,0,0);
- rc += _moncom(GETMONFUNC_CPRINTF,&_cprintf,0,0);
- rc += _moncom(GETMONFUNC_SPRINTF,&_sprintf,0,0);
- rc += _moncom(GETMONFUNC_RESTART,&_monrestart,0,0);
- rc += _moncom(GETMONFUNC_GETENV,&_getenv,0,0);
- rc += _moncom(GETMONFUNC_SETENV,&_setenv,0,0);
- rc += _moncom(GETMONFUNC_TFSINIT,&_tfsinit,0,0);
- rc += _moncom(GETMONFUNC_TFSADD,&_tfsadd,0,0);
- rc += _moncom(GETMONFUNC_TFSUNLINK,&_tfsunlink,0,0);
- rc += _moncom(GETMONFUNC_TFSRUN,&_tfsrun,0,0);
- rc += _moncom(GETMONFUNC_TFSNEXT,&_tfsnext,0,0);
- rc += _moncom(GETMONFUNC_TFSSTAT,&_tfsstat,0,0);
- rc += _moncom(GETMONFUNC_TFSREAD,&_tfsread,0,0);
- rc += _moncom(GETMONFUNC_TFSWRITE,&_tfswrite,0,0);
- rc += _moncom(GETMONFUNC_TFSOPEN,&_tfsopen,0,0);
- rc += _moncom(GETMONFUNC_TFSCLOSE,&_tfsclose,0,0);
- rc += _moncom(GETMONFUNC_TFSSEEK,&_tfsseek,0,0);
- rc += _moncom(GETMONFUNC_TFSGETLINE,&_tfsgetline,0,0);
- rc += _moncom(GETMONFUNC_TFSIPMOD,&_tfsipmod,0,0);
- rc += _moncom(GETMONFUNC_TFSCTRL,&_tfsctrl,0,0);
- rc += _moncom(GETMONFUNC_ADDCOMMAND,&_addcommand,0,0);
- rc += _moncom(GETMONFUNC_DOCOMMAND,&_docommand,0,0);
- rc += _moncom(GETMONFUNC_GETARGV,&_getargv,0,0);
- rc += _moncom(GETMONFUNC_CRC16,&_xcrc16,0,0);
- rc += _moncom(GETMONFUNC_CRC32,&_crc32,0,0);
- rc += _moncom(GETMONFUNC_INTSOFF,&_intsoff,0,0);
- rc += _moncom(GETMONFUNC_INTSRESTORE,&_intsrestore,0,0);
- rc += _moncom(GETMONFUNC_APPEXIT,&_appexit,0,0);
- rc += _moncom(GETMONFUNC_MALLOC,&_malloc,0,0);
- rc += _moncom(GETMONFUNC_FREE,&_free,0,0);
- rc += _moncom(GETMONFUNC_GETLINE,&_getline,0,0);
- rc += _moncom(GETMONFUNC_TFSFSTAT,&_tfsfstat,0,0);
- rc += _moncom(GETMONFUNC_TFSEOF,&_tfseof,0,0);
- rc += _moncom(GETMONFUNC_DECOMPRESS,&_decompress,0,0);
- rc += _moncom(GETMONFUNC_TFSTRUNCATE,&_tfstruncate,0,0);
- rc += _moncom(GETMONFUNC_HEAPXTEND,&_heapextend,0,0);
- rc += _moncom(GETMONFUNC_PROFILER,&_profiler,0,0);
- rc += _moncom(GETMONFUNC_TFSLINK,&_tfslink,0,0);
- rc += _moncom(GETMONFUNC_BBC,&_bbc,0,0);
- rc += _moncom(GETMONFUNC_MEMTRACE,&_memtrace,0,0);
- rc += _moncom(GETMONFUNC_TFSTELL,&_tfstell,0,0);
- rc += _moncom(GETMONFUNC_VERSION,&_version,0,0);
- rc += _moncom(GETMONFUNC_WARMSTART,&_appwarmstart,0,0);
- rc += _moncom(GETMONFUNC_PCICFGREAD,&_pcicfgread,0,0);
- rc += _moncom(GETMONFUNC_PCICFGWRITE,&_pcicfgwrite,0,0);
- rc += _moncom(GETMONFUNC_PCICONTROL,&_pcictrl,0,0);
- rc += _moncom(GETMONFUNC_I2CREAD,&_i2cread,0,0);
- rc += _moncom(GETMONFUNC_I2CWRITE,&_i2cwrite,0,0);
- rc += _moncom(GETMONFUNC_I2CCONTROL,&_i2cctrl,0,0);
- rc += _moncom(GETMONFUNC_MONDELAY,&_mondelay,0,0);
- rc += _moncom(GETMONFUNC_GETENVP,&_getenvp,0,0);
- rc += _moncom(GETMONFUNC_REALLOC,&_realloc,0,0);
- rc += _moncom(GETMONFUNC_SENDENETPKT,&_sendenet,0,0);
- rc += _moncom(GETMONFUNC_RECVENETPKT,&_recvenet,0,0);
- rc += _moncom(GETMONFUNC_GETSYM,&_getsym,0,0);
- rc += _moncom(GETMONFUNC_PRINTPKT,&_printpkt,0,0);
- rc += _moncom(GETMONFUNC_FLASHWRITE,&_flashwrite,0,0);
- rc += _moncom(GETMONFUNC_FLASHERASE,&_flasherase,0,0);
- rc += _moncom(GETMONFUNC_FLASHINFO,&_flashinfo,0,0);
- rc += _moncom(GETMONFUNC_ASSIGNHDLR,&_assign_handler,0,0);
- rc += _moncom(GETMONFUNC_WATCHDOG,&_watchdog,0,0);
- rc += _moncom(GETMONFUNC_PRINTMEM,&_printmem,0,0);
- rc += _moncom(GETMONFUNC_PORTCMD,&_portcmd,0,0);
- rc += _moncom(GETMONFUNC_TIMEOFDAY,&_timeofday,0,0);
- rc += _moncom(GETMONFUNC_TIMER,&_montimer,0,0);
- rc += _moncom(GETMONFUNC_FLASHOVRRD,&_flashoverride,0,0);
- }
- return(rc);
+ void (*lock)(void), void (*unlock)(void))
+{
+ int rc = 0;
+
+ /* Assign incoming lock and unlock functions... */
+ _monlock = lock;
+ _monunlock = unlock;
+
+ /* If the mon pointer is non-zero, then make the mon_ connections... */
+ if(mon) {
+
+ _moncom = mon;
+
+ /* Make the connections between "mon_" functions that are */
+ /* symbolically accessible by the application and the corresponding */
+ /* functions that exists in the monitor. */
+ rc += _moncom(GETMONFUNC_PUTCHAR,&_rputchar,0,0);
+ rc += _moncom(GETMONFUNC_GETCHAR,&_getchar,0,0);
+ rc += _moncom(GETMONFUNC_GOTACHAR,&_gotachar,0,0);
+ rc += _moncom(GETMONFUNC_GETBYTES,&_getbytes,0,0);
+ rc += _moncom(GETMONFUNC_PRINTF,&_printf,0,0);
+ rc += _moncom(GETMONFUNC_CPRINTF,&_cprintf,0,0);
+ rc += _moncom(GETMONFUNC_SPRINTF,&_sprintf,0,0);
+ rc += _moncom(GETMONFUNC_RESTART,&_monrestart,0,0);
+ rc += _moncom(GETMONFUNC_GETENV,&_getenv,0,0);
+ rc += _moncom(GETMONFUNC_SETENV,&_setenv,0,0);
+ rc += _moncom(GETMONFUNC_TFSINIT,&_tfsinit,0,0);
+ rc += _moncom(GETMONFUNC_TFSADD,&_tfsadd,0,0);
+ rc += _moncom(GETMONFUNC_TFSUNLINK,&_tfsunlink,0,0);
+ rc += _moncom(GETMONFUNC_TFSRUN,&_tfsrun,0,0);
+ rc += _moncom(GETMONFUNC_TFSNEXT,&_tfsnext,0,0);
+ rc += _moncom(GETMONFUNC_TFSSTAT,&_tfsstat,0,0);
+ rc += _moncom(GETMONFUNC_TFSREAD,&_tfsread,0,0);
+ rc += _moncom(GETMONFUNC_TFSWRITE,&_tfswrite,0,0);
+ rc += _moncom(GETMONFUNC_TFSOPEN,&_tfsopen,0,0);
+ rc += _moncom(GETMONFUNC_TFSCLOSE,&_tfsclose,0,0);
+ rc += _moncom(GETMONFUNC_TFSSEEK,&_tfsseek,0,0);
+ rc += _moncom(GETMONFUNC_TFSGETLINE,&_tfsgetline,0,0);
+ rc += _moncom(GETMONFUNC_TFSIPMOD,&_tfsipmod,0,0);
+ rc += _moncom(GETMONFUNC_TFSCTRL,&_tfsctrl,0,0);
+ rc += _moncom(GETMONFUNC_ADDCOMMAND,&_addcommand,0,0);
+ rc += _moncom(GETMONFUNC_DOCOMMAND,&_docommand,0,0);
+ rc += _moncom(GETMONFUNC_GETARGV,&_getargv,0,0);
+ rc += _moncom(GETMONFUNC_CRC16,&_xcrc16,0,0);
+ rc += _moncom(GETMONFUNC_CRC32,&_crc32,0,0);
+ rc += _moncom(GETMONFUNC_INTSOFF,&_intsoff,0,0);
+ rc += _moncom(GETMONFUNC_INTSRESTORE,&_intsrestore,0,0);
+ rc += _moncom(GETMONFUNC_APPEXIT,&_appexit,0,0);
+ rc += _moncom(GETMONFUNC_MALLOC,&_malloc,0,0);
+ rc += _moncom(GETMONFUNC_FREE,&_free,0,0);
+ rc += _moncom(GETMONFUNC_GETLINE,&_getline,0,0);
+ rc += _moncom(GETMONFUNC_TFSFSTAT,&_tfsfstat,0,0);
+ rc += _moncom(GETMONFUNC_TFSEOF,&_tfseof,0,0);
+ rc += _moncom(GETMONFUNC_DECOMPRESS,&_decompress,0,0);
+ rc += _moncom(GETMONFUNC_TFSTRUNCATE,&_tfstruncate,0,0);
+ rc += _moncom(GETMONFUNC_HEAPXTEND,&_heapextend,0,0);
+ rc += _moncom(GETMONFUNC_PROFILER,&_profiler,0,0);
+ rc += _moncom(GETMONFUNC_TFSLINK,&_tfslink,0,0);
+ rc += _moncom(GETMONFUNC_BBC,&_bbc,0,0);
+ rc += _moncom(GETMONFUNC_MEMTRACE,&_memtrace,0,0);
+ rc += _moncom(GETMONFUNC_TFSTELL,&_tfstell,0,0);
+ rc += _moncom(GETMONFUNC_VERSION,&_version,0,0);
+ rc += _moncom(GETMONFUNC_WARMSTART,&_appwarmstart,0,0);
+ rc += _moncom(GETMONFUNC_PCICFGREAD,&_pcicfgread,0,0);
+ rc += _moncom(GETMONFUNC_PCICFGWRITE,&_pcicfgwrite,0,0);
+ rc += _moncom(GETMONFUNC_PCICONTROL,&_pcictrl,0,0);
+ rc += _moncom(GETMONFUNC_I2CREAD,&_i2cread,0,0);
+ rc += _moncom(GETMONFUNC_I2CWRITE,&_i2cwrite,0,0);
+ rc += _moncom(GETMONFUNC_I2CCONTROL,&_i2cctrl,0,0);
+ rc += _moncom(GETMONFUNC_MONDELAY,&_mondelay,0,0);
+ rc += _moncom(GETMONFUNC_GETENVP,&_getenvp,0,0);
+ rc += _moncom(GETMONFUNC_REALLOC,&_realloc,0,0);
+ rc += _moncom(GETMONFUNC_SENDENETPKT,&_sendenet,0,0);
+ rc += _moncom(GETMONFUNC_RECVENETPKT,&_recvenet,0,0);
+ rc += _moncom(GETMONFUNC_GETSYM,&_getsym,0,0);
+ rc += _moncom(GETMONFUNC_PRINTPKT,&_printpkt,0,0);
+ rc += _moncom(GETMONFUNC_FLASHWRITE,&_flashwrite,0,0);
+ rc += _moncom(GETMONFUNC_FLASHERASE,&_flasherase,0,0);
+ rc += _moncom(GETMONFUNC_FLASHINFO,&_flashinfo,0,0);
+ rc += _moncom(GETMONFUNC_ASSIGNHDLR,&_assign_handler,0,0);
+ rc += _moncom(GETMONFUNC_WATCHDOG,&_watchdog,0,0);
+ rc += _moncom(GETMONFUNC_PRINTMEM,&_printmem,0,0);
+ rc += _moncom(GETMONFUNC_PORTCMD,&_portcmd,0,0);
+ rc += _moncom(GETMONFUNC_TIMEOFDAY,&_timeofday,0,0);
+ rc += _moncom(GETMONFUNC_TIMER,&_montimer,0,0);
+ rc += _moncom(GETMONFUNC_FLASHOVRRD,&_flashoverride,0,0);
+ }
+ return(rc);
}
/* ignorelock:
@@ -284,9 +284,9 @@ monConnect(int (*mon)(int,void *,void *,void *),
* is already active, so when the function tries to call some other mon_xxx
* function it won't be able to because of the lock already being set.
*
- * With these functions in the application space, the user can do the
+ * With these functions in the application space, the user can do the
* following:
- * call %DisableLock
+ * call %DisableLock
* call %Func_with_monXXX_in_it
* call %EnableLock
*
@@ -299,13 +299,13 @@ static int ignorelock = 0;
void
DisableMonLock(void)
{
- ignorelock = 2;
+ ignorelock = 2;
}
void
EnableMonLock(void)
{
- ignorelock = 0;
+ ignorelock = 0;
}
/* monLock() & monUnlock():
@@ -315,94 +315,94 @@ EnableMonLock(void)
* These functions must test both the function pointer and the state
* of the ignorelock variable. The function DisableMonLock() sets the
* ignorelock variable to 2 because it is being executed through "call"
- * which means that the lock is active.
+ * which means that the lock is active.
*/
static void
monLock()
{
- if (_monlock) {
- switch(ignorelock) {
- case 1:
- break;
- case 2:
- ignorelock--;
- break;
- default:
- _monlock();
- break;
- }
- }
+ if(_monlock) {
+ switch(ignorelock) {
+ case 1:
+ break;
+ case 2:
+ ignorelock--;
+ break;
+ default:
+ _monlock();
+ break;
+ }
+ }
}
static void
monUnlock()
{
- if (_monunlock) {
- switch(ignorelock) {
- case 1:
- break;
- case 2:
- ignorelock--;
- default:
- _monunlock();
- break;
- }
- }
+ if(_monunlock) {
+ switch(ignorelock) {
+ case 1:
+ break;
+ case 2:
+ ignorelock--;
+ default:
+ _monunlock();
+ break;
+ }
+ }
}
int
mon_com(int cmd, void *arg1, void *arg2, void *arg3)
{
- int ret;
-
- GENERIC_MONLOCK();
- ret = _moncom(cmd,arg1,arg2,arg3);
- GENERIC_MONUNLOCK();
- return(ret);
+ int ret;
+
+ GENERIC_MONLOCK();
+ ret = _moncom(cmd,arg1,arg2,arg3);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
int
mon_putchar(char c)
{
- int ret;
-
- CONSOLE_MONLOCK();
- ret = _rputchar(c);
- CONSOLE_MONUNLOCK();
- return(ret);
+ int ret;
+
+ CONSOLE_MONLOCK();
+ ret = _rputchar(c);
+ CONSOLE_MONUNLOCK();
+ return(ret);
}
int
mon_getchar(void)
{
- int ret;
+ int ret;
- BLOCKING_MONLOCK();
- ret = _getchar();
- BLOCKING_MONUNLOCK();
- return(ret);
+ BLOCKING_MONLOCK();
+ ret = _getchar();
+ BLOCKING_MONUNLOCK();
+ return(ret);
}
int
mon_gotachar(void)
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _gotachar();
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _gotachar();
+ GENERIC_MONUNLOCK();
+ return(ret);
}
int
mon_getbytes(char *buf,int cnt,int block)
{
- int ret;
+ int ret;
- BLOCKING_MONLOCK();
- ret = _getbytes(buf,cnt,block);
- BLOCKING_MONUNLOCK();
- return(ret);
+ BLOCKING_MONLOCK();
+ ret = _getbytes(buf,cnt,block);
+ BLOCKING_MONUNLOCK();
+ return(ret);
}
int
@@ -410,12 +410,12 @@ mon_printf(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
char *fmt;
int a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12;
{
- int ret;
+ int ret;
- CONSOLE_MONLOCK();
- ret = _printf(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);
- CONSOLE_MONUNLOCK();
- return(ret);
+ CONSOLE_MONLOCK();
+ ret = _printf(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);
+ CONSOLE_MONUNLOCK();
+ return(ret);
}
int
@@ -423,12 +423,12 @@ mon_cprintf(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
char *fmt;
int a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12;
{
- int ret;
+ int ret;
- CONSOLE_MONLOCK();
- ret = _cprintf(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);
- CONSOLE_MONUNLOCK();
- return(ret);
+ CONSOLE_MONLOCK();
+ ret = _cprintf(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);
+ CONSOLE_MONUNLOCK();
+ return(ret);
}
int
@@ -436,443 +436,443 @@ mon_sprintf(buf,fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
char *fmt, *buf;
int a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12;
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _sprintf(buf,fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _sprintf(buf,fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
int
mon_restart(int val)
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _monrestart(val);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _monrestart(val);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
char *
mon_getenvp(void)
{
- char *ret;
+ char *ret;
- ENV_MONLOCK();
- ret = _getenvp();
- ENV_MONUNLOCK();
- return(ret);
+ ENV_MONLOCK();
+ ret = _getenvp();
+ ENV_MONUNLOCK();
+ return(ret);
}
char *
mon_getenv(char *name)
{
- char *ret;
+ char *ret;
- ENV_MONLOCK();
- ret = _getenv(name);
- ENV_MONUNLOCK();
- return(ret);
+ ENV_MONLOCK();
+ ret = _getenv(name);
+ ENV_MONUNLOCK();
+ return(ret);
}
int
mon_setenv(char *name,char *val)
{
- int ret;
+ int ret;
- ENV_MONLOCK();
- ret = _setenv(name,val);
- ENV_MONUNLOCK();
- return(ret);
+ ENV_MONLOCK();
+ ret = _setenv(name,val);
+ ENV_MONUNLOCK();
+ return(ret);
}
char *
mon_getsym(char *name,char *buf, int bufsize)
{
- char *ret;
+ char *ret;
- ENV_MONLOCK();
- ret = _getsym(name,buf,bufsize);
- ENV_MONUNLOCK();
- return(ret);
+ ENV_MONLOCK();
+ ret = _getsym(name,buf,bufsize);
+ ENV_MONUNLOCK();
+ return(ret);
}
int
mon_tfsinit(void)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfsinit();
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsinit();
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfsadd(char *name, char *info, char *flags, unsigned char *src, int size)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfsadd(name,info,flags,src,size);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsadd(name,info,flags,src,size);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfslink(char *src, char *target)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfslink(src,target);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfslink(src,target);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfsunlink(char *name)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfsunlink(name);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsunlink(name);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfsrun(char **name,int verbose)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfsrun(name,verbose);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsrun(name,verbose);
+ TFS_MONUNLOCK();
+ return(ret);
}
struct tfshdr *
mon_tfsnext(struct tfshdr *fp)
{
- struct tfshdr *ret;
+ struct tfshdr *ret;
- TFS_MONLOCK();
- ret = _tfsnext(fp);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsnext(fp);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfstruncate(int tfd, long len)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfstruncate(tfd,len);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfstruncate(tfd,len);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfseof(int tfd)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfseof(tfd);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfseof(tfd);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfsfstat(char *name, struct tfshdr *fp)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfsfstat(name,fp);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsfstat(name,fp);
+ TFS_MONUNLOCK();
+ return(ret);
}
struct tfshdr *
mon_tfsstat(char *name)
{
- struct tfshdr *ret;
+ struct tfshdr *ret;
- TFS_MONLOCK();
- ret = _tfsstat(name);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsstat(name);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfsread(int fd, char *buf, int cnt)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfsread(fd,buf,cnt);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsread(fd,buf,cnt);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfswrite(int fd, char *buf, int cnt)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfswrite(fd,buf,cnt);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfswrite(fd,buf,cnt);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfsopen(char *file,long flagmode,char *buf)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfsopen(file,flagmode,buf);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsopen(file,flagmode,buf);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfsclose(int fd,char *info)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfsclose(fd,info);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsclose(fd,info);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfsseek(int fd, int offset, int whence)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfsseek(fd,offset,whence);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsseek(fd,offset,whence);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfsgetline(int fd,char *bp,int max)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfsgetline(fd,bp,max);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsgetline(fd,bp,max);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_tfsipmod(char *name,char *buf,int offset,int size)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _tfsipmod(name,buf,offset,size);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsipmod(name,buf,offset,size);
+ TFS_MONUNLOCK();
+ return(ret);
}
long
mon_tfsctrl(int rqst,long arg1,long arg2)
{
- long ret;
+ long ret;
- TFS_MONLOCK();
- ret = _tfsctrl(rqst,arg1,arg2);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfsctrl(rqst,arg1,arg2);
+ TFS_MONUNLOCK();
+ return(ret);
}
long
mon_tfstell(int fd)
{
- long ret;
+ long ret;
- TFS_MONLOCK();
- ret = _tfstell(fd);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _tfstell(fd);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_addcommand(struct monCommand *cmdlist, char *cmdlvl)
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _addcommand(cmdlist,cmdlvl);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _addcommand(cmdlist,cmdlvl);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
int
mon_docommand(char *cmdline,int verbose)
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _docommand(cmdline,verbose);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _docommand(cmdline,verbose);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
void
mon_getargv(int *argc,char ***argv)
{
- GENERIC_MONLOCK();
- _getargv(argc,argv);
- GENERIC_MONUNLOCK();
+ GENERIC_MONLOCK();
+ _getargv(argc,argv);
+ GENERIC_MONUNLOCK();
}
unsigned short
mon_xcrc16(char *buf,long nbytes)
{
- unsigned short ret;
+ unsigned short ret;
- GENERIC_MONLOCK();
- ret = _xcrc16((unsigned char *)buf,nbytes);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _xcrc16((unsigned char *)buf,nbytes);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
unsigned long
mon_intsoff(void)
{
- unsigned long ret;
+ unsigned long ret;
- GENERIC_MONLOCK();
- ret = _intsoff();
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _intsoff();
+ GENERIC_MONUNLOCK();
+ return(ret);
}
void
mon_intsrestore(unsigned long msr)
{
- GENERIC_MONLOCK();
- _intsrestore(msr);
- GENERIC_MONUNLOCK();
+ GENERIC_MONLOCK();
+ _intsrestore(msr);
+ GENERIC_MONUNLOCK();
}
void
mon_appexit(int val)
{
- GENERIC_MONLOCK();
- _appexit(val);
- GENERIC_MONUNLOCK();
+ GENERIC_MONLOCK();
+ _appexit(val);
+ GENERIC_MONUNLOCK();
}
#ifdef MALLOC_DEBUG
char *
mon_malloc(int size,char *fname,int fline)
{
- char *ret;
+ char *ret;
- HEAP_MONLOCK();
- ret = _malloc(size,fname,fline);
- HEAP_MONUNLOCK();
- return(ret);
+ HEAP_MONLOCK();
+ ret = _malloc(size,fname,fline);
+ HEAP_MONUNLOCK();
+ return(ret);
}
char *
mon_realloc(char *buf, int size, char *fname, int fline)
{
- char *ret;
+ char *ret;
- HEAP_MONLOCK();
- ret = _realloc(buf,size, fname, fline);
- HEAP_MONUNLOCK();
- return(ret);
+ HEAP_MONLOCK();
+ ret = _realloc(buf,size, fname, fline);
+ HEAP_MONUNLOCK();
+ return(ret);
}
#else
char *
mon_malloc(int size)
{
- char *ret;
+ char *ret;
- HEAP_MONLOCK();
- ret = _malloc(size);
- HEAP_MONUNLOCK();
- return(ret);
+ HEAP_MONLOCK();
+ ret = _malloc(size);
+ HEAP_MONUNLOCK();
+ return(ret);
}
char *
mon_realloc(char *buf, int size)
{
- char *ret;
+ char *ret;
- HEAP_MONLOCK();
- ret = _realloc(buf,size);
- HEAP_MONUNLOCK();
- return(ret);
+ HEAP_MONLOCK();
+ ret = _realloc(buf,size);
+ HEAP_MONUNLOCK();
+ return(ret);
}
#endif
void
mon_free(char *cp)
{
- HEAP_MONLOCK();
- _free(cp);
- HEAP_MONUNLOCK();
+ HEAP_MONLOCK();
+ _free(cp);
+ HEAP_MONUNLOCK();
}
int
mon_getline(char *buf,int max,int ledit)
{
- int ret;
+ int ret;
- BLOCKING_MONLOCK();
- ret = _getline(buf,max,ledit);
- BLOCKING_MONUNLOCK();
- return(ret);
+ BLOCKING_MONLOCK();
+ ret = _getline(buf,max,ledit);
+ BLOCKING_MONUNLOCK();
+ return(ret);
}
int
mon_decompress(char *src,int srcsize,char *dest)
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _decompress(src,srcsize,dest);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _decompress(src,srcsize,dest);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
int
mon_heapextend(char *base,int size)
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _heapextend(base,size);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _heapextend(base,size);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
void
mon_bbc(char *filename, int lineno)
{
- _bbc(filename, lineno);
+ _bbc(filename, lineno);
}
void
mon_profiler(void *pdata)
{
- _profiler(pdata);
+ _profiler(pdata);
}
void
@@ -880,236 +880,236 @@ mon_memtrace(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
char *fmt;
int a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12;
{
- _memtrace(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);
+ _memtrace(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12);
}
char *
mon_version(void)
{
- char *ret;
+ char *ret;
- GENERIC_MONLOCK();
- ret = _version();
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _version();
+ GENERIC_MONUNLOCK();
+ return(ret);
}
void
mon_warmstart(unsigned long mask)
{
- GENERIC_MONLOCK();
- _appwarmstart(mask);
- GENERIC_MONUNLOCK();
+ GENERIC_MONLOCK();
+ _appwarmstart(mask);
+ GENERIC_MONUNLOCK();
}
int
mon_pcicfgwrite(int interface,int bus,int dev,int func,int reg,
- unsigned long val)
+ unsigned long val)
{
- int retval;
+ int retval;
- GENERIC_MONLOCK();
- retval = _pcicfgwrite(interface,bus,dev,func,reg,val);
- GENERIC_MONUNLOCK();
- return(retval);
+ GENERIC_MONLOCK();
+ retval = _pcicfgwrite(interface,bus,dev,func,reg,val);
+ GENERIC_MONUNLOCK();
+ return(retval);
}
unsigned long
mon_pcicfgread(int interface,int bus,int dev, int func,int reg)
{
- unsigned long retval;
+ unsigned long retval;
- GENERIC_MONLOCK();
- retval = _pcicfgread(interface,bus,dev,func,reg);
- GENERIC_MONUNLOCK();
- return(retval);
+ GENERIC_MONLOCK();
+ retval = _pcicfgread(interface,bus,dev,func,reg);
+ GENERIC_MONUNLOCK();
+ return(retval);
}
unsigned long
mon_pcictrl(int interface, int cmd, unsigned long arg1, unsigned long arg2)
{
- unsigned long val;
+ unsigned long val;
- GENERIC_MONLOCK();
- val = _pcictrl(interface,cmd,arg1,arg2);
- GENERIC_MONUNLOCK();
- return(val);
+ GENERIC_MONLOCK();
+ val = _pcictrl(interface,cmd,arg1,arg2);
+ GENERIC_MONUNLOCK();
+ return(val);
}
unsigned long
mon_i2cctrl(int interface, int cmd, unsigned long arg1, unsigned long arg2)
{
- unsigned long val;
+ unsigned long val;
- GENERIC_MONLOCK();
- val = _i2cctrl(interface,cmd,arg1,arg2);
- GENERIC_MONUNLOCK();
- return(val);
+ GENERIC_MONLOCK();
+ val = _i2cctrl(interface,cmd,arg1,arg2);
+ GENERIC_MONUNLOCK();
+ return(val);
}
int
mon_i2cwrite(int interface, int bigaddr, unsigned char *data, int len)
{
- int val;
+ int val;
- GENERIC_MONLOCK();
- val = _i2cwrite(interface,bigaddr,data,len);
- GENERIC_MONUNLOCK();
- return(val);
+ GENERIC_MONLOCK();
+ val = _i2cwrite(interface,bigaddr,data,len);
+ GENERIC_MONUNLOCK();
+ return(val);
}
int
mon_i2cread(int interface, int bigaddr, unsigned char *data, int len)
{
- int val;
+ int val;
- GENERIC_MONLOCK();
- val = _i2cread(interface,bigaddr,data,len);
- GENERIC_MONUNLOCK();
- return(val);
+ GENERIC_MONLOCK();
+ val = _i2cread(interface,bigaddr,data,len);
+ GENERIC_MONUNLOCK();
+ return(val);
}
void
mon_delay(long msec)
{
- GENERIC_MONLOCK();
- _mondelay(msec);
- GENERIC_MONUNLOCK();
+ GENERIC_MONLOCK();
+ _mondelay(msec);
+ GENERIC_MONUNLOCK();
}
int
mon_timer(int cmd, void *arg)
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _montimer(cmd, arg);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _montimer(cmd, arg);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
int
mon_sendenetpkt(char *pkt,int size)
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _sendenet(pkt,size);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _sendenet(pkt,size);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
int
mon_recvenetpkt(char *pkt,int size)
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _recvenet(pkt,size);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _recvenet(pkt,size);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
void
mon_printpkt(char *buf,int size, int incoming)
{
- GENERIC_MONLOCK();
- _printpkt(buf,size,incoming);
- GENERIC_MONUNLOCK();
+ GENERIC_MONLOCK();
+ _printpkt(buf,size,incoming);
+ GENERIC_MONUNLOCK();
}
int
mon_flashoverride(void *flashinfo,int get,int bank)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _flashoverride(flashinfo,get,bank);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _flashoverride(flashinfo,get,bank);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_flashwrite(char *dest,char *src,int bytecnt)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _flashwrite(dest,src,bytecnt);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _flashwrite(dest,src,bytecnt);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_flasherase(int snum)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _flasherase(snum);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _flasherase(snum);
+ TFS_MONUNLOCK();
+ return(ret);
}
int
mon_flashinfo(int snum, int *size, char **base)
{
- int ret;
+ int ret;
- TFS_MONLOCK();
- ret = _flashinfo(snum,size,base);
- TFS_MONUNLOCK();
- return(ret);
+ TFS_MONLOCK();
+ ret = _flashinfo(snum,size,base);
+ TFS_MONUNLOCK();
+ return(ret);
}
unsigned long
mon_assignhandler(long hnum, unsigned long arg1, unsigned long arg2)
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _assign_handler(hnum,arg1,arg2);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _assign_handler(hnum,arg1,arg2);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
int
mon_watchdog(void)
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _watchdog();
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _watchdog();
+ GENERIC_MONUNLOCK();
+ return(ret);
}
void
mon_printmem(char *mem, int size, int ascii)
{
- GENERIC_MONLOCK();
- _printmem(mem,size,ascii);
- GENERIC_MONUNLOCK();
+ GENERIC_MONLOCK();
+ _printmem(mem,size,ascii);
+ GENERIC_MONUNLOCK();
}
long
mon_portcmd(int cmd, void *arg)
{
- long ret;
+ long ret;
- GENERIC_MONLOCK();
- ret = _portcmd(cmd,arg);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _portcmd(cmd,arg);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
int
mon_timeofday(int cmd, void *arg)
{
- int ret;
+ int ret;
- GENERIC_MONLOCK();
- ret = _timeofday(cmd,arg);
- GENERIC_MONUNLOCK();
- return(ret);
+ GENERIC_MONLOCK();
+ ret = _timeofday(cmd,arg);
+ GENERIC_MONUNLOCK();
+ return(ret);
}
diff --git a/apps/common/monlib.h b/apps/common/monlib.h
index 10e37f4..b1765db 100644
--- a/apps/common/monlib.h
+++ b/apps/common/monlib.h
@@ -1,22 +1,22 @@
/* monlib.h:
- * This header file is used by both the monitor and the application that
- * may reside on top of the monitor.
- * General notice:
- * This code is part of a boot-monitor package developed as a generic base
- * platform for embedded system designs. As such, it is likely to be
- * distributed to various projects beyond the control of the original
- * author. Please notify the author of any enhancements made or bugs found
- * so that all may benefit from the changes. In addition, notification back
- * to the author will allow the new user to pick up changes that may have
- * been made by other users after this version of the code was distributed.
+ * This header file is used by both the monitor and the application that
+ * may reside on top of the monitor.
+ * General notice:
+ * This code is part of a boot-monitor package developed as a generic base
+ * platform for embedded system designs. As such, it is likely to be
+ * distributed to various projects beyond the control of the original
+ * author. Please notify the author of any enhancements made or bugs found
+ * so that all may benefit from the changes. In addition, notification back
+ * to the author will allow the new user to pick up changes that may have
+ * been made by other users after this version of the code was distributed.
*
- * Note1: the majority of this code was edited with 4-space tabs.
- * Note2: as more and more contributions are accepted, the term "author"
- * is becoming a mis-representation of credit.
+ * Note1: the majority of this code was edited with 4-space tabs.
+ * Note2: as more and more contributions are accepted, the term "author"
+ * is becoming a mis-representation of credit.
*
- * Original author: Ed Sutter
- * Email: esutter@lucent.com
- * Phone: 908-582-2351
+ * Original author: Ed Sutter
+ * Email: esutter@lucent.com
+ * Phone: 908-582-2351
*/
#ifndef _MONLIB_H_
#define _MONLIB_H_
@@ -30,7 +30,7 @@ extern "C" {
extern int monConnect(int (*monptr)(int,void *,void *,void *),
- void (*lock)(void),void (*unlock)(void));
+ void (*lock)(void),void (*unlock)(void));
extern void mon_getargv(int *argc,char ***argv);
extern void mon_intsrestore(unsigned long oldval);
extern void mon_appexit(int exit_value);
@@ -44,7 +44,7 @@ extern void mon_printmem(char *mem, int size, int ascii);
extern int mon_com(int cmd,void *arg1,void *arg2,void *arg3);
-extern int mon_timer(int cmd, void * arg);
+extern int mon_timer(int cmd, void *arg);
extern int mon_setenv(char *varname,char *value);
extern int mon_putchar(char c);
extern int mon_getchar(void);
@@ -71,13 +71,13 @@ extern int mon_getline(char *buffer,int max,int ledit);
extern int mon_decompress(char *src,int srcsize,char *dest);
extern int mon_heapextend(char *base,int size);
extern int mon_pcicfgwrite(int interface,int bus,int dev,int func,int reg,
- unsigned long val);
+ unsigned long val);
extern int mon_tfsadd(char *filename, char *info, char *flags,
- unsigned char *src, int size);
+ unsigned char *src, int size);
extern int mon_i2cwrite(int interface, int bigaddr, unsigned char *data,
- int len);
+ int len);
extern int mon_i2cread(int interface, int bigaddr, unsigned char *data,
- int len);
+ int len);
extern int mon_sendenetpkt(char *pkt, int len);
extern int mon_recvenetpkt(char *pkt, int len);
extern int mon_flashoverride(void *flashinfo, int get, int bank);
@@ -108,16 +108,16 @@ extern unsigned short mon_xcrc16(char *buffer,long length);
extern unsigned long mon_intsoff(void);
extern unsigned long mon_pcicfgread(int interface,int bus,int dev,
- int func,int reg);
+ int func,int reg);
extern unsigned long mon_pcictrl(int interface, int cmd,
- unsigned long arg1, unsigned long arg2);
+ unsigned long arg1, unsigned long arg2);
extern unsigned long mon_i2cctrl(int interface, int cmd,
- unsigned long arg1, unsigned long arg2);
+ unsigned long arg1, unsigned long arg2);
extern unsigned long mon_assignhandler(long hnum,
- unsigned long arg1,unsigned long arg2);
+ unsigned long arg1,unsigned long arg2);
extern struct tfshdr *mon_tfsnext(struct tfshdr *tfp);
extern struct tfshdr *mon_tfsstat(char *filename);
@@ -141,99 +141,99 @@ extern int mon_sprintf();
/* defines used by monConnect():
*/
-#define GETMONFUNC_PUTCHAR 1
-#define GETMONFUNC_GETCHAR 2
-#define GETMONFUNC_GOTACHAR 3
-#define GETMONFUNC_GETBYTES 4
-#define GETMONFUNC_PRINTF 5
-#define GETMONFUNC_CPRINTF 6
-#define GETMONFUNC_SPRINTF 7
-#define GETMONFUNC_RESTART 8
-#define GETMONFUNC_GETENV 9
-#define GETMONFUNC_SETENV 10
-#define GETMONFUNC_TFSINIT 11
-#define GETMONFUNC_TFSADD 12
-#define GETMONFUNC_TFSUNLINK 13
-#define GETMONFUNC_TFSRUN 14
-#define GETMONFUNC_TFSNEXT 15
-#define GETMONFUNC_TFSSTAT 16
-#define GETMONFUNC_TFSREAD 17
-#define GETMONFUNC_TFSWRITE 18
-#define GETMONFUNC_TFSOPEN 19
-#define GETMONFUNC_TFSCLOSE 20
-#define GETMONFUNC_TFSSEEK 21
-#define GETMONFUNC_TFSGETLINE 22
-#define GETMONFUNC_TFSIPMOD 23
-#define GETMONFUNC_TFSCTRL 24
-#define GETMONFUNC_ADDCOMMAND 25
-#define GETMONFUNC_DOCOMMAND 26
-#define GETMONFUNC_GETARGV 27
-#define GETMONFUNC_CRC16 28
-#define GETMONFUNC_CRC32 29
-#define GETMONFUNC_PIOGET 30 /* NA (removed as of 1.0) */
-#define GETMONFUNC_PIOSET 31 /* NA (removed as of 1.0) */
-#define GETMONFUNC_PIOCLR 32 /* NA (removed as of 1.0) */
-#define GETMONFUNC_INTSOFF 33
-#define GETMONFUNC_INTSRESTORE 34
-#define GETMONFUNC_APPEXIT 35
-#define GETMONFUNC_MALLOC 36
-#define GETMONFUNC_FREE 37
-#define GETMONFUNC_GETLINE 38
-#define GETMONFUNC_TFSFSTAT 39
-#define GETMONFUNC_TFSEOF 40
-#define GETMONFUNC_DECOMPRESS 41
-#define GETMONFUNC_TFSTRUNCATE 42
-#define GETMONFUNC_HEAPXTEND 43
-#define GETMONFUNC_PROFILER 44
-#define GETMONFUNC_TFSLINK 45
-#define GETMONFUNC_BBC 46
-#define GETMONFUNC_MEMTRACE 47
-#define GETMONFUNC_TFSTELL 48
-#define GETMONFUNC_VERSION 49
-#define GETMONFUNC_WARMSTART 50
-#define GETMONFUNC_PCICFGREAD 51
-#define GETMONFUNC_PCICFGWRITE 52
-#define GETMONFUNC_PCICONTROL 53
-#define GETMONFUNC_I2CREAD 54
-#define GETMONFUNC_I2CWRITE 55
-#define GETMONFUNC_I2CCONTROL 56
-#define GETMONFUNC_MONDELAY 57
-#define GETMONFUNC_GETENVP 58
-#define GETMONFUNC_REALLOC 59
-#define GETMONFUNC_SENDENETPKT 60
-#define GETMONFUNC_RECVENETPKT 61
-#define GETMONFUNC_GETSYM 62
-#define GETMONFUNC_PRINTPKT 63
-#define GETMONFUNC_FLASHWRITE 64
-#define GETMONFUNC_FLASHERASE 65
-#define GETMONFUNC_FLASHINFO 66
-#define GETMONFUNC_ASSIGNHDLR 67
-#define GETMONFUNC_WATCHDOG 68
-#define GETMONFUNC_PRINTMEM 69
-#define GETMONFUNC_PORTCMD 70
-#define GETMONFUNC_TIMEOFDAY 71
-#define GETMONFUNC_TIMER 72
-#define GETMONFUNC_FLASHOVRRD 73
-
-#define CACHEFTYPE_DFLUSH 200
-#define CACHEFTYPE_IINVALIDATE 201
-
-#define CHARFUNC_PUTCHAR 300
-#define CHARFUNC_GETCHAR 301
-#define CHARFUNC_GOTACHAR 302
-#define CHARFUNC_RAWMODEON 303
-#define CHARFUNC_RAWMODEOFF 304
-
-#define ASSIGNFUNC_GETUSERLEVEL 400
+#define GETMONFUNC_PUTCHAR 1
+#define GETMONFUNC_GETCHAR 2
+#define GETMONFUNC_GOTACHAR 3
+#define GETMONFUNC_GETBYTES 4
+#define GETMONFUNC_PRINTF 5
+#define GETMONFUNC_CPRINTF 6
+#define GETMONFUNC_SPRINTF 7
+#define GETMONFUNC_RESTART 8
+#define GETMONFUNC_GETENV 9
+#define GETMONFUNC_SETENV 10
+#define GETMONFUNC_TFSINIT 11
+#define GETMONFUNC_TFSADD 12
+#define GETMONFUNC_TFSUNLINK 13
+#define GETMONFUNC_TFSRUN 14
+#define GETMONFUNC_TFSNEXT 15
+#define GETMONFUNC_TFSSTAT 16
+#define GETMONFUNC_TFSREAD 17
+#define GETMONFUNC_TFSWRITE 18
+#define GETMONFUNC_TFSOPEN 19
+#define GETMONFUNC_TFSCLOSE 20
+#define GETMONFUNC_TFSSEEK 21
+#define GETMONFUNC_TFSGETLINE 22
+#define GETMONFUNC_TFSIPMOD 23
+#define GETMONFUNC_TFSCTRL 24
+#define GETMONFUNC_ADDCOMMAND 25
+#define GETMONFUNC_DOCOMMAND 26
+#define GETMONFUNC_GETARGV 27
+#define GETMONFUNC_CRC16 28
+#define GETMONFUNC_CRC32 29
+#define GETMONFUNC_PIOGET 30 /* NA (removed as of 1.0) */
+#define GETMONFUNC_PIOSET 31 /* NA (removed as of 1.0) */
+#define GETMONFUNC_PIOCLR 32 /* NA (removed as of 1.0) */
+#define GETMONFUNC_INTSOFF 33
+#define GETMONFUNC_INTSRESTORE 34
+#define GETMONFUNC_APPEXIT 35
+#define GETMONFUNC_MALLOC 36
+#define GETMONFUNC_FREE 37
+#define GETMONFUNC_GETLINE 38
+#define GETMONFUNC_TFSFSTAT 39
+#define GETMONFUNC_TFSEOF 40
+#define GETMONFUNC_DECOMPRESS 41
+#define GETMONFUNC_TFSTRUNCATE 42
+#define GETMONFUNC_HEAPXTEND 43
+#define GETMONFUNC_PROFILER 44
+#define GETMONFUNC_TFSLINK 45
+#define GETMONFUNC_BBC 46
+#define GETMONFUNC_MEMTRACE 47
+#define GETMONFUNC_TFSTELL 48
+#define GETMONFUNC_VERSION 49
+#define GETMONFUNC_WARMSTART 50
+#define GETMONFUNC_PCICFGREAD 51
+#define GETMONFUNC_PCICFGWRITE 52
+#define GETMONFUNC_PCICONTROL 53
+#define GETMONFUNC_I2CREAD 54
+#define GETMONFUNC_I2CWRITE 55
+#define GETMONFUNC_I2CCONTROL 56
+#define GETMONFUNC_MONDELAY 57
+#define GETMONFUNC_GETENVP 58
+#define GETMONFUNC_REALLOC 59
+#define GETMONFUNC_SENDENETPKT 60
+#define GETMONFUNC_RECVENETPKT 61
+#define GETMONFUNC_GETSYM 62
+#define GETMONFUNC_PRINTPKT 63
+#define GETMONFUNC_FLASHWRITE 64
+#define GETMONFUNC_FLASHERASE 65
+#define GETMONFUNC_FLASHINFO 66
+#define GETMONFUNC_ASSIGNHDLR 67
+#define GETMONFUNC_WATCHDOG 68
+#define GETMONFUNC_PRINTMEM 69
+#define GETMONFUNC_PORTCMD 70
+#define GETMONFUNC_TIMEOFDAY 71
+#define GETMONFUNC_TIMER 72
+#define GETMONFUNC_FLASHOVRRD 73
+
+#define CACHEFTYPE_DFLUSH 200
+#define CACHEFTYPE_IINVALIDATE 201
+
+#define CHARFUNC_PUTCHAR 300
+#define CHARFUNC_GETCHAR 301
+#define CHARFUNC_GOTACHAR 302
+#define CHARFUNC_RAWMODEON 303
+#define CHARFUNC_RAWMODEOFF 304
+
+#define ASSIGNFUNC_GETUSERLEVEL 400
/* Defines used by mon_warmstart():
*/
-#define WARMSTART_IOINIT 0x00000001
-#define WARMSTART_BSSINIT 0x00000002
-#define WARMSTART_RUNMONRC 0x00000004
-#define WARMSTART_MONHEADER 0x00000008
-#define WARMSTART_TFSAUTOBOOT 0x00000010
-#define WARMSTART_BOARDINFO 0x00000020
-#define WARMSTART_ALL 0xffffffff
+#define WARMSTART_IOINIT 0x00000001
+#define WARMSTART_BSSINIT 0x00000002
+#define WARMSTART_RUNMONRC 0x00000004
+#define WARMSTART_MONHEADER 0x00000008
+#define WARMSTART_TFSAUTOBOOT 0x00000010
+#define WARMSTART_BOARDINFO 0x00000020
+#define WARMSTART_ALL 0xffffffff
#endif
diff --git a/apps/common/tfs.h b/apps/common/tfs.h
index f83d518..5362e3b 100644
--- a/apps/common/tfs.h
+++ b/apps/common/tfs.h
@@ -1,187 +1,187 @@
/* tfs.h:
- * Header file for TFS transactions, used by both application and monitor.
- *
- * General notice:
- * This code is part of a boot-monitor package developed as a generic base
- * platform for embedded system designs. As such, it is likely to be
- * distributed to various projects beyond the control of the original
- * author. Please notify the author of any enhancements made or bugs found
- * so that all may benefit from the changes. In addition, notification back
- * to the author will allow the new user to pick up changes that may have
- * been made by other users after this version of the code was distributed.
+ * Header file for TFS transactions, used by both application and monitor.
*
- * Note1: the majority of this code was edited with 4-space tabs.
- * Note2: as more and more contributions are accepted, the term "author"
- * is becoming a mis-representation of credit.
+ * General notice:
+ * This code is part of a boot-monitor package developed as a generic base
+ * platform for embedded system designs. As such, it is likely to be
+ * distributed to various projects beyond the control of the original
+ * author. Please notify the author of any enhancements made or bugs found
+ * so that all may benefit from the changes. In addition, notification back
+ * to the author will allow the new user to pick up changes that may have
+ * been made by other users after this version of the code was distributed.
*
- * Original author: Ed Sutter
- * Email: esutter@lucent.com
- * Phone: 908-582-2351
+ * Note1: the majority of this code was edited with 4-space tabs.
+ * Note2: as more and more contributions are accepted, the term "author"
+ * is becoming a mis-representation of credit.
+ *
+ * Original author: Ed Sutter
+ * Email: esutter@lucent.com
+ * Phone: 908-582-2351
*/
#ifndef _tfs_h
#define _tfs_h
-#define TFSINFOSIZE 23 /* Max size of info string (mod4-1). */
+#define TFSINFOSIZE 23 /* Max size of info string (mod4-1). */
-#ifndef TFSNAMESIZE /* This specifies the maximum size of a file */
-#define TFSNAMESIZE 23 /* name that can be used in TFS. */
-#endif /* This MUST be some value mod4 - 1. */
+#ifndef TFSNAMESIZE /* This specifies the maximum size of a file */
+#define TFSNAMESIZE 23 /* name that can be used in TFS. */
+#endif /* This MUST be some value mod4 - 1. */
-#ifndef TFS_CHANGELOG_FILE /* Information used for change-log */
-#define TFS_CHANGELOG_SIZE 0 /* facility within tfs. */
-#define TFS_CHANGELOG_FILE ".tfschlog"
+#ifndef TFS_CHANGELOG_FILE /* Information used for change-log */
+#define TFS_CHANGELOG_SIZE 0 /* facility within tfs. */
+#define TFS_CHANGELOG_FILE ".tfschlog"
#endif
-#ifndef SYMFILE /* This specifies the default filename */
-#define SYMFILE "symtbl" /* used by the monitor for the symbol */
-#endif /* table. */
+#ifndef SYMFILE /* This specifies the default filename */
+#define SYMFILE "symtbl" /* used by the monitor for the symbol */
+#endif /* table. */
-#define MINUSRLEVEL 0 /* Minimum user level supported. */
-#define MAXUSRLEVEL 3 /* Maximum user level supported. */
+#define MINUSRLEVEL 0 /* Minimum user level supported. */
+#define MAXUSRLEVEL 3 /* Maximum user level supported. */
#ifndef TFS_RESERVED
-#define TFS_RESERVED 4 /* Number of "reserved" entries (ulong) */
-#endif /* in the TFS header. */
+#define TFS_RESERVED 4 /* Number of "reserved" entries (ulong) */
+#endif /* in the TFS header. */
/* Flags: */
-#define TFS_EXEC 0x00000001 /* 'e': Executable script. */
-#define TFS_BRUN 0x00000002 /* 'b': To be executed at boot. */
-#define TFS_QRYBRUN 0x00000004 /* 'B': To be executed at boot if */
- /* query passes. */
-#define TFS_SYMLINK 0x00000008 /* 'l': Symbolic link file. */
-#define TFS_EBIN 0x00000010 /* 'E': Executable binary (coff/elf/a.out). */
-#define TFS_CPRS 0x00000040 /* 'c': File is compressed. */
-#define TFS_IPMOD 0x00000080 /* 'i': File is in-place modifiable. */
-#define TFS_UNREAD 0x00000100 /* 'u': File is not even readable if the */
- /* user-level requirement is not met; */
- /* else, it is read-only. */
-#define TFS_ULVLMSK 0x00000600 /* User level mask defines 4 access levels: */
-#define TFS_ULVL0 0x00000000 /* '0' level 0 */
-#define TFS_ULVL1 0x00000200 /* '1' level 1 */
-#define TFS_ULVL2 0x00000400 /* '2' level 2 */
-#define TFS_ULVL3 0x00000600 /* '3' level 3 */
-#define TFS_NSTALE 0x00000800 /* File is NOT stale, invisible to user.
- * When this bit is clear, the file is
- * considered stale (see notes in tfsadd()).
- * See notes in tfsclose() for this.
- */
-#define TFS_ACTIVE 0x00008000 /* Used to indicate that file is not deleted. */
-
-#define TFS_ULVLMAX TFS_ULVL3
-#define TFS_USRLVL(f) ((f->flags & TFS_ULVLMSK) >> 9)
+#define TFS_EXEC 0x00000001 /* 'e': Executable script. */
+#define TFS_BRUN 0x00000002 /* 'b': To be executed at boot. */
+#define TFS_QRYBRUN 0x00000004 /* 'B': To be executed at boot if */
+/* query passes. */
+#define TFS_SYMLINK 0x00000008 /* 'l': Symbolic link file. */
+#define TFS_EBIN 0x00000010 /* 'E': Executable binary (coff/elf/a.out). */
+#define TFS_CPRS 0x00000040 /* 'c': File is compressed. */
+#define TFS_IPMOD 0x00000080 /* 'i': File is in-place modifiable. */
+#define TFS_UNREAD 0x00000100 /* 'u': File is not even readable if the */
+/* user-level requirement is not met; */
+/* else, it is read-only. */
+#define TFS_ULVLMSK 0x00000600 /* User level mask defines 4 access levels: */
+#define TFS_ULVL0 0x00000000 /* '0' level 0 */
+#define TFS_ULVL1 0x00000200 /* '1' level 1 */
+#define TFS_ULVL2 0x00000400 /* '2' level 2 */
+#define TFS_ULVL3 0x00000600 /* '3' level 3 */
+#define TFS_NSTALE 0x00000800 /* File is NOT stale, invisible to user.
+ * When this bit is clear, the file is
+ * considered stale (see notes in tfsadd()).
+ * See notes in tfsclose() for this.
+ */
+#define TFS_ACTIVE 0x00008000 /* Used to indicate that file is not deleted. */
+
+#define TFS_ULVLMAX TFS_ULVL3
+#define TFS_USRLVL(f) ((f->flags & TFS_ULVLMSK) >> 9)
/* Open modes */
-#define TFS_RDONLY 0x00010000 /* File is opened for reading. */
-#define TFS_CREATE 0x00020000 /* File is to be created. Error if file */
- /* with the same name already exists. */
-#define TFS_APPEND 0x00040000 /* Append to existing file. If OR'ed */
- /* with TFS_CREATE, then create if */
- /* necessary. */
-#define TFS_ALLFFS 0x00080000 /* File is created with all FFs. */
-#define TFS_CREATERM 0x00100000 /* File is to be created. If file with */
- /* same name already exists, then allow */
- /* tfsadd() to remove it if necessary. */
+#define TFS_RDONLY 0x00010000 /* File is opened for reading. */
+#define TFS_CREATE 0x00020000 /* File is to be created. Error if file */
+/* with the same name already exists. */
+#define TFS_APPEND 0x00040000 /* Append to existing file. If OR'ed */
+/* with TFS_CREATE, then create if */
+/* necessary. */
+#define TFS_ALLFFS 0x00080000 /* File is created with all FFs. */
+#define TFS_CREATERM 0x00100000 /* File is to be created. If file with */
+/* same name already exists, then allow */
+/* tfsadd() to remove it if necessary. */
/* The function tfsrunrc() will search through the current file set and */
/* if the file defined by TFS_RCFILE exists, it will be executed. */
/* If this file exists, it will NOT be run by tfsrunboot(). */
-#define TFS_RCFILE "monrc"
+#define TFS_RCFILE "monrc"
/* Requests that can be made to tfsctrl(): */
-#define TFS_ERRMSG 1
-#define TFS_MEMUSE 2
-#define TFS_MEMDEAD 3
-#define TFS_DEFRAG 4
-#define TFS_TELL 5
-#define TFS_UNOPEN 7
-#define TFS_FATOB 8
-#define TFS_FBTOA 9
-#define TFS_MEMAVAIL 10
-#define TFS_TIMEFUNCS 11
-#define TFS_DOCOMMAND 12
-#define TFS_INITDEV 13
-#define TFS_CHECKDEV 14
-#define TFS_DEFRAGDEV 15
-#define TFS_DEFRAGOFF 16
-#define TFS_DEFRAGON 17
-#define TFS_HEADROOM 18
-#define TFS_FCOUNT 19
+#define TFS_ERRMSG 1
+#define TFS_MEMUSE 2
+#define TFS_MEMDEAD 3
+#define TFS_DEFRAG 4
+#define TFS_TELL 5
+#define TFS_UNOPEN 7
+#define TFS_FATOB 8
+#define TFS_FBTOA 9
+#define TFS_MEMAVAIL 10
+#define TFS_TIMEFUNCS 11
+#define TFS_DOCOMMAND 12
+#define TFS_INITDEV 13
+#define TFS_CHECKDEV 14
+#define TFS_DEFRAGDEV 15
+#define TFS_DEFRAGOFF 16
+#define TFS_DEFRAGON 17
+#define TFS_HEADROOM 18
+#define TFS_FCOUNT 19
/* struct tfshdr:
- * It is in FLASH as part of the file system to record the attributes of
- * the file at the time of creation.
+ * It is in FLASH as part of the file system to record the attributes of
+ * the file at the time of creation.
*/
struct tfshdr {
- unsigned short hdrsize; /* Size of this header. */
- unsigned short hdrvrsn; /* Header version #. */
- long filsize; /* Size of the file. */
- long flags; /* Flags describing the file. */
- unsigned long filcrc; /* 32 bit CRC of file. */
- unsigned long hdrcrc; /* 32 bit CRC of the header. */
- unsigned long modtime; /* Time when file was last modified. */
- struct tfshdr *next; /* Pointer to next file in list. */
- char name[TFSNAMESIZE+1]; /* Name of file. */
- char info[TFSINFOSIZE+1]; /* Miscellaneous info field. */
+ unsigned short hdrsize; /* Size of this header. */
+ unsigned short hdrvrsn; /* Header version #. */
+ long filsize; /* Size of the file. */
+ long flags; /* Flags describing the file. */
+ unsigned long filcrc; /* 32 bit CRC of file. */
+ unsigned long hdrcrc; /* 32 bit CRC of the header. */
+ unsigned long modtime; /* Time when file was last modified. */
+ struct tfshdr *next; /* Pointer to next file in list. */
+ char name[TFSNAMESIZE+1]; /* Name of file. */
+ char info[TFSINFOSIZE+1]; /* Miscellaneous info field. */
#if TFS_RESERVED
- unsigned long rsvd[TFS_RESERVED];
+ unsigned long rsvd[TFS_RESERVED];
#endif
};
-#define TFSHDRSIZ sizeof(struct tfshdr)
+#define TFSHDRSIZ sizeof(struct tfshdr)
/* TFS error returns. */
-#define TFS_OKAY 0
-#define TFSERR_NOFILE -1
-#define TFSERR_NOSLOT -2
-#define TFSERR_EOF -3
-#define TFSERR_BADARG -4
-#define TFSERR_NOTEXEC -5
-#define TFSERR_BADCRC -6
-#define TFSERR_FILEEXISTS -7
-#define TFSERR_FLASHFAILURE -8
-#define TFSERR_WRITEMAX -9
-#define TFSERR_RDONLY -10
-#define TFSERR_BADFD -11
-#define TFSERR_BADHDR -12
-#define TFSERR_CORRUPT -13
-#define TFSERR_MEMFAIL -14
-#define TFSERR_NOTIPMOD -16
-#define TFSERR_MUTEXFAILURE -17
-#define TFSERR_FLASHFULL -18
-#define TFSERR_USERDENIED -19
-#define TFSERR_NAMETOOBIG -20
-#define TFSERR_FILEINUSE -21
-#define TFSERR_NOTCPRS -22
-#define TFSERR_NOTAVAILABLE -23
-#define TFSERR_BADFLAG -24
-#define TFSERR_CLEANOFF -25
-#define TFSERR_FLAKEYSOURCE -26
-#define TFSERR_BADEXTENSION -27
-#define TFSERR_MIN -100
+#define TFS_OKAY 0
+#define TFSERR_NOFILE -1
+#define TFSERR_NOSLOT -2
+#define TFSERR_EOF -3
+#define TFSERR_BADARG -4
+#define TFSERR_NOTEXEC -5
+#define TFSERR_BADCRC -6
+#define TFSERR_FILEEXISTS -7
+#define TFSERR_FLASHFAILURE -8
+#define TFSERR_WRITEMAX -9
+#define TFSERR_RDONLY -10
+#define TFSERR_BADFD -11
+#define TFSERR_BADHDR -12
+#define TFSERR_CORRUPT -13
+#define TFSERR_MEMFAIL -14
+#define TFSERR_NOTIPMOD -16
+#define TFSERR_MUTEXFAILURE -17
+#define TFSERR_FLASHFULL -18
+#define TFSERR_USERDENIED -19
+#define TFSERR_NAMETOOBIG -20
+#define TFSERR_FILEINUSE -21
+#define TFSERR_NOTCPRS -22
+#define TFSERR_NOTAVAILABLE -23
+#define TFSERR_BADFLAG -24
+#define TFSERR_CLEANOFF -25
+#define TFSERR_FLAKEYSOURCE -26
+#define TFSERR_BADEXTENSION -27
+#define TFSERR_MIN -100
/* TFS seek options. */
-#define TFS_BEGIN 1
-#define TFS_CURRENT 2
-#define TFS_END 3
+#define TFS_BEGIN 1
+#define TFS_CURRENT 2
+#define TFS_END 3
/* Macros: */
-#define TFS_DELETED(fp) (!((fp)->flags & TFS_ACTIVE))
-#define TFS_FILEEXISTS(fp) ((fp)->flags & TFS_ACTIVE)
-#define TFS_ISCPRS(fp) ((fp)->flags & TFS_CPRS)
-#define TFS_ISEXEC(fp) ((fp)->flags & TFS_EXEC)
-#define TFS_ISBOOT(fp) ((fp)->flags & TFS_BRUN)
-#define TFS_ISLINK(fp) ((fp)->flags & TFS_SYMLINK)
-#define TFS_STALE(fp) (!((fp)->flags & TFS_NSTALE))
-#define TFS_FLAGS(fp) ((fp)->flags)
-#define TFS_NAME(fp) ((fp)->name)
-#define TFS_SIZE(fp) ((fp)->filsize)
-#define TFS_TIME(fp) ((fp)->modtime)
-#define TFS_INFO(fp) ((fp)->info)
-#define TFS_NEXT(fp) ((fp)->next)
-#define TFS_CRC(fp) ((fp)->filcrc)
-#define TFS_ENTRY(fp) ((fp)->entry)
-#define TFS_BASE(fp) ((char *)(fp)+(fp)->hdrsize)
+#define TFS_DELETED(fp) (!((fp)->flags & TFS_ACTIVE))
+#define TFS_FILEEXISTS(fp) ((fp)->flags & TFS_ACTIVE)
+#define TFS_ISCPRS(fp) ((fp)->flags & TFS_CPRS)
+#define TFS_ISEXEC(fp) ((fp)->flags & TFS_EXEC)
+#define TFS_ISBOOT(fp) ((fp)->flags & TFS_BRUN)
+#define TFS_ISLINK(fp) ((fp)->flags & TFS_SYMLINK)
+#define TFS_STALE(fp) (!((fp)->flags & TFS_NSTALE))
+#define TFS_FLAGS(fp) ((fp)->flags)
+#define TFS_NAME(fp) ((fp)->name)
+#define TFS_SIZE(fp) ((fp)->filsize)
+#define TFS_TIME(fp) ((fp)->modtime)
+#define TFS_INFO(fp) ((fp)->info)
+#define TFS_NEXT(fp) ((fp)->next)
+#define TFS_CRC(fp) ((fp)->filcrc)
+#define TFS_ENTRY(fp) ((fp)->entry)
+#define TFS_BASE(fp) ((char *)(fp)+(fp)->hdrsize)
typedef struct tfshdr TFILE;
#endif
diff --git a/apps/common/timer.h b/apps/common/timer.h
index e48ba52..fa6e865 100644
--- a/apps/common/timer.h
+++ b/apps/common/timer.h
@@ -2,40 +2,40 @@
#define _TIMER_H_
struct elapsed_tmr {
- unsigned long start; // Start value of elapsed timeout.
- unsigned long tmrval; // Running timer value
- // (used by elapsed timeout)
- unsigned long currenttmrval; // Current timer value
- // (not used by elapsed timeout)
- unsigned long tpm; // Ticks per millisecond
+ unsigned long start; // Start value of elapsed timeout.
+ unsigned long tmrval; // Running timer value
+ // (used by elapsed timeout)
+ unsigned long currenttmrval; // Current timer value
+ // (not used by elapsed timeout)
+ unsigned long tpm; // Ticks per millisecond
- unsigned long elapsed_low;
- unsigned long elapsed_high;
+ unsigned long elapsed_low;
+ unsigned long elapsed_high;
- unsigned long timeout_low;
- unsigned long timeout_high;
+ unsigned long timeout_low;
+ unsigned long timeout_high;
- unsigned long tmrflags;
+ unsigned long tmrflags;
};
/* Timer flags:
*/
-#define HWTMR_ENABLED (1 << 0)
-#define TIMEOUT_OCCURRED (1 << 1)
+#define HWTMR_ENABLED (1 << 0)
+#define TIMEOUT_OCCURRED (1 << 1)
/* Timer macros:
*/
-#define HWRTMR_IS_ENABLED(tmr) \
- ((tmr)->tmrflags & HWTMR_ENABLED)
+#define HWRTMR_IS_ENABLED(tmr) \
+ ((tmr)->tmrflags & HWTMR_ENABLED)
-#define ELAPSED_TIMEOUT(tmr) \
- ((tmr)->tmrflags & TIMEOUT_OCCURRED)
+#define ELAPSED_TIMEOUT(tmr) \
+ ((tmr)->tmrflags & TIMEOUT_OCCURRED)
/* uMon API timer commands:
*/
-#define TIMER_START 1
-#define TIMER_ELAPSED 2
-#define TIMER_QUERY 3
+#define TIMER_START 1
+#define TIMER_ELAPSED 2
+#define TIMER_QUERY 3
extern unsigned long target_timer(void);
extern void startElapsedTimer(struct elapsed_tmr *tmr,long timeout);
diff --git a/apps/demo/main.c b/apps/demo/main.c
index d74a2d3..800b0d0 100644
--- a/apps/demo/main.c
+++ b/apps/demo/main.c
@@ -1,4 +1,4 @@
-/*
+/*
* This file is a simple example of an application that could be run
* on top of the monitor.
*
@@ -29,8 +29,8 @@ extern void strace_demo(void);
void
hitakey(void)
{
- while(!mon_gotachar());
- mon_getchar();
+ while(!mon_gotachar());
+ mon_getchar();
}
/* timer_demo():
@@ -42,84 +42,83 @@ hitakey(void)
void
timer_demo(void)
{
- struct elapsed_tmr tmr;
- unsigned long starttime, endtime;
-
- /* Here are a few different ways (using the uMon API) to wait for
- * three seconds...
- *
- * First make sure the underlying monitor has a Hardware-based
- * timer. If it doesn't then this is worthless.
- */
- mon_timer(TIMER_QUERY,&tmr);
- if ((HWRTMR_IS_ENABLED(&tmr)) == 0) {
- mon_printf("This monitor doesn't have INCLUDE_HWTMR configured\n");
- return;
- }
-
- mon_printf("Timer demo ready to start, hit a key to continue\n");
- hitakey();
-
- /*****************************************************************
- *
- * The first one, also the simplest, but least versatile is to just
- * use mon_delay(). The mon_delay function just takes the number
- * of milliseconds you want to wait, and uses the underlying hardware
- * to busy wait on that duration...
- */
- mon_printf("1. Wait for 3 seconds...\n");
- mon_delay(3000);
- mon_printf("1. Done, hit a key to continue\n");
- hitakey();
-
- /*****************************************************************
- *
- * The second one, allows the user to specify the elapsed time
- * (in milliseconds), then allows the user to poll waiting for that
- * time to expire. Meanwhile, the application can do other things
- * while it waits.
- */
- mon_printf("2. Wait for 3 seconds...\n");
- tmr.start = 3000;
- mon_timer(TIMER_START,&tmr);
- while(mon_timer(TIMER_ELAPSED,&tmr) == 0) {
- /* Do whatever you like here. */
- }
- mon_printf("2. Done, hit a key to continue\n");
- hitakey();
-
- /*****************************************************************
- *
- * The third method, uses the granularity of the hardware clock
- * and the returned value of "ticks-per-millisecond". It provides
- * the most versatility (without actually knowing the details of
- * the hardware clock), but requires the most work. Note that we
- * have to deal with the possiblity of 32-bit timer value wrap.
- */
- mon_printf("3. Wait for 3 seconds...\n");
- mon_timer(TIMER_QUERY,&tmr);
- starttime = tmr.currenttmrval;
- endtime = starttime + 3000 * tmr.tpm;
- if (endtime < starttime) {
- do {
- mon_timer(TIMER_QUERY,&tmr);
- } while(tmr.currenttmrval > starttime);
- do {
- mon_timer(TIMER_QUERY,&tmr);
- } while(tmr.currenttmrval < endtime);
- }
- else {
- do {
- mon_timer(TIMER_QUERY,&tmr);
- } while((tmr.currenttmrval > starttime) &&
- (tmr.currenttmrval < endtime));
- }
-
- mon_printf("3. Done, hit a key to continue\n");
- while(!mon_gotachar());
-
- mon_printf("Timer demo done\n");
- mon_appexit(1);
+ struct elapsed_tmr tmr;
+ unsigned long starttime, endtime;
+
+ /* Here are a few different ways (using the uMon API) to wait for
+ * three seconds...
+ *
+ * First make sure the underlying monitor has a Hardware-based
+ * timer. If it doesn't then this is worthless.
+ */
+ mon_timer(TIMER_QUERY,&tmr);
+ if((HWRTMR_IS_ENABLED(&tmr)) == 0) {
+ mon_printf("This monitor doesn't have INCLUDE_HWTMR configured\n");
+ return;
+ }
+
+ mon_printf("Timer demo ready to start, hit a key to continue\n");
+ hitakey();
+
+ /*****************************************************************
+ *
+ * The first one, also the simplest, but least versatile is to just
+ * use mon_delay(). The mon_delay function just takes the number
+ * of milliseconds you want to wait, and uses the underlying hardware
+ * to busy wait on that duration...
+ */
+ mon_printf("1. Wait for 3 seconds...\n");
+ mon_delay(3000);
+ mon_printf("1. Done, hit a key to continue\n");
+ hitakey();
+
+ /*****************************************************************
+ *
+ * The second one, allows the user to specify the elapsed time
+ * (in milliseconds), then allows the user to poll waiting for that
+ * time to expire. Meanwhile, the application can do other things
+ * while it waits.
+ */
+ mon_printf("2. Wait for 3 seconds...\n");
+ tmr.start = 3000;
+ mon_timer(TIMER_START,&tmr);
+ while(mon_timer(TIMER_ELAPSED,&tmr) == 0) {
+ /* Do whatever you like here. */
+ }
+ mon_printf("2. Done, hit a key to continue\n");
+ hitakey();
+
+ /*****************************************************************
+ *
+ * The third method, uses the granularity of the hardware clock
+ * and the returned value of "ticks-per-millisecond". It provides
+ * the most versatility (without actually knowing the details of
+ * the hardware clock), but requires the most work. Note that we
+ * have to deal with the possiblity of 32-bit timer value wrap.
+ */
+ mon_printf("3. Wait for 3 seconds...\n");
+ mon_timer(TIMER_QUERY,&tmr);
+ starttime = tmr.currenttmrval;
+ endtime = starttime + 3000 * tmr.tpm;
+ if(endtime < starttime) {
+ do {
+ mon_timer(TIMER_QUERY,&tmr);
+ } while(tmr.currenttmrval > starttime);
+ do {
+ mon_timer(TIMER_QUERY,&tmr);
+ } while(tmr.currenttmrval < endtime);
+ } else {
+ do {
+ mon_timer(TIMER_QUERY,&tmr);
+ } while((tmr.currenttmrval > starttime) &&
+ (tmr.currenttmrval < endtime));
+ }
+
+ mon_printf("3. Done, hit a key to continue\n");
+ while(!mon_gotachar());
+
+ mon_printf("Timer demo done\n");
+ mon_appexit(1);
}
/* Global variables added just to be able to use this
@@ -131,64 +130,66 @@ long apprambase;
int
main(int argc,char *argv[])
{
- int i, tfd;
- char line[80], *ab, *filename;
-
- argtot = argc;
-
- /* If argument count is greater than one, then dump out the
- * set of CLI arguments...
- */
- if (argc > 1) {
- if ((argc == 2) && (strcmp(argv[1],"strace_demo") == 0))
- strace_demo();
-
- if ((argc == 2) && (strcmp(argv[1],"timer") == 0))
- timer_demo();
-
- mon_printf("Argument list...\n");
- for(i=0;i<argc;i++) {
- mon_printf(" arg[%d]: %s\n",i,argv[i]);
- if (strcmp(argv[i],"match") == 0)
- mon_printf("got a match!\n");
- }
- }
-
- /* Using the content of the shell variable APPRAMBASE, dump the
- * memory starting at that location...
- */
- ab = mon_getenv("APPRAMBASE");
- if (ab) {
- char *addr = (char *)strtoul(ab,0,0);
- apprambase = strtoul(ab,0,0);
-
- mon_printf("Dumping memory at 0x%lx...\n",addr);
- mon_printmem(addr,128,1);
- }
-
- filename = "monrc";
-
- /* If the 'monrc' file exists, the assume it is ASCII and dump it
- * line by line...
- */
- if (mon_tfsstat(filename)) {
- mon_printf("Dumping content of '%s'...\n",filename);
-
- tfd = mon_tfsopen(filename,TFS_RDONLY,0);
- if (tfd >= 0) {
- while(mon_tfsgetline(tfd,line,sizeof(line)))
- mon_printf("%s",line);
- mon_tfsclose(tfd,0);
- }
- else {
- mon_printf("TFS error: %s\n",
- (char *)mon_tfsctrl(TFS_ERRMSG,tfd,0));
- }
- }
- else {
- mon_printf("File '%s' not found\n",filename);
- }
- return(0);
+ int i, tfd;
+ char line[80], *ab, *filename;
+
+ argtot = argc;
+
+ /* If argument count is greater than one, then dump out the
+ * set of CLI arguments...
+ */
+ if(argc > 1) {
+ if((argc == 2) && (strcmp(argv[1],"strace_demo") == 0)) {
+ strace_demo();
+ }
+
+ if((argc == 2) && (strcmp(argv[1],"timer") == 0)) {
+ timer_demo();
+ }
+
+ mon_printf("Argument list...\n");
+ for(i=0; i<argc; i++) {
+ mon_printf(" arg[%d]: %s\n",i,argv[i]);
+ if(strcmp(argv[i],"match") == 0) {
+ mon_printf("got a match!\n");
+ }
+ }
+ }
+
+ /* Using the content of the shell variable APPRAMBASE, dump the
+ * memory starting at that location...
+ */
+ ab = mon_getenv("APPRAMBASE");
+ if(ab) {
+ char *addr = (char *)strtoul(ab,0,0);
+ apprambase = strtoul(ab,0,0);
+
+ mon_printf("Dumping memory at 0x%lx...\n",addr);
+ mon_printmem(addr,128,1);
+ }
+
+ filename = "monrc";
+
+ /* If the 'monrc' file exists, the assume it is ASCII and dump it
+ * line by line...
+ */
+ if(mon_tfsstat(filename)) {
+ mon_printf("Dumping content of '%s'...\n",filename);
+
+ tfd = mon_tfsopen(filename,TFS_RDONLY,0);
+ if(tfd >= 0) {
+ while(mon_tfsgetline(tfd,line,sizeof(line))) {
+ mon_printf("%s",line);
+ }
+ mon_tfsclose(tfd,0);
+ } else {
+ mon_printf("TFS error: %s\n",
+ (char *)mon_tfsctrl(TFS_ERRMSG,tfd,0));
+ }
+ } else {
+ mon_printf("File '%s' not found\n",filename);
+ }
+ return(0);
}
void
@@ -199,33 +200,33 @@ __gccmain()
int
Cstart(void)
{
- char **argv;
- int argc;
+ char **argv;
+ int argc;
- /* Connect the application to the monitor. This must be done
- * prior to the application making any other attempts to use the
- * "mon_" functions provided by the monitor.
- */
- monConnect((int(*)())(*(unsigned long *)MONCOMPTR),(void *)0,(void *)0);
+ /* Connect the application to the monitor. This must be done
+ * prior to the application making any other attempts to use the
+ * "mon_" functions provided by the monitor.
+ */
+ monConnect((int(*)())(*(unsigned long *)MONCOMPTR),(void *)0,(void *)0);
- /* When the monitor starts up an application, it stores the argument
- * list internally. The call to mon_getargv() retrieves the arg list
- * for use by this application...
- */
- mon_getargv(&argc,&argv);
+ /* When the monitor starts up an application, it stores the argument
+ * list internally. The call to mon_getargv() retrieves the arg list
+ * for use by this application...
+ */
+ mon_getargv(&argc,&argv);
- /* Call main, then exit to monitor.
- */
- main(argc,argv);
+ /* Call main, then exit to monitor.
+ */
+ main(argc,argv);
- mon_appexit(0);
+ mon_appexit(0);
- /* Won't get here. */
- return(0);
+ /* Won't get here. */
+ return(0);
}
/* CstartAlt():
- * Demonstrates the use of the "call -a" command in uMon.
+ * Demonstrates the use of the "call -a" command in uMon.
* For example, if for some reason you wanted to do this...
* Load the application then load the symtbl file using
* "make TARGET_IP=1.2.3.4 sym", then issue these commands:
@@ -243,8 +244,8 @@ Cstart(void)
int
CstartAlt(int argc, char *argv[])
{
- monConnect((int(*)())(*(unsigned long *)MONCOMPTR),(void *)0,(void *)0);
- main(argc,argv);
- mon_appexit(0);
- return(0);
+ monConnect((int(*)())(*(unsigned long *)MONCOMPTR),(void *)0,(void *)0);
+ main(argc,argv);
+ mon_appexit(0);
+ return(0);
}
diff --git a/apps/demo/strace.c b/apps/demo/strace.c
index a2fcb0f..88a4e63 100644
--- a/apps/demo/strace.c
+++ b/apps/demo/strace.c
@@ -5,7 +5,7 @@
* NO_EXCEPTION_RESTART shell variable is set at the top of
* strace_demo() below (typically this environment variable would
* be set during development in the monrc file).
- *
+ *
* After the exception has completed, at the uMON> prompt type the
* "strace" command. Assuming your monitor is built with INCLUDE_STRACE
* set (refer to config.h for your monitor's port), then the output
@@ -31,7 +31,7 @@
* 18: uMON>
*
* Line 1 : shows the invocation of the application 'app'.
- * Lines 2-5 : show the output of the strace.c mon_printf calls.
+ * Lines 2-5 : show the output of the strace.c mon_printf calls.
* Lines 7-8 : show uMon catching the exception.
* Line 10 : shows the invocation of the 'strace' command.
* Lines 11-16 : show the output of strace giving the user the exact
@@ -49,52 +49,52 @@
#include "monlib.h"
#if CPU_IS_MIPS
-#define EXCEPTION() asm("syscall 99"); /* System call */
+#define EXCEPTION() asm("syscall 99"); /* System call */
#elif CPU_IS_68K
-#define EXCEPTION() asm("trap #3"); /* Trap */
+#define EXCEPTION() asm("trap #3"); /* Trap */
#elif CPU_IS_SH
-#define EXCEPTION() asm("trap #3"); /* Trap */
+#define EXCEPTION() asm("trap #3"); /* Trap */
#elif CPU_IS_BFIN
-#define EXCEPTION() asm("excpt 5"); /* Force exception */
+#define EXCEPTION() asm("excpt 5"); /* Force exception */
#elif CPU_IS_MICROBLAZE
-#define EXCEPTION() asm("bralid r15,8"); /* User exception */
+#define EXCEPTION() asm("bralid r15,8"); /* User exception */
#elif CPU_IS_PPC
-#define EXCEPTION() asm("sc"); /* System call */
+#define EXCEPTION() asm("sc"); /* System call */
#elif CPU_IS_ARM
-#define EXCEPTION() asm("swi"); /* Software interrupt */
+#define EXCEPTION() asm("swi"); /* Software interrupt */
#else
#error: Must specify CPU type for exception demo.
#endif
-
+
int
func3(int i)
{
- mon_printf("func3 exception now!\n");
- EXCEPTION();
- return(i+5);
+ mon_printf("func3 exception now!\n");
+ EXCEPTION();
+ return(i+5);
}
int
func2(int i)
{
- mon_printf("func2\n");
- func3(i+3);
- return(99);
+ mon_printf("func2\n");
+ func3(i+3);
+ return(99);
}
int
func1(void)
{
- mon_printf("func1\n");
- func2(3);
- return(88);
+ mon_printf("func1\n");
+ func2(3);
+ return(88);
}
int
strace_demo(void)
{
- mon_printf("strace_demo\n");
- mon_setenv("NO_EXCEPTION_RESTART","TRUE");
- func1();
- return(77);
+ mon_printf("strace_demo\n");
+ mon_setenv("NO_EXCEPTION_RESTART","TRUE");
+ func1();
+ return(77);
}