1*b725ae77Skettenis /* 2*b725ae77Skettenis * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved. 3*b725ae77Skettenis * 4*b725ae77Skettenis * This software may be freely used, copied, modified, and distributed 5*b725ae77Skettenis * provided that the above copyright notice is preserved in all copies of the 6*b725ae77Skettenis * software. 7*b725ae77Skettenis */ 8*b725ae77Skettenis 9*b725ae77Skettenis /*> angel.h <*/ 10*b725ae77Skettenis /*---------------------------------------------------------------------------*/ 11*b725ae77Skettenis /* This header file is the main holder for the declarations and 12*b725ae77Skettenis * prototypes for the core Angel system. Some Angel concepts are 13*b725ae77Skettenis * described at the start of this file to ensure that a complete view 14*b725ae77Skettenis * of the Angel world can be derived purely from the source. 15*b725ae77Skettenis * 16*b725ae77Skettenis * $Revision: 1.1.1.1 $ 17*b725ae77Skettenis * $Date: 2004/05/21 19:15:48 $ 18*b725ae77Skettenis * 19*b725ae77Skettenis * 20*b725ae77Skettenis * NOTE: Currently the Angel source is designed to be simple, 21*b725ae77Skettenis * understandable and easy to port to new hardware platforms. However, 22*b725ae77Skettenis * this does not always yield the highest performing system. The 23*b725ae77Skettenis * current layered approach introduces an overhead to the performance 24*b725ae77Skettenis * of the system. In a true commercial target, this code should be 25*b725ae77Skettenis * re-designed to build a system where the Angel logical message 26*b725ae77Skettenis * system, device driver and hardware accesses are merged to provide 27*b725ae77Skettenis * the best performance. 28*b725ae77Skettenis */ 29*b725ae77Skettenis /*---------------------------------------------------------------------------*/ 30*b725ae77Skettenis /* Angel overview: 31*b725ae77Skettenis 32*b725ae77Skettenis ... some comments describing Angel ... 33*b725ae77Skettenis 34*b725ae77Skettenis * Angel is designed as a kit-of-parts that can be used to provide 35*b725ae77Skettenis * run-time support for the development of ARM applications. The main 36*b725ae77Skettenis * core of Angel is in providing support for the "debug" message 37*b725ae77Skettenis * communication with a host system. These messages do not just cover 38*b725ae77Skettenis * debugging ARM processes, but also the process of downloading ARM 39*b725ae77Skettenis * programs or attaching to executing processes on the target. 40*b725ae77Skettenis * 41*b725ae77Skettenis * A stand-alone ROM based Angel world is the basic starting point for 42*b725ae77Skettenis * a system, since it will allow programs to be downloaded to the 43*b725ae77Skettenis * target. The ROM version of Angel will provide the generic debug 44*b725ae77Skettenis * support, but no system specific routines. The preferred method of 45*b725ae77Skettenis * using Angel is as a link library. This ensures that applications 46*b725ae77Skettenis * carry with them the Angel routines necessary to support debugging 47*b725ae77Skettenis * (and also ensure that the Angel version is up-to-date, independant 48*b725ae77Skettenis * of the version in the target ROM). Eventually, once a program has 49*b725ae77Skettenis * been fully debugged, a ROMmed version of the program can be 50*b725ae77Skettenis * generated with the Angel code being provided in the application. 51*b725ae77Skettenis 52*b725ae77Skettenis .. more comments .. 53*b725ae77Skettenis 54*b725ae77Skettenis * The standard Angel routines do *NOT* perform any dynamic memory 55*b725ae77Skettenis * allocation. To simplify the source, and aid the porting to a non C 56*b725ae77Skettenis * library world, memory is either pre-allocated (as build-time 57*b725ae77Skettenis * globals) or actually given to the particular Angel routine by the 58*b725ae77Skettenis * active run-time. This ensures that the interaction between Angel 59*b725ae77Skettenis * and the target O/S is minimised. 60*b725ae77Skettenis * 61*b725ae77Skettenis * Notes: We sub-include more header files to keep the source 62*b725ae77Skettenis * modular. Since Angel is a kit-of-parts alternative systems may need 63*b725ae77Skettenis * to change the prototypes of particular functions, whilst 64*b725ae77Skettenis * maintaining a fixed external interface. e.g. using the standard 65*b725ae77Skettenis * DEBUG messages, but with a different communications world. 66*b725ae77Skettenis */ 67*b725ae77Skettenis /*---------------------------------------------------------------------------*/ 68*b725ae77Skettenis 69*b725ae77Skettenis #ifndef __angel_h 70*b725ae77Skettenis #define __angel_h 71*b725ae77Skettenis 72*b725ae77Skettenis /*---------------------------------------------------------------------------*/ 73*b725ae77Skettenis /*-- Global Angel definitions and manifests ---------------------------------*/ 74*b725ae77Skettenis /*---------------------------------------------------------------------------*/ 75*b725ae77Skettenis /* When building Angel we may not include the standard library 76*b725ae77Skettenis * headers. However, it is useful coding using standard macro names 77*b725ae77Skettenis * since it makes the code easier to understand. 78*b725ae77Skettenis */ 79*b725ae77Skettenis 80*b725ae77Skettenis typedef unsigned int word ; 81*b725ae77Skettenis typedef unsigned char byte ; 82*b725ae77Skettenis 83*b725ae77Skettenis /* The following typedefs can be used to access I/O registers: */ 84*b725ae77Skettenis typedef volatile unsigned int vuword ; 85*b725ae77Skettenis typedef volatile unsigned char vubyte ; 86*b725ae77Skettenis 87*b725ae77Skettenis /* 88*b725ae77Skettenis * The following typedefs are used when defining objects that may also 89*b725ae77Skettenis * be created on a host system, where the word size is not 90*b725ae77Skettenis * 32bits. This ensures that the same data values are manipulated. 91*b725ae77Skettenis */ 92*b725ae77Skettenis #ifdef TARGET 93*b725ae77Skettenis typedef unsigned int unsigned32; 94*b725ae77Skettenis typedef signed int signed32; 95*b725ae77Skettenis typedef int int32; 96*b725ae77Skettenis 97*b725ae77Skettenis typedef unsigned short int unsigned16; 98*b725ae77Skettenis typedef signed short int signed16; 99*b725ae77Skettenis 100*b725ae77Skettenis /* 101*b725ae77Skettenis * yet another solution for the bool/boolean problem, this one is 102*b725ae77Skettenis * copied from Scott's modifications to clx/host.h 103*b725ae77Skettenis */ 104*b725ae77Skettenis # ifdef IMPLEMENT_BOOL_AS_ENUM 105*b725ae77Skettenis enum _bool { _false, _true }; 106*b725ae77Skettenis # define _bool enum _bool 107*b725ae77Skettenis # elif defined(IMPLEMENT_BOOL_AS_INT) || !defined(__cplusplus) 108*b725ae77Skettenis # define _bool int 109*b725ae77Skettenis # define _false 0 110*b725ae77Skettenis # define _true 1 111*b725ae77Skettenis # endif 112*b725ae77Skettenis 113*b725ae77Skettenis # ifdef _bool 114*b725ae77Skettenis # define bool _bool 115*b725ae77Skettenis # endif 116*b725ae77Skettenis 117*b725ae77Skettenis # ifndef true 118*b725ae77Skettenis # define true _true 119*b725ae77Skettenis # define false _false 120*b725ae77Skettenis # endif 121*b725ae77Skettenis 122*b725ae77Skettenis # ifndef YES 123*b725ae77Skettenis # define YES true 124*b725ae77Skettenis # define NO false 125*b725ae77Skettenis # endif 126*b725ae77Skettenis 127*b725ae77Skettenis # undef TRUE /* some OSF headers define as 1 */ 128*b725ae77Skettenis # define TRUE true 129*b725ae77Skettenis 130*b725ae77Skettenis # undef FALSE /* some OSF headers define as 1 */ 131*b725ae77Skettenis # define FALSE false 132*b725ae77Skettenis 133*b725ae77Skettenis # ifndef NULL 134*b725ae77Skettenis # define NULL 0 135*b725ae77Skettenis # endif 136*b725ae77Skettenis 137*b725ae77Skettenis #else 138*b725ae77Skettenis 139*b725ae77Skettenis # include "host.h" 140*b725ae77Skettenis 141*b725ae77Skettenis #endif 142*b725ae77Skettenis 143*b725ae77Skettenis #ifndef IGNORE 144*b725ae77Skettenis # define IGNORE(x) ((x)=(x)) 145*b725ae77Skettenis #endif 146*b725ae77Skettenis 147*b725ae77Skettenis /* The following typedef allows us to cast between integral and 148*b725ae77Skettenis * function pointers. This isn't allowed by direct casting when 149*b725ae77Skettenis * conforming to the ANSI spec. 150*b725ae77Skettenis */ 151*b725ae77Skettenis typedef union ansibodge 152*b725ae77Skettenis { 153*b725ae77Skettenis word w ; 154*b725ae77Skettenis word *wp ; 155*b725ae77Skettenis void *vp ; 156*b725ae77Skettenis byte *bp ; 157*b725ae77Skettenis void (*vfn)(void) ; 158*b725ae77Skettenis word (*wfn)(void) ; 159*b725ae77Skettenis int (*ifn)(void) ; 160*b725ae77Skettenis byte (*bfn)(void) ; 161*b725ae77Skettenis } ansibodge ; 162*b725ae77Skettenis 163*b725ae77Skettenis /*---------------------------------------------------------------------------*/ 164*b725ae77Skettenis 165*b725ae77Skettenis /* The amount setup aside by the run-time system for stack overflow 166*b725ae77Skettenis * handlers to execute in. This must be at least 256bytes, since that 167*b725ae77Skettenis * value is assumed by the current ARM Ltd compiler. 168*b725ae77Skettenis * This space is _only_ kept for the USR stack, not any of the privileged 169*b725ae77Skettenis * mode stacks, as stack overflow on these is always fatal - there is 170*b725ae77Skettenis * no point attemptingto recover. In addition is is important that 171*b725ae77Skettenis * Angel should keep privileged stack space requirements to a minimum. 172*b725ae77Skettenis */ 173*b725ae77Skettenis #define APCS_STACKGUARD 256 174*b725ae77Skettenis 175*b725ae77Skettenis #endif /* __angel_h */ 176*b725ae77Skettenis 177*b725ae77Skettenis /* EOF angel.h */ 178