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

reset.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 
00038 NTSTATUS
00039 cbmiec_reset(IN PDEVICE_EXTENSION Pdx)
00040 {
00041     FUNC_ENTER();
00042 
00043     CBMIEC_RELEASE(PP_DATA_OUT | PP_ATN_OUT | PP_CLK_OUT | PP_LP_BIDIR | PP_LP_IRQ);
00044 
00045     CBMIEC_SET(PP_RESET_OUT);
00046     cbmiec_schedule_timeout(libiec_global_timeouts.T_holdreset);
00047     CBMIEC_RELEASE(PP_RESET_OUT);
00048 
00049     DBG_SUCCESS((DBG_PREFIX "sleeping after RESET..."));
00050 
00051 /*
00052     cbmiec_schedule_timeout(libiec_global_timeouts.T_afterreset);
00053     CBMIEC_SET(PP_CLK_OUT);
00054 */
00055     {
00056         int i=1;
00057 
00058         while (1) {
00059             IEC_CHECKDEVICE check_device;
00060 
00061             cbmiec_check_device(Pdx, &check_device);
00062 
00063 #if 0
00064             switch (check_device)
00065             {
00066             case IEC_CHECKDEVICE_BUSFREE:
00067                 DBG_PRINT((DBG_PREFIX "%u: Bus is free!", i));
00068                 break;
00069 
00070             case IEC_CHECKDEVICE_BUSBUSY:
00071                 DBG_PRINT((DBG_PREFIX "%u: Bus is busy.", i));
00072                 break;
00073 
00074             case IEC_CHECKDEVICE_NODEVICE:
00075                 DBG_PRINT((DBG_PREFIX "%u: No device.", i));
00076                 break;
00077 
00078             default:
00079                 DBG_PRINT((DBG_PREFIX "%u: UNKNOWN", i));
00080                 break;
00081             }
00082 #endif
00083 
00084             if (check_device == IEC_CHECKDEVICE_BUSFREE)
00085                 break;
00086 
00087             ++i;
00088 
00089             if (i == 1000)
00090             {
00091                 DBG_PRINT((DBG_PREFIX "Quiting because i has reached %u", i));
00092                 break;
00093             }
00094             cbmiec_schedule_timeout(1000);
00095         }
00096     }
00097 
00098     FUNC_LEAVE_NTSTATUS_CONST(STATUS_SUCCESS);
00099 }

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