Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

sendbyte.c

Go to the documentation of this file.
00001 /*
00002  *  This program is free software; you can redistribute it and/or
00003  *  modify it under the terms of the GNU General Public License
00004  *  as published by the Free Software Foundation; either version
00005  *  2 of the License, or (at your option) any later version.
00006  *
00007  *  Copyright 1999-2004 Michael Klein <michael(dot)klein(at)puffin(dot)lb(dot)shuttle(dot)de>
00008  *  Copyright 2001-2004 Spiro Trikaliotis
00009  *
00010  */
00011 
00023 #include <wdm.h>
00024 #include "cbm_driver.h"
00025 #include "i_iec.h"
00026 
00039 BOOLEAN
00040 cbmiec_send_byte(IN PDEVICE_EXTENSION Pdx, IN UCHAR Byte)
00041 {
00042     BOOLEAN ack;
00043     ULONG i;
00044 
00045     FUNC_ENTER();
00046 
00047     PERF_EVENT_VERBOSE(0x1050, 0);
00048 
00049     DBG_SUCCESS((DBG_PREFIX "send_byte %02x", Byte));
00050     
00051     PERF_EVENT_VERBOSE(0x1051, 0);
00052 
00053     ack = FALSE;
00054 
00055     PERF_EVENT_VERBOSE(0x1052, 0);
00056 
00057     cbmiec_block_irq(Pdx);
00058 
00059     PERF_EVENT_VERBOSE(0x1053, 0);
00060 
00061     for(i = 0; i<8; i++)
00062     {
00063         PERF_EVENT_WRITE_BIT_NO(i);
00064 
00065         PERF_EVENT_VERBOSE(0x1054, 0);
00066 
00067         cbmiec_udelay(libiec_global_timeouts.T_15_SEND_BEFORE_BIT_DELAY_T_S);
00068 
00069         PERF_EVENT_VERBOSE(0x1055, 0);
00070 
00071         if(!((Byte>>i) & 1))
00072         {
00073             CBMIEC_SET(PP_DATA_OUT);
00074         }
00075         CBMIEC_RELEASE(PP_CLK_OUT);
00076         PERF_EVENT_VERBOSE(0x1056, 0);
00077         cbmiec_udelay(libiec_global_timeouts.T_16_SEND_BIT_TIME_T_V);
00078         PERF_EVENT_VERBOSE(0x1057, 0);
00079         CBMIEC_SET_RELEASE(PP_CLK_OUT, PP_DATA_OUT);
00080     }
00081 
00082     PERF_EVENT_VERBOSE(0x1058, 0);
00083     cbmiec_release_irq(Pdx);
00084     PERF_EVENT_VERBOSE(0x1059, 0);
00085 
00086     for(i=0; (i<libiec_global_timeouts.T_17_Times) && !(ack=CBMIEC_GET(PP_DATA_IN)); i++)
00087     {
00088         PERF_EVENT_VERBOSE(0x105A, 0);
00089         cbmiec_udelay(libiec_global_timeouts.T_17_SEND_FRAME_HANDSHAKE_T_F);
00090     }
00091     PERF_EVENT_VERBOSE(0x105B, 0);
00092 
00093     DBG_SUCCESS((DBG_PREFIX "ack=%s", ack ? "TRUE" : "FALSE" ));
00094 
00095     FUNC_LEAVE_BOOLEAN(ack);
00096 }

Generated on Sun Apr 30 18:45:59 2006 for opencbm by  doxygen 1.4.2