1 #include <devices/timer.h>
3 #include <exec/memory.h>
4 #include <exec/ports.h>
5 #include <exec/types.h>
7 #include <proto/exec.h>
8 #include <proto/timer.h>
14 #include "asmsupport.h"
16 /* Internal prototypes */
21 extern void __asm
TOSERIAL(register __a0 UBYTE
*);
27 ReadEClock(&globals
->ecv
);
30 void END(UBYTE
*name
) {
31 struct EClockVal ecv2
;
35 freq
=ReadEClock(&ecv2
);
37 diff
=ecv2
.ev_lo
-globals
->ecv
.ev_lo
;
42 _DEBUG(("%s: ticks %ld (f=%ld)\n",name
,diff
,freq
));
51 void debug(UBYTE
*fmt
, ... ) {
58 if((port
=FindPort("SFS debug output port"))!=0) {
59 if((msg
=AllocVec(sizeof(struct Message
)+512,MEMF_CLEAR
))!=0) {
61 dest
+=sizeof(struct Message
);
65 RawDoFmt(fmt
,args
,putChFunc
,dest
);
75 void tdebug(UBYTE
*fmt
, ... ) {
84 debug("%4ld.%4ld ", ds
.ds_Minute
, ds
.ds_Tick
*2);
87 if((port
=FindPort("SFS debug output port"))!=0) {
88 if((msg
=AllocVec(sizeof(struct Message
)+512,MEMF_CLEAR
))!=0) {
90 dest
+=sizeof(struct Message
);
94 RawDoFmt(fmt
,args
,putChProc
,dest
);
104 void xdebug(ULONG type
,UBYTE
*fmt
, ... ) {
105 struct MsgPort
*port
;
109 // ULONG debug=0xFFFFFFFE-DEBUG_CACHEBUFFER-DEBUG_NODES-DEBUG_IO-DEBUG_SEEK-DEBUG_LOCK-DEBUG_BITMAP;
110 // ULONG debugdetailed=0xFFFFFFFE-DEBUG_CACHEBUFFER-DEBUG_NODES-DEBUG_IO-DEBUG_SEEK-DEBUG_LOCK-DEBUG_BITMAP;
111 // ULONG debug=0xFFFFFFFE-DEBUG_CACHEBUFFER-DEBUG_NODES-DEBUG_LOCK-DEBUG_BITMAP;
112 // ULONG debugdetailed=0xFFFFFFFE-DEBUG_CACHEBUFFER-DEBUG_NODES-DEBUG_LOCK-DEBUG_BITMAP;
113 // ULONG debug=0xFFFFFFFE;
114 // ULONG debugdetailed=0xFFFFFFFE;
115 ULONG debug
=mask_debug
;
116 ULONG debugdetailed
=mask_debug
& ~(DEBUG_CACHEBUFFER
|DEBUG_NODES
|DEBUG_LOCK
|DEBUG_BITMAP
);
118 if((debugdetailed
& type
)!=0 || ((type
& 1)==0 && (debug
& type
)!=0)) {
120 if((port
=FindPort("SFS debug output port"))!=0) {
121 if((msg
=AllocVec(sizeof(struct Message
)+512,MEMF_CLEAR
))!=0) {
123 dest
+=sizeof(struct Message
);
127 RawDoFmt(fmt
,args
,putChProc
,dest
);
138 UBYTE serbuffer
[500];
140 void debug(UBYTE
*fmt
, ... ) {
146 RawDoFmt(fmt
,args
,putChProc
,serbuffer
);
157 void xdebug(ULONG type
,UBYTE
*fmt
, ... ) {
159 // ULONG debug=0xFFFFFFFE-DEBUG_CACHEBUFFER-DEBUG_NODES-DEBUG_IO-DEBUG_SEEK-DEBUG_LOCK-DEBUG_BITMAP;
160 // ULONG debugdetailed=0xFFFFFFFE-DEBUG_CACHEBUFFER-DEBUG_NODES-DEBUG_IO-DEBUG_SEEK-DEBUG_LOCK-DEBUG_BITMAP;
161 // ULONG debug=0xFFFFFFFE-DEBUG_CACHEBUFFER-DEBUG_NODES-DEBUG_LOCK-DEBUG_BITMAP;
162 // ULONG debugdetailed=0xFFFFFFFE-DEBUG_CACHEBUFFER-DEBUG_NODES-DEBUG_LOCK-DEBUG_BITMAP;
163 // ULONG debug=0xFFFFFFFE;
164 // ULONG debugdetailed=0xFFFFFFFE;
165 ULONG debug
=mask_debug
;
166 ULONG debugdetailed
=mask_debug
& ~(DEBUG_CACHEBUFFER
|DEBUG_NODES
|DEBUG_LOCK
|DEBUG_BITMAP
);
168 if((debugdetailed
& type
)!=0 || ((type
& 1)==0 && (debug
& type
)!=0)) {
173 RawDoFmt(fmt
,args
,putChProc
,serbuffer
);
188 void xkprintf(ULONG type
,const char *fmt
, ... ) {
192 ULONG debug
=mask_debug
;
193 ULONG debugdetailed
=mask_debug
& ~(DEBUG_CACHEBUFFER
|DEBUG_NODES
|DEBUG_LOCK
|DEBUG_BITMAP
);
195 if((debugdetailed
& type
)!=0 || ((type
& 1)==0 && (debug
& type
)!=0)) {
196 if((str
=AllocVec(512,MEMF_CLEAR
))!=0) {
201 RawDoFmt((char *)fmt
,args
,putChProc
,dest
);