Monitor: Standard Monitor Functions
PmT1 and PmE1 User’s Manual 10002367-02
8-38
See also: StartMon.c, NvMonDefs.h, NVTable.c, “Boot Commands” Section .
InitFifo
InitFifo(FPtr, StartAddr, Length)
struct Fifo *FPtr;
unsigned char *StartAddr;
int Length;
ToFifo(FPtr, c)
struct Fifo *FPtr;
unsigned char c;
FromFifo(FPtr, Ptr)
struct Fifo *FPtr;
unsigned char *Ptr;
Description: These functions provide the necessary interface to initialize, read, and write a software
FIFO. The FIFO is used for buffering serial I/O when using transparent mode, but could be
used for a variety of applications. All three functions accept a pointer FPtr as the first argu-
ment to a FIFO management structure. This FIFO structure is described briefly below:
struct Fifo {
unsigned char *Top;
unsigned char *Bottom;
int Length;
unsigned char *Front;
unsigned char *Rear;
int Count;
} Fifo;
The function InitFifo initializes the FIFO control structure specified by FPtr to use the
unsigned character buffer starting at StartAddr that is of size Length.
The function ToFifo writes the byte c to the specified FIFO. This function returns TRUE if
there is room in the FIFO (before adding c to the FIFO), or FALSE if the FIFO is full.
The function FromFifo reads a byte from the specified FIFO. If a character is available, it is
written to the address specified by the pointer Ptr and the function returns TRUE. If no char-
acter is available, the function returns FALSE.
IsLegal
IsLegal(Type,Str)
unsigned char Type;
char *Str;
Description: This function is used to determine if the specified character string Str contains legal values
to allow the string to be parsed as decimal, hex, uppercase, or lowercase. The function IsLe-
gal traverses the character string until a NULL is reached. Each character is verified accord-
ing to the Ty pe argument.
The effects of specifying each type are described below: