Leaked source code of windows server 2003
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.

164 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. _read.c
  5. Abstract:
  6. Author:
  7. Thomas J. Dimitri (TommyD) 08-May-1992
  8. Environment:
  9. Kernel Mode - Or whatever is the equivalent on OS/2 and DOS.
  10. Revision History:
  11. --*/
  12. #include "asyncall.h"
  13. #define RAISEIRQL
  14. #if DBG
  15. ULONG UlFramesUp = 0;
  16. #endif
  17. #ifdef LALALA
  18. PVOID CurrentWatchPoint=0;
  19. static
  20. VOID
  21. AsyncSetBreakPoint(
  22. PVOID LinearAddress) {
  23. ASSERT(CurrentWatchPoint == 0);
  24. CurrentWatchPoint = LinearAddress;
  25. _asm {
  26. mov eax, LinearAddress
  27. mov dr0, eax
  28. mov eax, dr7
  29. or eax, 10303h
  30. mov dr7, eax
  31. }
  32. }
  33. static
  34. VOID
  35. AsyncRemoveBreakPoint(
  36. PVOID LinearAddress) {
  37. ASSERT(CurrentWatchPoint == LinearAddress);
  38. CurrentWatchPoint = 0;
  39. _asm {
  40. mov eax, dr7
  41. mov ebx, 10003h
  42. not ebx
  43. and eax, ebx
  44. mov dr7, eax
  45. }
  46. }
  47. #endif
  48. // the function below is called by an executive worker thread
  49. // to start reading frames.
  50. NTSTATUS
  51. AsyncStartReads(
  52. PASYNC_INFO pInfo
  53. )
  54. /*++
  55. --*/
  56. {
  57. UCHAR eventChar;
  58. //
  59. // Initialize locals.
  60. //
  61. //
  62. // assign back ptr from frame to adapter
  63. //
  64. pInfo->AsyncFrame->Adapter = pInfo->Adapter;
  65. //
  66. // assign other back ptr
  67. //
  68. pInfo->AsyncFrame->Info = pInfo;
  69. //
  70. // set baud rate and timeouts
  71. // we use a linkspeed of 0 to indicate
  72. // no read interval timeout
  73. //
  74. SetSerialStuff(NULL, pInfo, 0);
  75. eventChar = PPP_FLAG_BYTE;
  76. if (pInfo->GetLinkInfo.RecvFramingBits & SLIP_FRAMING) {
  77. eventChar = SLIP_END_BYTE;
  78. }
  79. SerialSetEventChar(pInfo, eventChar);
  80. //
  81. // We will wait on whenever we get the special PPP flag byte
  82. // or whenever we get RLSD or DSR changes (for possible hang-up
  83. // cases) or when the receive buffer is getting full.
  84. //
  85. SerialSetWaitMask(pInfo, pInfo->WaitMaskToUse) ;
  86. //
  87. // For SLIP and PPP reads we use the AsyncPPPRead routine.
  88. //
  89. AsyncPPPRead(pInfo);
  90. return NDIS_STATUS_SUCCESS;
  91. }
  92. VOID
  93. AsyncIndicateFragment(
  94. IN PASYNC_INFO pInfo,
  95. IN ULONG Error)
  96. {
  97. PASYNC_ADAPTER pAdapter=pInfo->Adapter;
  98. NDIS_MAC_FRAGMENT AsyncFragment;
  99. AsyncFragment.NdisLinkContext = pInfo->NdisLinkContext;
  100. AsyncFragment.Errors = Error;
  101. //
  102. // Tell the transport above (or really RasHub) that a frame
  103. // was just dropped. Give the endpoint when doing so.
  104. //
  105. NdisMIndicateStatus(
  106. pAdapter->MiniportHandle,
  107. NDIS_STATUS_WAN_FRAGMENT, // General Status
  108. &AsyncFragment, // Specific Status (address)
  109. sizeof(NDIS_MAC_FRAGMENT));
  110. }