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.

85 lines
2.3 KiB

  1. /*****************************************************************************
  2. ** **
  3. ** COPYRIGHT (C) 2000, 2001 MKNET CORPORATION **
  4. ** DEVELOPED FOR THE MK7100-BASED VFIR PCI CONTROLLER. **
  5. ** **
  6. *****************************************************************************/
  7. /**********************************************************************
  8. Module Name:
  9. UTIL.C
  10. Routines:
  11. GetPacketInfo
  12. ProcReturnedRpd
  13. Comments:
  14. Various utilities to assist in operating in the NDIS env.
  15. **********************************************************************/
  16. #include "precomp.h"
  17. //#include "protot.h"
  18. #pragma hdrstop
  19. //-----------------------------------------------------------------------------
  20. // Procedure: [GetPacketInfo]
  21. //
  22. //-----------------------------------------------------------------------------
  23. PNDIS_IRDA_PACKET_INFO GetPacketInfo(PNDIS_PACKET packet)
  24. {
  25. MEDIA_SPECIFIC_INFORMATION *mediaInfo;
  26. UINT size;
  27. NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(packet, &mediaInfo, &size);
  28. return (PNDIS_IRDA_PACKET_INFO)mediaInfo->ClassInformation;
  29. }
  30. //----------------------------------------------------------------------
  31. // Procedure: [ProcReturnedRpd]
  32. //
  33. // Description: Process a RPD (previously indicated pkt) being returned
  34. // to us from NDIS.
  35. //
  36. //----------------------------------------------------------------------
  37. VOID ProcReturnedRpd(PMK7_ADAPTER Adapter, PRPD rpd)
  38. {
  39. NdisAdjustBufferLength(rpd->ReceiveBuffer, MK7_MAXIMUM_PACKET_SIZE);
  40. //******************************
  41. // If a RCB is waiting for a RPD, bind the RPD to the RCB-RRD
  42. // and give the RCB-RRD to hw. Else, put the RPD on FreeRpdList.
  43. //******************************
  44. if (Adapter->rcbPendRpdCnt > 0) {
  45. PRCB rcb;
  46. rcb = Adapter->pRcbArray[Adapter->rcbPendRpdIdx];
  47. rcb->rpd = rpd;
  48. rcb->rrd->addr = rpd->databuffphys;
  49. rcb->rrd->count = 0;
  50. GrantRrdToHw(rcb->rrd);
  51. Adapter->rcbPendRpdCnt--;
  52. //****************************************
  53. // If more RCBs waiting for RPDs then need to
  54. // bump the index up, taking care of wrapping.
  55. //****************************************
  56. if (Adapter->rcbPendRpdCnt > 0) {
  57. Adapter->rcbPendRpdIdx++;
  58. Adapter->rcbPendRpdIdx %= Adapter->NumRcb;
  59. }
  60. }
  61. else {
  62. QueuePutTail(&Adapter->FreeRpdList, &rpd->link);
  63. }
  64. }