#ifndef NMon_h
#define NMon_h
/*******************************************************************************
NMon - Nohau Monitor

Creator: Sten Larsson
$Header: /NCARM_Misc/BSP_ARM/Src/NMon/NMon.h 31    7/01/03 10:33a Stenl $
--------------------------------------------------------------------------------
DO NOT MODIFY THIS FILE - IT IS A PART OF NMON (Nohau Monitor) AND MAY BE 
UPDATED IN FUTURE RELEASES OF SEEHAU.

This computer software is owned by Nohau Corp, and is protected by U.S. 
copyright laws and other laws and by international treaties. Customers of Nohau
emulators/debuggers are allowed include it in their products for the purpose of 
enhancing the debug capabilities of Nohau products. It is not allowed to use it 
for any other purpose. The source code may not be provided or otherwise made 
available to third parties, except with the purpose of using it with Nohau 
tools. Nohau may elect to grant exceptions to the above statement in a written 
agreement.

Copyright  ©  2002, Nohau Corporation. All Rights Reserved.
Copyright (c) 2002, Nohau Corporation. All Rights Reserved.
*******************************************************************************/
#include "NDefs.h"
#include "NMon_Cfg.h"
#ifdef __cplusplus
extern "C" {
#endif

/*##############################################################################
## FUNCTIONS
##############################################################################*/

     /* Initialize the Nohau Monitor */
void NMon_Init(void);

#ifndef NPUT_NO_EXEC
     /* Execute - needs to be called from low priory function, as quite long
     ** busy waits could be caused. */
void NMon_Exec(void);
#endif

     /* Set watchdog hook - ie function to be called during busy waits to
     ** prevent that the watch dog be activated. */
void NMon_WatchdogHook(void(*pFn)(void));

          
     /*-------------------------------------------------------------------------
     ** printf() / putc() functionality
     **-----------------------------------------------------------------------*/
#ifdef NPUT_ENABLE

     /* Put one character */
void NPut_Putc(char ch);
#define NMon_Putc NPut_Putc

     /* Put zero terminated string of characters */
void NPut_Puts(const char* str);
#define NMon_Puts NPut_Puts

     /* Put count characters from the supplied string - zero termination in 
     ** the string will be ignored. */
void NPut_Putn(const char* str, U_INT16 count);
#define NMon_Putn NPut_Putn

     /* Error Output
     ** NPut can show error messages from the target application in Seehau.
     ** Following functions are available for this purpose. Note that we support 
     ** functionality similar to the std c <assert.h> - see file NAssert.h.
     ** Output error message - will show as error message in Seehau. */
void NPut_Error(const char* str);
#define NMon_Error NPut_Error

     /* Advanced Functionality
     ** NPut can also position the cursor on the Target Console window, and 
     ** clear page, end of page and end of line to allow building simple user
     ** interfaces.  */
void NPut_ClrScr(void);         /* Clear screen. */
void NPut_ClrEol(void);         /* Clear end of line. */
void NPut_ClrEop(void);         /* Clear end of page. */
void NPut_Move(BYTE x, BYTE y); /* Move the cursor */
void NPut_Echo(BOOL on);        /* Set echo on/off for characters entered in the TargetConsole. */
void NPut_Assert(int condition, BYTE type, const char* file, U_INT16 line);
#define NMon_ClrScr NPut_ClrScr
#define NMon_ClrEol NPut_ClrEol
#define NMon_ClrEop NPut_ClrEop
#define NMon_Move   NPut_Move
#define NMon_Echo   NPut_Echo
#define NMon_Assert NPut_Assert

#endif /* NPUT_ENABLE */ 


       /*-----------------------------------------------------------------------
       ** getc() functionality
       **---------------------------------------------------------------------*/
#ifdef NGET_ENABLE

       /* Get one character - wait for it to be available, if not 
       ** already available. */
BYTE NGet_Getc(void);
#define NMon_Getc NGet_Getc

     /* Get character buffer of count characters - wait for it to be available. 
     ** Characteres will be copied into the pointed out buffer. */
void NGet_Gets(BYTE* pBuf, U_INT16 count);
#define NMon_Gets NGet_Gets

     /* Are there and characters available? */
BOOL NGet_Available(void);
#define NMon_Available NGet_Available

     /* Clear all characters in the input buffer. */
void NGet_Clear(void);
#define NMon_Clear NGet_Clear

#endif /* NGET_ENABLE */ 


       /*-----------------------------------------------------------------------
       ** User application
       **---------------------------------------------------------------------*/

#ifdef NUSR_WRITE_ENABLE
void NUsr_Init(void)
BOOL NUsr_WantWrite(void)
BYTE NUsr_PreWrite(void)
BYTE NUsr_Write(void)
BYTE NUsr_PostWrite(void)
#endif /* NUSR_WRITE_ENABLE */


#ifdef NUSR_READ_ENABLE
void NUsr_Init(void)
BOOL NUsr_WantRead(void)
BYTE NUsr_Read(void)
#endif /* NUSR_READ_ENABLE */


/*##############################################################################
## EXPORTED DATA
##############################################################################*/
#if defined(NUSR_WRITE_ENABLE) || defined(NUSR_READ_ENABLE)
 /* 
User defined services, as defined in file "NSrv.h" should use this data to 
define what should be processed. NMon_Buf is a buffer from which data 
shall be read at MEM WRITE, and to which data shall be written at MEM READ.
*/

                /* Addresses and space for read & write. */
extern BYTE*    NMon_Addr_Curr;    /* Current addr - should be incremented for each write. */
extern BYTE*    NMon_Addr_Last;    /* Last address that shall be written to. */
extern NSPACE   NMon_Addr_Space;

                /* Address limits - allows to erase only selected parts etc. 
                ** These are used optionally. */
extern ADDRESS  NMon_AddrLimit_Lo;
extern ADDRESS  NMon_AddrLimit_Hi;

                /* When true, the service should read back after writing. 
                ** If verify fails, the first addr for failure should be stored
                ** in NMon_Verify_Addr. */
extern BOOL     NMon_Verify_On;
extern ADDRESS  NMon_Verify_Addr;

                /* Buffer for reading/writing data. */ 
#if (NMON_BUF_SIZE > 0)
extern BYTE     NMon_Buf[NMON_BUF_SIZE];
#endif
                                           
#endif /* NUSR_WRITE_ENABLE || NUSR_READ_ENABLE */


#ifdef __cplusplus
}
#endif
#endif /* NMonCom_h */
