m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2018-05-18 14:23:53 +0200
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2018-05-18 14:23:53 +0200
commitd7ac0204c65b576978354f3767e8a8f29211424d (patch)
treec75c2042f5bee6f51924c6908919bd2df9180723
parent1a8a5e5f7ec151c38eec7b4d0ca4835fc717e010 (diff)
Define private surface data
-rw-r--r--char.h1
-rw-r--r--harddoomdev.c1
-rw-r--r--pci.c1
-rw-r--r--pci.h8
-rw-r--r--private_data.h26
-rw-r--r--surface.c1
-rw-r--r--util.h1
7 files changed, 30 insertions, 9 deletions
diff --git a/char.h b/char.h
index a708023..63152a1 100644
--- a/char.h
+++ b/char.h
@@ -4,6 +4,7 @@
#include <linux/pci.h>
#include "pci.h"
+#include "private_data.h"
int new_doomdev(struct pci_dev *dev);
void destroy_doomdev(struct doom_data *doom_data);
diff --git a/harddoomdev.c b/harddoomdev.c
index f903b10..00ef6f7 100644
--- a/harddoomdev.c
+++ b/harddoomdev.c
@@ -3,6 +3,7 @@
#include "harddoom.h"
#include "doomcode.h"
#include "pci.h"
+#include "private_data.h"
void doomdev_write(void __iomem *iomem, size_t addr, uint32_t data)
{
diff --git a/pci.c b/pci.c
index 833a72e..e4cfde6 100644
--- a/pci.c
+++ b/pci.c
@@ -7,6 +7,7 @@
#include "harddoom.h"
#include "util.h"
#include "harddoomdev.h"
+#include "private_data.h"
int init_pci(struct pci_dev *dev) {
struct doom_data *doom_data;
diff --git a/pci.h b/pci.h
index 9386703..377530e 100644
--- a/pci.h
+++ b/pci.h
@@ -1,14 +1,6 @@
#ifndef PCI_H
#define PCI_H
-#include <linux/device.h>
-
-struct doom_data {
- struct cdev *cdev;
- struct device *device;
- void __iomem *iomem;
-};
-
int pci_init(void);
void pci_cleanup(void);
diff --git a/private_data.h b/private_data.h
new file mode 100644
index 0000000..38148bd
--- /dev/null
+++ b/private_data.h
@@ -0,0 +1,26 @@
+#ifndef PRIVATE_DATA_H
+#define PRIVATE_DATA_H
+
+#include <linux/device.h>
+#include <linux/cdev.h>
+
+struct doom_data {
+ struct cdev cdev;
+ struct device *device;
+ struct device *pci_device;
+ void __iomem *iomem;
+};
+
+struct surface_data {
+ struct doom_data *doom_data;
+
+ int surface_size;
+ int pages;
+
+ uint8_t *surface_cpu;
+ uint32_t *page_table_cpu;
+ dma_addr_t surface_dev;
+ dma_addr_t page_table_dev;
+};
+
+#endif
diff --git a/surface.c b/surface.c
index 8400e3f..7dd4793 100644
--- a/surface.c
+++ b/surface.c
@@ -2,6 +2,7 @@
#include <linux/file.h>
#include <linux/fs.h>
+#include "private_data.h"
#include "surface.h"
long surface_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
diff --git a/util.h b/util.h
index 7a64462..8c56f67 100644
--- a/util.h
+++ b/util.h
@@ -16,6 +16,5 @@
goto label; \
} \
})
-
#endif