Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * |
| 4 | Copyright (c) Eicon Technology Corporation, 2000. |
| 5 | * |
| 6 | This source file is supplied for the use with Eicon |
| 7 | Technology Corporation's range of DIVA Server Adapters. |
| 8 | * |
| 9 | This program is free software; you can redistribute it and/or modify |
| 10 | it under the terms of the GNU General Public License as published by |
| 11 | the Free Software Foundation; either version 2, or (at your option) |
| 12 | any later version. |
| 13 | * |
| 14 | This program is distributed in the hope that it will be useful, |
| 15 | but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY |
| 16 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 17 | See the GNU General Public License for more details. |
| 18 | * |
| 19 | You should have received a copy of the GNU General Public License |
| 20 | along with this program; if not, write to the Free Software |
| 21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 | * |
| 23 | */ |
| 24 | /*------------------------------------------------------------------*/ |
| 25 | /* file: dbgioctl.h */ |
| 26 | /*------------------------------------------------------------------*/ |
| 27 | |
| 28 | #if !defined(__DBGIOCTL_H__) |
| 29 | |
| 30 | #define __DBGIOCTL_H__ |
| 31 | |
| 32 | #ifdef NOT_YET_NEEDED |
| 33 | /* |
| 34 | * The requested operation is passed in arg0 of DbgIoctlArgs, |
| 35 | * additional arguments (if any) in arg1, arg2 and arg3. |
| 36 | */ |
| 37 | |
| 38 | typedef struct |
| 39 | { ULONG arg0 ; |
| 40 | ULONG arg1 ; |
| 41 | ULONG arg2 ; |
| 42 | ULONG arg3 ; |
| 43 | } DbgIoctlArgs ; |
| 44 | |
| 45 | #define DBG_COPY_LOGS 0 /* copy debugs to user until buffer full */ |
| 46 | /* arg1: size threshold */ |
| 47 | /* arg2: timeout in milliseconds */ |
| 48 | |
| 49 | #define DBG_FLUSH_LOGS 1 /* flush pending debugs to user buffer */ |
| 50 | /* arg1: internal driver id */ |
| 51 | |
| 52 | #define DBG_LIST_DRVS 2 /* return the list of registered drivers */ |
| 53 | |
| 54 | #define DBG_GET_MASK 3 /* get current debug mask of driver */ |
| 55 | /* arg1: internal driver id */ |
| 56 | |
| 57 | #define DBG_SET_MASK 4 /* set/change debug mask of driver */ |
| 58 | /* arg1: internal driver id */ |
| 59 | /* arg2: new debug mask */ |
| 60 | |
| 61 | #define DBG_GET_BUFSIZE 5 /* get current buffer size of driver */ |
| 62 | /* arg1: internal driver id */ |
| 63 | /* arg2: new debug mask */ |
| 64 | |
| 65 | #define DBG_SET_BUFSIZE 6 /* set new buffer size of driver */ |
| 66 | /* arg1: new buffer size */ |
| 67 | |
| 68 | /* |
| 69 | * common internal debug message structure |
| 70 | */ |
| 71 | |
| 72 | typedef struct |
| 73 | { unsigned short id ; /* virtual driver id */ |
| 74 | unsigned short type ; /* special message type */ |
| 75 | unsigned long seq ; /* sequence number of message */ |
| 76 | unsigned long size ; /* size of message in bytes */ |
| 77 | unsigned long next ; /* offset to next buffered message */ |
| 78 | LARGE_INTEGER NTtime ; /* 100 ns since 1.1.1601 */ |
| 79 | unsigned char data[4] ;/* message data */ |
| 80 | } OldDbgMessage ; |
| 81 | |
| 82 | typedef struct |
| 83 | { LARGE_INTEGER NTtime ; /* 100 ns since 1.1.1601 */ |
| 84 | unsigned short size ; /* size of message in bytes */ |
| 85 | unsigned short ffff ; /* always 0xffff to indicate new msg */ |
| 86 | unsigned short id ; /* virtual driver id */ |
| 87 | unsigned short type ; /* special message type */ |
| 88 | unsigned long seq ; /* sequence number of message */ |
| 89 | unsigned char data[4] ;/* message data */ |
| 90 | } DbgMessage ; |
| 91 | |
| 92 | #endif |
| 93 | |
| 94 | #define DRV_ID_UNKNOWN 0x0C /* for messages via prtComp() */ |
| 95 | |
| 96 | #define MSG_PROC_FLAG 0x80 |
| 97 | #define MSG_PROC_NO_GET(x) (((x) & MSG_PROC_FLAG) ? (((x) >> 4) & 7) : -1) |
| 98 | #define MSG_PROC_NO_SET(x) (MSG_PROC_FLAG | (((x) & 7) << 4)) |
| 99 | |
| 100 | #define MSG_TYPE_DRV_ID 0x0001 |
| 101 | #define MSG_TYPE_FLAGS 0x0002 |
| 102 | #define MSG_TYPE_STRING 0x0003 |
| 103 | #define MSG_TYPE_BINARY 0x0004 |
| 104 | |
| 105 | #define MSG_HEAD_SIZE ((unsigned long)&(((DbgMessage *)0)->data[0])) |
| 106 | #define MSG_ALIGN(len) (((unsigned long)(len) + MSG_HEAD_SIZE + 3) & ~3) |
| 107 | #define MSG_SIZE(pMsg) MSG_ALIGN((pMsg)->size) |
| 108 | #define MSG_NEXT(pMsg) ((DbgMessage *)( ((char *)(pMsg)) + MSG_SIZE(pMsg) )) |
| 109 | |
| 110 | #define OLD_MSG_HEAD_SIZE ((unsigned long)&(((OldDbgMessage *)0)->data[0])) |
| 111 | #define OLD_MSG_ALIGN(len) (((unsigned long)(len)+OLD_MSG_HEAD_SIZE+3) & ~3) |
| 112 | |
| 113 | /* |
| 114 | * manifest constants |
| 115 | */ |
| 116 | |
| 117 | #define MSG_FRAME_MAX_SIZE 2150 /* maximum size of B1 frame */ |
| 118 | #define MSG_TEXT_MAX_SIZE 1024 /* maximum size of msg text */ |
| 119 | #define MSG_MAX_SIZE MSG_ALIGN(MSG_FRAME_MAX_SIZE) |
| 120 | #define DBG_MIN_BUFFER_SIZE 0x00008000 /* minimal total buffer size 32 KB */ |
| 121 | #define DBG_DEF_BUFFER_SIZE 0x00020000 /* default total buffer size 128 KB */ |
| 122 | #define DBG_MAX_BUFFER_SIZE 0x00400000 /* maximal total buffer size 4 MB */ |
| 123 | |
| 124 | #define DBGDRV_NAME "Diehl_DIMAINT" |
| 125 | #define UNIDBG_DRIVER L"\\Device\\Diehl_DIMAINT" /* UNICODE name for kernel */ |
| 126 | #define DEBUG_DRIVER "\\\\.\\" DBGDRV_NAME /* traditional string for apps */ |
| 127 | #define DBGVXD_NAME "DIMAINT" |
| 128 | #define DEBUG_VXD "\\\\.\\" DBGVXD_NAME /* traditional string for apps */ |
| 129 | |
| 130 | /* |
| 131 | * Special IDI interface debug construction |
| 132 | */ |
| 133 | |
| 134 | #define DBG_IDI_SIG_REQ (unsigned long)0xF479C402 |
| 135 | #define DBG_IDI_SIG_IND (unsigned long)0xF479C403 |
| 136 | #define DBG_IDI_NL_REQ (unsigned long)0xF479C404 |
| 137 | #define DBG_IDI_NL_IND (unsigned long)0xF479C405 |
| 138 | |
| 139 | typedef struct |
| 140 | { unsigned long magic_type ; |
| 141 | unsigned short data_len ; |
| 142 | unsigned char layer_ID ; |
| 143 | unsigned char entity_ID ; |
| 144 | unsigned char request ; |
| 145 | unsigned char ret_code ; |
| 146 | unsigned char indication ; |
| 147 | unsigned char complete ; |
| 148 | unsigned char data[4] ; |
| 149 | } DbgIdiAct, *DbgIdiAction ; |
| 150 | |
| 151 | /* |
| 152 | * We want to use the same IOCTL codes in Win95 and WinNT. |
| 153 | * The official constructor for IOCTL codes is the CTL_CODE macro |
| 154 | * from <winoctl.h> (<devioctl.h> in WinNT DDK environment). |
| 155 | * The problem here is that we don't know how to get <winioctl.h> |
| 156 | * working in a Win95 DDK environment! |
| 157 | */ |
| 158 | |
| 159 | # ifdef CTL_CODE /*{*/ |
| 160 | |
| 161 | /* Assert that we have the same idea of the CTL_CODE macro. */ |
| 162 | |
| 163 | #define CTL_CODE( DeviceType, Function, Method, Access ) ( \ |
| 164 | ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ |
| 165 | ) |
| 166 | |
| 167 | # else /* !CTL_CODE */ /*}{*/ |
| 168 | |
| 169 | /* Use the definitions stolen from <winioctl.h>. */ |
| 170 | |
| 171 | #define CTL_CODE( DeviceType, Function, Method, Access ) ( \ |
| 172 | ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ |
| 173 | ) |
| 174 | |
| 175 | #define METHOD_BUFFERED 0 |
| 176 | #define METHOD_IN_DIRECT 1 |
| 177 | #define METHOD_OUT_DIRECT 2 |
| 178 | #define METHOD_NEITHER 3 |
| 179 | |
| 180 | #define FILE_ANY_ACCESS 0 |
| 181 | #define FILE_READ_ACCESS ( 0x0001 ) // file & pipe |
| 182 | #define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe |
| 183 | |
| 184 | # endif /* CTL_CODE */ /*}*/ |
| 185 | |
| 186 | /* |
| 187 | * Now we can define WinNT/Win95 DeviceIoControl codes. |
| 188 | * |
| 189 | * These codes are defined in di_defs.h too, a possible mismatch will be |
| 190 | * detected when the dbgtool is compiled. |
| 191 | */ |
| 192 | |
| 193 | #define IOCTL_DRIVER_LNK \ |
| 194 | CTL_CODE(0x8001U,0x701,METHOD_OUT_DIRECT,FILE_ANY_ACCESS) |
| 195 | #define IOCTL_DRIVER_DBG \ |
| 196 | CTL_CODE(0x8001U,0x702,METHOD_OUT_DIRECT,FILE_ANY_ACCESS) |
| 197 | |
| 198 | #endif /* __DBGIOCTL_H__ */ |