com0com-cvs Mailing List for Null-modem emulator (Page 21)
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
You can subscribe to this list here.
2005 |
Jan
|
Feb
(7) |
Mar
|
Apr
|
May
(13) |
Jun
(18) |
Jul
(9) |
Aug
(10) |
Sep
(15) |
Oct
(6) |
Nov
(9) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(6) |
Feb
(4) |
Mar
(4) |
Apr
(2) |
May
(7) |
Jun
(11) |
Jul
(6) |
Aug
(9) |
Sep
(1) |
Oct
(27) |
Nov
(22) |
Dec
(3) |
2007 |
Jan
(13) |
Feb
(16) |
Mar
(2) |
Apr
(3) |
May
(7) |
Jun
(17) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(20) |
Nov
(18) |
Dec
(1) |
2008 |
Jan
|
Feb
(3) |
Mar
(46) |
Apr
(40) |
May
(4) |
Jun
(9) |
Jul
(7) |
Aug
(62) |
Sep
(25) |
Oct
(51) |
Nov
(67) |
Dec
(81) |
2009 |
Jan
(13) |
Feb
(31) |
Mar
(12) |
Apr
|
May
(10) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(10) |
Oct
|
Nov
(3) |
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
|
May
(12) |
Jun
(9) |
Jul
(12) |
Aug
(7) |
Sep
(6) |
Oct
|
Nov
|
Dec
(1) |
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(11) |
Jun
|
Jul
(26) |
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(23) |
2012 |
Jan
(7) |
Feb
(3) |
Mar
|
Apr
|
May
(2) |
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Vyacheslav F. <vf...@us...> - 2008-08-13 14:31:45
|
Update of /cvsroot/com0com/hub4com/plugins/pinmap In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv31933 Modified Files: filter.cpp Log Message: Fixed Help Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pinmap/filter.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** filter.cpp 11 Aug 2008 07:26:48 -0000 1.1 --- filter.cpp 13 Aug 2008 14:31:41 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2008/08/13 14:31:41 vfrolov + * Fixed Help + * * Revision 1.1 2008/08/11 07:26:48 vfrolov * Initial revision *************** *** 245,256 **** << endl << "OUT method input data stream description:" << endl ! << " HUB_MSG_TYPE_GET_OPTIONS(<pOptions>)" << endl ! << " - the value pointed by <pOptions> will be or'ed with" << endl << " the required mask to get line status and modem" << endl << " status." << endl << " SET_PIN_STATE(<set>) - pin settings controlled by this filter will be" << endl << " discarded from <set>." << endl ! << " LINE_STATUS(<val>) - current state of line" << endl ! << " MODEM_STATUS(<val>) - current state of modem" << endl << endl << "OUT method output data stream description:" << endl --- 248,260 ---- << endl << "OUT method input data stream description:" << endl ! << " SET_OPTIONS(<opts>) - the value <opts> will be or'ed with the required mask" << endl ! << " to to set pin state." << endl ! << " GET_OPTIONS(<pOpts>) - the value pointed by <pOpts> will be or'ed with" << endl << " the required mask to get line status and modem" << endl << " status." << endl << " SET_PIN_STATE(<set>) - pin settings controlled by this filter will be" << endl << " discarded from <set>." << endl ! << " LINE_STATUS(<val>) - current state of line." << endl ! << " MODEM_STATUS(<val>) - current state of modem." << endl << endl << "OUT method output data stream description:" << endl *************** *** 260,264 **** << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << " --add-filters=0,1:" << GetPluginAbout()->pName << " COM1 COM2" << endl << " - transfer data and signals between COM1 and COM2." << endl ! << " " << pProgPath << " --echo-route=0 COM2" << endl << " - receive data and signals from COM2 and send it back to COM2." << endl ; --- 264,270 ---- << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << " --add-filters=0,1:" << GetPluginAbout()->pName << " COM1 COM2" << endl << " - transfer data and signals between COM1 and COM2." << endl ! << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << ":\"--rts=cts\" --add-filters=0,1:" << GetPluginAbout()->pName << " --octs=off COM1 COM2" << endl ! << " - allow end-to-end RTS/CTS handshaking between COM1 and COM2." << endl ! << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << " --add-filters=0:" << GetPluginAbout()->pName << " --echo-route=0 COM2" << endl << " - receive data and signals from COM2 and send it back to COM2." << endl ; |
From: Vyacheslav F. <vf...@us...> - 2008-08-11 07:28:46
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13802 Modified Files: hub4com.sln Log Message: Added filter-pinmap project Index: hub4com.sln =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.sln,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** hub4com.sln 3 Apr 2008 14:54:47 -0000 1.6 --- hub4com.sln 11 Aug 2008 07:28:42 -0000 1.7 *************** *** 16,19 **** --- 16,21 ---- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-echo", "plugins\echo\echo.vcproj", "{F0ACE42D-3488-4054-B683-3B4BC43CD239}" EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-pinmap", "plugins\pinmap\pinmap.vcproj", "{DC90F370-D011-4C9A-BD59-6BDC9BC161C0}" + EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution *************** *** 50,53 **** --- 52,59 ---- {F0ACE42D-3488-4054-B683-3B4BC43CD239}.Release|Win32.ActiveCfg = Release|Win32 {F0ACE42D-3488-4054-B683-3B4BC43CD239}.Release|Win32.Build.0 = Release|Win32 + {DC90F370-D011-4C9A-BD59-6BDC9BC161C0}.Debug|Win32.ActiveCfg = Debug|Win32 + {DC90F370-D011-4C9A-BD59-6BDC9BC161C0}.Debug|Win32.Build.0 = Debug|Win32 + {DC90F370-D011-4C9A-BD59-6BDC9BC161C0}.Release|Win32.ActiveCfg = Release|Win32 + {DC90F370-D011-4C9A-BD59-6BDC9BC161C0}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution |
From: Vyacheslav F. <vf...@us...> - 2008-08-11 07:26:51
|
Update of /cvsroot/com0com/hub4com/plugins/pinmap In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13043 Added Files: .cvsignore filter.cpp pinmap.vcproj precomp.cpp precomp.h Log Message: Initial revision --- NEW FILE: precomp.cpp --- /* * $Id: precomp.cpp,v 1.1 2008/08/11 07:26:48 vfrolov Exp $ * * Copyright (c) 2007-2008 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 * */ /////////////////////////////////////////////////////////////// #include "precomp.h" /////////////////////////////////////////////////////////////// --- NEW FILE: precomp.h --- /* * $Id: precomp.h,v 1.1 2008/08/11 07:26:48 vfrolov Exp $ * * Copyright (c) 2008 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: precomp.h,v $ * Revision 1.1 2008/08/11 07:26:48 vfrolov * Initial revision * */ #ifndef _PRECOMP_H_ #define _PRECOMP_H_ #include <windows.h> #include <crtdbg.h> #include <map> #include <iostream> using namespace std; #pragma warning(disable:4512) // assignment operator could not be generated #endif /* _PRECOMP_H_ */ --- NEW FILE: pinmap.vcproj --- <?xml version="1.0" encoding="windows-1251"?> <VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="filter-pinmap" ProjectGUID="{DC90F370-D011-4C9A-BD59-6BDC9BC161C0}" RootNamespace="hub4com" Keyword="Win32Proj" > <Platforms> <Platform Name="Win32" /> </Platforms> <ToolFiles> </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="Debug" IntermediateDirectory="Debug" ConfigurationType="2" UseOfMFC="0" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" /> <Tool Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" UsePrecompiledHeader="2" PrecompiledHeaderThrough="precomp.h" PrecompiledHeaderFile="$(IntDir)\precomp.pch" WarningLevel="4" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" OutputFile="..\..\$(OutDir)\plugins\$(ProjectName).dll" LinkIncremental="2" ModuleDefinitionFile="..\plugins.def" GenerateDebugInformation="true" SubSystem="1" TargetMachine="1" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCWebDeploymentTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="Release" IntermediateDirectory="Release" ConfigurationType="2" UseOfMFC="0" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" /> <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE" RuntimeLibrary="0" UsePrecompiledHeader="2" PrecompiledHeaderThrough="precomp.h" PrecompiledHeaderFile="$(IntDir)\precomp.pch" WarningLevel="4" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" OutputFile="..\..\$(OutDir)\plugins\$(ProjectName).dll" LinkIncremental="2" ModuleDefinitionFile="..\plugins.def" GenerateDebugInformation="true" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCWebDeploymentTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > <File RelativePath="..\plugins_api.h" > </File> <File RelativePath=".\precomp.h" > </File> </Filter> <Filter Name="Source Files" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File RelativePath=".\filter.cpp" > </File> <File RelativePath="..\plugins.def" > </File> <File RelativePath=".\precomp.cpp" > <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" UsePrecompiledHeader="1" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" UsePrecompiledHeader="1" /> </FileConfiguration> </File> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> --- NEW FILE: filter.cpp --- /* * $Id: filter.cpp,v 1.1 2008/08/11 07:26:48 vfrolov Exp $ * * Copyright (c) 2008 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: filter.cpp,v $ * Revision 1.1 2008/08/11 07:26:48 vfrolov * Initial revision * */ #include "precomp.h" #include "../plugins_api.h" /////////////////////////////////////////////////////////////// static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) { size_t lenPattern = strlen(pPattern); if (_strnicmp(pArg, pPattern, lenPattern) != 0) return NULL; return pArg + lenPattern; } /////////////////////////////////////////////////////////////// class Valid { public: Valid() : isValid(TRUE) {} void Invalidate() { isValid = FALSE; } BOOL IsValid() const { return isValid; } private: BOOL isValid; }; /////////////////////////////////////////////////////////////// static struct { const char *pName; DWORD val; } pinOut_names[] = { {"rts=", SO_V2O_PIN_STATE(PIN_STATE_RTS)}, {"dtr=", SO_V2O_PIN_STATE(PIN_STATE_DTR)}, {"out1=", SO_V2O_PIN_STATE(PIN_STATE_OUT1)}, {"out2=", SO_V2O_PIN_STATE(PIN_STATE_OUT2)}, {"break=", SO_V2O_PIN_STATE(PIN_STATE_BREAK)}, }; /////////////////////////////////////////////////////////////// static struct { const char *pName; DWORD val; } pinIn_names[] = { {"cts", GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS)}, {"dsr", GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)}, {"dcd", GO_V2O_MODEM_STATUS(MODEM_STATUS_DCD)}, {"ring", GO_V2O_MODEM_STATUS(MODEM_STATUS_RI)}, {"break", GO_V2O_LINE_STATUS(LINE_STATUS_BI)}, }; /////////////////////////////////////////////////////////////// class State { public: State() : inVal(0) {} WORD inVal; }; /////////////////////////////////////////////////////////////// class Filter : public Valid { public: Filter(int argc, const char *const argv[]); State *GetState(int nPort); struct PinOuts { PinOuts() : mask(0), val(0) {} WORD mask; WORD val; }; PinOuts pinMap[sizeof(pinIn_names)/sizeof(pinIn_names[0])]; WORD outMask; WORD inMask; private: typedef map<int, State*> PortsMap; typedef pair<int, State*> PortPair; PortsMap portsMap; void Parse(const char *pArg); }; Filter::Filter(int argc, const char *const argv[]) : outMask(0), inMask(0) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { const char *pArg = GetParam(*pArgs, "--"); if (!pArg) { cerr << "Unknown option " << *pArgs << endl; Invalidate(); continue; } Parse(pArg); } if (!inMask) { Parse("rts=cts"); Parse("dtr=dsr"); Parse("break=break"); } } void Filter::Parse(const char *pArg) { BOOL foundOut = FALSE; for (int iOut = 0 ; iOut < sizeof(pinOut_names)/sizeof(pinOut_names[0]) ; iOut++) { const char *pParam; if ((pParam = GetParam(pArg, pinOut_names[iOut].pName)) == NULL) continue; foundOut = TRUE; if ((outMask & pinOut_names[iOut].val) != 0) { cerr << "Duplicated option --" << pinOut_names[iOut].pName << endl; Invalidate(); } outMask |= pinOut_names[iOut].val; BOOL negative; if (*pParam == '!') { negative = TRUE; pParam++; } else { negative = FALSE; } BOOL foundIn = FALSE; _ASSERTE(sizeof(pinIn_names)/sizeof(pinIn_names[0]) == sizeof(pinMap)/sizeof(pinMap[0])); for (int iIn = 0 ; iIn < sizeof(pinIn_names)/sizeof(pinIn_names[0]) ; iIn++) { if (_stricmp(pParam, pinIn_names[iIn].pName) == 0) { foundIn = TRUE; inMask |= pinIn_names[iIn].val; pinMap[iIn].mask |= pinOut_names[iOut].val; if (negative) pinMap[iIn].val &= ~pinOut_names[iOut].val; else pinMap[iIn].val |= pinOut_names[iOut].val; break; } } if (!foundIn) { cerr << "Unknown pin " << pParam << endl; Invalidate(); } break; } if (!foundOut) { cerr << "Unknown option " << pArg << endl; Invalidate(); } } State *Filter::GetState(int nPort) { PortsMap::iterator iPair = portsMap.find(nPort); if (iPair == portsMap.end()) { portsMap.insert(PortPair(nPort, NULL)); iPair = portsMap.find(nPort); if (iPair == portsMap.end()) return NULL; } if (!iPair->second) iPair->second = new State(); return iPair->second; } /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() { return PLUGIN_TYPE_FILTER; } /////////////////////////////////////////////////////////////// static const PLUGIN_ABOUT_A about = { sizeof(PLUGIN_ABOUT_A), "pinmap", "Copyright (c) 2008 Vyacheslav Frolov", "GNU General Public License", "Pinouts mapping filter", }; static const PLUGIN_ABOUT_A * CALLBACK GetPluginAbout() { return &about; } /////////////////////////////////////////////////////////////// static void CALLBACK Help(const char *pProgPath) { cerr << "Usage:" << endl << " " << pProgPath << " ... --create-filter=" << GetPluginAbout()->pName << "[,<FID>][:<options>] ... --add-filters=<ports>:[...,]<FID>[,...] ..." << endl << endl << "Wire options:" << endl << " --rts=[!]<s> - wire input state of <s> to output pin RTS." << endl << " --dtr=[!]<s> - wire input state of <s> to output pin DTR." << endl << " --out1=[!]<s> - wire input state of <s> to output pin OUT1." << endl << " --out2=[!]<s> - wire input state of <s> to output pin OUT2." << endl << " --break=[!]<s> - wire input state of <s> to output pin BREAK." << endl << endl << " The possible values of <s> above can be cts, dsr, dcd, ring or break. The" << endl << " exclamation sign (!) can be used to invert the value. If no any wire option" << endl << " specified, then the options --rts=cts --dtr=dsr --break=break are used by" << endl << " default." << endl << endl << "OUT method input data stream description:" << endl << " HUB_MSG_TYPE_GET_OPTIONS(<pOptions>)" << endl << " - the value pointed by <pOptions> will be or'ed with" << endl << " the required mask to get line status and modem" << endl << " status." << endl << " SET_PIN_STATE(<set>) - pin settings controlled by this filter will be" << endl << " discarded from <set>." << endl << " LINE_STATUS(<val>) - current state of line" << endl << " MODEM_STATUS(<val>) - current state of modem" << endl << endl << "OUT method output data stream description:" << endl << " SET_PIN_STATE(<set>) - will be added on appropriate state changing." << endl << endl << "Examples:" << endl << " " << pProgPath << " --create-filter=" << GetPluginAbout()->pName << " --add-filters=0,1:" << GetPluginAbout()->pName << " COM1 COM2" << endl << " - transfer data and signals between COM1 and COM2." << endl << " " << pProgPath << " --echo-route=0 COM2" << endl << " - receive data and signals from COM2 and send it back to COM2." << endl ; } /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( HCONFIG /*hConfig*/, int argc, const char *const argv[]) { Filter *pFilter = new Filter(argc, argv); if (!pFilter) return NULL; if (!pFilter->IsValid()) { delete pFilter; return NULL; } return (HFILTER)pFilter; } /////////////////////////////////////////////////////////////// static void InsertPinState( Filter &filter, WORD inMask, WORD inVal, HUB_MSG **ppOutMsg) { if (!inMask) return; //cout << "InsertPinState inMask=0x" << hex << inMask << " inVal=0x" << inVal << dec << endl; WORD mask = 0; WORD val = 0; for (int iIn = 0 ; iIn < sizeof(pinIn_names)/sizeof(pinIn_names[0]) ; iIn++) { if ((inMask & pinIn_names[iIn].val) == 0) continue; mask |= (DWORD)filter.pinMap[iIn].mask; if ((inVal & pinIn_names[iIn].val) != 0) val |= (filter.pinMap[iIn].val & mask); else val |= (~filter.pinMap[iIn].val & mask); } if (mask) { DWORD dVal = (SPS_PIN2MASK(mask) | val); //cout << "SET_PIN_STATE 0x" << hex << dVal << dec << endl; *ppOutMsg = pMsgInsertVal(*ppOutMsg, HUB_MSG_TYPE_SET_PIN_STATE, dVal); } } static BOOL CALLBACK OutMethod( HFILTER hFilter, int /*nFromPort*/, int nToPort, HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); _ASSERTE(pOutMsg != NULL); switch (pOutMsg->type) { case HUB_MSG_TYPE_SET_OPTIONS: { // or'e with the required mask to set pin state pOutMsg->u.val |= ((Filter *)hFilter)->outMask; break; } case HUB_MSG_TYPE_GET_OPTIONS: { _ASSERTE(pOutMsg->u.pv.pVal != NULL); // or'e with the required mask to get line status and modem status WORD mask = (WORD)(((Filter *)hFilter)->inMask & pOutMsg->u.pv.val); *pOutMsg->u.pv.pVal |= mask; break; } case HUB_MSG_TYPE_SET_PIN_STATE: // discard any pin settings controlled by this filter pOutMsg->u.val &= ~(SPS_PIN2MASK(((Filter *)hFilter)->outMask)); break; case HUB_MSG_TYPE_LINE_STATUS: case HUB_MSG_TYPE_MODEM_STATUS: { State *pState = ((Filter *)hFilter)->GetState(nToPort); if (!pState) return FALSE; WORD inVal; if (pOutMsg->type == HUB_MSG_TYPE_MODEM_STATUS) inVal = ((WORD)pOutMsg->u.val & 0x00FF) | (pState->inVal & 0xFF00); else inVal = ((WORD)pOutMsg->u.val << 8) | (pState->inVal & 0x00FF); inVal &= ((Filter *)hFilter)->inMask; InsertPinState(*(Filter *)hFilter, pState->inVal ^ inVal, inVal, &pOutMsg); pState->inVal = inVal; break; } } return pOutMsg != NULL; } /////////////////////////////////////////////////////////////// static const FILTER_ROUTINES_A routines = { sizeof(FILTER_ROUTINES_A), GetPluginType, GetPluginAbout, Help, NULL, // ConfigStart NULL, // Config NULL, // ConfigStop Create, NULL, // Init NULL, // InMethod OutMethod, }; static const PLUGIN_ROUTINES_A *const plugins[] = { (const PLUGIN_ROUTINES_A *)&routines, NULL }; /////////////////////////////////////////////////////////////// PLUGIN_INIT_A InitA; const PLUGIN_ROUTINES_A *const * CALLBACK InitA( const HUB_ROUTINES_A * pHubRoutines) { if (!ROUTINE_IS_VALID(pHubRoutines, pMsgInsertVal)) { return NULL; } pMsgInsertVal = pHubRoutines->pMsgInsertVal; return plugins; } /////////////////////////////////////////////////////////////// --- NEW FILE: .cvsignore --- *.user Release Debug |
From: Vyacheslav F. <vf...@us...> - 2008-08-11 07:20:09
|
Update of /cvsroot/com0com/hub4com/plugins/pinmap In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv10416/pinmap Log Message: Directory /cvsroot/com0com/hub4com/plugins/pinmap added to the repository |
From: Vyacheslav F. <vf...@us...> - 2008-08-11 07:15:39
|
Update of /cvsroot/com0com/hub4com/plugins/pin2con In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8775/plugins/pin2con Modified Files: filter.cpp Log Message: Replaced HUB_MSG_TYPE_COM_FUNCTION HUB_MSG_TYPE_INIT_LSR_MASK HUB_MSG_TYPE_INIT_MST_MASK by HUB_MSG_TYPE_SET_PIN_STATE HUB_MSG_TYPE_GET_OPTIONS HUB_MSG_TYPE_SET_OPTIONS Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pin2con/filter.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** filter.cpp 14 Apr 2008 07:32:04 -0000 1.4 --- filter.cpp 11 Aug 2008 07:15:33 -0000 1.5 *************** *** 20,23 **** --- 20,33 ---- * * $Log$ + * Revision 1.5 2008/08/11 07:15:33 vfrolov + * Replaced + * HUB_MSG_TYPE_COM_FUNCTION + * HUB_MSG_TYPE_INIT_LSR_MASK + * HUB_MSG_TYPE_INIT_MST_MASK + * by + * HUB_MSG_TYPE_SET_PIN_STATE + * HUB_MSG_TYPE_GET_OPTIONS + * HUB_MSG_TYPE_SET_OPTIONS + * * Revision 1.4 2008/04/14 07:32:04 vfrolov * Renamed option --use-port-module to --use-driver *************** *** 76,90 **** static struct { const char *pName; ! WORD val; } pin_names[] = { ! {"cts", MODEM_STATUS_CTS}, ! {"dsr", MODEM_STATUS_DSR}, ! {"dcd", MODEM_STATUS_DCD}, ! {"ring", MODEM_STATUS_RI}, ! {"break", LINE_STATUS_BI << 8}, }; Filter::Filter(int argc, const char *const argv[]) ! : pin(MODEM_STATUS_DSR), negative(FALSE) { --- 86,100 ---- static struct { const char *pName; ! DWORD val; } pin_names[] = { ! {"cts", GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS)}, ! {"dsr", GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)}, ! {"dcd", GO_V2O_MODEM_STATUS(MODEM_STATUS_DCD)}, ! {"ring", GO_V2O_MODEM_STATUS(MODEM_STATUS_RI)}, ! {"break", GO_V2O_LINE_STATUS(LINE_STATUS_BI)}, }; Filter::Filter(int argc, const char *const argv[]) ! : pin(GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)), negative(FALSE) { *************** *** 170,177 **** << endl << "IN method input data stream description:" << endl ! << " INIT_LSR_MASK(<pval>) - the value pointed by <pval> will be or'ed with the" << endl ! << " required line status mask." << endl ! << " INIT_MST_MASK(<pval>) - the value pointed by <pval> will be or'ed with the" << endl ! << " required modem status mask." << endl << " CONNECT(TRUE/FALSE) - will be discarded from stream." << endl << " LINE_STATUS(<val>) - current state of line" << endl --- 180,187 ---- << endl << "IN method input data stream description:" << endl ! << " HUB_MSG_TYPE_GET_OPTIONS(<pOptions>)" << endl ! << " - the value pointed by <pOptions> will be or'ed with" << endl ! << " the required mask to get line status and modem" << endl ! << " status." << endl << " CONNECT(TRUE/FALSE) - will be discarded from stream." << endl << " LINE_STATUS(<val>) - current state of line" << endl *************** *** 207,218 **** _ASSERTE(*ppEchoMsg == NULL); ! if (pInMsg->type == HUB_MSG_TYPE_INIT_LSR_MASK) { ! _ASSERTE(pInMsg->u.pVal != NULL); ! *pInMsg->u.pVal |= (((Filter *)hFilter)->pin >> 8); ! } ! else ! if (pInMsg->type == HUB_MSG_TYPE_INIT_MST_MASK) { ! _ASSERTE(pInMsg->u.pVal != NULL); ! *pInMsg->u.pVal |= (((Filter *)hFilter)->pin & 0xFF); } else --- 217,223 ---- _ASSERTE(*ppEchoMsg == NULL); ! if (pInMsg->type == HUB_MSG_TYPE_GET_OPTIONS) { ! _ASSERTE(pInMsg->u.pv.pVal != NULL); ! *pInMsg->u.pv.pVal |= (((Filter *)hFilter)->pin & pInMsg->u.pv.val); } else *************** *** 228,234 **** if (pInMsg->type == HUB_MSG_TYPE_LINE_STATUS) ! connect = ((pInMsg->u.val & (((Filter *)hFilter)->pin >> 8)) != 0); else ! connect = ((pInMsg->u.val & (((Filter *)hFilter)->pin & 0xFF)) != 0); if (((Filter *)hFilter)->negative) --- 233,239 ---- if (pInMsg->type == HUB_MSG_TYPE_LINE_STATUS) ! connect = ((pInMsg->u.val & GO_O2V_LINE_STATUS(((Filter *)hFilter)->pin)) != 0); else ! connect = ((pInMsg->u.val & GO_O2V_MODEM_STATUS(((Filter *)hFilter)->pin)) != 0); if (((Filter *)hFilter)->negative) |
From: Vyacheslav F. <vf...@us...> - 2008-08-11 07:15:39
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8775 Modified Files: comhub.cpp Log Message: Replaced HUB_MSG_TYPE_COM_FUNCTION HUB_MSG_TYPE_INIT_LSR_MASK HUB_MSG_TYPE_INIT_MST_MASK by HUB_MSG_TYPE_SET_PIN_STATE HUB_MSG_TYPE_GET_OPTIONS HUB_MSG_TYPE_SET_OPTIONS Index: comhub.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/comhub.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** comhub.cpp 26 Mar 2008 08:48:18 -0000 1.5 --- comhub.cpp 11 Aug 2008 07:15:33 -0000 1.6 *************** *** 20,23 **** --- 20,33 ---- * * $Log$ + * Revision 1.6 2008/08/11 07:15:33 vfrolov + * Replaced + * HUB_MSG_TYPE_COM_FUNCTION + * HUB_MSG_TYPE_INIT_LSR_MASK + * HUB_MSG_TYPE_INIT_MST_MASK + * by + * HUB_MSG_TYPE_SET_PIN_STATE + * HUB_MSG_TYPE_GET_OPTIONS + * HUB_MSG_TYPE_SET_OPTIONS + * * Revision 1.5 2008/03/26 08:48:18 vfrolov * Initial revision *************** *** 83,86 **** --- 93,103 ---- for (Ports::const_iterator i = ports.begin() ; i != ports.end() ; i++) { + HubMsg msg; + + msg.type = HUB_MSG_TYPE_SET_OPTIONS; + OnRead(*i, &msg); + } + + for (Ports::const_iterator i = ports.begin() ; i != ports.end() ; i++) { if (!(*i)->Start()) return FALSE; |
From: Vyacheslav F. <vf...@us...> - 2008-08-11 07:15:39
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8775/plugins/serial Modified Files: comio.cpp comio.h comport.cpp comport.h Log Message: Replaced HUB_MSG_TYPE_COM_FUNCTION HUB_MSG_TYPE_INIT_LSR_MASK HUB_MSG_TYPE_INIT_MST_MASK by HUB_MSG_TYPE_SET_PIN_STATE HUB_MSG_TYPE_GET_OPTIONS HUB_MSG_TYPE_SET_OPTIONS Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** comport.cpp 11 Apr 2008 14:48:42 -0000 1.3 --- comport.cpp 11 Aug 2008 07:15:34 -0000 1.4 *************** *** 20,23 **** --- 20,33 ---- * * $Log$ + * Revision 1.4 2008/08/11 07:15:34 vfrolov + * Replaced + * HUB_MSG_TYPE_COM_FUNCTION + * HUB_MSG_TYPE_INIT_LSR_MASK + * HUB_MSG_TYPE_INIT_MST_MASK + * by + * HUB_MSG_TYPE_SET_PIN_STATE + * HUB_MSG_TYPE_GET_OPTIONS + * HUB_MSG_TYPE_SET_OPTIONS + * * Revision 1.3 2008/04/11 14:48:42 vfrolov * Replaced SET_RT_EVENTS by INIT_LSR_MASK and INIT_MST_MASK *************** *** 62,65 **** --- 72,76 ---- filterX(FALSE), events(0), + maskOutPins(0), writeQueueLimit(256), writeQueued(0), *************** *** 94,135 **** HUB_MSG msg; - DWORD mask; - - mask = 0; - msg.type = HUB_MSG_TYPE_INIT_LSR_MASK; - msg.u.pVal = &mask; - pOnRead(hHub, hMasterPort, &msg); - maskLsr = (BYTE)mask; ! mask = 0; ! msg.type = HUB_MSG_TYPE_INIT_MST_MASK; ! msg.u.pVal = &mask; pOnRead(hHub, hMasterPort, &msg); ! maskMst = (BYTE)mask; ! ! CheckComEvents(DWORD(-1)); ! if (maskLsr || maskMst) { ! if ((maskMst & MODEM_STATUS_CTS) != 0) events |= EV_CTS; ! if ((maskMst & MODEM_STATUS_DSR) != 0) events |= EV_DSR; ! if ((maskMst & MODEM_STATUS_DCD) != 0) events |= EV_RLSD; ! if ((maskMst & MODEM_STATUS_RI) != 0) events |= EV_RING; ! if (maskMst & ~(MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI)) { ! cout << "WARNING: Changing of MODEM STATUS bits 0x" << hex ! << (unsigned)(maskMst & ~(MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI)) << dec << " will be ignored" << endl; } ! if (maskLsr) { ! cout << "WARNING: Changing of LINE STATUS bits 0x" << hex ! << (unsigned)maskLsr << dec << " will be ignored" << endl; } --- 105,139 ---- HUB_MSG msg; ! DWORD options = 0; ! msg.type = HUB_MSG_TYPE_GET_OPTIONS; ! msg.u.pv.pVal = &options; ! msg.u.pv.val = 0xFFFFFFFF; pOnRead(hHub, hMasterPort, &msg); ! optsLsr = GO_O2V_LINE_STATUS(options); ! optsMst = GO_O2V_MODEM_STATUS(options); ! if (optsLsr || optsMst) { ! if ((optsMst & MODEM_STATUS_CTS) != 0) events |= EV_CTS; ! if ((optsMst & MODEM_STATUS_DSR) != 0) events |= EV_DSR; ! if ((optsMst & MODEM_STATUS_DCD) != 0) events |= EV_RLSD; ! if ((optsMst & MODEM_STATUS_RI) != 0) events |= EV_RING; ! if (optsMst & ~(MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI)) { ! cout << name << " WARNING: Changing of MODEM STATUS bit(s) 0x" << hex ! << (unsigned)(optsMst & ~(MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI)) << dec << " will be ignored" << endl; } ! if (optsLsr) { ! cout << name << " WARNING: Changing of LINE STATUS bit(s) 0x" << hex ! << (unsigned)optsLsr << dec << " will be ignored" << endl; } *************** *** 142,147 **** --- 146,155 ---- if (!StartWaitCommEvent()) return FALSE; + + cout << name << " Event(s) 0x" << hex << events << dec << " will be monitired" << endl; } + CheckComEvents(DWORD(-1)); + if (!StartRead()) return FALSE; *************** *** 176,180 **** countReadOverlapped++; ! //cout << "Started Read " << name << " " << countReadOverlapped << endl; return TRUE; --- 184,188 ---- countReadOverlapped++; ! //cout << name << " Started Read " << countReadOverlapped << endl; return TRUE; *************** *** 244,256 **** writeQueued += len; ! //cout << "Started Write " << name << " " << len << " " << writeQueued << endl; } else ! if (pMsg->type == HUB_MSG_TYPE_COM_FUNCTION) { if (handle == INVALID_HANDLE_VALUE) return FALSE; ! if (!::EscapeCommFunction(handle, pMsg->u.val)) return FALSE; } --- 252,314 ---- writeQueued += len; ! //cout << name << " Started Write " << len << " " << writeQueued << endl; } else ! if (pMsg->type == HUB_MSG_TYPE_SET_PIN_STATE) { if (handle == INVALID_HANDLE_VALUE) return FALSE; ! cout << name << " SET_PIN_STATE 0x" << hex << pMsg->u.val << dec << endl; ! ! WORD mask = (SPS_MASK2PIN(pMsg->u.val) & maskOutPins); ! ! if (mask & PIN_STATE_RTS) { ! if (!CommFunction(handle, (pMsg->u.val & PIN_STATE_RTS) ? SETRTS : CLRRTS)) ! cerr << name << " WARNING! can't change RTS state" << endl; ! } ! if (mask & PIN_STATE_DTR) { ! if (!CommFunction(handle, (pMsg->u.val & PIN_STATE_DTR) ? SETDTR : CLRDTR)) ! cerr << name << " WARNING! can't change DTR state" << endl; ! } ! if (mask & PIN_STATE_OUT1) { ! cerr << name << " WARNING! can't change OUT1 state" << endl; ! } ! if (mask & PIN_STATE_OUT2) { ! cerr << name << " WARNING! can't change OUT2 state" << endl; ! } ! if (mask & PIN_STATE_BREAK) { ! if (!CommFunction(handle, (pMsg->u.val & PIN_STATE_BREAK) ? SETBREAK : CLRBREAK)) ! cerr << name << " WARNING! can't change BREAK state" << endl; ! } ! } ! else ! if (pMsg->type == HUB_MSG_TYPE_SET_OPTIONS) { ! if (handle == INVALID_HANDLE_VALUE) return FALSE; + + BYTE addedPins = (~maskOutPins & SO_O2V_PIN_STATE(pMsg->u.val)); + + if (addedPins & PIN_STATE_RTS) { + if (!SetManualRtsControl(handle)) { + addedPins &= ~PIN_STATE_RTS; + cerr << name << " WARNING! can't set manual RTS state mode" << endl; + } + } + if (addedPins & PIN_STATE_DTR) { + if (!SetManualDtrControl(handle)) { + addedPins &= ~PIN_STATE_DTR; + cerr << name << " WARNING! can't set manual DTR state mode" << endl; + } + } + if (addedPins & PIN_STATE_OUT1) { + addedPins &= ~PIN_STATE_OUT1; + cerr << name << " WARNING! can't set manual OUT1 state mode" << endl; + } + if (addedPins & PIN_STATE_OUT2) { + addedPins &= ~PIN_STATE_OUT2; + cerr << name << " WARNING! can't set manual OUT2 state mode" << endl; + } + + maskOutPins |= addedPins; } *************** *** 280,284 **** countWaitCommEventOverlapped++; ! //cout << "Started WaitCommEvent " << name << " " << countReadOverlapped // << " " << hex << events << dec << endl; --- 338,342 ---- countWaitCommEventOverlapped++; ! //cout << name << " Started WaitCommEvent " << countReadOverlapped // << " " << hex << events << dec << endl; *************** *** 313,317 **** countReadOverlapped--; ! //cout << "Stopped Read " << name << " " << countReadOverlapped << endl; } } --- 371,375 ---- countReadOverlapped--; ! //cout << name << " Stopped Read " << countReadOverlapped << endl; } } *************** *** 325,329 **** countWaitCommEventOverlapped--; ! //cout << "Stopped WaitCommEvent " << name << " " << countWaitCommEventOverlapped << endl; } } --- 383,387 ---- countWaitCommEventOverlapped--; ! //cout << name << " Stopped WaitCommEvent " << countWaitCommEventOverlapped << endl; } } Index: comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** comport.h 11 Apr 2008 14:48:42 -0000 1.3 --- comport.h 11 Aug 2008 07:15:34 -0000 1.4 *************** *** 20,23 **** --- 20,33 ---- * * $Log$ + * Revision 1.4 2008/08/11 07:15:34 vfrolov + * Replaced + * HUB_MSG_TYPE_COM_FUNCTION + * HUB_MSG_TYPE_INIT_LSR_MASK + * HUB_MSG_TYPE_INIT_MST_MASK + * by + * HUB_MSG_TYPE_SET_PIN_STATE + * HUB_MSG_TYPE_GET_OPTIONS + * HUB_MSG_TYPE_SET_OPTIONS + * * Revision 1.3 2008/04/11 14:48:42 vfrolov * Replaced SET_RT_EVENTS by INIT_LSR_MASK and INIT_MST_MASK *************** *** 87,92 **** BOOL filterX; DWORD events; ! BYTE maskLsr; ! BYTE maskMst; DWORD writeQueueLimit; --- 97,103 ---- BOOL filterX; DWORD events; ! BYTE maskOutPins; ! BYTE optsLsr; ! BYTE optsMst; DWORD writeQueueLimit; Index: comio.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** comio.h 7 Apr 2008 12:28:03 -0000 1.2 --- comio.h 11 Aug 2008 07:15:34 -0000 1.3 *************** *** 20,23 **** --- 20,33 ---- * * $Log$ + * Revision 1.3 2008/08/11 07:15:34 vfrolov + * Replaced + * HUB_MSG_TYPE_COM_FUNCTION + * HUB_MSG_TYPE_INIT_LSR_MASK + * HUB_MSG_TYPE_INIT_MST_MASK + * by + * HUB_MSG_TYPE_SET_PIN_STATE + * HUB_MSG_TYPE_GET_OPTIONS + * HUB_MSG_TYPE_SET_OPTIONS + * * Revision 1.2 2008/04/07 12:28:03 vfrolov * Replaced --rt-events option by SET_RT_EVENTS message *************** *** 46,50 **** --- 56,63 ---- /////////////////////////////////////////////////////////////// extern HANDLE OpenComPort(const char *pPath, const ComParams &comParams); + extern BOOL SetManualRtsControl(HANDLE handle); + extern BOOL SetManualDtrControl(HANDLE handle); extern BOOL SetComEvents(HANDLE handle, DWORD *events); + extern BOOL CommFunction(HANDLE handle, DWORD func); /////////////////////////////////////////////////////////////// class ReadOverlapped : private OVERLAPPED Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** comio.cpp 7 Apr 2008 12:28:02 -0000 1.2 --- comio.cpp 11 Aug 2008 07:15:33 -0000 1.3 *************** *** 20,23 **** --- 20,33 ---- * * $Log$ + * Revision 1.3 2008/08/11 07:15:33 vfrolov + * Replaced + * HUB_MSG_TYPE_COM_FUNCTION + * HUB_MSG_TYPE_INIT_LSR_MASK + * HUB_MSG_TYPE_INIT_MST_MASK + * by + * HUB_MSG_TYPE_SET_PIN_STATE + * HUB_MSG_TYPE_GET_OPTIONS + * HUB_MSG_TYPE_SET_OPTIONS + * * Revision 1.2 2008/04/07 12:28:02 vfrolov * Replaced --rt-events option by SET_RT_EVENTS message *************** *** 120,123 **** --- 130,142 ---- } /////////////////////////////////////////////////////////////// + BOOL CommFunction(HANDLE handle, DWORD func) + { + if (!::EscapeCommFunction(handle, func)) { + TraceError(GetLastError(), "EscapeCommFunction(%lu)", (long)func); + return FALSE; + } + return TRUE; + } + /////////////////////////////////////////////////////////////// HANDLE OpenComPort(const char *pPath, const ComParams &comParams) { *************** *** 223,226 **** --- 242,269 ---- } /////////////////////////////////////////////////////////////// + BOOL SetManualRtsControl(HANDLE handle) + { + DCB dcb; + + if (!myGetCommState(handle, &dcb)) + return FALSE; + + dcb.fRtsControl = RTS_CONTROL_DISABLE; + + return mySetCommState(handle, &dcb); + } + + BOOL SetManualDtrControl(HANDLE handle) + { + DCB dcb; + + if (!myGetCommState(handle, &dcb)) + return FALSE; + + dcb.fDtrControl = DTR_CONTROL_DISABLE; + + return mySetCommState(handle, &dcb); + } + /////////////////////////////////////////////////////////////// WriteOverlapped::WriteOverlapped(ComPort &_port, BYTE *_pBuf, DWORD _len) : port(_port), |
From: Vyacheslav F. <vf...@us...> - 2008-08-11 07:15:39
|
Update of /cvsroot/com0com/hub4com/plugins In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8775/plugins Modified Files: plugins_api.h Log Message: Replaced HUB_MSG_TYPE_COM_FUNCTION HUB_MSG_TYPE_INIT_LSR_MASK HUB_MSG_TYPE_INIT_MST_MASK by HUB_MSG_TYPE_SET_PIN_STATE HUB_MSG_TYPE_GET_OPTIONS HUB_MSG_TYPE_SET_OPTIONS Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** plugins_api.h 14 Apr 2008 07:32:03 -0000 1.4 --- plugins_api.h 11 Aug 2008 07:15:33 -0000 1.5 *************** *** 20,23 **** --- 20,33 ---- * * $Log$ + * Revision 1.5 2008/08/11 07:15:33 vfrolov + * Replaced + * HUB_MSG_TYPE_COM_FUNCTION + * HUB_MSG_TYPE_INIT_LSR_MASK + * HUB_MSG_TYPE_INIT_MST_MASK + * by + * HUB_MSG_TYPE_SET_PIN_STATE + * HUB_MSG_TYPE_GET_OPTIONS + * HUB_MSG_TYPE_SET_OPTIONS + * * Revision 1.4 2008/04/14 07:32:03 vfrolov * Renamed option --use-port-module to --use-driver *************** *** 53,60 **** #define HUB_MSG_TYPE_CONNECT (2 | HUB_MSG_UNION_TYPE_VAL) #define HUB_MSG_TYPE_MODEM_STATUS (3 | HUB_MSG_UNION_TYPE_VAL) #define HUB_MSG_TYPE_LINE_STATUS (4 | HUB_MSG_UNION_TYPE_VAL) ! #define HUB_MSG_TYPE_COM_FUNCTION (5 | HUB_MSG_UNION_TYPE_VAL) ! #define HUB_MSG_TYPE_INIT_LSR_MASK (6 | HUB_MSG_UNION_TYPE_PVAL) ! #define HUB_MSG_TYPE_INIT_MST_MASK (7 | HUB_MSG_UNION_TYPE_PVAL) /*******************************************************************/ typedef struct _HUB_MSG { --- 63,99 ---- #define HUB_MSG_TYPE_CONNECT (2 | HUB_MSG_UNION_TYPE_VAL) #define HUB_MSG_TYPE_MODEM_STATUS (3 | HUB_MSG_UNION_TYPE_VAL) + #define MODEM_STATUS_DCTS 0x01 + #define MODEM_STATUS_DDSR 0x02 + #define MODEM_STATUS_TERI 0x04 + #define MODEM_STATUS_DDCD 0x08 + #define MODEM_STATUS_CTS 0x10 + #define MODEM_STATUS_DSR 0x20 + #define MODEM_STATUS_RI 0x40 + #define MODEM_STATUS_DCD 0x80 #define HUB_MSG_TYPE_LINE_STATUS (4 | HUB_MSG_UNION_TYPE_VAL) ! #define LINE_STATUS_DR 0x01 ! #define LINE_STATUS_OE 0x02 ! #define LINE_STATUS_PE 0x04 ! #define LINE_STATUS_FE 0x08 ! #define LINE_STATUS_BI 0x10 ! #define LINE_STATUS_THRE 0x20 ! #define LINE_STATUS_TEMT 0x40 ! #define LINE_STATUS_FIFOERR 0x80 ! #define HUB_MSG_TYPE_SET_PIN_STATE (5 | HUB_MSG_UNION_TYPE_VAL) ! #define SPS_PIN2MASK(p) ((DWORD)(BYTE)(p) << 16) ! #define SPS_MASK2PIN(m) ((BYTE)((m) >> 16)) ! #define PIN_STATE_RTS 0x01 ! #define PIN_STATE_DTR 0x02 ! #define PIN_STATE_OUT1 0x04 ! #define PIN_STATE_OUT2 0x08 ! #define PIN_STATE_BREAK 0x10 ! #define HUB_MSG_TYPE_GET_OPTIONS (6 | HUB_MSG_UNION_TYPE_PVAL) ! #define GO_O2V_MODEM_STATUS(o) ((BYTE)(o)) ! #define GO_V2O_MODEM_STATUS(v) ((DWORD)(BYTE)(v)) ! #define GO_O2V_LINE_STATUS(o) ((BYTE)((o) >> 8)) ! #define GO_V2O_LINE_STATUS(v) ((DWORD)(BYTE)(v) << 8) ! #define HUB_MSG_TYPE_SET_OPTIONS (7 | HUB_MSG_UNION_TYPE_VAL) ! #define SO_O2V_PIN_STATE(o) ((BYTE)(o)) ! #define SO_V2O_PIN_STATE(v) ((DWORD)(BYTE)(v)) /*******************************************************************/ typedef struct _HUB_MSG { *************** *** 65,69 **** DWORD size; } buf; ! DWORD *pVal; DWORD val; } u; --- 104,111 ---- DWORD size; } buf; ! struct { ! DWORD *pVal; ! DWORD val; ! } pv; DWORD val; } u; *************** *** 255,276 **** (ROUTINE_GET(pStruct, pRoutine) != NULL) /*******************************************************************/ - #define LINE_STATUS_DR 0x01 - #define LINE_STATUS_OE 0x02 - #define LINE_STATUS_PE 0x04 - #define LINE_STATUS_FE 0x08 - #define LINE_STATUS_BI 0x10 - #define LINE_STATUS_THRE 0x20 - #define LINE_STATUS_TEMT 0x40 - #define LINE_STATUS_FIFOERR 0x80 - /*******************************************************************/ - #define MODEM_STATUS_DCTS 0x01 - #define MODEM_STATUS_DDSR 0x02 - #define MODEM_STATUS_TERI 0x04 - #define MODEM_STATUS_DDCD 0x08 - #define MODEM_STATUS_CTS 0x10 - #define MODEM_STATUS_DSR 0x20 - #define MODEM_STATUS_RI 0x40 - #define MODEM_STATUS_DCD 0x80 - /*******************************************************************/ #ifdef __cplusplus --- 297,300 ---- |
From: Vyacheslav F. <vf...@us...> - 2008-07-11 10:38:06
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv5859 Modified Files: com0com.h handflow.c handflow.h ioctl.c openclos.c Log Message: Added nonstandard ability to enable LSR insertion on BREAK OFF Index: handflow.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/handflow.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** handflow.c 3 Jul 2007 14:35:17 -0000 1.8 --- handflow.c 11 Jul 2008 10:38:00 -0000 1.9 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2008/07/11 10:38:00 vfrolov + * Added nonstandard ability to enable LSR insertion on BREAK OFF + * * Revision 1.8 2007/07/03 14:35:17 vfrolov * Implemented pinout customization *************** *** 45,49 **** * Initial revision * - * */ --- 48,51 ---- *************** *** 51,54 **** --- 53,57 ---- #include "handflow.h" #include "bufutils.h" + #include "../include/cncext.h" /* *************** *** 385,389 **** } ! VOID SetBreakHolding(PC0C_IO_PORT pIoPort, BOOLEAN on) { if (on) { --- 388,392 ---- } ! VOID SetBreakHolding(PC0C_IO_PORT pIoPort, BOOLEAN on, PLIST_ENTRY pQueueToComplete) { if (on) { *************** *** 395,403 **** } else { if (pIoPort->writeHolding & SERIAL_TX_WAITING_ON_BREAK) { pIoPort->writeHolding &= ~SERIAL_TX_WAITING_ON_BREAK; pIoPort->sendBreak = FALSE; if ((!(pIoPort->writeHolding & ~SERIAL_TX_WAITING_FOR_XON) && pIoPort->sendXonXoff) || ! !pIoPort->writeHolding && pIoPort->irpQueues[C0C_QUEUE_WRITE].pCurrent) { pIoPort->tryWrite = TRUE; --- 398,423 ---- } else { if (pIoPort->writeHolding & SERIAL_TX_WAITING_ON_BREAK) { + PC0C_IO_PORT pIoPortRead; + pIoPort->writeHolding &= ~SERIAL_TX_WAITING_ON_BREAK; pIoPort->sendBreak = FALSE; + pIoPortRead = pIoPort->pIoPortRemote; + + if (pIoPortRead->escapeChar && (pIoPortRead->insertMask & C0CE_INSERT_ENABLE_LSR_NBI)) { + UCHAR lsr = 0; + + if (C0C_TX_BUFFER_THR_EMPTY(&pIoPortRead->txBuf)) { + lsr |= 0x20; /* transmit holding register empty */ + + if (C0C_TX_BUFFER_EMPTY(&pIoPortRead->txBuf)) + lsr |= 0x40; /* transmit holding register empty and line is idle */ + } + + InsertLsrMst(pIoPortRead, FALSE, lsr, pQueueToComplete); + } + if ((!(pIoPort->writeHolding & ~SERIAL_TX_WAITING_FOR_XON) && pIoPort->sendXonXoff) || ! (!pIoPort->writeHolding && pIoPort->irpQueues[C0C_QUEUE_WRITE].pCurrent)) { pIoPort->tryWrite = TRUE; Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/com0com.h,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** com0com.h 26 Jun 2008 13:37:10 -0000 1.44 --- com0com.h 11 Jul 2008 10:38:00 -0000 1.45 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.45 2008/07/11 10:38:00 vfrolov + * Added nonstandard ability to enable LSR insertion on BREAK OFF + * * Revision 1.44 2008/06/26 13:37:10 vfrolov * Implemented noise emulation *************** *** 528,531 **** --- 531,540 ---- IN ULONG pinRI); + VOID InsertLsrMst( + PC0C_IO_PORT pIoPortRead, + BOOLEAN isMST, + UCHAR value, + PLIST_ENTRY pQueueToComplete); + VOID InsertRemoteBr( PC0C_IO_PORT pIoPortRead, Index: openclos.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/openclos.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** openclos.c 26 Jun 2008 13:37:10 -0000 1.23 --- openclos.c 11 Jul 2008 10:38:00 -0000 1.24 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.24 2008/07/11 10:38:00 vfrolov + * Added nonstandard ability to enable LSR insertion on BREAK OFF + * * Revision 1.23 2008/06/26 13:37:10 vfrolov * Implemented noise emulation *************** *** 243,247 **** SetModemControl(pIoPort, C0C_MCR_OUT2, C0C_MCR_MASK | C0C_MCR_OPEN, &queueToComplete); FreeBuffer(&pIoPort->readBuf); ! SetBreakHolding(pIoPort, FALSE); KeReleaseSpinLock(pIoPort->pIoLock, oldIrql); --- 246,250 ---- SetModemControl(pIoPort, C0C_MCR_OUT2, C0C_MCR_MASK | C0C_MCR_OPEN, &queueToComplete); FreeBuffer(&pIoPort->readBuf); ! SetBreakHolding(pIoPort, FALSE, &queueToComplete); KeReleaseSpinLock(pIoPort->pIoLock, oldIrql); Index: ioctl.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/ioctl.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** ioctl.c 10 Jun 2008 11:32:35 -0000 1.36 --- ioctl.c 11 Jul 2008 10:38:00 -0000 1.37 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.37 2008/07/11 10:38:00 vfrolov + * Added nonstandard ability to enable LSR insertion on BREAK OFF + * * Revision 1.36 2008/06/10 11:32:35 vfrolov * Fixed break interrupt indicator for C0CE_INSERT_IOCTL_GET *************** *** 353,357 **** KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); ! SetBreakHolding(pIoPortLocal, TRUE); UpdateTransmitToggle(pIoPortLocal, &queueToComplete); --- 356,360 ---- KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); ! SetBreakHolding(pIoPortLocal, TRUE, &queueToComplete); UpdateTransmitToggle(pIoPortLocal, &queueToComplete); *************** *** 372,376 **** KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); ! SetBreakHolding(pIoPortLocal, FALSE); UpdateTransmitToggle(pIoPortLocal, &queueToComplete); --- 375,379 ---- KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); ! SetBreakHolding(pIoPortLocal, FALSE, &queueToComplete); UpdateTransmitToggle(pIoPortLocal, &queueToComplete); *************** *** 632,641 **** C0CE_INSERT_ENABLE_MST| \ C0CE_INSERT_ENABLE_RBR| \ ! C0CE_INSERT_ENABLE_RLC) #define C0CE_INSERT_CAPS (C0CE_INSERT_OPTS|C0CE_INSERT_BITS) if (optsAndBits == C0CE_INSERT_IOCTL_CAPS) { - optsAndBits = (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_MST); optsAndBits = 0; --- 635,644 ---- C0CE_INSERT_ENABLE_MST| \ C0CE_INSERT_ENABLE_RBR| \ ! C0CE_INSERT_ENABLE_RLC| \ ! C0CE_INSERT_ENABLE_LSR_NBI) #define C0CE_INSERT_CAPS (C0CE_INSERT_OPTS|C0CE_INSERT_BITS) if (optsAndBits == C0CE_INSERT_IOCTL_CAPS) { optsAndBits = 0; *************** *** 656,660 **** if (optsAndBits & C0CE_INSERT_IOCTL_GET) { ! if (optsAndBits & C0CE_INSERT_ENABLE_LSR) Information += sizeof(UCHAR)*2 + sizeof(UCHAR); if (optsAndBits & C0CE_INSERT_ENABLE_MST) --- 659,663 ---- if (optsAndBits & C0CE_INSERT_IOCTL_GET) { ! if (optsAndBits & (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_LSR_NBI)) Information += sizeof(UCHAR)*2 + sizeof(UCHAR); if (optsAndBits & C0CE_INSERT_ENABLE_MST) *************** *** 692,706 **** if (extended) { LIST_ENTRY queueToComplete; InitializeListHead(&queueToComplete); if (optsAndBits & C0CE_INSERT_IOCTL_GET) { ! if (optsAndBits & C0CE_INSERT_ENABLE_LSR) { UCHAR lsr = 0; ! if (!pIoPortLocal->amountInWriteQueue || pIoPortLocal->writeHolding) ! lsr |= 0x60; /* transmit holding register empty and transmitter empty indicators */ ! if (pIoPortLocal->pIoPortRemote->writeHolding & SERIAL_TX_WAITING_ON_BREAK) lsr |= 0x10; /* break interrupt indicator */ --- 695,715 ---- if (extended) { LIST_ENTRY queueToComplete; + PC0C_IO_PORT pIoPortRemote; InitializeListHead(&queueToComplete); + pIoPortRemote = pIoPortLocal->pIoPortRemote; if (optsAndBits & C0CE_INSERT_IOCTL_GET) { ! if (optsAndBits & (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_LSR_NBI)) { UCHAR lsr = 0; ! if (C0C_TX_BUFFER_THR_EMPTY(&pIoPortLocal->txBuf)) { ! lsr |= 0x20; /* transmit holding register empty */ ! if (C0C_TX_BUFFER_EMPTY(&pIoPortLocal->txBuf)) ! lsr |= 0x40; /* transmit holding register empty and line is idle */ ! } ! ! if (pIoPortRemote->writeHolding & SERIAL_TX_WAITING_ON_BREAK && !pIoPortRemote->sendBreak) lsr |= 0x10; /* break interrupt indicator */ *************** *** 719,723 **** *pSysBuf++ = escapeChar; *pSysBuf++ = C0CE_INSERT_RBR; ! *(ULONG *)pSysBuf = pIoPortLocal->pIoPortRemote->baudRate.BaudRate; pSysBuf += sizeof(ULONG); } --- 728,732 ---- *pSysBuf++ = escapeChar; *pSysBuf++ = C0CE_INSERT_RBR; ! *(ULONG *)pSysBuf = pIoPortRemote->baudRate.BaudRate; pSysBuf += sizeof(ULONG); } *************** *** 726,732 **** *pSysBuf++ = escapeChar; *pSysBuf++ = C0CE_INSERT_RLC; ! *pSysBuf++ = pIoPortLocal->pIoPortRemote->lineControl.WordLength; ! *pSysBuf++ = pIoPortLocal->pIoPortRemote->lineControl.Parity; ! *pSysBuf++ = pIoPortLocal->pIoPortRemote->lineControl.StopBits; } } --- 735,741 ---- *pSysBuf++ = escapeChar; *pSysBuf++ = C0CE_INSERT_RLC; ! *pSysBuf++ = pIoPortRemote->lineControl.WordLength; ! *pSysBuf++ = pIoPortRemote->lineControl.Parity; ! *pSysBuf++ = pIoPortRemote->lineControl.StopBits; } } *************** *** 737,744 **** PurgeBuffer(&pIoPortLocal->readBuf); UpdateHandFlow(pIoPortLocal, TRUE, &queueToComplete); ! if (pIoPortLocal->tryWrite || pIoPortLocal->pIoPortRemote->tryWrite) { ReadWrite( pIoPortLocal, FALSE, ! pIoPortLocal->pIoPortRemote, FALSE, &queueToComplete); } --- 746,753 ---- PurgeBuffer(&pIoPortLocal->readBuf); UpdateHandFlow(pIoPortLocal, TRUE, &queueToComplete); ! if (pIoPortLocal->tryWrite || pIoPortRemote->tryWrite) { ReadWrite( pIoPortLocal, FALSE, ! pIoPortRemote, FALSE, &queueToComplete); } Index: handflow.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/handflow.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** handflow.h 21 Jun 2006 16:23:57 -0000 1.4 --- handflow.h 11 Jul 2008 10:38:00 -0000 1.5 *************** *** 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-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/07/11 10:38:00 vfrolov + * Added nonstandard ability to enable LSR insertion on BREAK OFF + * * Revision 1.4 2006/06/21 16:23:57 vfrolov * Fixed possible BSOD after one port of pair removal *************** *** 32,36 **** * Initial revision * - * */ --- 35,38 ---- *************** *** 55,59 **** VOID SetModemStatusHolding(PC0C_IO_PORT pIoPort); VOID SetXonXoffHolding(PC0C_IO_PORT pIoPort, short xonXoff); ! VOID SetBreakHolding(PC0C_IO_PORT pIoPort, BOOLEAN on); #endif /* _C0C_FLOW_H_ */ --- 57,61 ---- VOID SetModemStatusHolding(PC0C_IO_PORT pIoPort); VOID SetXonXoffHolding(PC0C_IO_PORT pIoPort, short xonXoff); ! VOID SetBreakHolding(PC0C_IO_PORT pIoPort, BOOLEAN on, PLIST_ENTRY pQueueToComplete); #endif /* _C0C_FLOW_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2008-07-11 10:34:47
|
Update of /cvsroot/com0com/com0com/include In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv4683 Modified Files: cncext.h Log Message: Added nonstandard ability to enable LSR insertion on BREAK OFF Index: cncext.h =================================================================== RCS file: /cvsroot/com0com/com0com/include/cncext.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cncext.h 5 Jun 2008 10:45:57 -0000 1.2 --- cncext.h 11 Jul 2008 10:34:43 -0000 1.3 *************** *** 51,58 **** #define C0CE_INSERT_IOCTL_RXCLEAR 0x02000000 /* IOCTL clears the driver's input buffer */ ! #define C0CE_INSERT_ENABLE_LSR 0x00000001 /* enable SERIAL_LSRMST_LSR_[NO]DATA insertion */ ! #define C0CE_INSERT_ENABLE_MST 0x00000002 /* enable SERIAL_LSRMST_MST insertion */ #define C0CE_INSERT_ENABLE_RBR 0x00000100 /* enable C0CE_INSERT_RBR insertion */ #define C0CE_INSERT_ENABLE_RLC 0x00000200 /* enable C0CE_INSERT_RLC insertion */ #endif /* _INCLUDE_C0C_CNCEXT_H_ */ --- 51,59 ---- #define C0CE_INSERT_IOCTL_RXCLEAR 0x02000000 /* IOCTL clears the driver's input buffer */ ! #define C0CE_INSERT_ENABLE_LSR 0x00000001 /* enable standard SERIAL_LSRMST_LSR_[NO]DATA insertion */ ! #define C0CE_INSERT_ENABLE_MST 0x00000002 /* enable standard SERIAL_LSRMST_MST insertion */ #define C0CE_INSERT_ENABLE_RBR 0x00000100 /* enable C0CE_INSERT_RBR insertion */ #define C0CE_INSERT_ENABLE_RLC 0x00000200 /* enable C0CE_INSERT_RLC insertion */ + #define C0CE_INSERT_ENABLE_LSR_NBI 0x00010000 /* enable SERIAL_LSRMST_LSR_[NO]DATA insertion on BREAK OFF */ #endif /* _INCLUDE_C0C_CNCEXT_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2008-07-11 10:30:46
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3175 Modified Files: bufutils.c Log Message: Added missing data available bit to LSR Index: bufutils.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/bufutils.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** bufutils.c 26 Jun 2008 13:37:10 -0000 1.11 --- bufutils.c 11 Jul 2008 10:30:39 -0000 1.12 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.12 2008/07/11 10:30:39 vfrolov + * Added missing data available bit to LSR + * * Revision 1.11 2008/06/26 13:37:10 vfrolov * Implemented noise emulation *************** *** 242,246 **** SIZE_T len; ! lsr |= 0x80; /* errornous data in FIFO */ if (C0C_TX_BUFFER_THR_EMPTY(&pIoPort->txBuf)) { --- 245,249 ---- SIZE_T len; ! lsr |= 0x81; /* errornous data in FIFO and data available */ if (C0C_TX_BUFFER_THR_EMPTY(&pIoPort->txBuf)) { |
From: Vyacheslav F. <vf...@us...> - 2008-07-10 11:18:32
|
Update of /cvsroot/com0com/com0com/setupg In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11610 Modified Files: pinmap.cpp Log Message: Added noise representation Index: pinmap.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setupg/pinmap.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pinmap.cpp 8 Apr 2008 06:52:12 -0000 1.2 --- pinmap.cpp 10 Jul 2008 11:18:27 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/07/10 11:18:27 vfrolov + * Added noise representation + * * Revision 1.2 2008/04/08 06:52:12 vfrolov * Added pin OUT2 *************** *** 57,60 **** --- 60,64 ---- IC(ic), isFixed(_isFixed), + isNoise(false), source(nullptr) {} *************** *** 70,73 **** --- 74,78 ---- int IC; bool isFixed; + bool isNoise; PinSource ^source; *************** *** 153,156 **** --- 158,177 ---- MouseInit(); + for (int i = 0 ; i < 2 ; i++) { + String ^tx = (i == 0) ? "TX(A)" : "TX(B)"; + + if (pins->ContainsKey(tx)) { + if (pair != nullptr && + pair[i] != nullptr && + pair[i]->ContainsKey("emunoise") && + pair[i]["emunoise"]->IndexOfAny((gcnew String("123456789"))->ToCharArray()) != -1) + { + pins[tx]->isNoise = true; + } else { + pins[tx]->isNoise = false; + } + } + } + array<String ^> ^dstPins = {"DSR", "DCD", "CTS", "RI"}; *************** *** 203,207 **** array<String ^> ^fields; ! fields = kvp.Key->Split(separator); --- 224,228 ---- array<String ^> ^fields; ! fields = kvp.Key->Split(separator); *************** *** 421,425 **** }; - Pen ^pCur = (pin->isFixed || pin->source->IsEqual(pinsOrg[kvp.Key])) ? pOrg : pNew; e->Graphics->DrawPolygon(pCur, poly); } --- 442,445 ---- *************** *** 439,443 **** }; - Pen ^pCur = (pin->isFixed || pin->source->IsEqual(pinsOrg[kvp.Key])) ? pOrg : pNew; e->Graphics->DrawPolygon(pCur, poly); } --- 459,462 ---- *************** *** 457,461 **** }; - Pen ^pCur = (pin->isFixed || pin->source->IsEqual(pinsOrg[kvp.Key])) ? pOrg : pNew; e->Graphics->DrawPolygon(pCur, poly); } --- 476,479 ---- *************** *** 505,508 **** --- 523,535 ---- e->Graphics->DrawLines(pCur, line); + + if (pinS->isNoise) { + Pen ^pNoise = gcnew Pen(pCur->Color, 3); + + pNoise->EndCap = pCur->EndCap; + pNoise->DashStyle = Drawing2D::DashStyle::Dot; + + e->Graphics->DrawLines(pNoise, line); + } } } |
From: Vyacheslav F. <vf...@us...> - 2008-07-10 11:16:29
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv10837 Modified Files: ReadMe.txt Log Message: Added FAQ: What version am I running? Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ReadMe.txt 5 Jun 2008 10:42:48 -0000 1.17 --- ReadMe.txt 10 Jul 2008 11:16:24 -0000 1.18 *************** *** 185,186 **** --- 185,192 ---- http://com0com.sourceforge.net/examples/MODEM_CONTROL/tstser.cpp + + Q. What version am I running? + A. In the device manager, the driver properties page shows the version and date + of the com0com.inf file, while the driver details page shows a version of + com0com.sys file. The version of com0com.sys file is the version that you + are running. |
From: Vyacheslav F. <vf...@us...> - 2008-07-10 11:15:04
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv10081 Added Files: trace_disable.reg Log Message: Initial revision --- NEW FILE: trace_disable.reg --- Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com\Trace] "TraceFile"="" |
From: Vyacheslav F. <vf...@us...> - 2008-07-10 11:13:40
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9691 Modified Files: trace.reg Log Message: Changed 00000000 to FFFFFFFF Index: trace.reg =================================================================== RCS file: /cvsroot/com0com/com0com/trace.reg,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** trace.reg 13 Sep 2005 08:55:41 -0000 1.4 --- trace.reg 10 Jul 2008 11:13:35 -0000 1.5 *************** *** 5,13 **** [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com\Trace\Enable] ! "Read"=dword:00000000 ! "Write"=dword:00000000 ! "GetTimeouts"=dword:00000000 ! "SetTimeouts"=dword:00000000 ! "GetCommStatus"=dword:00000000 ! "GetModemStatus"=dword:00000000 ! "ModemStatus"=dword:00000000 --- 5,13 ---- [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com\Trace\Enable] ! "Read"=dword:FFFFFFFF ! "Write"=dword:FFFFFFFF ! "GetTimeouts"=dword:FFFFFFFF ! "SetTimeouts"=dword:FFFFFFFF ! "GetCommStatus"=dword:FFFFFFFF ! "GetModemStatus"=dword:FFFFFFFF ! "ModemStatus"=dword:FFFFFFFF |
From: Vyacheslav F. <vf...@us...> - 2008-06-26 13:39:22
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv20376 Modified Files: params.cpp params.h Log Message: Implemented noise emulation Index: params.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** params.h 4 May 2008 09:53:51 -0000 1.6 --- params.h 26 Jun 2008 13:39:19 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/06/26 13:39:19 vfrolov + * Implemented noise emulation + * * Revision 1.6 2008/05/04 09:53:51 vfrolov * Implemented HiddenMode option *************** *** 43,46 **** --- 46,51 ---- #define _C0C_PARAMS_H_ + struct Bit; + class PortParameters { public: *************** *** 59,69 **** protected: BOOL FillParametersKey(char *pRegKey, int size); - BOOL SetPortName(const char *pNewPortName); DWORD *GetDwPtr(DWORD bit); - BOOL SetFlag(const char *pNewVal, DWORD bit); - BOOL SetPin(const char *pNewVal, DWORD bit); void LoadDw(HKEY hKey, DWORD bit); LONG SaveDw(HKEY hKey, DWORD bit); DWORD maskChanged; DWORD maskExplicit; --- 64,77 ---- protected: BOOL FillParametersKey(char *pRegKey, int size); DWORD *GetDwPtr(DWORD bit); void LoadDw(HKEY hKey, DWORD bit); LONG SaveDw(HKEY hKey, DWORD bit); + BOOL SetPortName(const char *pNewPortName); + BOOL SetFlag(const char *pNewVal, DWORD bit); + BOOL SetPin(const char *pNewVal, DWORD bit); + BOOL SetProbability(const char *pNewVal, DWORD bit); + BOOL SetBit(const char *pVal, const Bit &bit); + DWORD maskChanged; DWORD maskExplicit; *************** *** 78,81 **** --- 86,90 ---- DWORD pinDCD; DWORD pinRI; + DWORD emuNoise; char service[20]; Index: params.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** params.cpp 4 May 2008 09:53:51 -0000 1.11 --- params.cpp 26 Jun 2008 13:39:19 -0000 1.12 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.12 2008/06/26 13:39:19 vfrolov + * Implemented noise emulation + * * Revision 1.11 2008/05/04 09:53:51 vfrolov * Implemented HiddenMode option *************** *** 65,93 **** /////////////////////////////////////////////////////////////// enum { ! m_portName = 0x0001, ! m_emuBR = 0x0002, ! m_emuOverrun = 0x0004, ! m_plugInMode = 0x0008, ! m_exclusiveMode = 0x0010, ! m_hiddenMode = 0x0020, ! m_pinCTS = 0x0100, ! m_pinDSR = 0x0200, ! m_pinDCD = 0x0400, ! m_pinRI = 0x0800, ! }; ! /////////////////////////////////////////////////////////////// ! static DWORD flagBits[] = { ! m_emuBR, ! m_emuOverrun, ! m_plugInMode, ! m_exclusiveMode, ! m_hiddenMode }; /////////////////////////////////////////////////////////////// ! static DWORD pinBits[] = { ! m_pinCTS, ! m_pinDSR, ! m_pinDCD, ! m_pinRI }; /////////////////////////////////////////////////////////////// --- 68,105 ---- /////////////////////////////////////////////////////////////// enum { ! m_portName = 0x00000001, ! m_emuBR = 0x00000002, ! m_emuOverrun = 0x00000004, ! m_plugInMode = 0x00000008, ! m_exclusiveMode = 0x00000010, ! m_hiddenMode = 0x00000020, ! m_pinCTS = 0x00000100, ! m_pinDSR = 0x00000200, ! m_pinDCD = 0x00000400, ! m_pinRI = 0x00000800, ! m_emuNoise = 0x00010000, }; /////////////////////////////////////////////////////////////// ! static struct Bit ! { ! DWORD bit; ! ! enum { ! OTHER, ! FLAG, ! PIN, ! } type; ! } bits[] = { ! {m_portName, Bit::OTHER}, ! {m_emuBR, Bit::FLAG}, ! {m_emuOverrun, Bit::FLAG}, ! {m_plugInMode, Bit::FLAG}, ! {m_exclusiveMode, Bit::FLAG}, ! {m_hiddenMode, Bit::FLAG}, ! {m_pinCTS, Bit::PIN}, ! {m_pinDSR, Bit::PIN}, ! {m_pinDCD, Bit::PIN}, ! {m_pinRI, Bit::PIN}, ! {m_emuNoise, Bit::OTHER}, }; /////////////////////////////////////////////////////////////// *************** *** 114,117 **** --- 126,131 ---- pinRI = 0; + emuNoise = 0; + maskChanged = 0; maskExplicit = 0; *************** *** 120,126 **** BOOL PortParameters::SetPortName(const char *pNewPortName) { - if (!lstrcmpi(pNewPortName, "*")) - return TRUE; - if (lstrcmpi(pNewPortName, "-")) { if ((maskExplicit & m_portName) == 0) { --- 134,137 ---- *************** *** 156,159 **** --- 167,171 ---- case m_pinDCD: return &pinDCD; case m_pinRI: return &pinRI; + case m_emuNoise: return &emuNoise; } *************** *** 172,175 **** --- 184,188 ---- static const DWORD pinDCD = C0C_DEFAULT_PIN_DCD; static const DWORD pinRI = C0C_DEFAULT_PIN_RI; + static const DWORD emuNoise = C0C_DEFAULT_EMUNOISE; switch (bit) { *************** *** 183,186 **** --- 196,200 ---- case m_pinDCD: return &pinDCD; case m_pinRI: return &pinRI; + case m_emuNoise: return &emuNoise; } *************** *** 201,204 **** --- 215,219 ---- case m_pinDCD: return "dcd"; case m_pinRI: return "ri"; + case m_emuNoise: return "EmuNoise"; } *************** *** 208,214 **** BOOL PortParameters::SetFlag(const char *pNewVal, DWORD bit) { - if (!lstrcmpi(pNewVal, "*")) - return TRUE; - DWORD newFlag; --- 223,226 ---- *************** *** 256,262 **** BOOL PortParameters::SetPin(const char *pNewVal, DWORD bit) { - if (!lstrcmpi(pNewVal, "*")) - return TRUE; - DWORD newPin; --- 268,271 ---- *************** *** 312,317 **** } else ! if (!lstrcmpi(pNewVal, "-")) { ! newPin = 0; } else { --- 321,325 ---- } else ! if (!lstrcmpi(pNewVal, "-") && newPin == 0) { } else { *************** *** 345,348 **** --- 353,444 ---- } /////////////////////////////////////////////////////////////// + BOOL PortParameters::SetProbability(const char *pNewVal, DWORD bit) + { + DWORD newVal = 0; + + if (!lstrcmpi(pNewVal, "-")) { + } + else + if (pNewVal[0] == '0' && pNewVal[1] == '.') { + const char *p = pNewVal + 2; + + for (DWORD one = C0C_PROBABILITY_ONE ; one > 1 ; one /= 10) { + newVal *= 10; + + if (*p == 0) + continue; + + if (*p < '0' || *p > '9') { + Trace("Invalid value '%s'\n", pNewVal); + return FALSE; + } + + newVal += *p++ - '0'; + } + + while (*p == '0') + p++; + + if (*p != 0) { + Trace("Too long value '%s'\n", pNewVal); + return FALSE; + } + } + else + if (pNewVal[0] == '0') { + } + else { + Trace("Invalid value '%s'\n", pNewVal); + return FALSE; + } + + DWORD *pVal = GetDwPtr(bit); + + if (pVal == NULL) + return FALSE; + + if (lstrcmpi("-", pNewVal)) { + if ((maskExplicit & bit) == 0) { + maskExplicit |= bit; + maskChanged |= bit; + } + } else { + if (maskExplicit & bit) { + maskExplicit &= ~bit; + maskChanged |= bit; + } + } + + if (*pVal != newVal) { + *pVal = newVal; + maskChanged |= bit; + } + + return TRUE; + } + /////////////////////////////////////////////////////////////// + BOOL PortParameters::SetBit(const char *pVal, const Bit &bit) + { + if (!lstrcmpi(pVal, "*")) + return TRUE; + + if (bit.type == Bit::FLAG) { + return SetFlag(pVal, bit.bit); + } + else + if (bit.type == Bit::PIN) { + return SetPin(pVal, bit.bit); + } + else + if (bit.type == Bit::OTHER) { + if (bit.bit == m_portName) + return SetPortName(pVal); + if (bit.bit == m_emuNoise) + return SetProbability(pVal, bit.bit); + } + + return FALSE; + } + /////////////////////////////////////////////////////////////// BOOL PortParameters::FillParametersKey(char *pRegKey, int size) { *************** *** 461,469 **** int i; ! for (i = 0 ; i < sizeof(flagBits)/sizeof(flagBits[0]) ; i++) ! LoadDw(hKey, flagBits[i]); ! for (i = 0 ; i < sizeof(pinBits)/sizeof(pinBits[0]) ; i++) ! LoadDw(hKey, pinBits[i]); RegCloseKey(hKey); --- 557,566 ---- int i; ! for (i = 0 ; i < sizeof(bits)/sizeof(bits[0]) ; i++) { ! if (!GetDwPtr(bits[i].bit)) ! continue; ! LoadDw(hKey, bits[i].bit); ! } RegCloseKey(hKey); *************** *** 523,533 **** int i; ! for (i = 0 ; i < sizeof(flagBits)/sizeof(flagBits[0]) ; i++) { ! if (SaveDw(hKey, flagBits[i]) != ERROR_SUCCESS) ! goto err; ! } ! for (i = 0 ; i < sizeof(pinBits)/sizeof(pinBits[0]) ; i++) { ! if (SaveDw(hKey, pinBits[i]) != ERROR_SUCCESS) goto err; } --- 620,628 ---- int i; ! for (i = 0 ; i < sizeof(bits)/sizeof(bits[0]) ; i++) { ! if (!GetDwPtr(bits[i].bit)) ! continue; ! if (SaveDw(hKey, bits[i].bit) != ERROR_SUCCESS) goto err; } *************** *** 545,560 **** if (!lstrcmpi(pParameters, "-") || !lstrcmpi(pParameters, "*")) { - if (!tmp.SetPortName(pParameters)) - return FALSE; - int i; ! for (i = 0 ; i < sizeof(flagBits)/sizeof(flagBits[0]) ; i++) { ! if (!tmp.SetFlag(pParameters, flagBits[i])) ! return FALSE; ! } ! ! for (i = 0 ; i < sizeof(pinBits)/sizeof(pinBits[0]) ; i++) { ! if (!tmp.SetPin(pParameters, pinBits[i])) return FALSE; } --- 640,647 ---- if (!lstrcmpi(pParameters, "-") || !lstrcmpi(pParameters, "*")) { int i; ! for (i = 0 ; i < sizeof(bits)/sizeof(bits[0]) ; i++) { ! if (!tmp.SetBit(pParameters, bits[i])) return FALSE; } *************** *** 581,626 **** } ! if (!lstrcmpi(pKey, "PortName")) { ! if (!tmp.SetPortName(pVal)) ! return FALSE; ! } else { ! int i; ! ! for (i = 0 ; i < sizeof(flagBits)/sizeof(flagBits[0]) ; i++) { ! DWORD bit = flagBits[i]; ! DWORD *pFlag = GetDwPtr(bit); ! const char *pName = GetBitName(bit); ! ! if (pFlag == NULL || pName == NULL) ! continue; ! ! if (!lstrcmpi(pKey, pName)) { ! if (!tmp.SetFlag(pVal, bit)) ! return FALSE; ! break; ! } ! } ! if (i >= sizeof(flagBits)/sizeof(flagBits[0])) { ! for (i = 0 ; i < sizeof(pinBits)/sizeof(pinBits[0]) ; i++) { ! DWORD bit = pinBits[i]; ! DWORD *pPin = GetDwPtr(bit); ! const char *pName = GetBitName(bit); ! if (pPin == NULL || pName == NULL) ! continue; ! if (!lstrcmpi(pKey, pName)) { ! if (!tmp.SetPin(pVal, bit)) ! return FALSE; ! break; ! } ! } ! if (i >= sizeof(pinBits)/sizeof(pinBits[0])) { ! Trace("Invalid parameter '%s'\n", pKey); return FALSE; ! } } } } } --- 668,691 ---- } ! int i; ! for (i = 0 ; i < sizeof(bits)/sizeof(bits[0]) ; i++) { ! DWORD bit = bits[i].bit; ! const char *pName = GetBitName(bit); ! if (pName == NULL) ! continue; ! if (!lstrcmpi(pKey, pName)) { ! if (!tmp.SetBit(pVal, bits[i])) return FALSE; ! break; } } + + if (i >= sizeof(bits)/sizeof(bits[0])) { + Trace("Invalid parameter '%s'\n", pKey); + return FALSE; + } } } *************** *** 646,715 **** int i; ! for (i = 0 ; i < sizeof(flagBits)/sizeof(flagBits[0]) ; i++) { ! DWORD bit = flagBits[i]; const char *pName = GetBitName(bit); if (pName) { ! const DWORD *pFlag; if ((maskExplicit & bit) != 0) ! pFlag = GetDwPtr(bit); else if (detail) ! pFlag = GetDwPtrDefault(bit); else continue; ! if (pFlag == NULL) continue; ! len = SNPRINTF(pParameters, size, ",%s=%s", pName, *pFlag ? "yes" : "no"); ! if (len < 0) ! return FALSE; ! pParameters += len; ! size -= len; ! } ! } ! for (i = 0 ; i < sizeof(pinBits)/sizeof(pinBits[0]) ; i++) { ! DWORD bit = pinBits[i]; ! const char *pName = GetBitName(bit); ! if (pName) { ! const DWORD *pPin; ! if ((maskExplicit & bit) != 0) ! pPin = GetDwPtr(bit); ! else ! if (detail) ! pPin = GetDwPtrDefault(bit); ! else ! continue; ! if (pPin == NULL) ! continue; ! const char *pVal = NULL; ! switch (*pPin & ~C0C_PIN_NEGATIVE) { ! case C0C_PIN_RRTS: pVal = "rrts"; break; ! case C0C_PIN_RDTR: pVal = "rdtr"; break; ! case C0C_PIN_ROUT1: pVal = "rout1"; break; ! case C0C_PIN_ROUT2: pVal = "rout2"; break; ! case C0C_PIN_ROPEN: pVal = "ropen"; break; ! case C0C_PIN_LRTS: pVal = "lrts"; break; ! case C0C_PIN_LDTR: pVal = "ldtr"; break; ! case C0C_PIN_LOUT1: pVal = "lout1"; break; ! case C0C_PIN_LOUT2: pVal = "lout2"; break; ! case C0C_PIN_LOPEN: pVal = "lopen"; break; ! case C0C_PIN_ON: pVal = "on"; break; ! } ! if (pVal == NULL) ! continue; ! len = SNPRINTF(pParameters, size, ",%s=%s%s", pName, (*pPin & C0C_PIN_NEGATIVE) == 0 ? "" : "!", pVal); if (len < 0) --- 711,802 ---- int i; ! for (i = 0 ; i < sizeof(bits)/sizeof(bits[0]) ; i++) { ! DWORD bit = bits[i].bit; ! ! if (!GetDwPtr(bit)) ! continue; ! const char *pName = GetBitName(bit); if (pName) { ! const DWORD *pBit; if ((maskExplicit & bit) != 0) ! pBit = GetDwPtr(bit); else if (detail) ! pBit = GetDwPtrDefault(bit); else continue; ! if (pBit == NULL) continue; ! if (bits[i].type == Bit::FLAG) { ! len = SNPRINTF(pParameters, size, ",%s=%s", pName, *pBit ? "yes" : "no"); ! } ! else ! if (bits[i].type == Bit::PIN) { ! const char *pVal = NULL; ! switch (*pBit & ~C0C_PIN_NEGATIVE) { ! case C0C_PIN_RRTS: pVal = "rrts"; break; ! case C0C_PIN_RDTR: pVal = "rdtr"; break; ! case C0C_PIN_ROUT1: pVal = "rout1"; break; ! case C0C_PIN_ROUT2: pVal = "rout2"; break; ! case C0C_PIN_ROPEN: pVal = "ropen"; break; ! case C0C_PIN_LRTS: pVal = "lrts"; break; ! case C0C_PIN_LDTR: pVal = "ldtr"; break; ! case C0C_PIN_LOUT1: pVal = "lout1"; break; ! case C0C_PIN_LOUT2: pVal = "lout2"; break; ! case C0C_PIN_LOPEN: pVal = "lopen"; break; ! case C0C_PIN_ON: pVal = "on"; break; ! } ! if (pVal == NULL) ! continue; ! len = SNPRINTF(pParameters, size, ",%s=%s%s", pName, (*pBit & C0C_PIN_NEGATIVE) == 0 ? "" : "!", pVal); ! } ! else { ! if (bit == m_emuNoise) { ! if (*pBit == 0) { ! len = SNPRINTF(pParameters, size, ",%s=0", pName); ! } else { ! char strVal[11] = ""; ! char digits[11]; ! SNPRINTF(digits, sizeof(digits)/sizeof(digits[0]), "%ld", (unsigned long)*pBit); ! for (int i = lstrlen(digits) ; i ; i--) { ! if (digits[i - 1] > '0') ! break; ! digits[i - 1] = 0; ! } ! const char *p = digits; ! for (DWORD one = C0C_PROBABILITY_ONE/10 ; one > 0 ; one /= 10) { ! if (one > *pBit) { ! lstrcat(strVal, "0"); ! } ! else ! if (*p) { ! char sc[2]; ! sc[0] = *p++; ! sc[1] = 0; ! lstrcat(strVal, sc); ! } ! else { ! break; ! } ! } ! len = SNPRINTF(pParameters, size, ",%s=0.%s", pName, strVal); ! } ! } ! } if (len < 0) *************** *** 748,751 **** --- 835,841 ---- " to the paired port (disabled by default)\n" " EmuOverrun={yes|no} - enable/disable buffer overrun (disabled by default)\n" + " EmuNoise=<n> - probability in range 0-0.99999999 of error per\n" + " character frame in the direction to the paired port\n" + " (0 by default)\n" " PlugInMode={yes|no} - enable/disable plug-in mode, the plug-in mode port\n" " is hidden and can't be open if the paired port is\n" |
From: Vyacheslav F. <vf...@us...> - 2008-06-26 13:37:14
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19614 Modified Files: adddev.c bufutils.c bufutils.h com0com.h delay.c io.c openclos.c pinouts.c sources Added Files: noise.c noise.h rand.c rand.h Log Message: Implemented noise emulation Index: bufutils.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/bufutils.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** bufutils.c 5 Oct 2007 07:34:21 -0000 1.10 --- bufutils.c 26 Jun 2008 13:37:10 -0000 1.11 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2008/06/26 13:37:10 vfrolov + * Implemented noise emulation + * * Revision 1.10 2007/10/05 07:34:21 vfrolov * Added missing *pOverrun initialization *************** *** 61,64 **** --- 64,68 ---- #include "precomp.h" #include "bufutils.h" + #include "noise.h" /* *************** *** 82,115 **** } ! NTSTATUS MoveRawData(PC0C_RAW_DATA pDstRawData, PC0C_RAW_DATA pSrcRawData) { ! SIZE_T free; ! if (!pSrcRawData->size) ! return STATUS_SUCCESS; HALT_UNLESS2(pDstRawData->size <= sizeof(pDstRawData->data), pDstRawData->size, sizeof(pDstRawData->data)); ! free = sizeof(pDstRawData->data) - pDstRawData->size; ! if (free) { ! SIZE_T length; ! if (free > pSrcRawData->size) ! length = pSrcRawData->size; ! else ! length = free; ! HALT_UNLESS3((pDstRawData->size + length) <= sizeof(pDstRawData->data), ! pDstRawData->size, length, sizeof(pDstRawData->data)); - RtlCopyMemory(pDstRawData->data + pDstRawData->size, pSrcRawData->data, length); - pDstRawData->size = (UCHAR)(pDstRawData->size + length); - CompactRawData(pSrcRawData, length); - } return pSrcRawData->size ? STATUS_PENDING : STATUS_SUCCESS; } /********************************************************************/ VOID FlowFilterInit(PC0C_IO_PORT pIoPort, PC0C_FLOW_FILTER pFlowFilter) --- 86,126 ---- } ! SIZE_T AddRawData(PC0C_RAW_DATA pDstRawData, PUCHAR pSrc, SIZE_T length) { ! SIZE_T len; ! if (!length) ! return 0; HALT_UNLESS2(pDstRawData->size <= sizeof(pDstRawData->data), pDstRawData->size, sizeof(pDstRawData->data)); ! len = sizeof(pDstRawData->data) - pDstRawData->size; ! if (!len) ! return 0; ! if (len > length) ! len = length; ! HALT_UNLESS3((pDstRawData->size + len) <= sizeof(pDstRawData->data), ! pDstRawData->size, len, sizeof(pDstRawData->data)); ! ! RtlCopyMemory(pDstRawData->data + pDstRawData->size, pSrc, len); ! pDstRawData->size = (UCHAR)(pDstRawData->size + len); ! ! return len; ! } ! ! NTSTATUS MoveRawData(PC0C_RAW_DATA pDstRawData, PC0C_RAW_DATA pSrcRawData) ! { ! CompactRawData(pSrcRawData, AddRawData(pDstRawData, pSrcRawData->data, pSrcRawData->size)); return pSrcRawData->size ? STATUS_PENDING : STATUS_SUCCESS; } /********************************************************************/ + #define C0C_FLOW_FILTER_FL_AUTO_TRANSMIT 0x01 + #define C0C_FLOW_FILTER_FL_NULL_STRIPPING 0x02 + #define C0C_FLOW_FILTER_FL_IGNORE_RECEIVED 0x04 VOID FlowFilterInit(PC0C_IO_PORT pIoPort, PC0C_FLOW_FILTER pFlowFilter) *************** *** 119,122 **** --- 130,135 ---- RtlZeroMemory(pFlowFilter, sizeof(*pFlowFilter)); + pFlowFilter->pIoPort = pIoPort; + pHandFlow = &pIoPort->handFlow; *************** *** 124,151 **** (pIoPort->modemStatus & C0C_MSB_DSR) == 0) { ! pFlowFilter->flags |= C0C_FLOW_FILTER_IGNORE_RECEIVED; ! return; } ! if (pHandFlow->FlowReplace & SERIAL_AUTO_TRANSMIT) { ! pFlowFilter->flags |= C0C_FLOW_FILTER_AUTO_TRANSMIT; ! pFlowFilter->xonChar = pIoPort->specialChars.XonChar; ! pFlowFilter->xoffChar = pIoPort->specialChars.XoffChar; ! } if (pHandFlow->FlowReplace & SERIAL_NULL_STRIPPING) ! pFlowFilter->flags |= C0C_FLOW_FILTER_NULL_STRIPPING; ! ! if (pIoPort->waitMask & SERIAL_EV_RXCHAR) ! pFlowFilter->flags |= C0C_FLOW_FILTER_EV_RXCHAR; ! ! if (pIoPort->waitMask & SERIAL_EV_RXFLAG) { ! pFlowFilter->flags |= C0C_FLOW_FILTER_EV_RXFLAG; ! pFlowFilter->eventChar = pIoPort->specialChars.EventChar; ! } ! ! pFlowFilter->escapeChar = pIoPort->escapeChar; } - /********************************************************************/ VOID CopyCharsWithEscape( --- 137,149 ---- (pIoPort->modemStatus & C0C_MSB_DSR) == 0) { ! pFlowFilter->flags |= C0C_FLOW_FILTER_FL_IGNORE_RECEIVED; } ! if (pHandFlow->FlowReplace & SERIAL_AUTO_TRANSMIT) ! pFlowFilter->flags |= C0C_FLOW_FILTER_FL_AUTO_TRANSMIT; if (pHandFlow->FlowReplace & SERIAL_NULL_STRIPPING) ! pFlowFilter->flags |= C0C_FLOW_FILTER_FL_NULL_STRIPPING; } VOID CopyCharsWithEscape( *************** *** 160,174 **** SIZE_T writeDone; ! HALT_UNLESS(pReadBuf || (pFlowFilter && !readLength)); readDone = 0; - if (pBuf->escape && readLength) { - pBuf->escape = FALSE; - *pReadBuf++ = SERIAL_LSRMST_ESCAPE; - readDone++; - readLength--; - } - if (pBuf->insertData.size && readLength) { SIZE_T length = pBuf->insertData.size; --- 158,166 ---- SIZE_T writeDone; ! HALT_UNLESS3(pReadBuf || (pFlowFilter && !readLength), pReadBuf != NULL, pFlowFilter != NULL, readLength); ! HALT_UNLESS2(pWriteBuf || pFlowFilter, pReadBuf != NULL, pFlowFilter != NULL); readDone = 0; if (pBuf->insertData.size && readLength) { SIZE_T length = pBuf->insertData.size; *************** *** 196,217 **** } else ! if (pFlowFilter->flags & C0C_FLOW_FILTER_IGNORE_RECEIVED) { writeDone = writeLength; } else { writeDone = 0; while (writeLength--) { UCHAR curChar; ! curChar = *pWriteBuf++; ! if (!curChar && (pFlowFilter->flags & C0C_FLOW_FILTER_NULL_STRIPPING)) { } else ! if ((pFlowFilter->flags & C0C_FLOW_FILTER_AUTO_TRANSMIT) && ! (curChar == pFlowFilter->xoffChar || curChar == pFlowFilter->xonChar)) { ! if (curChar == pFlowFilter->xoffChar) pFlowFilter->lastXonXoff = C0C_XCHAR_OFF; else --- 188,298 ---- } else ! if (pFlowFilter->flags & C0C_FLOW_FILTER_FL_IGNORE_RECEIVED) { writeDone = writeLength; } else { + PC0C_IO_PORT pIoPort = pFlowFilter->pIoPort; + PC0C_IO_PORT pIoPortRemote = pIoPort->pIoPortRemote; + writeDone = 0; while (writeLength--) { UCHAR curChar; + UCHAR lsr = 0; ! if (pWriteBuf) { ! curChar = *pWriteBuf++; ! if (pIoPortRemote->brokeCharsProbability > 0) ! BrokeChar(pIoPortRemote, pIoPort, &curChar, &lsr); ! } else { ! if (pIoPortRemote->writeHolding & SERIAL_TX_WAITING_ON_BREAK && !pIoPortRemote->sendBreak) { ! BreakError(pIoPort, &lsr); ! pFlowFilter->events |= SERIAL_EV_BREAK; ! ! curChar = 0x00; ! } else { ! curChar = 0xFF; ! } ! } ! ! if (lsr) { ! pFlowFilter->events |= SERIAL_EV_ERR; ! ! if (pIoPort->handFlow.FlowReplace & SERIAL_ERROR_CHAR) { ! UCHAR errorChar = pIoPort->specialChars.ErrorChar; ! ! if (!readLength--) { ! #if DBG ! SIZE_T done = ! #endif /* DBG */ ! AddRawData(&pBuf->insertData, &errorChar, sizeof(errorChar)); ! HALT_UNLESS1(done == sizeof(errorChar), done); ! ! readLength++; ! } else { ! *pReadBuf++ = errorChar; ! readDone++; ! } ! } ! ! if (pIoPort->escapeChar) { ! UCHAR buf[4]; ! SIZE_T length = sizeof(buf); ! SIZE_T len; ! ! lsr |= 0x80; /* errornous data in FIFO */ ! ! if (C0C_TX_BUFFER_THR_EMPTY(&pIoPort->txBuf)) { ! lsr |= 0x20; /* transmit holding register empty */ ! ! if (C0C_TX_BUFFER_EMPTY(&pIoPort->txBuf)) ! lsr |= 0x40; /* transmit holding register empty and line is idle */ ! } ! ! if (pIoPortRemote->writeHolding & SERIAL_TX_WAITING_ON_BREAK && !pIoPortRemote->sendBreak) ! lsr |= 0x10; /* break interrupt indicator */ ! ! buf[0] = pIoPort->escapeChar; ! buf[1] = SERIAL_LSRMST_LSR_DATA; ! buf[2] = lsr; ! buf[3] = curChar; ! ! writeDone++; ! ! if (length > readLength) ! len = readLength; ! else ! len = length; ! ! if (len) { ! RtlCopyMemory(pReadBuf, buf, len); ! pReadBuf += len; ! readDone += len; ! readLength -= len; ! length -= len; ! } ! ! if (length) { ! #if DBG ! SIZE_T done = ! #endif /* DBG */ ! AddRawData(&pBuf->insertData, buf + len, length); ! HALT_UNLESS2(done == length, done, length); ! ! break; ! } ! ! continue; ! } ! } ! ! if (!curChar && (pFlowFilter->flags & C0C_FLOW_FILTER_FL_NULL_STRIPPING)) { } else ! if ((pFlowFilter->flags & C0C_FLOW_FILTER_FL_AUTO_TRANSMIT) && ! (curChar == pIoPort->specialChars.XoffChar || curChar == pIoPort->specialChars.XonChar)) { ! if (curChar == pIoPort->specialChars.XoffChar) pFlowFilter->lastXonXoff = C0C_XCHAR_OFF; else *************** *** 225,243 **** *pReadBuf++ = curChar; ! if (pFlowFilter->flags & C0C_FLOW_FILTER_EV_RXCHAR) ! pFlowFilter->events |= C0C_FLOW_FILTER_EV_RXCHAR; ! if ((pFlowFilter->flags & C0C_FLOW_FILTER_EV_RXFLAG) && ! curChar == pFlowFilter->eventChar) { ! pFlowFilter->events |= C0C_FLOW_FILTER_EV_RXFLAG; } ! if (pFlowFilter->escapeChar && curChar == pFlowFilter->escapeChar) { if (!readLength--) { ! pBuf->escape = TRUE; readLength++; } else { ! *pReadBuf++ = SERIAL_LSRMST_ESCAPE; readDone++; } --- 306,330 ---- *pReadBuf++ = curChar; ! pFlowFilter->events |= SERIAL_EV_RXCHAR; ! if ((pIoPort->waitMask & SERIAL_EV_RXFLAG) && ! curChar == pIoPort->specialChars.EventChar) { ! pFlowFilter->events |= SERIAL_EV_RXFLAG; } ! if (pIoPort->escapeChar && curChar == pIoPort->escapeChar) { ! curChar = SERIAL_LSRMST_ESCAPE; ! if (!readLength--) { ! #if DBG ! SIZE_T done = ! #endif /* DBG */ ! AddRawData(&pBuf->insertData, &curChar, sizeof(curChar)); ! HALT_UNLESS1(done == sizeof(curChar), done); ! readLength++; } else { ! *pReadBuf++ = curChar; readDone++; } *************** *** 263,273 **** if (!pBuf->busy) { - if (pBuf->escape) { - pBuf->escape = FALSE; - *pReadBuf++ = SERIAL_LSRMST_ESCAPE; - readLength--; - if (!readLength) - break; - } if (pBuf->insertData.size) { length = pBuf->insertData.size; --- 350,353 ---- *************** *** 319,322 **** --- 399,403 ---- PSIZE_T pOverrun) { + SIZE_T writeDoneTotal = 0; PUCHAR pWriteBuf = (PUCHAR)pWrite; *************** *** 340,344 **** &writeDone, pOverrun); ! pWriteBuf += writeDone; } } --- 421,425 ---- &writeDone, pOverrun); ! writeDoneTotal += writeDone; } } *************** *** 365,373 **** pBuf->pFree = pBuf->pBase; ! pWriteBuf += writeDone; writeLength -= writeDone; } ! return pWriteBuf - (PUCHAR)pWrite; } --- 446,457 ---- pBuf->pFree = pBuf->pBase; ! writeDoneTotal += writeDone; writeLength -= writeDone; + + if (pWriteBuf) + pWriteBuf += writeDone; } ! return writeDoneTotal; } *************** *** 506,510 **** } - newBuf.escape = pBuf->escape; newBuf.insertData = pBuf->insertData; --- 590,593 ---- *************** *** 518,522 **** pBuf->pFree = pBuf->pBusy = pBuf->pBase; pBuf->busy = 0; - pBuf->escape = FALSE; pBuf->insertData.size = 0; } --- 601,604 ---- Index: pinouts.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/pinouts.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pinouts.c 8 Apr 2008 06:47:37 -0000 1.4 --- pinouts.c 26 Jun 2008 13:37:10 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/06/26 13:37:10 vfrolov + * Implemented noise emulation + * * Revision 1.4 2008/04/08 06:47:37 vfrolov * Added pin OUT2 *************** *** 171,188 **** RtlZeroMemory(&pIoPortRemote->pinOuts[i].remote, sizeof(pIoPortRemote->pinOuts[i].remote)); - if (!pinCTS) - pinCTS = C0C_DEFAULT_PIN_CTS; PinWire(pIoPort, pIoPortRemote, pinCTS, C0C_MSB_CTS, &pIoPort->modemStatus); - - if (!pinDSR) - pinDSR = C0C_DEFAULT_PIN_DSR; PinWire(pIoPort, pIoPortRemote, pinDSR, C0C_MSB_DSR, &pIoPort->modemStatus); - - if (!pinDCD) - pinDCD = C0C_DEFAULT_PIN_DCD; PinWire(pIoPort, pIoPortRemote, pinDCD, C0C_MSB_RLSD, &pIoPort->modemStatus); - - if (!pinRI) - pinRI = C0C_DEFAULT_PIN_RI; PinWire(pIoPort, pIoPortRemote, pinRI, C0C_MSB_RING, &pIoPort->modemStatus); } --- 174,180 ---- Index: openclos.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/openclos.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** openclos.c 8 Apr 2008 10:30:35 -0000 1.22 --- openclos.c 26 Jun 2008 13:37:10 -0000 1.23 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.23 2008/06/26 13:37:10 vfrolov + * Implemented noise emulation + * * Revision 1.22 2008/04/08 10:30:35 vfrolov * Fixed modem control setting on close *************** *** 100,103 **** --- 103,107 ---- #include "strutils.h" #include "timeout.h" + #include "delay.h" NTSTATUS FdoPortOpen(IN PC0C_FDOPORT_EXTENSION pDevExt) *************** *** 175,182 **** --- 179,190 ---- pIoPort->handFlow.XoffLimit = size >> 3; pIoPort->handFlow.XonLimit = size >> 1; + pIoPort->pIoPortRemote->brokeIdleChars = 0; SetHandFlow(pIoPort, NULL, &queueToComplete); SetModemControl(pIoPort, C0C_MCR_OPEN, C0C_MCR_OPEN, &queueToComplete); + if (pIoPort->pIoPortRemote->pWriteDelay && pIoPort->pIoPortRemote->brokeCharsProbability > 0) + StartWriteDelayTimer(pIoPort->pIoPortRemote->pWriteDelay); + KeReleaseSpinLock(pIoPort->pIoLock, oldIrql); --- NEW FILE: rand.c --- #include "precomp.h" #include "rand.h" ULONG RAND() { static ULONG x = 123456789, y = 362436069, z = 521288629, w = 88675123, v = 886756453; ULONG t = (x ^ ( x >> 7)); x = y; y = z; z = w; w = v; v = (v ^ (v << 6)) ^ (t ^ (t << 13)); return (y + y + 1) * v; } Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/io.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** io.c 14 Mar 2008 15:28:39 -0000 1.37 --- io.c 26 Jun 2008 13:37:10 -0000 1.38 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.38 2008/06/26 13:37:10 vfrolov + * Implemented noise emulation + * * Revision 1.37 2008/03/14 15:28:39 vfrolov * Implemented ability to get paired port settings with *************** *** 145,148 **** --- 148,152 ---- #include "bufutils.h" #include "handflow.h" + #include "noise.h" #include "../include/cncext.h" *************** *** 222,231 **** SetXonXoffHolding(pReadIoPort, pFlowFilter->lastXonXoff); ! if (pFlowFilter->events & (C0C_FLOW_FILTER_EV_RXCHAR | C0C_FLOW_FILTER_EV_RXFLAG)) { ! if (pFlowFilter->events & C0C_FLOW_FILTER_EV_RXCHAR) ! pReadIoPort->eventMask |= SERIAL_EV_RXCHAR; ! ! if (pFlowFilter->events & C0C_FLOW_FILTER_EV_RXFLAG) ! pReadIoPort->eventMask |= SERIAL_EV_RXFLAG; if (pReadIoPort->eventMask) --- 226,231 ---- SetXonXoffHolding(pReadIoPort, pFlowFilter->lastXonXoff); ! if (pFlowFilter->events) { ! pReadIoPort->eventMask |= (pFlowFilter->events & pReadIoPort->waitMask); if (pReadIoPort->eventMask) *************** *** 270,273 **** --- 270,274 ---- SIZE_T sendDone; SIZE_T readDone; + SIZE_T brokeIdleChars; PUCHAR pDestRest; *************** *** 297,300 **** --- 298,330 ---- FlowFilterInit(pReadIoPort, &flowFilter); + brokeIdleChars = pReadIoPort->pIoPortRemote->brokeIdleChars; + + if (brokeIdleChars) { + CopyCharsWithEscape(&pReadIoPort->readBuf, + &flowFilter, + pDestRest, destRestLength, + NULL, brokeIdleChars, + &readDone, + &sendDone); + + if (sendDone) { + pReadIoPort->pIoPortRemote->brokeIdleChars -= sendDone; + OnRxChars(pReadIoPort, sendDone, &flowFilter, pQueueToComplete); + } + + if (readDone) { + *pReadDone += readDone; + information += readDone; + destRestLength -= readDone; + + if (destRestLength == 0) { + pIrp->IoStatus.Information = information; + return STATUS_SUCCESS; + } + + pDestRest += readDone; + } + } + readDone = ReadFromTxBuffer(&pReadIoPort->readBuf, &flowFilter, *************** *** 304,313 **** &sendDone); - if (readDone) { - *pReadDone += readDone; - information += readDone; - destRestLength -= readDone; - } - if (sendDone) { if (pWriteLimit) --- 334,337 ---- *************** *** 323,326 **** --- 347,356 ---- } + if (readDone) { + *pReadDone += readDone; + information += readDone; + destRestLength -= readDone; + } + pIrp->IoStatus.Information = information; *************** *** 331,334 **** --- 361,405 ---- } + VOID ReadBrokenIdleChars( + PIRP pIrp, + PNTSTATUS pStatusRead, + PC0C_IO_PORT pReadIoPort, + PLIST_ENTRY pQueueToComplete, + PSIZE_T pReadDone) + { + SIZE_T destRestLength; + SIZE_T information; + C0C_FLOW_FILTER flowFilter; + SIZE_T sendDone; + SIZE_T readDone; + + if (pReadIoPort->pIoPortRemote->brokeIdleChars == 0) + return; + + information = pIrp->IoStatus.Information; + destRestLength = IoGetCurrentIrpStackLocation(pIrp)->Parameters.Read.Length - information; + + FlowFilterInit(pReadIoPort, &flowFilter); + + CopyCharsWithEscape(&pReadIoPort->readBuf, + &flowFilter, + GET_REST_BUFFER(pIrp, information), destRestLength, + NULL, pReadIoPort->pIoPortRemote->brokeIdleChars, + &readDone, + &sendDone); + + if (sendDone) { + pReadIoPort->pIoPortRemote->brokeIdleChars -= sendDone; + OnRxChars(pReadIoPort, sendDone, &flowFilter, pQueueToComplete); + } + + if (readDone) { + *pReadDone += readDone; + pIrp->IoStatus.Information += readDone; + if (destRestLength <= readDone) + *pStatusRead = STATUS_SUCCESS; + } + } + VOID AlertOverrun(PC0C_IO_PORT pReadIoPort, PLIST_ENTRY pQueueToComplete) { *************** *** 344,347 **** --- 415,458 ---- } + SIZE_T SendBrokenChars( + PC0C_IO_PORT pReadIoPort, + PLIST_ENTRY pQueueToComplete, + SIZE_T count) + { + SIZE_T sendDone; + C0C_FLOW_FILTER flowFilter; + + if (!count) + return 0; + + FlowFilterInit(pReadIoPort, &flowFilter); + + if (pReadIoPort->emuOverrun) { + SIZE_T overrun; + + sendDone = WriteToBuffer(&pReadIoPort->readBuf, + NULL, + count, + &flowFilter, + &overrun); + + if (overrun) { + AlertOverrun(pReadIoPort, pQueueToComplete); + pReadIoPort->perfStats.BufferOverrunErrorCount += (ULONG)overrun; + } + } else { + sendDone = WriteToBuffer(&pReadIoPort->readBuf, + NULL, + count, + &flowFilter, + NULL); + } + + if (sendDone) + OnRxChars(pReadIoPort, sendDone, &flowFilter, pQueueToComplete); + + return sendDone; + } + VOID SendTxBuffer( PC0C_IO_PORT pReadIoPort, *************** *** 965,972 **** if (pWriteDelay) { ! if (C0C_TX_BUFFER_BUSY(&pIoPortWrite->txBuf) || pQueueWrite->pCurrent || pIoPortWrite->sendBreak || ! pIoPortWrite->sendXonXoff) { StartWriteDelayTimer(pWriteDelay); --- 1076,1084 ---- if (pWriteDelay) { ! if (!C0C_TX_BUFFER_EMPTY(&pIoPortWrite->txBuf) || pQueueWrite->pCurrent || pIoPortWrite->sendBreak || ! pIoPortWrite->sendXonXoff || ! pIoPortWrite->brokeIdleChars) { StartWriteDelayTimer(pWriteDelay); *************** *** 1038,1043 **** ******************************************************************************/ ! if (!dataIrpRead.data.irp.pIrp) SendTxBuffer(pIoPortRead, pIoPortWrite, pQueueToComplete, pWriteLimit, pWriteDelay, &doneSend); /****************************************************************************** --- 1150,1159 ---- ******************************************************************************/ ! if (!dataIrpRead.data.irp.pIrp) { ! pIoPortWrite->brokeIdleChars -= ! SendBrokenChars(pIoPortRead, pQueueToComplete, pIoPortWrite->brokeIdleChars); ! SendTxBuffer(pIoPortRead, pIoPortWrite, pQueueToComplete, pWriteLimit, pWriteDelay, &doneSend); + } /****************************************************************************** *************** *** 1107,1110 **** --- 1223,1236 ---- else if (pWriteDelay) { + if (pIoPortWrite->brokeCharsProbability > 0) { + pIoPortWrite->brokeIdleChars += GetBrokenChars(pIoPortWrite->brokeCharsProbability, *pWriteLimit); + + ReadBrokenIdleChars(dataIrpRead.data.irp.pIrp, + &dataIrpRead.data.irp.status, + pIoPortRead, + pQueueToComplete, + &doneRead); + } + pWriteDelay->sentFrames += *pWriteLimit; *pWriteLimit = 0; *************** *** 1143,1146 **** --- 1269,1282 ---- else if (pWriteDelay) { + if (pIoPortWrite->brokeCharsProbability > 0) { + pIoPortWrite->brokeIdleChars += GetBrokenChars(pIoPortWrite->brokeCharsProbability, *pWriteLimit); + + ReadBrokenIdleChars(dataIrpRead.data.irp.pIrp, + &dataIrpRead.data.irp.status, + pIoPortRead, + pQueueToComplete, + &doneRead); + } + pWriteDelay->sentFrames += *pWriteLimit; *pWriteLimit = 0; *************** *** 1234,1237 **** --- 1370,1379 ---- else if (pWriteDelay) { + if (pIoPortWrite->brokeCharsProbability > 0) { + pIoPortWrite->brokeIdleChars += GetBrokenChars(pIoPortWrite->brokeCharsProbability, *pWriteLimit); + pIoPortWrite->brokeIdleChars -= + SendBrokenChars(pIoPortRead, pQueueToComplete, pIoPortWrite->brokeIdleChars); + } + pWriteDelay->sentFrames += *pWriteLimit; *pWriteLimit = 0; *************** *** 1259,1267 **** UCHAR lsr = 0x10; /* break interrupt indicator */ ! if (!pIoPortRead->amountInWriteQueue || pIoPortRead->writeHolding) ! lsr |= 0x60; /* transmit holding register empty and transmitter empty indicators */ InsertLsrMst(pIoPortRead, FALSE, lsr, pQueueToComplete); } if (pIoPortRead->handFlow.FlowReplace & SERIAL_BREAK_CHAR) InsertChar(pIoPortRead, pIoPortRead->specialChars.BreakChar, pQueueToComplete); --- 1401,1414 ---- UCHAR lsr = 0x10; /* break interrupt indicator */ ! if (C0C_TX_BUFFER_THR_EMPTY(&pIoPortRead->txBuf)) { ! lsr |= 0x20; /* transmit holding register empty */ ! ! if (C0C_TX_BUFFER_EMPTY(&pIoPortRead->txBuf)) ! lsr |= 0x40; /* transmit holding register empty and line is idle */ ! } InsertLsrMst(pIoPortRead, FALSE, lsr, pQueueToComplete); } + if (pIoPortRead->handFlow.FlowReplace & SERIAL_BREAK_CHAR) InsertChar(pIoPortRead, pIoPortRead->specialChars.BreakChar, pQueueToComplete); *************** *** 1285,1288 **** --- 1432,1441 ---- else if (pWriteDelay) { + if (pIoPortWrite->brokeCharsProbability > 0) { + pIoPortWrite->brokeIdleChars += GetBrokenChars(pIoPortWrite->brokeCharsProbability, *pWriteLimit); + pIoPortWrite->brokeIdleChars -= + SendBrokenChars(pIoPortRead, pQueueToComplete, pIoPortWrite->brokeIdleChars); + } + pWriteDelay->sentFrames += *pWriteLimit; *pWriteLimit = 0; *************** *** 1364,1367 **** --- 1517,1523 ---- } + if (C0C_TX_BUFFER_EMPTY(&pIoPortWrite->txBuf)) + pIoPortWrite->brokeChars = 0; /* reset on idle */ + UpdateTransmitToggle(pIoPortWrite, pQueueToComplete); Index: bufutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/bufutils.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** bufutils.h 20 Jul 2007 08:00:22 -0000 1.6 --- bufutils.h 26 Jun 2008 13:37:10 -0000 1.7 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/06/26 13:37:10 vfrolov + * Implemented noise emulation + * * Revision 1.6 2007/07/20 08:00:22 vfrolov * Implemented TX buffer *************** *** 47,63 **** typedef struct _C0C_FLOW_FILTER { ! #define C0C_FLOW_FILTER_AUTO_TRANSMIT 0x01 ! #define C0C_FLOW_FILTER_EV_RXCHAR 0x02 ! #define C0C_FLOW_FILTER_EV_RXFLAG 0x04 ! #define C0C_FLOW_FILTER_NULL_STRIPPING 0x08 ! #define C0C_FLOW_FILTER_IGNORE_RECEIVED 0x10 UCHAR flags; - UCHAR xonChar; - UCHAR xoffChar; - UCHAR eventChar; - UCHAR escapeChar; - UCHAR events; UCHAR lastXonXoff; } C0C_FLOW_FILTER, *PC0C_FLOW_FILTER; --- 50,58 ---- typedef struct _C0C_FLOW_FILTER { ! PC0C_IO_PORT pIoPort; + USHORT events; UCHAR flags; UCHAR lastXonXoff; } C0C_FLOW_FILTER, *PC0C_FLOW_FILTER; Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/com0com.h,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** com0com.h 4 May 2008 09:51:45 -0000 1.43 --- com0com.h 26 Jun 2008 13:37:10 -0000 1.44 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.44 2008/06/26 13:37:10 vfrolov + * Implemented noise emulation + * * Revision 1.43 2008/05/04 09:51:45 vfrolov * Implemented HiddenMode option *************** *** 218,222 **** SIZE_T limit; SIZE_T size80; - BOOLEAN escape; C0C_RAW_DATA insertData; } C0C_BUFFER, *PC0C_BUFFER; --- 221,224 ---- *************** *** 237,242 **** } C0C_TX_BUFFER, *PC0C_TX_BUFFER; ! #define C0C_TX_BUFFER_BUSY(pTxBuf) \ ! ((pTxBuf)->busy) #define C0C_TX_BUFFER_THR_EMPTY(pTxBuf) \ --- 239,244 ---- } C0C_TX_BUFFER, *PC0C_TX_BUFFER; ! #define C0C_TX_BUFFER_EMPTY(pTxBuf) \ ! (!(pTxBuf)->busy) #define C0C_TX_BUFFER_THR_EMPTY(pTxBuf) \ *************** *** 332,335 **** --- 334,341 ---- C0C_TX_BUFFER txBuf; + ULONG brokeCharsProbability; + short brokeChars; /* number of subsequent chars that should be broken */ + SIZE_T brokeIdleChars; + short sendXonXoff; ULONG writeHolding; --- NEW FILE: rand.h --- /* * $Id: rand.h,v 1.1 2008/06/26 13:37:10 vfrolov Exp $ * * Copyright (c) 2008 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: rand.h,v $ * Revision 1.1 2008/06/26 13:37:10 vfrolov * Implemented noise emulation * */ #ifndef _C0C_RAND_H_ #define _C0C_RAND_H_ ULONG RAND(); #endif /* _C0C_RAND_H_ */ Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/adddev.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** adddev.c 4 May 2008 09:51:44 -0000 1.33 --- adddev.c 26 Jun 2008 13:37:10 -0000 1.34 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.34 2008/06/26 13:37:10 vfrolov + * Implemented noise emulation + * * Revision 1.33 2008/05/04 09:51:44 vfrolov * Implemented HiddenMode option *************** *** 162,165 **** --- 165,169 ---- pDevExt->pIoPortLocal->pDevExt = NULL; FreeTxBuffer(&pDevExt->pIoPortLocal->txBuf); + pDevExt->pIoPortLocal->brokeChars = 0; /* reset on idle */ } *************** *** 189,192 **** --- 193,197 ---- PC0C_PDOPORT_EXTENSION pPhDevExt; ULONG emuBR, emuOverrun, plugInMode, exclusiveMode, hiddenMode; + ULONG brokeCharsProbability; ULONG pinCTS, pinDSR, pinDCD, pinRI; UNICODE_STRING ntDeviceName; *************** *** 267,275 **** exclusiveMode = C0C_DEFAULT_EXCLUSIVEMODE; hiddenMode = C0C_DEFAULT_HIDDENMODE; ! pinCTS = pinDSR = pinDCD = pinRI = 0; if (NT_SUCCESS(status)) { ! RTL_QUERY_REGISTRY_TABLE queryTable[10]; ! ULONG zero = 0; int i; --- 272,283 ---- exclusiveMode = C0C_DEFAULT_EXCLUSIVEMODE; hiddenMode = C0C_DEFAULT_HIDDENMODE; ! pinCTS = C0C_DEFAULT_PIN_CTS; ! pinDSR = C0C_DEFAULT_PIN_DSR; ! pinDCD = C0C_DEFAULT_PIN_DCD; ! pinRI = C0C_DEFAULT_PIN_RI; ! brokeCharsProbability = C0C_DEFAULT_EMUNOISE; if (NT_SUCCESS(status)) { ! RTL_QUERY_REGISTRY_TABLE queryTable[11]; int i; *************** *** 279,283 **** queryTable[i].Flags = RTL_QUERY_REGISTRY_DIRECT; queryTable[i].DefaultType = REG_DWORD; - queryTable[i].DefaultData = &zero; queryTable[i].DefaultLength = sizeof(ULONG); } --- 287,290 ---- *************** *** 311,326 **** --- 318,342 ---- queryTable[i].Name = L"cts"; queryTable[i].EntryContext = &pinCTS; + queryTable[i].DefaultData = &pinCTS; i++; queryTable[i].Name = L"dsr"; queryTable[i].EntryContext = &pinDSR; + queryTable[i].DefaultData = &pinDSR; i++; queryTable[i].Name = L"dcd"; queryTable[i].EntryContext = &pinDCD; + queryTable[i].DefaultData = &pinDCD; i++; queryTable[i].Name = L"ri"; queryTable[i].EntryContext = &pinRI; + queryTable[i].DefaultData = &pinRI; + + i++; + queryTable[i].Name = L"EmuNoise"; + queryTable[i].EntryContext = &brokeCharsProbability; + queryTable[i].DefaultData = &brokeCharsProbability; RtlQueryRegistryValues( *************** *** 425,428 **** --- 441,453 ---- PinMap(pDevExt->pIoPortLocal, pinCTS, pinDSR, pinDCD, pinRI); + pDevExt->pIoPortLocal->brokeCharsProbability = brokeCharsProbability; + + #if DBG + if (brokeCharsProbability) + Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Enabled noise emulation"); + else + Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Disabled noise emulation"); + #endif /* DBG */ + pDevExt->pLowDevObj = IoAttachDeviceToDeviceStack(pNewDevObj, pPhDevObj); --- NEW FILE: noise.c --- /* * $Id: noise.c,v 1.1 2008/06/26 13:37:10 vfrolov Exp $ * * Copyright (c) 2008 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: noise.c,v $ * Revision 1.1 2008/06/26 13:37:10 vfrolov * Implemented noise emulation * */ #include "precomp.h" #include "noise.h" #include "rand.h" /* * FILE_ID used by HALT_UNLESS to put it on BSOD */ #define FILE_ID 0xF /********************************************************************/ VOID ParityError(PC0C_IO_PORT pReadIoPort, PUCHAR pLsr) { *pLsr |= 0x04; /* parity error */ pReadIoPort->errors |= SERIAL_ERROR_PARITY; pReadIoPort->perfStats.ParityErrorCount++; } /********************************************************************/ VOID FrameError(PC0C_IO_PORT pReadIoPort, PUCHAR pLsr) { *pLsr |= 0x08; /* framing error */ pReadIoPort->errors |= SERIAL_ERROR_FRAMING; pReadIoPort->perfStats.FrameErrorCount++; } /********************************************************************/ VOID BreakError(PC0C_IO_PORT pReadIoPort, PUCHAR pLsr) { *pLsr |= 0x10; /* break interrupt indicator */ pReadIoPort->errors |= SERIAL_ERROR_BREAK; } /********************************************************************/ UCHAR GarbageChar(PC0C_IO_PORT pWriteIoPort, PC0C_IO_PORT pReadIoPort, PUCHAR pLsr) { if (pWriteIoPort->lineControl.Parity != NO_PARITY && RAND()%2 > 0) ParityError(pReadIoPort, pLsr); if (RAND()%2 > 0) FrameError(pReadIoPort, pLsr); return (UCHAR)RAND(); } /********************************************************************/ VOID BrokeChar(PC0C_IO_PORT pWriteIoPort, PC0C_IO_PORT pReadIoPort, PUCHAR pChar, PUCHAR pLsr) { if (pWriteIoPort->brokeChars) { pWriteIoPort->brokeChars--; *pChar = GarbageChar(pWriteIoPort, pReadIoPort, pLsr); } else if (pWriteIoPort->brokeCharsProbability > (RAND()%C0C_PROBABILITY_ONE)) { int r = (int)(RAND()%( + 1 /* start bit */ + 1 /* stop bit(s) */ + pWriteIoPort->lineControl.WordLength + ((pWriteIoPort->lineControl.Parity != NO_PARITY) ? 1 : 0) )); if (r-- == 0) { /* start bit error */ pWriteIoPort->brokeChars = (short)(RAND()%512); /* some of subsequent chars should be broken */ *pChar = GarbageChar(pWriteIoPort, pReadIoPort, pLsr); } else if (r-- == 0) { /* stop bit error */ pWriteIoPort->brokeChars = (short)(RAND()%512); /* some of subsequent chars should be broken */ FrameError(pReadIoPort, pLsr); } else if (r < pWriteIoPort->lineControl.WordLength) { /* data bit error */ *pChar ^= (1 << r); if (pWriteIoPort->lineControl.Parity == ODD_PARITY || pWriteIoPort->lineControl.Parity == EVEN_PARITY) ParityError(pReadIoPort, pLsr); } else { /* parity bit error */ ParityError(pReadIoPort, pLsr); } } } /********************************************************************/ SIZE_T GetBrokenChars(ULONG brokeCharsProbability, SIZE_T chars) { SIZE_T brokeChars = 0; while (chars--) { if (brokeCharsProbability > (RAND()%C0C_PROBABILITY_ONE)) brokeChars++; } return brokeChars; } /********************************************************************/ Index: sources =================================================================== RCS file: /cvsroot/com0com/com0com/sys/sources,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sources 3 Jul 2007 14:35:17 -0000 1.9 --- sources 26 Jun 2008 13:37:10 -0000 1.10 *************** *** 28,31 **** --- 28,33 ---- bufutils.c \ strutils.c \ + noise.c \ + rand.c \ syslog.c \ trace.c \ Index: delay.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/delay.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** delay.c 14 Mar 2008 15:28:39 -0000 1.10 --- delay.c 26 Jun 2008 13:37:10 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2008/06/26 13:37:10 vfrolov + * Implemented noise emulation + * * Revision 1.10 2008/03/14 15:28:39 vfrolov * Implemented ability to get paired port settings with *************** *** 57,65 **** * Initial revision * - * */ #include "precomp.h" #include "delay.h" /* --- 60,68 ---- * Initial revision * */ #include "precomp.h" #include "delay.h" + #include "noise.h" /* *************** *** 100,105 **** &queueToComplete); ! if (pWriteDelay->idleCount > 3) StopWriteDelayTimer(pWriteDelay); } --- 103,124 ---- &queueToComplete); ! if (pWriteDelay->idleCount > 3) { ! if (pIoPort->brokeCharsProbability > 0 && pIoPort->pIoPortRemote->isOpen) { ! SIZE_T idleChars = GetWriteLimit(pWriteDelay); ! ! pWriteDelay->idleCount = 0; ! pIoPort->brokeIdleChars += GetBrokenChars(pIoPort->brokeCharsProbability, idleChars); ! pWriteDelay->sentFrames += idleChars; ! ! if (pIoPort->brokeIdleChars > 0) { ! ReadWrite( ! pIoPort->pIoPortRemote, FALSE, ! pIoPort, FALSE, ! &queueToComplete); ! } ! } else { StopWriteDelayTimer(pWriteDelay); + } + } } --- NEW FILE: noise.h --- /* * $Id: noise.h,v 1.1 2008/06/26 13:37:10 vfrolov Exp $ * * Copyright (c) 2008 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: noise.h,v $ * Revision 1.1 2008/06/26 13:37:10 vfrolov * Implemented noise emulation * */ #ifndef _C0C_NOISE_H_ #define _C0C_NOISE_H_ VOID BreakError(PC0C_IO_PORT pReadIoPort, PUCHAR pLsr); VOID BrokeChar(PC0C_IO_PORT pWriteIoPort, PC0C_IO_PORT pReadIoPort, PUCHAR pChar, PUCHAR pLsr); SIZE_T GetBrokenChars(ULONG brokeCharsProbability, SIZE_T chars); #endif /* _C0C_NOISE_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2008-06-26 13:31:57
|
Update of /cvsroot/com0com/com0com/include In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv17347 Modified Files: com0com.h Log Message: Implemented noise emulation Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/include/com0com.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** com0com.h 4 May 2008 09:44:05 -0000 1.8 --- com0com.h 26 Jun 2008 13:31:54 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2008/06/26 13:31:54 vfrolov + * Implemented noise emulation + * * Revision 1.8 2008/05/04 09:44:05 vfrolov * Added C0C_DEFAULT_HIDDENMODE *************** *** 86,89 **** --- 89,95 ---- #define C0C_DEFAULT_EXCLUSIVEMODE 0x00000000 #define C0C_DEFAULT_HIDDENMODE 0x00000000 + #define C0C_DEFAULT_EMUNOISE 0x00000000 + + #define C0C_PROBABILITY_ONE 100000000 #endif /* _INCLUDE_C0C_COM0COM_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2008-06-10 11:32:39
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9119 Modified Files: ioctl.c Log Message: Fixed break interrupt indicator for C0CE_INSERT_IOCTL_GET Added parameter checking for IOCTL_SERIAL_SET_LINE_CONTROL Index: ioctl.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/ioctl.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** ioctl.c 8 Apr 2008 10:36:16 -0000 1.35 --- ioctl.c 10 Jun 2008 11:32:35 -0000 1.36 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.36 2008/06/10 11:32:35 vfrolov + * Fixed break interrupt indicator for C0CE_INSERT_IOCTL_GET + * Added parameter checking for IOCTL_SERIAL_SET_LINE_CONTROL + * * Revision 1.35 2008/04/08 10:36:16 vfrolov * Implemented ability to set individual pins with extended *************** *** 693,701 **** if (optsAndBits & C0CE_INSERT_IOCTL_GET) { if (optsAndBits & C0CE_INSERT_ENABLE_LSR) { ! UCHAR lsr = 0x10; /* break interrupt indicator */ if (!pIoPortLocal->amountInWriteQueue || pIoPortLocal->writeHolding) lsr |= 0x60; /* transmit holding register empty and transmitter empty indicators */ *pSysBuf++ = escapeChar; *pSysBuf++ = SERIAL_LSRMST_LSR_NODATA; --- 697,708 ---- if (optsAndBits & C0CE_INSERT_IOCTL_GET) { if (optsAndBits & C0CE_INSERT_ENABLE_LSR) { ! UCHAR lsr = 0; if (!pIoPortLocal->amountInWriteQueue || pIoPortLocal->writeHolding) lsr |= 0x60; /* transmit holding register empty and transmitter empty indicators */ + if (pIoPortLocal->pIoPortRemote->writeHolding & SERIAL_TX_WAITING_ON_BREAK) + lsr |= 0x10; /* break interrupt indicator */ + *pSysBuf++ = escapeChar; *pSysBuf++ = SERIAL_LSRMST_LSR_NODATA; *************** *** 758,761 **** --- 765,801 ---- pLineControl = (PSERIAL_LINE_CONTROL)pIrp->AssociatedIrp.SystemBuffer; + switch (pLineControl->WordLength) { + case 5: + case 6: + case 7: + case 8: + break; + default: + status = STATUS_INVALID_PARAMETER; + } + + switch (pLineControl->Parity) { + case NO_PARITY: + case ODD_PARITY: + case EVEN_PARITY: + case MARK_PARITY: + case SPACE_PARITY: + break; + default: + status = STATUS_INVALID_PARAMETER; + } + + switch (pLineControl->StopBits) { + case STOP_BIT_1: + case STOP_BITS_1_5: + case STOP_BITS_2: + break; + default: + status = STATUS_INVALID_PARAMETER; + } + + if (status == STATUS_INVALID_PARAMETER) + break; + KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); if (pIoPortLocal->lineControl.StopBits != pLineControl->StopBits || |
From: Vyacheslav F. <vf...@us...> - 2008-06-10 11:24:24
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv5678 Modified Files: trace.c Log Message: Disabled tracing if traceFileName is empty Index: trace.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/trace.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** trace.c 8 Apr 2008 10:37:56 -0000 1.30 --- trace.c 10 Jun 2008 11:24:20 -0000 1.31 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.31 2008/06/10 11:24:20 vfrolov + * Disabled tracing if traceFileName is empty + * * Revision 1.30 2008/04/08 10:37:56 vfrolov * Implemented ability to set individual pins with extended *************** *** 1178,1182 **** QueryRegistryTraceEnable(pRegistryPath); ! if (!pTraceData->traceFileName.Buffer) TraceDisable(); --- 1181,1185 ---- QueryRegistryTraceEnable(pRegistryPath); ! if (!pTraceData->traceFileName.Buffer || !pTraceData->traceFileName.Length) TraceDisable(); |
From: Vyacheslav F. <vf...@us...> - 2008-06-10 11:19:38
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3544 Modified Files: version.h Log Message: Post-tagging version change Index: version.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/version.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** version.h 5 Jun 2008 10:51:35 -0000 1.14 --- version.h 10 Jun 2008 11:19:33 -0000 1.15 *************** *** 28,32 **** #define C0C_V2 1 #define C0C_V3 0 ! #define C0C_V4 0 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 --- 28,32 ---- #define C0C_V2 1 #define C0C_V3 0 ! #define C0C_V4 1 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 |
From: Vyacheslav F. <vf...@us...> - 2008-06-05 10:51:46
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14881 Modified Files: version.h Log Message: Pre-tagging version change Index: version.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/version.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** version.h 14 Mar 2008 15:19:48 -0000 1.13 --- version.h 5 Jun 2008 10:51:35 -0000 1.14 *************** *** 26,32 **** #define C0C_V1 2 ! #define C0C_V2 0 #define C0C_V3 0 ! #define C0C_V4 1 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 --- 26,32 ---- #define C0C_V1 2 ! #define C0C_V2 1 #define C0C_V3 0 ! #define C0C_V4 0 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 |
From: Vyacheslav F. <vf...@us...> - 2008-06-05 10:46:02
|
Update of /cvsroot/com0com/com0com/include In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12632 Modified Files: cncext.h Log Message: Removed RCS keywords Index: cncext.h =================================================================== RCS file: /cvsroot/com0com/com0com/include/cncext.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cncext.h 14 Mar 2008 15:28:39 -0000 1.1 --- cncext.h 5 Jun 2008 10:45:57 -0000 1.2 *************** *** 1,4 **** /* ! * $Id$ * * Copyright (c) 2008 Vyacheslav Frolov --- 1,4 ---- /* ! * cncext.h * * Copyright (c) 2008 Vyacheslav Frolov *************** *** 18,28 **** * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * - * $Log$ - * Revision 1.1 2008/03/14 15:28:39 vfrolov - * Implemented ability to get paired port settings with - * extended IOCTL_SERIAL_LSRMST_INSERT - * - * */ --- 18,21 ---- *************** *** 33,36 **** --- 26,34 ---- #define C0CE_SIGNATURE_SIZE (sizeof(UCHAR)*4) + /************************************************************************** + Extended IOCTL_SERIAL_LSRMST_INSERT allows to monitor and get the paired + port settings as insertion to the data stream + **************************************************************************/ + /* Following this value is the baud rate (ULONG) of paired port *************** *** 44,50 **** #define C0CE_INSERT_RLC 17 ! #define C0CE_INSERT_IOCTL_CAPS 0xFFFFFFFF /* IOCTL returns signature and all possible options */ ! #define C0CE_INSERT_IOCTL_GET 0x01000000 /* IOCTL returns current values */ #define C0CE_INSERT_IOCTL_RXCLEAR 0x02000000 /* IOCTL clears the driver's input buffer */ --- 42,52 ---- #define C0CE_INSERT_RLC 17 ! /* ! Options (ULONG) ! */ ! #define C0CE_INSERT_IOCTL_CAPS 0xFFFFFFFF /* IOCTL returns bitmap of all possible options */ ! ! #define C0CE_INSERT_IOCTL_GET 0x01000000 /* IOCTL returns current values of enabled insertions */ #define C0CE_INSERT_IOCTL_RXCLEAR 0x02000000 /* IOCTL clears the driver's input buffer */ |
From: Vyacheslav F. <vf...@us...> - 2008-06-05 10:43:09
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11465 Modified Files: ReadMe.txt Log Message: Added 2 HOWTOs Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ReadMe.txt 30 Nov 2007 09:52:23 -0000 1.16 --- ReadMe.txt 5 Jun 2008 10:42:48 -0000 1.17 *************** *** 88,93 **** ! FAQ & HOWTO ! =========== Q. Is it possible to change the names CNCA0 and CNCB0 to COM2 and COM3? --- 88,93 ---- ! FAQs & HOWTOs ! ============= Q. Is it possible to change the names CNCA0 and CNCB0 to COM2 and COM3? *************** *** 172,173 **** --- 172,186 ---- The makecert, pvk2pfx, signtool and certmgr tools can be installed with the Platform Software Development Kit (SDK). + + Q. How to monitor and get the paired port settings? + A. It can be done with extended IOCTL_SERIAL_LSRMST_INSERT. See example in + + http://com0com.sourceforge.net/examples/LSRMST_INSERT/tstser.cpp + + Q. To transfer state to CTS and DSR they wired to RTS and DTR. How to transfer + state to DCD and RING? + A. The OUT1 can be wired to DCD and OUT2 to RING. Use extended + IOCTL_SERIAL_SET_MODEM_CONTROL and IOCTL_SERIAL_GET_MODEM_CONTROL to change + state of OUT1 and OUT2. See example in + + http://com0com.sourceforge.net/examples/MODEM_CONTROL/tstser.cpp |
From: Vyacheslav F. <vf...@us...> - 2008-05-04 09:56:52
|
Update of /cvsroot/com0com/com0com/setupg In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11770 Modified Files: Form1.h Form1.resx Log Message: Implemented HiddenMode option Index: Form1.h =================================================================== RCS file: /cvsroot/com0com/com0com/setupg/Form1.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Form1.h 8 Apr 2008 06:52:12 -0000 1.3 --- Form1.h 4 May 2008 09:56:47 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2008/05/04 09:56:47 vfrolov + * Implemented HiddenMode option + * * Revision 1.3 2008/04/08 06:52:12 vfrolov * Added pin OUT2 *************** *** 92,95 **** --- 95,100 ---- private: System::Windows::Forms::CheckBox^ EmuOverrunA; private: System::Windows::Forms::CheckBox^ EmuBrA; + private: System::Windows::Forms::CheckBox^ HiddenModeA; + private: System::Windows::Forms::CheckBox^ HiddenModeB; private: System::Windows::Forms::Label^ pinNameON; private: System::Windows::Forms::Label^ pinNameA_RX; *************** *** 145,148 **** --- 150,155 ---- this->EmuOverrunA = (gcnew System::Windows::Forms::CheckBox()); this->EmuBrA = (gcnew System::Windows::Forms::CheckBox()); + this->HiddenModeA = (gcnew System::Windows::Forms::CheckBox()); + this->HiddenModeB = (gcnew System::Windows::Forms::CheckBox()); this->pinNameA_RX = (gcnew System::Windows::Forms::Label()); this->pinNameA_DTR = (gcnew System::Windows::Forms::Label()); *************** *** 156,164 **** this->pinNameA_OUT2 = (gcnew System::Windows::Forms::Label()); this->pinNameA_OPEN = (gcnew System::Windows::Forms::Label()); - this->pairList = (gcnew System::Windows::Forms::TreeView()); - this->buttonRemovePair = (gcnew System::Windows::Forms::Button()); - this->buttonAddPair = (gcnew System::Windows::Forms::Button()); - this->buttonApply = (gcnew System::Windows::Forms::Button()); - this->buttonReset = (gcnew System::Windows::Forms::Button()); this->pinNameB_OPEN = (gcnew System::Windows::Forms::Label()); this->pinNameB_OUT1 = (gcnew System::Windows::Forms::Label()); --- 163,166 ---- *************** *** 172,175 **** --- 174,182 ---- this->pinNameB_DTR = (gcnew System::Windows::Forms::Label()); this->pinNameB_RX = (gcnew System::Windows::Forms::Label()); + this->pairList = (gcnew System::Windows::Forms::TreeView()); + this->buttonRemovePair = (gcnew System::Windows::Forms::Button()); + this->buttonAddPair = (gcnew System::Windows::Forms::Button()); + this->buttonApply = (gcnew System::Windows::Forms::Button()); + this->buttonReset = (gcnew System::Windows::Forms::Button()); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->picturePinMap))->BeginInit(); this->SuspendLayout(); *************** *** 275,278 **** --- 282,301 ---- this->EmuBrA->CheckedChanged += gcnew System::EventHandler(this, &Form1::EmuBrA_Changed); // + // HiddenModeA + // + resources->ApplyResources(this->HiddenModeA, L"HiddenModeA"); + this->HiddenModeA->Name = L"HiddenModeA"; + this->toolTip1->SetToolTip(this->HiddenModeA, resources->GetString(L"HiddenModeA.ToolTip")); + this->HiddenModeA->UseVisualStyleBackColor = true; + this->HiddenModeA->CheckedChanged += gcnew System::EventHandler(this, &Form1::HiddenModeA_Changed); + // + // HiddenModeB + // + resources->ApplyResources(this->HiddenModeB, L"HiddenModeB"); + this->HiddenModeB->Name = L"HiddenModeB"; + this->toolTip1->SetToolTip(this->HiddenModeB, resources->GetString(L"HiddenModeB.ToolTip")); + this->HiddenModeB->UseVisualStyleBackColor = true; + this->HiddenModeB->CheckedChanged += gcnew System::EventHandler(this, &Form1::HiddenModeB_Changed); + // // pinNameA_RX // *************** *** 341,380 **** this->toolTip1->SetToolTip(this->pinNameA_OPEN, resources->GetString(L"pinNameA_OPEN.ToolTip")); // - // pairList - // - this->pairList->HideSelection = false; - resources->ApplyResources(this->pairList, L"pairList"); - this->pairList->Name = L"pairList"; - this->pairList->AfterSelect += gcnew System::Windows::Forms::TreeViewEventHandler(this, &Form1::pairsList_AfterSelect); - this->pairList->BeforeSelect += gcnew System::Windows::Forms::TreeViewCancelEventHandler(this, &Form1::pairsList_BeforeSelect); - // - // buttonRemovePair - // - resources->ApplyResources(this->buttonRemovePair, L"buttonRemovePair"); - this->buttonRemovePair->Name = L"buttonRemovePair"; - this->buttonRemovePair->UseVisualStyleBackColor = true; - this->buttonRemovePair->Click += gcnew System::EventHandler(this, &Form1::buttonRemovePair_Click); - // - // buttonAddPair - // - resources->ApplyResources(this->buttonAddPair, L"buttonAddPair"); - this->buttonAddPair->Name = L"buttonAddPair"; - this->buttonAddPair->UseVisualStyleBackColor = true; - this->buttonAddPair->Click += gcnew System::EventHandler(this, &Form1::buttonAddPair_Click); - // - // buttonApply - // - resources->ApplyResources(this->buttonApply, L"buttonApply"); - this->buttonApply->Name = L"buttonApply"; - this->buttonApply->UseVisualStyleBackColor = true; - this->buttonApply->Click += gcnew System::EventHandler(this, &Form1::buttonApply_Click); - // - // buttonReset - // - resources->ApplyResources(this->buttonReset, L"buttonReset"); - this->buttonReset->Name = L"buttonReset"; - this->buttonReset->UseVisualStyleBackColor = true; - this->buttonReset->Click += gcnew System::EventHandler(this, &Form1::buttonReset_Click); - // // pinNameB_OPEN // --- 364,367 ---- *************** *** 443,450 **** --- 430,475 ---- this->toolTip1->SetToolTip(this->pinNameB_RX, resources->GetString(L"pinNameB_RX.ToolTip")); // + // pairList + // + this->pairList->HideSelection = false; + resources->ApplyResources(this->pairList, L"pairList"); + this->pairList->Name = L"pairList"; + this->pairList->AfterSelect += gcnew System::Windows::Forms::TreeViewEventHandler(this, &Form1::pairsList_AfterSelect); + this->pairList->BeforeSelect += gcnew System::Windows::Forms::TreeViewCancelEventHandler(this, &Form1::pairsList_BeforeSelect); + // + // buttonRemovePair + // + resources->ApplyResources(this->buttonRemovePair, L"buttonRemovePair"); + this->buttonRemovePair->Name = L"buttonRemovePair"; + this->buttonRemovePair->UseVisualStyleBackColor = true; + this->buttonRemovePair->Click += gcnew System::EventHandler(this, &Form1::buttonRemovePair_Click); + // + // buttonAddPair + // + resources->ApplyResources(this->buttonAddPair, L"buttonAddPair"); + this->buttonAddPair->Name = L"buttonAddPair"; + this->buttonAddPair->UseVisualStyleBackColor = true; + this->buttonAddPair->Click += gcnew System::EventHandler(this, &Form1::buttonAddPair_Click); + // + // buttonApply + // + resources->ApplyResources(this->buttonApply, L"buttonApply"); + this->buttonApply->Name = L"buttonApply"; + this->buttonApply->UseVisualStyleBackColor = true; + this->buttonApply->Click += gcnew System::EventHandler(this, &Form1::buttonApply_Click); + // + // buttonReset + // + resources->ApplyResources(this->buttonReset, L"buttonReset"); + this->buttonReset->Name = L"buttonReset"; + this->buttonReset->UseVisualStyleBackColor = true; + this->buttonReset->Click += gcnew System::EventHandler(this, &Form1::buttonReset_Click); + // // Form1 // resources->ApplyResources(this, L"$this"); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; + this->Controls->Add(this->HiddenModeA); + this->Controls->Add(this->HiddenModeB); this->Controls->Add(this->pinNameB_OPEN); this->Controls->Add(this->pinNameB_OUT1); *************** *** 569,572 **** --- 594,598 ---- DeclareControlPair(CheckBox, PlugInMode) DeclareControlPair(CheckBox, ExclusiveMode) + DeclareControlPair(CheckBox, HiddenMode) #define ForEachControlPair(func) \ *************** *** 576,579 **** --- 602,606 ---- PlugInMode_##func; \ ExclusiveMode_##func; \ + HiddenMode_##func; \ private: Index: Form1.resx =================================================================== RCS file: /cvsroot/com0com/com0com/setupg/Form1.resx,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Form1.resx 8 Apr 2008 12:28:52 -0000 1.4 --- Form1.resx 4 May 2008 09:56:47 -0000 1.5 *************** *** 149,153 **** </data> <data name=">>PortNameB.ZOrder" xml:space="preserve"> ! <value>33</value> </data> <data name="PortNameA.Location" type="System.Drawing.Point, System.Drawing"> --- 149,153 ---- </data> <data name=">>PortNameB.ZOrder" xml:space="preserve"> ! <value>37</value> </data> [...1042 lines suppressed...] ! <data name=">>buttonReset.Parent" xml:space="preserve"> ! <value>$this</value> ! </data> ! <data name=">>buttonReset.ZOrder" xml:space="preserve"> ! <value>32</value> </data> <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> *************** *** 1341,1345 **** </data> <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing"> ! <value>593, 381</value> </data> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> --- 1408,1412 ---- </data> <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing"> ! <value>593, 423</value> </data> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |