[Com0com-cvs] com0com/sys pinouts.c, NONE, 1.1 adddev.c, 1.27, 1.28 com0com.h, 1.35, 1.36 handflow.
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
From: Vyacheslav F. <vf...@us...> - 2007-07-03 14:35:49
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13803 Modified Files: adddev.c com0com.h handflow.c io.c ioctl.c openclos.c sources Added Files: pinouts.c Log Message: Implemented pinout customization --- NEW FILE: pinouts.c --- /* * $Id: pinouts.c,v 1.1 2007/07/03 14:35:17 vfrolov Exp $ * * Copyright (c) 2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * $Log: pinouts.c,v $ * Revision 1.1 2007/07/03 14:35:17 vfrolov * Implemented pinout customization * * */ #include "precomp.h" /* * FILE_ID used by HALT_UNLESS to put it on BSOD */ #define FILE_ID 0xE VOID SetModemControl( IN PC0C_IO_PORT pIoPort, IN UCHAR bits, IN UCHAR mask, PLIST_ENTRY pQueueToComplete) { UCHAR modemControlOld; UCHAR modemControlNew; UCHAR modemControlChanged; modemControlOld = modemControlNew = pIoPort->modemControl; modemControlNew |= bits & mask; modemControlNew &= ~(~bits & mask); modemControlChanged = modemControlOld ^ modemControlNew; if (modemControlChanged) { UCHAR bitsStatusRemote, maskStatusRemote; UCHAR bitsStatusLocal, maskStatusLocal; pIoPort->modemControl = modemControlNew; bitsStatusRemote = maskStatusRemote = 0; bitsStatusLocal = maskStatusLocal = 0; #define SET_PIN_OUTS(pin) \ if (modemControlChanged & C0C_MCR_##pin) { \ maskStatusRemote |= pIoPort->pinOuts[C0C_PIN_OUTS_##pin].remote.positive | \ pIoPort->pinOuts[C0C_PIN_OUTS_##pin].remote.negative; \ maskStatusLocal |= pIoPort->pinOuts[C0C_PIN_OUTS_##pin].local.positive | \ pIoPort->pinOuts[C0C_PIN_OUTS_##pin].local.negative; \ if (modemControlNew & C0C_MCR_##pin) { \ bitsStatusRemote |= pIoPort->pinOuts[C0C_PIN_OUTS_##pin].remote.positive; \ bitsStatusLocal |= pIoPort->pinOuts[C0C_PIN_OUTS_##pin].local.positive; \ } else { \ bitsStatusRemote |= pIoPort->pinOuts[C0C_PIN_OUTS_##pin].remote.negative; \ bitsStatusLocal |= pIoPort->pinOuts[C0C_PIN_OUTS_##pin].local.negative; \ } \ } SET_PIN_OUTS(RTS); SET_PIN_OUTS(DTR); SET_PIN_OUTS(OUT1); #undef SET_PIN_OUTS if (maskStatusRemote) SetModemStatus(pIoPort->pIoPortRemote, bitsStatusRemote, maskStatusRemote, pQueueToComplete); if (maskStatusLocal) SetModemStatus(pIoPort, bitsStatusLocal, maskStatusLocal, pQueueToComplete); } } VOID PinWire( PC0C_IO_PORT pIoPortLocal, PC0C_IO_PORT pIoPortRemote, ULONG pinSrc, UCHAR pinDst, PUCHAR pModemStatus) { switch (pinSrc) { case C0C_PIN_ON: *pModemStatus |= pinDst; break; case C0C_PIN_ON|C0C_PIN_NEGATIVE: *pModemStatus &= ~pinDst; break; #define CASE_PIN(pin) \ case C0C_PIN_R##pin: \ pIoPortRemote->pinOuts[C0C_PIN_OUTS_##pin].remote.positive |= pinDst; \ if (pIoPortRemote->modemControl & C0C_MCR_##pin) \ *pModemStatus |= pinDst; \ else \ *pModemStatus &= ~pinDst; \ break; \ case C0C_PIN_L##pin: \ pIoPortLocal->pinOuts[C0C_PIN_OUTS_##pin].local.positive |= pinDst; \ if (pIoPortLocal->modemControl & C0C_MCR_##pin) \ *pModemStatus |= pinDst; \ else \ *pModemStatus &= ~pinDst; \ break; \ case C0C_PIN_R##pin|C0C_PIN_NEGATIVE: \ pIoPortRemote->pinOuts[C0C_PIN_OUTS_##pin].remote.negative |= pinDst; \ if (pIoPortRemote->modemControl & C0C_MCR_##pin) \ *pModemStatus &= ~pinDst; \ else \ *pModemStatus |= pinDst; \ break; \ case C0C_PIN_L##pin|C0C_PIN_NEGATIVE: \ pIoPortLocal->pinOuts[C0C_PIN_OUTS_##pin].local.negative |= pinDst; \ if (pIoPortLocal->modemControl & C0C_MCR_##pin) \ *pModemStatus &= ~pinDst; \ else \ *pModemStatus |= pinDst; \ break; CASE_PIN(RTS) CASE_PIN(DTR) CASE_PIN(OUT1) #undef CASE_PIN } } VOID PinMap( IN PC0C_IO_PORT pIoPort, IN ULONG pinCTS, IN ULONG pinDSR, IN ULONG pinDCD, IN ULONG pinRI) { PC0C_IO_PORT pIoPortRemote; int i; for (i = 0 ; i < sizeof(pIoPort->pinOuts)/sizeof(pIoPort->pinOuts[0]) ; i++) RtlZeroMemory(&pIoPort->pinOuts[i].local, sizeof(pIoPort->pinOuts[i].local)); pIoPortRemote = pIoPort->pIoPortRemote; for (i = 0 ; i < sizeof(pIoPortRemote->pinOuts)/sizeof(pIoPortRemote->pinOuts[0]) ; i++) RtlZeroMemory(&pIoPortRemote->pinOuts[i].remote, sizeof(pIoPortRemote->pinOuts[i].remote)); if (!pinCTS) pinCTS = C0C_PIN_RRTS; PinWire(pIoPort, pIoPortRemote, pinCTS, C0C_MSB_CTS, &pIoPort->modemStatus); if (!pinDSR) pinDSR = C0C_PIN_RDTR; PinWire(pIoPort, pIoPortRemote, pinDSR, C0C_MSB_DSR, &pIoPort->modemStatus); if (!pinDCD) pinDCD = C0C_PIN_RDTR; PinWire(pIoPort, pIoPortRemote, pinDCD, C0C_MSB_RLSD, &pIoPort->modemStatus); if (!pinRI) pinRI = C0C_PIN_ON|C0C_PIN_NEGATIVE; PinWire(pIoPort, pIoPortRemote, pinRI, C0C_MSB_RING, &pIoPort->modemStatus); } Index: openclos.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/openclos.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** openclos.c 4 Jun 2007 15:24:32 -0000 1.18 --- openclos.c 3 Jul 2007 14:35:17 -0000 1.19 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.19 2007/07/03 14:35:17 vfrolov + * Implemented pinout customization + * * Revision 1.18 2007/06/04 15:24:32 vfrolov * Fixed open reject just after close in exclusiveMode *************** *** 219,223 **** pIoPort->writeHoldingRemote = 0; pIoPort->sendXonXoff = 0; ! SetModemStatus(pIoPort->pIoPortRemote, 0, C0C_MSB_CTS | C0C_MSB_DSR, &queueToComplete); FreeBuffer(&pIoPort->readBuf); SetBreakHolding(pIoPort, FALSE); --- 222,226 ---- pIoPort->writeHoldingRemote = 0; pIoPort->sendXonXoff = 0; ! SetModemControl(pIoPort, 0, C0C_MCR_RTS | C0C_MCR_DTR, &queueToComplete); FreeBuffer(&pIoPort->readBuf); SetBreakHolding(pIoPort, FALSE); Index: ioctl.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/ioctl.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ioctl.c 1 Jun 2007 08:36:26 -0000 1.30 --- ioctl.c 3 Jul 2007 14:35:17 -0000 1.31 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.31 2007/07/03 14:35:17 vfrolov + * Implemented pinout customization + * * Revision 1.30 2007/06/01 08:36:26 vfrolov * Changed parameter type for SetWriteDelay() *************** *** 162,169 **** InitializeListHead(&queueToComplete); ! SetModemStatus( ! pIoPortLocal->pIoPortRemote, ! code == IOCTL_SERIAL_SET_RTS ? C0C_MSB_CTS : 0, ! C0C_MSB_CTS, &queueToComplete); --- 165,172 ---- InitializeListHead(&queueToComplete); ! SetModemControl( ! pIoPortLocal, ! code == IOCTL_SERIAL_SET_RTS ? C0C_MCR_RTS : 0, ! C0C_MCR_RTS, &queueToComplete); *************** *** 193,200 **** InitializeListHead(&queueToComplete); ! SetModemStatus( ! pIoPortLocal->pIoPortRemote, ! code == IOCTL_SERIAL_SET_DTR ? C0C_MSB_DSR : 0, ! C0C_MSB_DSR, &queueToComplete); --- 196,203 ---- InitializeListHead(&queueToComplete); ! SetModemControl( ! pIoPortLocal, ! code == IOCTL_SERIAL_SET_DTR ? C0C_MCR_DTR : 0, ! C0C_MCR_DTR, &queueToComplete); *************** *** 213,217 **** case IOCTL_SERIAL_GET_MODEM_CONTROL: case IOCTL_SERIAL_GET_DTRRTS: { ! ULONG modemStatusRemote; if (pIrpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(ULONG)) { --- 216,220 ---- case IOCTL_SERIAL_GET_MODEM_CONTROL: case IOCTL_SERIAL_GET_DTRRTS: { ! ULONG modemControl; if (pIrpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(ULONG)) { *************** *** 221,234 **** KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); ! modemStatusRemote = pIoPortLocal->pIoPortRemote->modemStatus; KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); ! *(PULONG)pIrp->AssociatedIrp.SystemBuffer = ! ((modemStatusRemote & C0C_MSB_DSR) ? SERIAL_DTR_STATE : 0) | ! ((modemStatusRemote & C0C_MSB_CTS) ? SERIAL_RTS_STATE : 0); ! ! if (code == IOCTL_SERIAL_GET_MODEM_CONTROL) ! *(PULONG)pIrp->AssociatedIrp.SystemBuffer |= 0x8; pIrp->IoStatus.Information = sizeof(ULONG); --- 224,234 ---- KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); ! modemControl = pIoPortLocal->modemControl; KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); ! if (code == IOCTL_SERIAL_GET_DTRRTS) ! modemControl &= SERIAL_DTR_STATE | SERIAL_RTS_STATE; + *(PULONG)pIrp->AssociatedIrp.SystemBuffer = modemControl; pIrp->IoStatus.Information = sizeof(ULONG); Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/io.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** io.c 9 Jun 2007 08:49:47 -0000 1.33 --- io.c 3 Jul 2007 14:35:17 -0000 1.34 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.34 2007/07/03 14:35:17 vfrolov + * Implemented pinout customization + * * Revision 1.33 2007/06/09 08:49:47 vfrolov * Improved baudrate emulation *************** *** 881,891 **** } - readBufBusyEnd = C0C_BUFFER_BUSY(&pIoPortRead->readBuf); - - if (readBufBusyBeg > readBufBusyEnd) { - UpdateHandFlow(pIoPortRead, TRUE, pQueueToComplete); - readBufBusyBeg = readBufBusyEnd; - } - /* get char */ --- 884,887 ---- *************** *** 1084,1102 **** pQueueToComplete, pWriteLimit, &done); - readBufBusyEnd = C0C_BUFFER_BUSY(&pIoPortRead->readBuf); - - if (readBufBusyBeg < readBufBusyEnd) { - if ((pIoPortRead->waitMask & SERIAL_EV_RX80FULL) && - readBufBusyEnd > pIoPortRead->readBuf.size80 && - readBufBusyBeg <= pIoPortRead->readBuf.size80) - { - pIoPortRead->eventMask |= SERIAL_EV_RX80FULL; - WaitComplete(pIoPortRead, pQueueToComplete); - } - - UpdateHandFlow(pIoPortRead, FALSE, pQueueToComplete); - readBufBusyBeg = readBufBusyEnd; - } - if (pIoPortRead->emuOverrun && dataChar.data.chr.isChr && --- 1080,1083 ---- *************** *** 1161,1179 **** pQueueToComplete, pWriteLimit, &done); - readBufBusyEnd = C0C_BUFFER_BUSY(&pIoPortRead->readBuf); - - if (readBufBusyBeg < readBufBusyEnd) { - if ((pIoPortRead->waitMask & SERIAL_EV_RX80FULL) && - readBufBusyEnd > pIoPortRead->readBuf.size80 && - readBufBusyBeg <= pIoPortRead->readBuf.size80) - { - pIoPortRead->eventMask |= SERIAL_EV_RX80FULL; - WaitComplete(pIoPortRead, pQueueToComplete); - } - - UpdateHandFlow(pIoPortRead, FALSE, pQueueToComplete); - readBufBusyBeg = readBufBusyEnd; - } - if (pIoPortRead->emuOverrun && dataIrpWrite.data.irp.status == STATUS_PENDING && --- 1142,1145 ---- *************** *** 1250,1253 **** --- 1216,1237 ---- } + readBufBusyEnd = C0C_BUFFER_BUSY(&pIoPortRead->readBuf); + + if (readBufBusyBeg > readBufBusyEnd) { + UpdateHandFlow(pIoPortRead, TRUE, pQueueToComplete); + } + else + if (readBufBusyBeg < readBufBusyEnd) { + if ((pIoPortRead->waitMask & SERIAL_EV_RX80FULL) && + readBufBusyEnd > pIoPortRead->readBuf.size80 && + readBufBusyBeg <= pIoPortRead->readBuf.size80) + { + pIoPortRead->eventMask |= SERIAL_EV_RX80FULL; + WaitComplete(pIoPortRead, pQueueToComplete); + } + + UpdateHandFlow(pIoPortRead, FALSE, pQueueToComplete); + } + if (wasWrite && !pQueueWrite->pCurrent && pIoPortWrite->waitMask & SERIAL_EV_TXEMPTY) *************** *** 1271,1274 **** --- 1255,1260 ---- NTSTATUS status; + pIoPortWrite->tryWrite = FALSE; + status = TryReadWrite( pIoPortRead, startRead, *************** *** 1276,1287 **** pQueueToComplete); ! pIoPortWrite->tryWrite = FALSE; ! while (pIoPortRead->tryWrite) { ! PC0C_IO_PORT pIoPortTmp; ! pIoPortTmp = pIoPortRead; ! pIoPortRead = pIoPortWrite; ! pIoPortWrite = pIoPortTmp; TryReadWrite( --- 1262,1275 ---- pQueueToComplete); ! while (pIoPortWrite->tryWrite || pIoPortRead->tryWrite) { ! if (!pIoPortWrite->tryWrite) { ! PC0C_IO_PORT pIoPortTmp; ! pIoPortTmp = pIoPortRead; ! pIoPortRead = pIoPortWrite; ! pIoPortWrite = pIoPortTmp; ! } ! pIoPortWrite->tryWrite = FALSE; TryReadWrite( *************** *** 1289,1297 **** pIoPortWrite, FALSE, pQueueToComplete); - - pIoPortWrite->tryWrite = FALSE; - - if (status == STATUS_PENDING && (startRead || startWrite)) - break; } --- 1277,1280 ---- *************** *** 1301,1325 **** VOID SetModemStatus( IN PC0C_IO_PORT pIoPort, ! IN ULONG bits, ! IN ULONG mask, PLIST_ENTRY pQueueToComplete) { ! ULONG modemStatusOld; ! ULONG modemStatusChanged; ! ! modemStatusOld = pIoPort->modemStatus; ! pIoPort->modemStatus |= bits & mask; ! pIoPort->modemStatus &= ~(~bits & mask); ! /* DCD = DSR */ ! if (pIoPort->modemStatus & C0C_MSB_DSR) ! pIoPort->modemStatus |= C0C_MSB_RLSD; ! else ! pIoPort->modemStatus &= ~C0C_MSB_RLSD; ! modemStatusChanged = modemStatusOld ^ pIoPort->modemStatus; if (modemStatusChanged) { TraceModemStatus(pIoPort); --- 1284,1305 ---- VOID SetModemStatus( IN PC0C_IO_PORT pIoPort, ! IN UCHAR bits, ! IN UCHAR mask, PLIST_ENTRY pQueueToComplete) { ! UCHAR modemStatusOld; ! UCHAR modemStatusNew; ! UCHAR modemStatusChanged; ! modemStatusOld = modemStatusNew = pIoPort->modemStatus; ! modemStatusNew |= bits & mask; ! modemStatusNew &= ~(~bits & mask); ! modemStatusChanged = modemStatusOld ^ modemStatusNew; if (modemStatusChanged) { + pIoPort->modemStatus = modemStatusNew; + TraceModemStatus(pIoPort); Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/com0com.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** com0com.h 4 Jun 2007 15:24:32 -0000 1.35 --- com0com.h 3 Jul 2007 14:35:17 -0000 1.36 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.36 2007/07/03 14:35:17 vfrolov + * Implemented pinout customization + * * Revision 1.35 2007/06/04 15:24:32 vfrolov * Fixed open reject just after close in exclusiveMode *************** *** 206,209 **** --- 209,219 ---- struct _C0C_ADAPTIVE_DELAY; + typedef struct _C0C_PIN_OUTS { + struct { + UCHAR positive; + UCHAR negative; + } remote, local; + } C0C_PIN_OUTS, *PC0C_PIN_OUTS; + typedef struct _C0C_IO_PORT { *************** *** 238,241 **** --- 248,257 ---- struct _C0C_ADAPTIVE_DELAY *pWriteDelay; + #define C0C_PIN_OUTS_RTS 0 + #define C0C_PIN_OUTS_DTR 1 + #define C0C_PIN_OUTS_OUT1 2 + + C0C_PIN_OUTS pinOuts[3]; + SERIAL_HANDFLOW handFlow; SERIAL_CHARS specialChars; *************** *** 254,258 **** #define C0C_MSB_RLSD 0x80 ! ULONG modemStatus; C0C_BUFFER readBuf; --- 270,282 ---- #define C0C_MSB_RLSD 0x80 ! UCHAR modemStatus; ! ! #define C0C_MCR_DTR 0x01 ! #define C0C_MCR_RTS 0x02 ! #define C0C_MCR_OUT1 0x04 ! #define C0C_MCR_OUT2 0x08 ! #define C0C_MCR_LOOP 0x10 ! ! UCHAR modemControl; C0C_BUFFER readBuf; *************** *** 426,433 **** VOID SetModemStatus( IN PC0C_IO_PORT pIoPort, ! IN ULONG bits, ! IN ULONG mask, PLIST_ENTRY pQueueToComplete); #define C0C_TAG 'c0c' #define C0C_ALLOCATE_POOL(PoolType, NumberOfBytes) \ --- 450,470 ---- VOID SetModemStatus( IN PC0C_IO_PORT pIoPort, ! IN UCHAR bits, ! IN UCHAR mask, PLIST_ENTRY pQueueToComplete); + VOID SetModemControl( + IN PC0C_IO_PORT pIoPort, + IN UCHAR bits, + IN UCHAR mask, + PLIST_ENTRY pQueueToComplete); + + VOID PinMap( + IN PC0C_IO_PORT pIoPort, + IN ULONG pinCTS, + IN ULONG pinDSR, + IN ULONG pinDCD, + IN ULONG pinRI); + #define C0C_TAG 'c0c' #define C0C_ALLOCATE_POOL(PoolType, NumberOfBytes) \ Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/adddev.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** adddev.c 5 Jun 2007 12:15:08 -0000 1.27 --- adddev.c 3 Jul 2007 14:35:17 -0000 1.28 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.28 2007/07/03 14:35:17 vfrolov + * Implemented pinout customization + * * Revision 1.27 2007/06/05 12:15:08 vfrolov * Fixed memory leak *************** *** 168,171 **** --- 171,175 ---- PC0C_PDOPORT_EXTENSION pPhDevExt; ULONG emuBR, emuOverrun, plugInMode, exclusiveMode; + ULONG pinCTS, pinDSR, pinDCD, pinRI; UNICODE_STRING ntDeviceName; PWCHAR pPortName; *************** *** 241,247 **** emuBR = emuOverrun = plugInMode = exclusiveMode = 0; if (NT_SUCCESS(status)) { ! RTL_QUERY_REGISTRY_TABLE queryTable[5]; ULONG zero = 0; int i; --- 245,252 ---- emuBR = emuOverrun = plugInMode = exclusiveMode = 0; + pinCTS = pinDSR = pinDCD = pinRI = 0; if (NT_SUCCESS(status)) { ! RTL_QUERY_REGISTRY_TABLE queryTable[9]; ULONG zero = 0; int i; *************** *** 249,283 **** RtlZeroMemory(queryTable, sizeof(queryTable)); i = 0; - queryTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT; queryTable[i].Name = L"EmuBR"; queryTable[i].EntryContext = &emuBR; - queryTable[i].DefaultType = REG_DWORD; - queryTable[i].DefaultData = &zero; - queryTable[i].DefaultLength = sizeof(ULONG); i++; - queryTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT; queryTable[i].Name = L"EmuOverrun"; queryTable[i].EntryContext = &emuOverrun; - queryTable[i].DefaultType = REG_DWORD; - queryTable[i].DefaultData = &zero; - queryTable[i].DefaultLength = sizeof(ULONG); i++; - queryTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT; queryTable[i].Name = L"PlugInMode"; queryTable[i].EntryContext = &plugInMode; - queryTable[i].DefaultType = REG_DWORD; - queryTable[i].DefaultData = &zero; - queryTable[i].DefaultLength = sizeof(ULONG); i++; - queryTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT; queryTable[i].Name = L"ExclusiveMode"; queryTable[i].EntryContext = &exclusiveMode; ! queryTable[i].DefaultType = REG_DWORD; ! queryTable[i].DefaultData = &zero; ! queryTable[i].DefaultLength = sizeof(ULONG); RtlQueryRegistryValues( --- 254,295 ---- RtlZeroMemory(queryTable, sizeof(queryTable)); + for (i = 0 ; i < (sizeof(queryTable)/sizeof(queryTable[0]) - 1) ; i++) { + queryTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT; + queryTable[i].DefaultType = REG_DWORD; + queryTable[i].DefaultData = &zero; + queryTable[i].DefaultLength = sizeof(ULONG); + } + i = 0; queryTable[i].Name = L"EmuBR"; queryTable[i].EntryContext = &emuBR; i++; queryTable[i].Name = L"EmuOverrun"; queryTable[i].EntryContext = &emuOverrun; i++; queryTable[i].Name = L"PlugInMode"; queryTable[i].EntryContext = &plugInMode; i++; queryTable[i].Name = L"ExclusiveMode"; queryTable[i].EntryContext = &exclusiveMode; ! ! i++; ! queryTable[i].Name = L"cts"; ! queryTable[i].EntryContext = &pinCTS; ! ! i++; ! queryTable[i].Name = L"dsr"; ! queryTable[i].EntryContext = &pinDSR; ! ! i++; ! queryTable[i].Name = L"dcd"; ! queryTable[i].EntryContext = &pinDCD; ! ! i++; ! queryTable[i].Name = L"ri"; ! queryTable[i].EntryContext = &pinRI; RtlQueryRegistryValues( *************** *** 375,378 **** --- 387,394 ---- SetWriteDelay(pDevExt); + pDevExt->pIoPortLocal->modemControl |= C0C_MCR_OUT2; + + PinMap(pDevExt->pIoPortLocal, pinCTS, pinDSR, pinDCD, pinRI); + pDevExt->pLowDevObj = IoAttachDeviceToDeviceStack(pNewDevObj, pPhDevObj); Index: sources =================================================================== RCS file: /cvsroot/com0com/com0com/sys/sources,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sources 1 Jun 2007 16:22:40 -0000 1.8 --- sources 3 Jul 2007 14:35:17 -0000 1.9 *************** *** 21,24 **** --- 21,25 ---- fileinfo.c \ io.c \ + pinouts.c \ handflow.c \ startirp.c \ Index: handflow.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/handflow.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** handflow.c 21 Jun 2006 16:23:57 -0000 1.7 --- handflow.c 3 Jul 2007 14:35:17 -0000 1.8 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2007/07/03 14:35:17 vfrolov + * Implemented pinout customization + * * Revision 1.7 2006/06/21 16:23:57 vfrolov * Fixed possible BSOD after one port of pair removal *************** *** 59,63 **** PLIST_ENTRY pQueueToComplete) { ! ULONG bits, mask; PC0C_BUFFER pReadBuf; PSERIAL_HANDFLOW pNewHandFlow; --- 62,66 ---- PLIST_ENTRY pQueueToComplete) { ! UCHAR bits, mask; PC0C_BUFFER pReadBuf; PSERIAL_HANDFLOW pNewHandFlow; *************** *** 106,120 **** case 0: pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_CTS; ! mask |= C0C_MSB_CTS; // Turn off CTS on remote side if RTS is disabled break; case SERIAL_RTS_CONTROL: pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_CTS; ! bits |= C0C_MSB_CTS; ! mask |= C0C_MSB_CTS; break; case SERIAL_RTS_HANDSHAKE: if (C0C_BUFFER_BUSY(pReadBuf) > (C0C_BUFFER_SIZE(pReadBuf) - pNewHandFlow->XoffLimit)) { pIoPort->writeHoldingRemote |= SERIAL_TX_WAITING_FOR_CTS; ! mask |= C0C_MSB_CTS; } else --- 109,123 ---- case 0: pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_CTS; ! mask |= C0C_MCR_RTS; break; case SERIAL_RTS_CONTROL: pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_CTS; ! bits |= C0C_MCR_RTS; ! mask |= C0C_MCR_RTS; break; case SERIAL_RTS_HANDSHAKE: if (C0C_BUFFER_BUSY(pReadBuf) > (C0C_BUFFER_SIZE(pReadBuf) - pNewHandFlow->XoffLimit)) { pIoPort->writeHoldingRemote |= SERIAL_TX_WAITING_FOR_CTS; ! mask |= C0C_MCR_RTS; } else *************** *** 122,132 **** if (C0C_BUFFER_BUSY(pReadBuf) <= (SIZE_T)pNewHandFlow->XonLimit) { pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_CTS; ! bits |= C0C_MSB_CTS; ! mask |= C0C_MSB_CTS; } } else { ! bits |= C0C_MSB_CTS; ! mask |= C0C_MSB_CTS; } } --- 125,135 ---- if (C0C_BUFFER_BUSY(pReadBuf) <= (SIZE_T)pNewHandFlow->XonLimit) { pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_CTS; ! bits |= C0C_MCR_RTS; ! mask |= C0C_MCR_RTS; } } else { ! bits |= C0C_MCR_RTS; ! mask |= C0C_MCR_RTS; } } *************** *** 140,154 **** case 0: pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_DSR; ! mask |= C0C_MSB_DSR; // Turn off DSR on remote side if DTR is disabled break; case SERIAL_DTR_CONTROL: pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_DSR; ! bits |= C0C_MSB_DSR; ! mask |= C0C_MSB_DSR; break; case SERIAL_DTR_HANDSHAKE: if (C0C_BUFFER_BUSY(pReadBuf) > (C0C_BUFFER_SIZE(pReadBuf) - pNewHandFlow->XoffLimit)) { pIoPort->writeHoldingRemote |= SERIAL_TX_WAITING_FOR_DSR; ! mask |= C0C_MSB_DSR; } else --- 143,157 ---- case 0: pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_DSR; ! mask |= C0C_MCR_DTR; break; case SERIAL_DTR_CONTROL: pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_DSR; ! bits |= C0C_MCR_DTR; ! mask |= C0C_MCR_DTR; break; case SERIAL_DTR_HANDSHAKE: if (C0C_BUFFER_BUSY(pReadBuf) > (C0C_BUFFER_SIZE(pReadBuf) - pNewHandFlow->XoffLimit)) { pIoPort->writeHoldingRemote |= SERIAL_TX_WAITING_FOR_DSR; ! mask |= C0C_MCR_DTR; } else *************** *** 156,166 **** if (C0C_BUFFER_BUSY(pReadBuf) <= (SIZE_T)pNewHandFlow->XonLimit) { pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_DSR; ! bits |= C0C_MSB_DSR; ! mask |= C0C_MSB_DSR; } } else { ! bits |= C0C_MSB_DSR; ! mask |= C0C_MSB_DSR; } } --- 159,169 ---- if (C0C_BUFFER_BUSY(pReadBuf) <= (SIZE_T)pNewHandFlow->XonLimit) { pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_DSR; ! bits |= C0C_MCR_DTR; ! mask |= C0C_MCR_DTR; } } else { ! bits |= C0C_MCR_DTR; ! mask |= C0C_MCR_DTR; } } *************** *** 202,206 **** if (mask) ! SetModemStatus(pIoPort->pIoPortRemote, bits, mask, pQueueToComplete); UpdateTransmitToggle(pIoPort, pQueueToComplete); --- 205,209 ---- if (mask) ! SetModemControl(pIoPort, bits, mask, pQueueToComplete); UpdateTransmitToggle(pIoPort, pQueueToComplete); *************** *** 231,235 **** PLIST_ENTRY pQueueToComplete) { ! ULONG bits, mask; PC0C_BUFFER pReadBuf; PSERIAL_HANDFLOW pHandFlowLocal, pHandFlowRemote; --- 234,238 ---- PLIST_ENTRY pQueueToComplete) { ! UCHAR bits, mask; PC0C_BUFFER pReadBuf; PSERIAL_HANDFLOW pHandFlowLocal, pHandFlowRemote; *************** *** 245,254 **** if ((pHandFlowLocal->FlowReplace & SERIAL_RTS_MASK) == SERIAL_RTS_HANDSHAKE) { pIoPort->writeHoldingRemote |= SERIAL_TX_WAITING_FOR_CTS; ! mask |= C0C_MSB_CTS; } if ((pHandFlowLocal->ControlHandShake & SERIAL_DTR_MASK) == SERIAL_DTR_HANDSHAKE) { pIoPort->writeHoldingRemote |= SERIAL_TX_WAITING_FOR_DSR; ! mask |= C0C_MSB_DSR; } --- 248,257 ---- if ((pHandFlowLocal->FlowReplace & SERIAL_RTS_MASK) == SERIAL_RTS_HANDSHAKE) { pIoPort->writeHoldingRemote |= SERIAL_TX_WAITING_FOR_CTS; ! mask |= C0C_MCR_RTS; } if ((pHandFlowLocal->ControlHandShake & SERIAL_DTR_MASK) == SERIAL_DTR_HANDSHAKE) { pIoPort->writeHoldingRemote |= SERIAL_TX_WAITING_FOR_DSR; ! mask |= C0C_MCR_DTR; } *************** *** 265,276 **** if ((pHandFlowLocal->FlowReplace & SERIAL_RTS_MASK) == SERIAL_RTS_HANDSHAKE) { pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_CTS; ! bits |= C0C_MSB_CTS; ! mask |= C0C_MSB_CTS; } if ((pHandFlowLocal->ControlHandShake & SERIAL_DTR_MASK) == SERIAL_DTR_HANDSHAKE) { pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_DSR; ! bits |= C0C_MSB_DSR; ! mask |= C0C_MSB_DSR; } --- 268,279 ---- if ((pHandFlowLocal->FlowReplace & SERIAL_RTS_MASK) == SERIAL_RTS_HANDSHAKE) { pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_CTS; ! bits |= C0C_MCR_RTS; ! mask |= C0C_MCR_RTS; } if ((pHandFlowLocal->ControlHandShake & SERIAL_DTR_MASK) == SERIAL_DTR_HANDSHAKE) { pIoPort->writeHoldingRemote &= ~SERIAL_TX_WAITING_FOR_DSR; ! bits |= C0C_MCR_DTR; ! mask |= C0C_MCR_DTR; } *************** *** 285,289 **** if (mask) ! SetModemStatus(pIoPort->pIoPortRemote, bits, mask, pQueueToComplete); } --- 288,292 ---- if (mask) ! SetModemControl(pIoPort, bits, mask, pQueueToComplete); } *************** *** 293,307 **** { if ((pIoPort->handFlow.FlowReplace & SERIAL_RTS_MASK) == SERIAL_TRANSMIT_TOGGLE) { ! ULONG bits; if ((pIoPort->writeHolding & SERIAL_TX_WAITING_ON_BREAK) == 0 && (pIoPort->sendXonXoff || pIoPort->irpQueues[C0C_QUEUE_WRITE].pCurrent)) { ! bits = C0C_MSB_CTS; } else { bits = 0; } ! SetModemStatus(pIoPort->pIoPortRemote, bits, C0C_MSB_CTS, pQueueToComplete); } } --- 296,310 ---- { if ((pIoPort->handFlow.FlowReplace & SERIAL_RTS_MASK) == SERIAL_TRANSMIT_TOGGLE) { ! UCHAR bits; if ((pIoPort->writeHolding & SERIAL_TX_WAITING_ON_BREAK) == 0 && (pIoPort->sendXonXoff || pIoPort->irpQueues[C0C_QUEUE_WRITE].pCurrent)) { ! bits = C0C_MCR_RTS; } else { bits = 0; } ! SetModemControl(pIoPort, bits, C0C_MCR_RTS, pQueueToComplete); } } |