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.

101 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1990, 1991 Microsoft Corporation
  3. Module Name:
  4. hwapm.c
  5. Abstract:
  6. Author:
  7. Environment:
  8. Real mode.
  9. Revision History:
  10. --*/
  11. #include "hwdetect.h"
  12. #include <string.h>
  13. #if defined(NEC_98)
  14. #define _PNP_POWER_ 1
  15. #endif
  16. #if _PNP_POWER_
  17. #include "apm.h"
  18. #if defined(NEC_98)
  19. //
  20. // interface api numbers
  21. //
  22. #define PC98_APM_INSTALLATION_CHECK 0x9A00
  23. #define PC98_APM_REAL_MODE_CONNECT 0x9A01
  24. #define PC98_APM_PROTECT_MODE_16bit_CONNECT 0x9A02
  25. #define PC98_APM_DISCONNECT 0x9A04
  26. #define PC98_APM_DRIVER_VERSION 0x9A3E
  27. #define APM_MODE_16BIT 0x0001
  28. #endif // PC98
  29. VOID Int15 (PULONG, PULONG, PULONG, PULONG, PULONG);
  30. BOOLEAN
  31. HwGetApmSystemData(
  32. IN PAPM_REGISTRY_INFO ApmEntry
  33. )
  34. {
  35. ULONG RegEax, RegEbx, RegEcx, RegEdx, CyFlag;
  36. //
  37. // Perform APM installation check
  38. //
  39. #if defined(NEC_98)
  40. RegEax = PC98_APM_INSTALLATION_CHECK;
  41. #else // PC98
  42. RegEax = APM_INSTALLATION_CHECK;
  43. #endif // PC98
  44. RegEbx = APM_DEVICE_BIOS;
  45. Int15 (&RegEax, &RegEbx, &RegEcx, &RegEdx, &CyFlag);
  46. if (CyFlag ||
  47. (RegEbx & 0xff) != 'M' ||
  48. ((RegEbx >> 8) & 0xff) != 'P') {
  49. return FALSE;
  50. }
  51. ApmEntry->ApmRevMajor = (UCHAR) (RegEax >> 8) & 0xff;
  52. ApmEntry->ApmRevMinor = (UCHAR) RegEax & 0xff;
  53. ApmEntry->ApmInstallFlags = (USHORT) RegEcx;
  54. //
  55. // Connect to 32 bit interface
  56. //
  57. #if defined(NEC_98)
  58. RegEax = PC98_APM_PROTECT_MODE_16bit_CONNECT;
  59. #else // PC98
  60. RegEax = APM_PROTECT_MODE_16bit_CONNECT;
  61. #endif // PC98
  62. RegEbx = APM_DEVICE_BIOS;
  63. Int15 (&RegEax, &RegEbx, &RegEcx, &RegEdx, &CyFlag);
  64. if (CyFlag) {
  65. return FALSE;
  66. }
  67. ApmEntry->Code16BitSegmentBase = (USHORT) RegEax;
  68. ApmEntry->Code16BitOffset = (USHORT) RegEbx;
  69. ApmEntry->Data16BitSegment = (USHORT) RegEcx;
  70. return TRUE;
  71. }
  72. #endif // _PNP_POWER_