OpenCBM
dbgwrite.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 2008 Spiro Trikaliotis
8  *
9  */
10 
19 #include <wdm.h>
20 #include "cbm_driver.h"
21 #include "i_iec.h"
22 
23 
25 #define PARALLEL_CONTROL_PORT_MASK_VALUES 0x0F
26 
55 NTSTATUS
56 cbmiec_iec_dbg_write(IN PDEVICE_EXTENSION Pdx, IN UCHAR Value)
57 {
58  UCHAR valueToSet;
59 
60  FUNC_ENTER();
61 
62  valueToSet = (Value & PARALLEL_CONTROL_PORT_MASK_VALUES)
63  | ((Pdx->IecOutEor ^ Pdx->IecOutBits) & ~ PARALLEL_CONTROL_PORT_MASK_VALUES);
64 
65  DBG_PRINT((DBG_PREFIX "Value to set: %02x, modified to %02x", Value, valueToSet));
66 
67  WRITE_PORT_UCHAR(OUT_PORT, valueToSet);
68 
69  Pdx->IecOutBits = valueToSet ^ Pdx->IecOutEor;
70 
71  FUNC_LEAVE_NTSTATUS_CONST(STATUS_SUCCESS);
72 }
#define OUT_PORT
Definition: i_iec.h:61
#define PARALLEL_CONTROL_PORT_MASK_VALUES
Definition: dbgwrite.c:25
NTSTATUS cbmiec_iec_dbg_write(IN PDEVICE_EXTENSION Pdx, IN UCHAR Value)
Write a byte to the parallel port output register.
Definition: dbgwrite.c:56
Internal functions and definitions of the libiec library.
#define WRITE_PORT_UCHAR(_x_, _y_)
WRITE_PORT_UCHAR replacement for debugging.
Definition: i_iec.h:221
#define FUNC_ENTER()
Definition: debug.h:347
Definitions for the opencbm driver.
#define DBG_PREFIX
Definition: debug.h:320
#define DBG_PRINT(_xxx)
Definition: debug.h:403