devLib2  2.12
devLibPCIImpl.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2010 Brookhaven Science Associates, as Operator of
3 * Brookhaven National Laboratory.
4 * devLib2 is distributed subject to a Software License Agreement found
5 * in file LICENSE that is included with this distribution.
6 \*************************************************************************/
7 /*
8  * Author: Michael Davidsaver <mdavidsaver@gmail.com>
9  */
10 
11 #ifndef DEVLIBPCIIMPL_H_INC
12 #define DEVLIBPCIIMPL_H_INC
13 
14 #include <stddef.h>
15 
16 #include <dbDefs.h>
17 #include <ellLib.h>
18 #include <shareLib.h>
19 #include <epicsTypes.h>
20 
21 #include "devLibPCI.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 typedef enum {
28  RD_08 = 0x01,
29  RD_16 = 0x02,
30  RD_32 = 0x04,
31  WR_08 = 0x11,
32  WR_16 = 0x12,
33  WR_32 = 0x14
35 
36 #define CFG_ACC_WIDTH(mode) ((mode) & 0x0f)
37 #define CFG_ACC_WRITE(mode) ((mode) & 0x10)
38 
39 typedef struct {
40  const char *name;
41 
42  int (*pDevInit)(void);
43 
44  int (*pDevFinal)(void);
45 
46  int (*pDevPCIFind)(const epicsPCIID *ids, devPCISearchFn searchfn, void *arg, unsigned int o);
47 
48  int (*pDevPCIToLocalAddr)(const epicsPCIDevice* dev,unsigned int bar,volatile void **a,unsigned int o);
49 
50  int (*pDevPCIBarLen)(const epicsPCIDevice* dev,unsigned int bar,epicsUInt32 *len);
51 
52  int (*pDevPCIConnectInterrupt)(const epicsPCIDevice *id,
53  void (*pFunction)(void *),
54  void *parameter,
55  unsigned int opt);
56 
57  int (*pDevPCIDisconnectInterrupt)(const epicsPCIDevice *id,
58  void (*pFunction)(void *),
59  void *parameter);
60 
61  int (*pDevPCIConfigAccess)(const epicsPCIDevice *id, unsigned offset, void *pArg, devPCIAccessMode mode);
62 
63  /* level 0 enables, higher levels disable - on error a negative value is returned */
64  int (*pDevPCISwitchInterrupt)(const epicsPCIDevice *id, int level);
65  ELLNODE node;
66 } devLibPCI;
67 
68 epicsShareFunc
69 int
71 
72 #define devLibPCIRegisterDriver(TPTR) devLibPCIRegisterDriver2(TPTR, sizeof(*(TPTR)))
73 
76 epicsShareFunc
78 
84 epicsShareFunc
85 int
86 devLibPCIMatch(const epicsPCIID *match, const epicsPCIID *dev);
87 
88 #ifdef __cplusplus
89 } /* extern "C" */
90 #endif
91 
92 #endif /* DEVLIBPCIIMPL_H_INC */
int(* devPCISearchFn)(void *ptr, const epicsPCIDevice *dev)
PCI search callback prototype.
Definition: devLibPCI.h:136
epicsShareFunc int devLibPCIRegisterDriver2(devLibPCI *, size_t)
Definition: devLibPCI.c:70
epicsShareFunc void devLibPCIRegisterBaseDefault(void)
devPCIAccessMode
Definition: devLibPCIImpl.h:27
const char * name
Definition: devLibPCIImpl.h:40
Device token.
Definition: devLibPCI.h:112
PCI device identifier.
Definition: devLibPCI.h:55
epicsShareFunc int devLibPCIMatch(const epicsPCIID *match, const epicsPCIID *dev)
Definition: devLibPCI.c:153
ELLNODE node
Definition: devLibPCIImpl.h:65