Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
4.0 KiB

  1. /***************************************************************************
  2. Name : FCOMINt.H
  3. Comment : Interface between FaxComm driver (entirely different for
  4. Windows and DOS) and everything else.
  5. Copyright (c) Microsoft Corp. 1991, 1992, 1993
  6. Num Date Name Description
  7. --- -------- ---------- -----------------------------------------------
  8. ***************************************************************************/
  9. #define WRITEQUANTUM (pTG->Comm.cbOutSize / 8) // totally arbitrary
  10. #define CR 0x0d
  11. #define LF 0x0a
  12. #define DLE 0x10 // DLE = ^P = 16d = 10h
  13. #define ETX 0x03
  14. #define FComGetError(pTG) \
  15. { GetCommErrorNT ( pTG, (HANDLE) pTG->Comm.nCid, &pTG->Comm.CommErr, &(pTG->Comm.comstat)); \
  16. if(pTG->Comm.CommErr) D_GotError(pTG, pTG->Comm.nCid, pTG->Comm.CommErr, &(pTG->Comm.comstat));\
  17. iModemSetError(pTG, MODEMERR_COMPORT, 0, 0); }
  18. #ifdef WIN32 // WIN32 Overlapped I/O internal routines...
  19. BOOL ov_init(PThrdGlbl pTG);
  20. BOOL ov_deinit(PThrdGlbl pTG);
  21. OVREC * ov_get(PThrdGlbl pTG);
  22. BOOL ov_write(PThrdGlbl pTG, OVREC *lpovr, LPDWORD lpdwcbWrote);
  23. BOOL ov_drain(PThrdGlbl pTG, BOOL fLongTO);
  24. BOOL ov_unget(PThrdGlbl pTG, OVREC *lpovr);
  25. BOOL iov_flush(PThrdGlbl pTG, OVREC *lpovr, BOOL fLongTO);
  26. #endif // WIN32
  27. BOOL FComGetSettings(PThrdGlbl pTG, LPFCOMSETTINGS);
  28. BOOL FComSetSettings(PThrdGlbl pTG, LPFCOMSETTINGS);
  29. // nothing
  30. #define iModemSetError(pTG, a,b,c)
  31. #ifdef WIN32
  32. # define MONINBASE
  33. # define MONOUTBASE
  34. # define MONINOUTBASE
  35. #else
  36. # define MONINBASE __based(__segname("_MONIN"))
  37. # define MONOUTBASE __based(__segname("_MONOUT"))
  38. # define MONINOUTBASE __based(__segname("_MONINOUT"))
  39. #endif
  40. /****************** begin prototypes from filter.c *****************/
  41. /****************** end of prototypes from filter.c *****************/
  42. /****************** begin prototypes from ncuparms.c *****************/
  43. void iNCUParamsReset(PThrdGlbl pTG);
  44. void FComInitGlobals(PThrdGlbl pTG);
  45. /***************** end of prototypes from ncuparms.c *****************/
  46. #ifdef DEBUG
  47. # ifndef WIN32
  48. # define SLIPMULT 2
  49. # define SLIPDIV 2
  50. # else
  51. # define SLIPMULT 1
  52. # define SLIPDIV 4
  53. # endif
  54. # define BEFORESLEEP DWORD t1, t2; t1=GetTickCount();
  55. # define AFTERSLEEP(x) t2=GetTickCount(); \
  56. if((t2-t1) > (((x)*SLIPMULT)+((x)/SLIPDIV))) \
  57. DEBUGMSG(1, ("!!!SLEPT %ld. Wanted only %d!!!\r\n", (t2-t1), (x)));
  58. #else
  59. # define BEFORESLEEP
  60. # define AFTERSLEEP(arg)
  61. #endif
  62. ////////// Variables controlling Sleep ///////////
  63. //
  64. // Comm.fBG -- used only in WFW, because can't call DllSleep in FG!
  65. // Comm.bDontYield -- enabled during T30 "critical" sections. In non-premptive
  66. // systems this should disable sleeping completely
  67. //
  68. //////////////////////////////////////////////////
  69. // ACTIVESLICE defined in mysched.h
  70. #define IDLESLICE 500
  71. #if defined(WIN32) && defined(THREAD)
  72. # define MySleep(x) \
  73. {BG_CHK(x); \
  74. { BEFORESLEEP; Sleep(pTG->Comm.bDontYield?0:(x)); AFTERSLEEP(x); }}
  75. // Note. Until 12/9/94, we used to call Sleep(1) if bDontYield as in :
  76. // if (Comm.bDontYield) { BEFORESLEEP; Sleep(1); AFTERSLEEP(x); }
  77. #endif //WIN32 && THREAD