OpenCBM
setrelease.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 1999-2004 Michael Klein <michael(dot)klein(at)puffin(dot)lb(dot)shuttle(dot)de>
8  * Copyright 2001-2004 Spiro Trikaliotis
9  *
10  */
11 
22 #include <wdm.h>
23 #include "cbm_driver.h"
24 #include "i_iec.h"
25 
30 #define SET_RELEASE_LINE(_LineName, _PPName) \
31  if (Set & IEC_LINE_##_LineName) { set_mask |= PP_##_PPName##_OUT; } \
32  if (Release & IEC_LINE_##_LineName) { release_mask |= PP_##_PPName##_OUT; }
33 
58 NTSTATUS
59 cbmiec_iec_setrelease(IN PDEVICE_EXTENSION Pdx, IN USHORT Set, IN USHORT Release)
60 {
61  NTSTATUS ntStatus;
62 
63  FUNC_ENTER();
64 
65  FUNC_PARAM((DBG_PREFIX "set = 0x%02x, release = 0x%02x", Set, Release));
66 
67  ntStatus = STATUS_SUCCESS;
68 
69  DBG_ASSERT((Set & Release) == 0);
70 
71  // Set the correct line as given by the call
72 
75  {
76  // there was some bit set that is not recognized, return
77  // with an error
78  ntStatus = STATUS_INVALID_PARAMETER;
79  }
80  else
81  {
82  ULONG set_mask = 0;
83  ULONG release_mask = 0;
84 
85  SET_RELEASE_LINE(DATA, DATA);
86  SET_RELEASE_LINE(CLOCK, CLK);
87  SET_RELEASE_LINE(ATN, ATN);
88  SET_RELEASE_LINE(RESET, RESET);
89 
90 #ifdef TEST_BIDIR
91 
92  #define PP_BIDIR_OUT PP_LP_BIDIR
93  #define IEC_LINE_BIDIR PP_BIDIR_OUT
94 
95  SET_RELEASE_LINE(BIDIR, BIDIR);
96 
97  #undef PP_BIDIR_OUT
98  #undef IEC_LINE_BIDIR
99 
100 #endif // #ifdef TEST_BIDIR
101 
102  CBMIEC_SET_RELEASE(set_mask, release_mask);
103 
104  }
105 
106  FUNC_LEAVE_NTSTATUS(ntStatus );
107 }
#define SET_RELEASE_LINE(_LineName, _PPName)
set and release line
Definition: setrelease.c:30
Internal functions and definitions of the libiec library.
#define DBG_ASSERT(_xxx)
Definition: debug.h:401
#define IEC_LINE_RESET
Definition: cbmioctl.h:80
#define IEC_LINE_DATA
Definition: cbmioctl.h:74
#define FUNC_ENTER()
Definition: debug.h:347
#define FUNC_PARAM(_xxx)
Definition: debug.h:351
Definitions for the opencbm driver.
#define DBG_PREFIX
Definition: debug.h:320
#define CBMIEC_SET_RELEASE(_set, _rel)
Definition: i_iec.h:68
NTSTATUS cbmiec_iec_setrelease(IN PDEVICE_EXTENSION Pdx, IN USHORT Set, IN USHORT Release)
Activate and deactive a line on the IEC serial bus.
Definition: setrelease.c:59
#define IEC_LINE_ATN
Definition: cbmioctl.h:78
#define IEC_LINE_CLOCK
Definition: cbmioctl.h:76