CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/cache/sources/linuxpg/pgdrv.h
Views: 3959
1
#ifndef _PG_DRV_H
2
#define _PG_DRV_H
3
4
#define BYTE __u8
5
#define WORD __u16
6
#define DWORD __u32
7
#define DWORD64 __u64
8
#define BOOLEAN int
9
typedef void * PVOID;
10
typedef BYTE * PBYTE;
11
typedef WORD * PWORD;
12
typedef DWORD * PDWORD;
13
14
#ifndef TRUE
15
#define TRUE 1
16
#define FALSE 0
17
#endif
18
19
#define PRINT_LEVEL KERN_NOTICE
20
21
#ifdef DEBUG
22
#define DebugPrint(fmt,args...) printk(PRINT_LEVEL "[RTNICPG]" fmt "\n",## args)
23
#define DbgFunPrint(fmt,args...) printk(PRINT_LEVEL "[RTNICPG]" "%s %i: " fmt "\n",__FUNCTION__,__LINE__,## args)
24
#else
25
#define DebugPrint(fmt,args...) //printk(PRINT_LEVEL fmt "\n",## args)
26
#define DbgFunPrint(fmt,args...) //printk(PRINT_LEVEL "%s %i: " fmt "\n",__FUNCTION__,__LINE__,## args)
27
#endif
28
29
/*******************************************************************************
30
*******************************************************************************/
31
#define Writel(Address,Data) writel(Data,(void *)(Address))
32
#define Readl(Address) readl((void *)(Address))
33
#define Writew(Address,Data) writew(Data,(void *)(Address))
34
#define Readw(Address) readw((void *)(Address))
35
#define Writeb(Address,Data) writeb(Data,(void *)(Address))
36
#define Readb(Address) readb((void *)(Address))
37
38
#define MODULENAME "pgtool"
39
#define MAX_DEV_NUM 10
40
#define MAX_IO_SIZE 0x100
41
42
typedef struct _DEV_INFO_
43
{
44
dev_t devno;
45
bool bUsed;
46
}DEV_INFO,*PDEV_INFO;
47
48
typedef struct _PG_DEV_
49
{
50
struct cdev cdev;
51
struct pci_dev *pdev;
52
unsigned long base_phyaddr;
53
unsigned int offset;
54
unsigned int deviceID;
55
atomic_t count;
56
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
57
struct semaphore dev_sem;
58
#else
59
struct mutex dev_mutex;
60
#endif
61
unsigned int index;
62
}PGDEV,*PPGDEV;
63
64
typedef struct _PCI_CONFIG_RW_
65
{
66
union
67
{
68
unsigned char byte;
69
unsigned short word;
70
unsigned int dword;
71
};
72
unsigned int bRead:1;
73
unsigned int size:7;
74
unsigned int addr:8;
75
unsigned int reserve:16;
76
}PCI_CONFIG_RW,*PPCI_CONFIG_RW;
77
78
#define RTL_IOC_MAGIC 0x95
79
80
#define IOC_PCI_CONFIG _IOWR(RTL_IOC_MAGIC, 0, PCI_CONFIG_RW)
81
#define IOC_IOMEM_OFFSET _IOR(RTL_IOC_MAGIC, 1, unsigned int)
82
#define IOC_DEV_FUN _IOR(RTL_IOC_MAGIC, 2, unsigned int)
83
84
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
85
#define __devinit
86
#define __devexit
87
#define __devexit_p(func) func
88
#endif
89
90
#endif // end of #ifndef _PG_DRV_H
91
92