📄 dbug.h
字号:
/*
* File: src/include/dbug.h
* Purpose: Definitions and prototypes for dBUG.
*
* Notes: Main header file for dBUG
*
*/
#ifndef _DBUG_H
#define _DBUG_H
/********************************************************************/
#ifdef __GNUC__
#define asm __asm__
#endif
/********************************************************************/
/* dBUG definition visible to all */
#define DBUG_MAJOR 2
#define DBUG_MINOR 0
/* Obtain board specific configurations */
#include "config.h"
/* Obtain CPU basic types and other CPU information */
#include "src/include/cpu/cpu.h"
/* Obtain dBUG CPU information */
#include "src/cpu/dbugcpu.h"
#ifdef FALSE
#undef FALSE
#endif
#define FALSE (0)
#ifdef TRUE
#undef TRUE
#endif
#define TRUE (1)
#ifdef NULL
#undef NULL
#endif
#define NULL (0)
/********************************************************************/
/* */
/* CPU specific information */
/* */
/********************************************************************/
/*
* User-code register set buffer
*/
extern REGISTERS context;
/*
* Constant variables
*/
extern const char CPU_STR[]; /* CPU string, ie "MPC860" */
extern const int CPU_VER_MAJOR; /* CPU src ver, ie 1 */
extern const char CPU_VER_MINOR; /* CPU src ver, ie 'a' */
/********************************************************************/
/* */
/* Board-specific prototypes */
/* */
/********************************************************************/
/*
* Constant variables
*/
extern const char BRD_STR[]; /* Board string, ie "ADS" */
extern const int BRD_VER_MAJOR;/* Board src ver, ie 2 */
extern const char BRD_VER_MINOR;/* Board src ver, ie 'a' */
extern const char BRD_DATE[]; /* Board build date */
extern const char BRD_TIME[]; /* Board build time */
extern const int BRD_BUILD; /* Board build number */
extern const char COPYRIGHT2[];
/*
* Prototypes for functions REQUIRED by any BSP.
*/
void
board_init (void);
void
board_init2 (void);
void
board_init3 (void);
char
board_getchar (void);
void
board_putchar (char);
int
board_getchar_present (void);
void
board_putchar_flush (void);
int
board_dlio_getchar (void);
int
board_dlio_init (void);
void
board_dlio_done (void);
int
board_dlio_vda (ADDRESS);
void
board_reset (void);
/*
* Optional, needed only if used
*/
int
board_get_baud (void);
void
board_set_baud (int);
int
board_get_speed (void);
void
board_set_speed(int);
void
timer_start(uint8);
void
timer_stop(uint8);
uint32
timer_read(uint8);
uint32
timer_set_secs(uint8, uint32);
uint32
timer_get_reference(uint8);
/*
* Network support routines
*/
int
board_dlio_filetype (char *, char *);
void
board_irq_enable (void);
void
board_irq_disable (void);
void
board_set_client (uint8 *);
uint8 *
board_get_client (uint8 *);
void
board_set_server (uint8 *);
uint8 *
board_get_server (uint8 *);
void
board_set_gateway (uint8 *);
uint8 *
board_get_gateway (uint8 *);
void
board_set_netmask (uint8 *);
uint8 *
board_get_netmask (uint8 *);
void
board_set_filename (char *);
char *
board_get_filename (char *);
void
board_set_filetype (int);
int
board_get_filetype (void);
/********************************************************************/
/* */
/* Global messages/constant strings */
/* */
/********************************************************************/
extern const char COPYRIGHT[];
extern const char HELPMSG[];
extern const char INVARG[];
extern const char INVCMD[];
extern const char INVREG[];
extern const char INVALUE[];
/********************************************************************/
/* */
/* Interrupt service routine prototypes */
/* */
/********************************************************************/
#define ISR_DBUG_ISR (0x01)
#define ISR_USER_ISR (0x02)
int
isr_register_handler (int, int,
int (*)(void *, void *), void *, void *);
void
isr_remove_handler (int, int (*)(void *, void *));
/********************************************************************/
/* */
/* Generic User InterFace definitions and prototypes */
/* */
/********************************************************************/
/*
* Maximum command line arguments
*/
#define UIF_MAX_ARGS (10)
/*
* Maximum length of the command line
*/
#define UIF_MAX_LINE (72)
/*
* User Interface version prototype
*/
extern const int UIF_VER_MAJOR;
extern const char UIF_VER_MINOR;
/*
* Linker defined symbol for start of user space
*/
extern char __USER_SPACE[];
/*
* Where character I/O comes from during download.
*/
extern int uif_dlio;
#define UIF_DLIO_CONSOLE (1)
#define UIF_DLIO_NETWORK (2)
/*
* The download data stream type during the download.
*/
#define UIF_DLIO_UNKNOWN (0)
#define UIF_DLIO_COFF (1)
#define UIF_DLIO_SREC (2)
#define UIF_DLIO_IMAGE (3)
#define UIF_DLIO_ELF (4)
/*
* Global variable indicating radix or base for string conversions to
* numbers.
*/
extern int BASE;
/*
* Function prototypes
*/
int
pause (int *);
char *
get_line (char *);
uint32
get_value (char *, int *, int);
int
make_argv (char *, char **);
/********************************************************************/
/* */
/* Miscellaneous */
/* */
/********************************************************************/
#define SIZE_8 (8)
#define SIZE_16 (16)
#define SIZE_32 (32)
#define SIZE_64 (64)
#define XON (0x11)
#define XOFF (0x13)
#define LF (0x0A)
#define CR (0x0D)
/********************************************************************/
/* */
/* Standard library functions provided by dBUG */
/* */
/********************************************************************/
int
isspace (int);
int
isalnum (int);
int
isdigit (int);
int
isupper (int);
int
strcasecmp (const char *, const char *);
int
strncasecmp (const char *, const char *, int);
unsigned long
strtoul (char *, char **, int);
int
strlen (const char *);
char *
strcat (char *, const char *);
char *
strncat (char *, const char *, int);
char *
strcpy (char *, const char *);
char *
strncpy (char *, const char *, int);
int
strcmp (const char *, const char *);
int
strncmp (const char *, const char *, int);
void *
memcpy (void *, const void *, unsigned);
void *
memset (void *, int, unsigned);
#define printf printD
#define sprintf sprintD
int
printD (const char *, ... );
int
sprintD (char *, const char *, ... );
void
free (void *);
void *
malloc (unsigned);
/********************************************************************/
/* */
/* Flash Utilities */
/* */
/********************************************************************/
#define MAX_FLASH_DEVICES (2)
typedef struct
{
/* Name of Flash device */
char name[60];
/* Base address of Flash device */
ADDRESS base;
/* Length of device in bytes */
int size;
/* Minimum port size mask */
int mask;
/* Erase function (start, bytes) */
int (*erase)(ADDRESS, int, void (*)(char));
/* Program function (dest, src, bytes) */
int (*program)(ADDRESS, ADDRESS, int, int, void (*)(void), void (*)(char));
/* Returns beginning of sector containing ADDRESS */
ADDRESS (*sector_start)(ADDRESS);
/* Returns end of sector containing ADDRESS */
ADDRESS (*sector_end)(ADDRESS);
/* Character output routine */
void (*putchar)(char);
/* Start address of protected region */
ADDRESS protect_start;
/* Size of protected region in bytes */
int protect_size;
} FLASH_INFO;
int
flash_dlio_vda(ADDRESS);
int
flash_register_device(FLASH_INFO*);
int
flash_program(ADDRESS, ADDRESS, int, int, int, int);
void
flash_usage(void);
/********************************************************************/
/* */
/* Generic User InterFace Commands */
/* */
/********************************************************************/
/*
* The command table entry data structure, and the prototype for the
* command table.
*/
typedef const struct
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -