source: trunk/src/win32k/dev16/d16strat.c@ 1330

Last change on this file since 1330 was 847, checked in by bird, 26 years ago

Initial checkin of Win32k. (not tested & pe2lx not up-to-date!)

File size: 4.9 KB
Line 
1/* $Id: d16strat.c,v 1.1 1999-09-06 02:19:55 bird Exp $
2 *
3 * d16strat.c - 16-bit strategy routine, device headers, device_helper (ptr)
4 * and 16-bit IOClts.
5 *
6 * Copyright (c) 1999 knut st. osmundsen
7 *
8 */
9
10/*******************************************************************************
11* Defined Constants *
12*******************************************************************************/
13#define INCL_DOSERRORS
14#define INCL_NOPMAPI
15
16/*******************************************************************************
17* Header Files *
18*******************************************************************************/
19#include <os2.h>
20#include <devhdr.h>
21#include <devcmd.h>
22#include <strat2.h>
23#include <reqpkt.h>
24#include <dhcalls.h>
25
26/* Note that C-library function are only allowed during init! */
27
28#include "dev1632.h"
29#include "dev16.h"
30
31
32/*******************************************************************************
33* Global Variables *
34*******************************************************************************/
35DDHDR aDevHdrs[2] = /* This is the first piece data in the driver!!!!!!! */
36{
37 {
38 (unsigned long)(void _far *)(&aDevHdrs[1]), /* NextHeader */
39 DEVLEV_3 | DEV_30 | DEV_CHAR_DEV, /* SDevAtt */
40 (unsigned short)(void _near *)strategyAsm0, /* StrategyEP */
41 0, /* InterruptEP */
42 "win32i$ ", /* Later: elf ?*/ /* DevName */
43 0, /* SDevProtCS */
44 0, /* SDevProtDS */
45 0, /* SDevRealCS */
46 0, /* SDevRealDS */
47 DEV_16MB | DEV_IOCTL2 /* SDevCaps */
48 },
49 {
50 ~0UL, /* NextHeader */
51 DEVLEV_3 | DEV_30 | DEV_CHAR_DEV, /* SDevAtt */
52 (unsigned short)(void _near *)strategyAsm1, /* StrategyEP */
53 0, /* InterruptEP */
54 "win32k$ ", /* DevName */
55 0, /* SDevProtCS */
56 0, /* SDevProtDS */
57 0, /* SDevRealCS */
58 0, /* SDevRealDS */
59 DEV_16MB | DEV_IOCTL2 /* SDevCaps */
60 }
61};
62
63/* Note: All global variables must be initialized! *
64 * Uninitialized variables ends up in DATA32. */
65PFN Device_Help = NULL;
66ULONG TKSSBase16 = 0;
67USHORT R0FlatCS16 = 0;
68USHORT R0FlatDS16 = 0;
69
70
71/*******************************************************************************
72* Internal Functions *
73*******************************************************************************/
74USHORT NEAR dev0GenIOCtl(PRP_GENIOCTL pRp);
75USHORT NEAR dev1GenIOCtl(PRP_GENIOCTL pRp);
76
77
78/**
79 * Strategy routine.
80 * @returns Status word.
81 * @param pRpH Pointer to request packed header.
82 * @parma usDev Device number.
83 * @remark This function is called from the entrypoint in dev1st.asm
84 */
85USHORT NEAR strategy(PRPH pRpH, unsigned short usDev)
86{
87 switch (pRpH->Cmd)
88 {
89 case CMDInit: /* INIT command */
90 if (usDev == 0)
91 return dev0Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH);
92 else
93 return dev1Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH);
94
95 case CMDGenIOCTL: /* Generic IOCTL */
96 if (usDev == 0)
97 return dev0GenIOCtl((PRP_GENIOCTL)pRpH);
98 else
99 return dev1GenIOCtl((PRP_GENIOCTL)pRpH);
100
101 case CMDOpen: /* device open */
102 case CMDClose: /* device close */
103 case CMDDeInstall: /* De-Install driver */
104 case CMDShutdown:
105 return STATUS_DONE;
106
107 default:
108 return STATUS_DONE | STATUS_ERR_UNKCMD;
109 }
110}
111
112extern char end;
113
114
115/**
116 * Generic I/O Control - device 0.
117 * This will only handle the request for Ring-0 initiation.
118 * @returns Status word.
119 * @param pRp Request packet.
120 */
121USHORT dev0GenIOCtl(PRP_GENIOCTL pRp)
122{
123/* _asm int 3;*/
124 if (pRp->Category == D16_IOCTL_CAT && pRp->Function == D16_IOCTL_RING0INIT)
125 return R0Init16(pRp);
126
127 return STATUS_DONE | STERR | ERROR_I24_INVALID_PARAMETER;
128}
129
130
131/**
132 * Generic I/O Control - device 0.
133 * This will forward requests to 32-bit counterpart.
134 * @returns Status word.
135 * @param pRp Request packet.
136 */
137USHORT dev1GenIOCtl(PRP_GENIOCTL pRp)
138{
139 pRp = pRp;
140 return STATUS_DONE | STERR | ERROR_I24_INVALID_PARAMETER;
141}
142
Note: See TracBrowser for help on using the repository browser.