|
|
1.1 root 1: /******************************Module*Header*******************************\
2: * Module Name: hardware.c
3: *
4: * Hardware dependent initialization
5: *
6: * Copyright (c) 1992 Microsoft Corporation
7: *
8: \**************************************************************************/
9:
10:
11: #include "driver.h"
12:
13:
14: /****************************************************************************
15: *
16: ***************************************************************************/
17: BOOL DevSetPalette(HANDLE hDriver, PPALETTEENTRY lpPalette,
18: DWORD iIndex, DWORD iCount)
19: {
20:
21: ULONG ReturnedDataLength;
22: PVIDEO_CLUT pClut;
23: ULONG iSize;
24: ULONG iSizeClut;
25:
26: iSizeClut = (iCount + 2) * sizeof(ULONG);
27: pClut = (PVIDEO_CLUT) LocalAlloc(LPTR, iSizeClut);
28:
29: pClut->NumEntries = (USHORT) iCount;
30: pClut->FirstEntry = (USHORT) iIndex;
31:
32: iSize = iCount * sizeof(ULONG);
33: memcpy(pClut->LookupTable, lpPalette, iSize);
34:
35: if (!DeviceIoControl(hDriver,
36: IOCTL_VIDEO_SET_COLOR_REGISTERS,
37: (PVOID) pClut, // input buffer
38: iSizeClut,
39: NULL, // output buffer
40: 0,
41: &ReturnedDataLength,
42: NULL)) {
43:
44: RIP("XGA.DLL: Initialization error-Set color registers");
45:
46: }
47:
48: LocalFree(pClut);
49:
50: return(TRUE);
51:
52: }
53:
54:
55: /****************************************************************************
56: * vWaitForCoProcessor
57: ***************************************************************************/
58: VOID vWaitForCoProcessor(PPDEV ppdev, ULONG ulDelay)
59: {
60:
61: ULONG i;
62: ULONG j;
63: volatile ULONG iWait = 0x5555;
64:
65: DISPDBG((3, "XGA.DLL!vWaitForCoProcessor - Entry\n"));
66:
67: while (ppdev->pXgaCpRegs->XGACoprocCntl & 0x80)
68: {
69: for (i = 0; i < ulDelay; i++)
70: {
71: if (iWait & 0x80)
72: j++;
73: }
74: }
75: }
76:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.