revert between 56095 -> 55830 in arch
[AROS.git] / arch / .unmaintained / ppc-native / geninc.c
blob3ab88b0f388a996496da0f39a6b1914b02a58ffb
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/alerts.h>
7 #include <exec/types.h>
8 #include <exec/execbase.h>
9 #include <exec/tasks.h>
10 #include <dos/dosextens.h>
11 #include <hardware/custom.h>
12 #include <graphics/rastport.h>
13 #include <graphics/clip.h>
14 #include <stdio.h>
15 #include <stddef.h>
17 #define FuncOffset(x) (int)__AROS_GETJUMPVEC(0,x)
19 ULONG BitOf(ULONG);
21 int main (void)
23 printf ("/*\n This file is generated automatically!\n\n"
24 " If you want to make changes, edit \"geninc.c\" and delete this file.\n*/\n\n");
26 printf ("/* Macros */\n"
27 "#define AROS_CSYMNAME(n) _ ## n\n"
28 "#define AROS_CDEFNAME(n) _ ## n\n"
29 "#define AROS_SLIB_ENTRY(n,s) _ ## s ## _ ## n\n"
30 "\n");
32 printf ("/* ExecBase */\n");
33 printf ("#define AttnResched %d\n", (int)offsetof (struct ExecBase, AttnResched));
34 printf ("#define IDNestCnt %d\n", (int)offsetof (struct ExecBase, IDNestCnt));
35 printf ("#define TDNestCnt %d\n", (int)offsetof (struct ExecBase, TDNestCnt));
36 printf ("#define TaskReady %d\n", (int)offsetof (struct ExecBase, TaskReady));
37 printf ("#define ThisTask %d\n", (int)offsetof (struct ExecBase, ThisTask));
39 printf ("\n/* struct Task */\n");
40 printf ("#define tc_State %d\n", (int)offsetof (struct Task, tc_State));
41 printf ("#define tc_Flags %d\n", (int)offsetof (struct Task, tc_Flags));
42 printf ("#define tc_ExceptCode %d\n", (int)offsetof (struct Task, tc_ExceptCode));
43 printf ("#define tc_ExceptData %d\n", (int)offsetof (struct Task, tc_ExceptData));
44 printf ("#define tc_SigExcept %d\n", (int)offsetof (struct Task, tc_SigExcept));
45 printf ("#define tc_SigRecvd %d\n", (int)offsetof (struct Task, tc_SigRecvd));
46 printf ("#define tc_Launch %d\n", (int)offsetof (struct Task, tc_Launch));
47 printf ("#define tc_Switch %d\n", (int)offsetof (struct Task, tc_Switch));
48 printf ("#define tc_SPReg %d\n", (int)offsetof (struct Task, tc_SPReg));
49 printf ("#define tc_SPLower %d\n", (int)offsetof (struct Task, tc_SPLower));
50 printf ("#define tc_SPUpper %d\n", (int)offsetof (struct Task, tc_SPUpper));
51 printf ("#define tc_IDNestCnt %d\n", (int)offsetof (struct Task, tc_IDNestCnt));
52 printf ("#define tc_TrapCode %d\n", (int)offsetof (struct Task, tc_TrapCode));
54 printf ("\n/* struct DosBase */\n");
55 printf ("#define dl_SysBase %d\n", (int)offsetof (struct DosLibrary, dl_SysBase));
57 printf ("\n/* struct StackSwapStruct */\n");
58 printf ("#define stk_Lower %d\n", (int)offsetof (struct StackSwapStruct, stk_Lower));
59 printf ("#define stk_Upper %d\n", (int)offsetof (struct StackSwapStruct, stk_Upper));
60 printf ("#define stk_Pointer %d\n", (int)offsetof (struct StackSwapStruct, stk_Pointer));
62 printf ("\n/* Task Flags */\n");
63 printf ("#define TS_RUN %d\n", TS_RUN);
64 printf ("#define TS_READY %d\n", TS_READY);
65 printf ("#define TF_EXCEPT 0x%04lX\n", TF_EXCEPT);
66 printf ("#define TF_SWITCH 0x%04lX\n", TF_SWITCH);
68 printf ("#define TB_EXCEPT %d\n", TB_EXCEPT);
69 printf ("#define TB_SWITCH %d\n", TB_SWITCH);
70 printf ("#define TB_LAUNCH %d\n", TB_LAUNCH);
72 printf ("\n/* Exec functions */\n");
73 printf ("#define Supervisor %d\n", FuncOffset (5));
74 printf ("#define Switch %d\n", FuncOffset (9));
75 printf ("#define Dispatch %d\n", FuncOffset (10));
76 printf ("#define Exception %d\n", FuncOffset (11));
77 printf ("#define Alert %d\n", FuncOffset (18));
78 printf ("#define Disable %d\n", FuncOffset (20));
79 printf ("#define Enable %d\n", FuncOffset (21));
80 printf ("#define Enqueue %d\n", FuncOffset (45));
81 printf ("#define CacheControl %d\n", FuncOffset (107));
82 printf ("#define StackSwap %d\n", FuncOffset (122));
84 printf ("\n/* Constants */\n");
85 printf ("#define AT_DeadEnd 0x%08X\n", AT_DeadEnd);
86 printf ("#define AN_StackProbe 0x%08X\n", AN_StackProbe);
88 printf ("\n/* Cache constants */\n");
89 printf ("#define CACRF_EnableI 0x%08lx\n", CACRF_EnableI );
90 printf ("#define CACRF_FreezeI 0x%08lx\n", CACRF_FreezeI );
91 printf ("#define CACRF_ClearI 0x%08lx\n", CACRF_ClearI );
92 printf ("#define CACRF_IBE 0x%08lx\n", CACRF_IBE );
93 printf ("#define CACRF_EnableD 0x%08lx\n", CACRF_EnableD );
94 printf ("#define CACRF_FreezeD 0x%08lx\n", CACRF_FreezeD );
95 printf ("#define CACRF_ClearD 0x%08lx\n", CACRF_ClearD );
96 printf ("#define CACRF_DBE 0x%08lx\n", CACRF_DBE );
97 printf ("#define CACRF_WriteAllocate 0x%08lx\n", CACRF_WriteAllocate);
98 printf ("#define CACRF_EnableE 0x%08lx\n", CACRF_EnableE );
99 printf ("#define CACRF_CopyBack 0x%08lx\n", CACRF_CopyBack );
100 printf ("#define DMA_Continue 0x%08lx\n", DMA_Continue );
101 printf ("#define DMA_NoModify 0x%08lx\n", DMA_NoModify );
102 printf ("#define DMA_ReadFromRA 0x%08lx\n", DMA_ReadFromRAM );
104 printf ("\n#define CACRB_EnableI %ld\n", BitOf(CACRF_EnableI ));
105 printf ("#define CACRB_FreezeI %ld\n", BitOf(CACRF_FreezeI ));
106 printf ("#define CACRB_ClearI %ld\n", BitOf(CACRF_ClearI ));
107 printf ("#define CACRB_IBE %ld\n", BitOf(CACRF_IBE ));
108 printf ("#define CACRB_EnableD %ld\n", BitOf(CACRF_EnableD ));
109 printf ("#define CACRB_FreezeD %ld\n", BitOf(CACRF_FreezeD ));
110 printf ("#define CACRB_ClearD %ld\n", BitOf(CACRF_ClearD ));
111 printf ("#define CACRB_DBE %ld\n", BitOf(CACRF_DBE ));
112 printf ("#define CACRB_WriteAllocate %ld\n", BitOf(CACRF_WriteAllocate));
113 printf ("#define CACRB_EnableE %ld\n", BitOf(CACRF_EnableE ));
114 printf ("#define CACRB_CopyBack %ld\n", BitOf(CACRF_CopyBack ));
115 printf ("#define DMAB_Continue %ld\n", BitOf(DMA_Continue ));
116 printf ("#define DMAB_NoModify %ld\n", BitOf(DMA_NoModify ));
117 printf ("#define DMAB_ReadFromR %ld\n", BitOf(DMA_ReadFromRAM ));
119 printf ("\n/* Custom register constants */\n");
120 printf ("#define custom 0xdff000\n");
121 printf ("#define dmaconr 0x%04lx\n", offsetof (struct Custom, dmaconr));
122 printf ("#define intenar 0x%04lx\n", offsetof (struct Custom, intenar));
123 printf ("#define intreqr 0x%04lx\n", offsetof (struct Custom, intreqr));
124 printf ("#define intena 0x%04lx\n", offsetof (struct Custom, intena));
125 printf ("#define intreq 0x%04lx\n", offsetof (struct Custom, intreq));
126 printf ("#define dmacon 0x%04lx\n", offsetof (struct Custom, dmacon));
128 printf ("\n/* Graphics constants */\n");
129 printf ("#define BltBitMap %d\n", FuncOffset (5));
131 printf ("\n#define rp_Layer %d\n", (int)offsetof (struct RastPort, Layer));
132 printf ("#define rp_BitMap %d\n", (int)offsetof (struct RastPort, BitMap));
133 printf ("#define cr_BitMap %d\n", (int)offsetof (struct ClipRect, BitMap));
134 printf ("#define cr_MinX %d\n", (int)offsetof (struct ClipRect, bounds.MinX));
135 printf ("#define cr_MinY %d\n", (int)offsetof (struct ClipRect, bounds.MinY));
136 printf ("#define cr_MaxX %d\n", (int)offsetof (struct ClipRect, bounds.MaxX));
137 printf ("#define cr_MaxY %d\n", (int)offsetof (struct ClipRect, bounds.MaxY));
139 return 0;
142 ULONG BitOf(ULONG mask)
144 LONG ret = -1;
148 mask = mask >> 1;
149 ret++;
150 } while(mask);
152 return (ULONG)ret;