OpenCBM
sendbyte.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 
38 BOOLEAN
39 cbmiec_send_byte(IN PDEVICE_EXTENSION Pdx, IN UCHAR Byte)
40 {
41  BOOLEAN ack;
42  ULONG i;
43 
44  FUNC_ENTER();
45 
46  PERF_EVENT_VERBOSE(0x1050, 0);
47 
48  DBG_SUCCESS((DBG_PREFIX "send_byte %02x", Byte));
49 
50  PERF_EVENT_VERBOSE(0x1051, 0);
51 
52  ack = FALSE;
53 
54  PERF_EVENT_VERBOSE(0x1052, 0);
55 
56  cbmiec_block_irq(Pdx);
57 
58  PERF_EVENT_VERBOSE(0x1053, 0);
59 
60  for(i = 0; i<8; i++)
61  {
63 
64  PERF_EVENT_VERBOSE(0x1054, 0);
65 
67 
68  PERF_EVENT_VERBOSE(0x1055, 0);
69 
70  if(!((Byte>>i) & 1))
71  {
73  }
75  PERF_EVENT_VERBOSE(0x1056, 0);
77  PERF_EVENT_VERBOSE(0x1057, 0);
79  }
80 
81  PERF_EVENT_VERBOSE(0x1058, 0);
82  cbmiec_release_irq(Pdx);
83  PERF_EVENT_VERBOSE(0x1059, 0);
84 
85  for(i=0; (i<libiec_global_timeouts.T_17_Times) && !(ack=CBMIEC_GET(PP_DATA_IN)); i++)
86  {
87  PERF_EVENT_VERBOSE(0x105A, 0);
89  }
90  PERF_EVENT_VERBOSE(0x105B, 0);
91 
92  DBG_SUCCESS((DBG_PREFIX "ack=%s", ack ? "TRUE" : "FALSE" ));
93 
94  FUNC_LEAVE_BOOLEAN(ack);
95 }
VOID cbmiec_udelay(IN ULONG howlong)
Wait for a timeout.
Definition: libiec/util.c:66
IEC_TIMEOUTS libiec_global_timeouts
Definition: libiec/init.c:28
#define CBMIEC_GET(_line)
Definition: i_iec.h:75
#define PP_DATA_OUT
The DATA OUT bit.
Definition: i_iec.h:41
ULONG T_15_SEND_BEFORE_BIT_DELAY_T_S
= 70 us: Inter-bit wait time while sending a byte
Definition: i_iec.h:153
ULONG T_17_SEND_FRAME_HANDSHAKE_T_F
= 100 us: Granularity: How long to wait for a frame handshake after sending a byte ...
Definition: i_iec.h:162
#define PERF_EVENT_WRITE_BIT_NO(_x_)
Definition: cbm_driver.h:89
ULONG T_16_SEND_BIT_TIME_T_V
= 20 us: How long to hold CLK low for every bit while sending
Definition: i_iec.h:156
ULONG T_17_Times
x T_17, is 20: How long to wait for a frame handshake after sending a byte
Definition: i_iec.h:159
#define FUNC_LEAVE_BOOLEAN(_xxx)
Definition: debug.h:356
BOOLEAN cbmiec_send_byte(IN PDEVICE_EXTENSION Pdx, IN UCHAR Byte)
Write one byte to the IEC bus.
Definition: sendbyte.c:39
#define CBMIEC_SET(_set)
Definition: i_iec.h:64
Internal functions and definitions of the libiec library.
#define PP_DATA_IN
The DATA IN bit.
Definition: i_iec.h:51
#define DBG_SUCCESS(_xxx)
Definition: debug.h:393
#define CBMIEC_RELEASE(_rel)
Definition: i_iec.h:66
#define PP_CLK_OUT
The CLOCK OUT bit.
Definition: i_iec.h:40
VOID cbmiec_block_irq(PDEVICE_EXTENSION Pdx)
Block all interrupts.
Definition: libiec/util.c:94
#define FUNC_ENTER()
Definition: debug.h:347
Definitions for the opencbm driver.
#define DBG_PREFIX
Definition: debug.h:320
#define CBMIEC_SET_RELEASE(_set, _rel)
Definition: i_iec.h:68
VOID cbmiec_release_irq(PDEVICE_EXTENSION Pdx)
Release the interrupts.
Definition: libiec/util.c:118