OpenCBM
sys/libiec/debug.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version
5  * 2 of the License, or (at your option) any later version.
6  *
7  * Copyright 2001-2004 Spiro Trikaliotis
8  *
9  */
10 
19 #if DBG
20 
21 #include <wdm.h>
22 #include "cbm_driver.h"
23 #include "i_iec.h"
24 
25 /* Since we need the originals of these functions here, undefine them! */
26 #undef READ_PORT_UCHAR
27 #undef WRITE_PORT_UCHAR
28 
29 
30 static PUCHAR parportBase = (PUCHAR) 0x378;
31 
32 
38 VOID
39 cbmiec_show_port(IN UCHAR *Str)
40 {
41  FUNC_DEF
42 
43  DBG_ASSERT(Str != 0);
44 
45  DBG_PORT((DBG_PREFIX
46  "%s: 0x%p = 0x%02x, 0x%p = 0x%02x, 0x%p = 0x%02x",
47  Str,
48  parportBase, READ_PORT_UCHAR(parportBase),
49  parportBase+1, READ_PORT_UCHAR(parportBase+1),
50  parportBase+2, READ_PORT_UCHAR(parportBase+2)
51  ));
52 }
53 
62 VOID
63 DbgWp(IN PUCHAR Port, IN UCHAR Value)
64 {
65  FUNC_DEF
66 
67  DBG_PORT((DBG_PREFIX "WRITE_PORT_UCHAR(0x%p, 0x%02x)", Port, (int)Value));
68 
69  cbmiec_show_port("Before Writing");
70 
71  WRITE_PORT_UCHAR(Port, Value);
72 
73  cbmiec_show_port("After Writing ");
74 }
75 
84 UCHAR
85 DbgRp(IN PUCHAR Port)
86 {
87  UCHAR Value;
88 
89  FUNC_DEF
90 
91  cbmiec_show_port("Before Reading");
92 
93  Value = READ_PORT_UCHAR(Port);
94 
95  DBG_PORT((DBG_PREFIX "READ_PORT_UCHAR(0x%p) = 0x%02x", Port, (int)Value));
96 
97  cbmiec_show_port("After Reading ");
98 
99  return Value;
100 }
101 
110 VOID
111 cbmiec_show_state(IN PDEVICE_EXTENSION Pdx, IN UCHAR *Str)
112 {
113  FUNC_DEF
114 
115  DBG_ASSERT(Pdx != 0);
116  DBG_ASSERT(Str != 0);
117 
118  DBG_SUCCESS((DBG_PREFIX "%s: data=%d, clk=%d, atn=%d", Str,
120 }
121 
122 #endif /* #if DBG */
#define CBMIEC_GET(_line)
Definition: i_iec.h:75
#define PP_CLK_IN
The CLOCK IN bit.
Definition: i_iec.h:50
VOID cbmiec_show_port(IN UCHAR *Str)
Show the contents of the parallel port's registers.
Internal functions and definitions of the libiec library.
#define DBG_ASSERT(_xxx)
Definition: debug.h:401
#define WRITE_PORT_UCHAR(_x_, _y_)
WRITE_PORT_UCHAR replacement for debugging.
Definition: i_iec.h:221
#define PP_DATA_IN
The DATA IN bit.
Definition: i_iec.h:51
#define DBG_SUCCESS(_xxx)
Definition: debug.h:393
VOID DbgWp(IN PUCHAR Port, IN UCHAR Value)
Write to a port address with debugging output.
VOID cbmiec_show_state(IN PDEVICE_EXTENSION Pdx, IN UCHAR *Str)
Dump the input lines.
#define PP_ATN_IN
The ATN IN bit.
Definition: i_iec.h:49
Definitions for the opencbm driver.
#define DBG_PREFIX
Definition: debug.h:320
#define FUNC_DEF
Definition: debug.h:302
UCHAR DbgRp(IN PUCHAR Port)
Read from a port address with debugging output.
#define READ_PORT_UCHAR(_x_)
READ_PORT_UCHAR replacement for debugging.
Definition: i_iec.h:211