/*This file may be included with any C file that uses the D-Bug12 user callable */ /* routines. It provides a simple, portable way to access the routines from C without */ /* having to use any assembly language "glue code" */ /* Some defaults used by D-Bug12 */ typedef void * Address; typedef int Boolean; typedef unsigned char Byte; /* The symbol "Version" should be set to the D-Bug12 version number that is being used. For example, if the D-Bug12 version number is 1.0.4, Version should be 104. */ #define Version 400 typedef enum Vect { UserRsrv0x80 = 0, UserRsrv0x82 = 1, UserRsrv0x84 = 2, UserRsrv0x86 = 3, UserRsrv0x88 = 4, UserRsrv0x8a = 5, UserPWMShDn = 6, UserPortP = 7, UserMSCAN4Tx = 8, UserMSCAN4Rx = 9, UserMSCAN4Errs = 10, UserMSCAN4Wake = 11, UserMSCAN3Tx = 12, UserMSCAN3Rx = 13, UserMSCAN3Errs = 14, UserMSCAN3Wake = 15, UserMSCAN2Tx = 16, UserMSCAN2Rx = 17, UserMSCAN2Errs = 18, UserMSCAN2Wake = 19, UserMSCAN1Tx = 20, UserMSCAN1Rx = 21, UserMSCAN1Errs = 22, UserMSCAN1Wake = 23, UserMSCAN0Tx = 24, UserMSCAN0Rx = 25, UserMSCAN0Errs = 26, UserMSCAN0Wake = 27, UserFlash = 28, UserEEPROM = 29, UserSPI2 = 30, UserSPI1 = 31, UserIIC = 32, UserDLC = 33, UserSCME = 34, UserCRG = 35, UserPAccBOv = 36, UserModDwnCtr = 37, UserPortH = 38, UserPortJ = 39, UserAtoD1 = 40, UserAtoD0 = 41, UserSCI1 = 42, UserSCI0 = 43, UserSPI0 = 44, UserPAccEdge = 45, UserPAccOvf = 46, UserTimerOvf = 47, UserTimerCh7 = 48, UserTimerCh6 = 49, UserTimerCh5 = 50, UserTimerCh4 = 51, UserTimerCh3 = 52, UserTimerCh2 = 53, UserTimerCh1 = 54, UserTimerCh0 = 55, UserRTI = 56, UserIRQ = 57, UserXIRQ = 58, UserSWI = 59, UserTrap = 60, RAMVectAddr = -1 }; /* structure that defines the functions in D-Bug12's user accessible */ /* function table. Also provides a function prototype for each function */ /* Documentation for each of these functions can be found in Application */ /* Note AN-xxxx text */ typedef struct { @far void (*DB12main)(void); int (*DB12getchar)(void); int (*DB12putchar)(int); int (*DB12printf)(const char *,...); @far int (*GetCmdLine)(char *CmdLineStr, int CmdLineLen); @far int (*sscanhex)(char *HexStr, unsigned int *BinNum); int (*DB12isxdigit)(int c); int (*DB12toupper)(int c); int (*DB12isalpha)(int c); unsigned int (*DB12strlen)(const char *cs); char * (*DB12strcpy)(char *s1, char *s2); @far void (*out2hex)(unsigned int num); @far void (*out4hex)(unsigned int num); int (*SetUserVector)(int VectNum, Address UserAddress); @far Boolean (*WriteEEByte)(Address EEAddress, Byte EEData); @far int (*EraseEE)(void); @far int (*ReadMem)(Address StartAddress, Byte *MemDataP, unsigned int NumBytes); @far int (*WriteMem)(Address StartAddress, Byte *MemDataP, unsigned int NumBytes); }UserFN, *UserFNP; /* defines a pointer to the start of D-Bug12's user accessible functable */ #define DB12FNP ((UserFNP)0xee80) /* in D-Bug12 version 4.x.x the user accessible table begins at $ee80 */ /* The following #defines are used to provide for portability and avoid a linker */ /* conflict with the standard library functions of the same name. No #define is */ /* included for DB12main() since all C programs contain a main() function */ #define printf DB12printf #define getchar DB12getchar #define putchar DB12putchar #define isxdigit DB12isxdigit #define toupper DB12toupper #define isalpha DB12isalpha #define strlen DB12strlen #define strcpy DB12strcpy