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 /* -----------------------------------------------
23Memory / I/O / Registers
24----------------------------------------------- */
25
40
41/* -----------------------------------------------
42 General
43 ----------------------------------------------- */
44
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 (WD_ENABLED_INT_TYPE_GET_ENABLED_INT_TYPE_BITS( \
193 ((PWDC_DEVICE)pDev)->Int.dwEnabledIntType))
194
204#define WDC_GET_INT_OPTIONS(pDev) ((PWDC_DEVICE)pDev)->Int.dwOptions
205
216#define WDC_INT_IS_MSI(dwIntType) \
217 (WD_ENABLED_INT_TYPE_GET_ENABLED_INT_TYPE_BITS(dwIntType) & \
218 (INTERRUPT_MESSAGE | INTERRUPT_MESSAGE_X))
219
233#define WDC_GET_NUM_VECTORS(pDev) \
234 ((pDev->Int.dwEnabledIntType) >> \
235 WD_ENABLED_INT_TYPE_NUM_VECTORS_POSITION_BITS)
236
246#define WDC_GET_ENABLED_INT_LAST_MSG(pDev) \
247 WDC_INT_IS_MSI(WDC_GET_ENABLED_INT_TYPE(pDev)) ? \
248 (((PWDC_DEVICE)pDev)->Int.dwLastMessage) : 0
249
250#ifdef __cplusplus
251}
252#endif
253
254#endif /* _WDC_DEFS_H_ */
255
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
struct WDC_ADDR_DESC WDC_ADDR_DESC
Address space information struct.
size_t UPTR
Definition windrvr.h:382
unsigned __int64 UINT64
Definition windrvr.h:318
UINT32 KPTR
Definition windrvr.h:376
#define PAD_TO_64(pName)
Definition windrvr_usb.h:15