1 //the OS 5 SDK doesnt work properly with Prc Tools, throws tons of define errors, just copyed this, its all I need from the OS 5 SDK 2 3 /****************************************************************************** 4 * 5 * Copyright (c) 2001-2004 PalmSource, Inc. All rights reserved. 6 * 7 * File: PceNativeCall.h 8 * 9 * Release: eclipse 5 SDK (68K) R4. 10 * 11 * Description: 12 * Headers for native code support 13 * 14 *****************************************************************************/ 15 16 #ifndef __PCENATIVECALL_H__ 17 #define __PCENATIVECALL_H__ 18 19 #include <PalmOS.h> 20 21 #define sysTrapPceNativeCall 0xA45A 22 23 24 #define kPceNativeWantA0 (0x10000000) 25 #define kPceNativeTrapNoMask (0x00000FFF) 26 27 #define PceNativeTrapNo(sysTrapNo) (sysTrapNo & kPceNativeTrapNoMask) 28 29 30 /************************************************************ 31 * 32 * FUNCTION: Call68KFuncType 33 * 34 * DESCRIPTION: The prototype for callback entry point to 35 * emulated routines or OS traps, passed to 36 * NativeFuncType functions. 37 * 38 * PARAMETERS: emulStateP -> private to emulator, must be passed 39 * trapOrFunction -> if <= kPceNativeTrapNoMask, treat 40 * this as a trap number. Otherwise, treat 41 * this as a pointer to a 68K function to call. 42 * argsOnStackP -> pointer to memory to be copied to the 43 * 68K stack prior to calling the function. 44 * Normally contains the arguments for the 68K 45 * code. 46 * argsSizeAndwantA0 -> the number of bytes from 47 * argsOnStackP to actually copy to the 68K 48 * emulator stack. If the function or trap 49 * returns its result in 68K register A0 50 * (when result is a pointer type), OR the 51 * size with kPceNativeWantA0. 52 * 53 * RESULT: returns value from 68K call, either A0 or D0 register. 54 * 55 *************************************************************/ 56 typedef unsigned long Call68KFuncType(const void *emulStateP, unsigned long trapOrFunction, const void *argsOnStackP, unsigned long argsSizeAndwantA0); 57 58 59 /************************************************************ 60 * 61 * FUNCTION: NativeFuncType 62 * 63 * DESCRIPTION: The prototype for native functions called 64 * from the 68K emulator through PceNativeCall 65 * 66 * PARAMETERS: emulStateP -> private to emulator 67 * userData -> pointer passed through from PceNativeCall 68 * call68KFuncP -> function to call back into 68K emulated 69 * routines or OS traps. 70 * 71 * RESULT: returns value will be passed back through PceNativeCall. 72 * 73 *************************************************************/ 74 typedef unsigned long NativeFuncType(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP); 75 76 77 // only define the trap if we've already got the macros that allow defining traps 78 // usually result: skip this part when #including this in native source 79 80 #ifdef __CORETRAPS_H_ 81 82 #ifdef __cplusplus 83 extern "C" { 84 #endif 85 86 87 /************************************************************ 88 * 89 * FUNCTION: PceNativeCall 90 * 91 * DESCRIPTION: In the ARM emulator, call the passed ARM instructions 92 * and send through the user data pointer and 93 * return the result to the 68K caller. 94 * 95 * PARAMETERS: nativeFuncP -> pointer to native function to call 96 * userDataP -> pointer to memory to pass through to function 97 * 98 * RESULT: returns the return value from the native function. 99 * 100 * NOTE: This trap will be unimplemented on devices that 101 * are not running a 68K emulator, check the device 102 * type before calling this function. 103 * 104 *************************************************************/ 105 106 UInt32 PceNativeCall(NativeFuncType *nativeFuncP, void *userDataP) 107 SYS_TRAP(sysTrapPceNativeCall); 108 109 #ifdef __cplusplus 110 } 111 #endif 112 113 #endif // __CORETRAPS_H_ 114 115 #endif // __PCENATIVECALL_H__ 116