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