Jungo WinDriver  
Official Documentation
wdc_defs.h
Go to the documentation of this file.
1/* @JUNGO_COPYRIGHT@ */
2
3#ifndef _WDC_DEFS_H_
4#define _WDC_DEFS_H_
5
6/**************************************************************************
7* File: wdc_defs.h - WD card (WDC) library low-level definitions header. *
8* This file is used by the WDC library's source files and from *
9* device-specific sample/generated code XXX library files, but not *
10* from high-level diagnostic code (wdc_diag/xxx_diag). *
11***************************************************************************/
12
13#include "wdc_lib.h"
14
15#ifdef __cplusplus
16 extern "C" {
17#endif
18
19/*************************************************************
20 General definitions
21 *************************************************************/
22/* -----------------------------------------------
23 Memory / I/O / Registers
24 ----------------------------------------------- */
25
27typedef struct {
29 BOOL fIsMemory;
32 DWORD reserved;
38 PAD_TO_64(pUserDirectMemAddr)
40
41/* -----------------------------------------------
42 General
43 ----------------------------------------------- */
44
46typedef struct WDC_DEVICE {
61 HANDLE hIntThread;
63
65 HANDLE hEvent;
67
68 PVOID pCtx;
71
72/*************************************************************
73 General utility macros
74 *************************************************************/
75/* -----------------------------------------------
76 Memory / I/O / Registers
77 ----------------------------------------------- */
78/* NOTE: pAddrDesc param should be of type WDC_ADDR_DESC* */
80#if defined(__KERNEL__)
81 #define WDC_MEM_DIRECT_ADDR(pAddrDesc) (pAddrDesc)->pAddr
82#else
83 #define WDC_MEM_DIRECT_ADDR(pAddrDesc) (pAddrDesc)->pUserDirectMemAddr
84#endif
85
87#define WDC_ADDR_IS_MEM(pAddrDesc) (pAddrDesc)->fIsMemory
88
89/* -----------------------------------------------
90 Kernel PlugIn
91 ----------------------------------------------- */
101#define WDC_GET_KP_HANDLE(pDev) \
102 ((WDC_DEVICE *)((PWDC_DEVICE)(pDev)))->kerPlug.hKernelPlugIn
103
105#define WDC_IS_KP(pDev) (BOOL)(WDC_GET_KP_HANDLE(pDev))
106
107/* -----------------------------------------------
108 General
109 ----------------------------------------------- */
110
121#define WDC_GET_PCARD(pDev) (&(((PWDC_DEVICE)(pDev))->cardReg.Card))
122
132#define WDC_GET_CARD_HANDLE(pDev) (((PWDC_DEVICE)(pDev))->cardReg.hCard)
133
143#define WDC_GET_PPCI_SLOT(pDev) (&(((PWDC_DEVICE)(pDev))->slot))
144
154#define WDC_GET_PPCI_ID(pDev) (&(((PWDC_DEVICE)(pDev))->id))
155
166#define WDC_GET_ADDR_DESC(pDev, dwAddrSpace) \
167 (&(((PWDC_DEVICE)(pDev))->pAddrDesc[dwAddrSpace]))
168
179#define WDC_GET_ADDR_SPACE_SIZE(pDev, dwAddrSpace) \
180 ((((PWDC_DEVICE)(pDev))->pAddrDesc[dwAddrSpace]).qwBytes)
181
191#define WDC_GET_ENABLED_INT_TYPE(pDev) \
192 ((PWDC_DEVICE)pDev)->Int.dwEnabledIntType
193
203#define WDC_GET_INT_OPTIONS(pDev) ((PWDC_DEVICE)pDev)->Int.dwOptions
204
215#define WDC_INT_IS_MSI(dwIntType) \
216 (dwIntType & (INTERRUPT_MESSAGE | INTERRUPT_MESSAGE_X))
217
227#define WDC_GET_ENABLED_INT_LAST_MSG(pDev) \
228 WDC_INT_IS_MSI(WDC_GET_ENABLED_INT_TYPE(pDev)) ? \
229 (((PWDC_DEVICE)pDev)->Int.dwLastMessage) : 0
230
231#ifdef __cplusplus
232}
233#endif
234
235#endif /* _WDC_DEFS_H_ */
236
UPTR pUserDirectMemAddr
Memory address for direct user-mode access.
Definition: wdc_defs.h:37
DWORD dwAddrSpace
Address space number.
Definition: wdc_defs.h:28
UINT64 qwBytes
Size of address space.
Definition: wdc_defs.h:33
DWORD reserved
Definition: wdc_defs.h:32
KPTR pAddr
I/O / Memory kernel mapped address – for WD_Transfer(), WD_MultiTransfer(), or direct kernel access.
Definition: wdc_defs.h:34
BOOL fIsMemory
TRUE: memory address space; FALSE: I/O.
Definition: wdc_defs.h:29
DWORD dwItemIndex
Index of address space in the pDev->cardReg.Card.Item array.
Definition: wdc_defs.h:30
Address space information struct.
Definition: wdc_defs.h:27
WD_PCI_ID id
PCI device ID.
Definition: wdc_defs.h:47
WD_KERNEL_PLUGIN kerPlug
Kernel PlugIn information.
Definition: wdc_defs.h:58
HANDLE hIntThread
Definition: wdc_defs.h:61
HANDLE hEvent
Definition: wdc_defs.h:65
WD_CARD_REGISTER cardReg
Device's resources information.
Definition: wdc_defs.h:56
DWORD dwNumAddrSpaces
Total number of device's address spaces.
Definition: wdc_defs.h:50
WD_EVENT Event
Event information.
Definition: wdc_defs.h:64
WD_PCI_SLOT slot
PCI device slot location information.
Definition: wdc_defs.h:48
WD_INTERRUPT Int
Interrupt information.
Definition: wdc_defs.h:60
WDC_ADDR_DESC * pAddrDesc
Array of device's address spaces information.
Definition: wdc_defs.h:53
PVOID pCtx
User-specific context.
Definition: wdc_defs.h:68
Device information struct.
Definition: wdc_defs.h:46
size_t UPTR
Definition: windrvr.h:378
unsigned __int64 UINT64
Definition: windrvr.h:314
UINT32 KPTR
Definition: windrvr.h:372
#define PAD_TO_64(pName)
Definition: windrvr_usb.h:15