dbgioctl.h 6.7 KB

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