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.

145 lines
2.6 KiB

  1. /*
  2. ************************************************************************
  3. *
  4. * SETTINGS.c
  5. *
  6. *
  7. * Portions Copyright (C) 1996-2001 National Semiconductor Corp.
  8. * All rights reserved.
  9. * Copyright (C) 1996-2001 Microsoft Corporation. All Rights Reserved.
  10. *
  11. *
  12. *
  13. *************************************************************************
  14. */
  15. #include "nsc.h"
  16. #include "settings.tmh"
  17. const baudRateInfo supportedBaudRateTable[NUM_BAUDRATES] = {
  18. {
  19. BAUDRATE_2400,
  20. 2400,
  21. NDIS_IRDA_SPEED_2400,
  22. },
  23. {
  24. BAUDRATE_9600,
  25. 9600,
  26. NDIS_IRDA_SPEED_9600,
  27. },
  28. {
  29. BAUDRATE_19200,
  30. 19200,
  31. NDIS_IRDA_SPEED_19200,
  32. },
  33. {
  34. BAUDRATE_38400,
  35. 38400,
  36. NDIS_IRDA_SPEED_38400,
  37. },
  38. {
  39. BAUDRATE_57600,
  40. 57600,
  41. NDIS_IRDA_SPEED_57600,
  42. },
  43. {
  44. BAUDRATE_115200,
  45. 115200,
  46. NDIS_IRDA_SPEED_115200,
  47. },
  48. {
  49. BAUDRATE_576000,
  50. 576000,
  51. NDIS_IRDA_SPEED_576K,
  52. },
  53. {
  54. BAUDRATE_1152000,
  55. 1152000,
  56. NDIS_IRDA_SPEED_1152K,
  57. },
  58. {
  59. BAUDRATE_4000000,
  60. 4000000,
  61. NDIS_IRDA_SPEED_4M,
  62. }
  63. };
  64. #if DBG
  65. // UINT dbgOpt = DBG_LOG | DBG_FIR_MODE ;
  66. UINT dbgOpt = DBG_ERR; //|DBG_FIR_MODE|DBG_SIR_MODE|DBG_BUF;
  67. #ifdef DBG_ADD_PKT_ID
  68. BOOLEAN addPktIdOn = TRUE;
  69. #endif
  70. VOID DBG_PrintBuf(PUCHAR bufptr, UINT buflen)
  71. {
  72. UINT i, linei;
  73. #define ISPRINT(ch) (((ch) >= ' ') && ((ch) <= '~'))
  74. #define PRINTCHAR(ch) (UCHAR)(ISPRINT(ch) ? (ch) : '.')
  75. DbgPrint("\r\n %d bytes @%xh:", buflen, bufptr);
  76. /*
  77. * Print whole lines of 8 characters with HEX and ASCII
  78. */
  79. for (i = 0; i+8 <= (UINT)buflen; i += 8) {
  80. UCHAR ch0 = bufptr[i+0],
  81. ch1 = bufptr[i+1], ch2 = bufptr[i+2],
  82. ch3 = bufptr[i+3], ch4 = bufptr[i+4],
  83. ch5 = bufptr[i+5], ch6 = bufptr[i+6],
  84. ch7 = bufptr[i+7];
  85. DbgPrint("\r\n %02x %02x %02x %02x %02x %02x %02x %02x"
  86. " %c %c %c %c %c %c %c %c",
  87. ch0, ch1, ch2, ch3, ch4, ch5, ch6, ch7,
  88. PRINTCHAR(ch0), PRINTCHAR(ch1),
  89. PRINTCHAR(ch2), PRINTCHAR(ch3),
  90. PRINTCHAR(ch4), PRINTCHAR(ch5),
  91. PRINTCHAR(ch6), PRINTCHAR(ch7));
  92. }
  93. /*
  94. * Print final incomplete line
  95. */
  96. DbgPrint("\r\n ");
  97. for (linei = 0; (linei < 8) && (i < buflen); i++, linei++){
  98. DbgPrint(" %02x", (UINT)(bufptr[i]));
  99. }
  100. DbgPrint(" ");
  101. i -= linei;
  102. while (linei++ < 8) DbgPrint(" ");
  103. for (linei = 0; (linei < 8) && (i < buflen); i++, linei++){
  104. UCHAR ch = bufptr[i];
  105. DbgPrint(" %c", PRINTCHAR(ch));
  106. }
  107. DbgPrint("\t\t<>\r\n");
  108. }
  109. VOID DBG_NDIS_Buffer(PNDIS_BUFFER ndisBuf);
  110. VOID DBG_NDIS_Buffer(PNDIS_BUFFER ndisBuf)
  111. {
  112. UCHAR *ptr;
  113. UINT bufLen;
  114. NdisQueryBufferSafe(ndisBuf, (PVOID *)&ptr, &bufLen,NormalPagePriority);
  115. if (ptr != NULL) {
  116. DBG_PrintBuf(ptr, bufLen);
  117. }
  118. }
  119. #endif