[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cdi-devel] [PATCH v2] Various cleanups and portability fixes
Hi,
This patch removes the CDI_DRIVER_CONST macro created previously, as well as the following:
* Added a few structures to cdi-osdep.h to clean up some tyndur-specific elements in some functions
* Added extern "C" to header files where necessary in order to handle C++ linkage problems
Cheers,
Matt
Signed-off-by: Matthew Iselin <matthew@xxxxxxxxxxxxxx>
---
include/cdi-osdep.h | 20 +++++++++++++++++++-
include/cdi/dma.h | 5 ++---
include/cdi/lists.h | 8 ++++++++
include/cdi/misc.h | 8 ++++++++
include/cdi/net.h | 8 ++++++++
include/cdi/pci.h | 3 +++
include/cdi/storage.h | 6 ++++++
7 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/include/cdi-osdep.h b/include/cdi-osdep.h
index 6227e91..57a34a7 100644
--- a/include/cdi-osdep.h
+++ b/include/cdi-osdep.h
@@ -26,10 +26,28 @@
* the driver with the CDI library.
*
* @param name Name of the driver
- * @param drv Pointer to a driver description (struct cdi_driver*)
+ * @param drv A driver description (struct cdi_driver)
* @param deps List of names of other drivers on which this driver depends
* \endenglish
*/
#define CDI_DRIVER(name, drv, deps...) /* TODO */
+/**
+ * \english
+ * OS-specific PCI metadata.
+ * \endenglish
+ */
+typedef struct
+{
+} os_pci_meta;
+
+/**
+ * \english
+ * OS-specific DMA metadata.
+ * \endenglish
+ */
+typedef struct
+{
+} os_dma_meta;
+
#endif
diff --git a/include/cdi/dma.h b/include/cdi/dma.h
index 24f53a8..2ff19ec 100644
--- a/include/cdi/dma.h
+++ b/include/cdi/dma.h
@@ -20,9 +20,8 @@ struct cdi_dma_handle {
size_t length;
uint8_t mode;
void* buffer;
-
- // LOST-Implementation...
- FILE* file;
+
+ os_dma_meta meta;
};
// Geraet => Speicher
diff --git a/include/cdi/lists.h b/include/cdi/lists.h
index 9a3403c..53c3def 100644
--- a/include/cdi/lists.h
+++ b/include/cdi/lists.h
@@ -21,6 +21,10 @@
*/
typedef struct cdi_list_implementation* cdi_list_t;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* Erzeugt eine neue Liste
*
@@ -106,4 +110,8 @@ void* cdi_list_remove(cdi_list_t list, size_t index);
*/
size_t cdi_list_size(cdi_list_t list);
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
#endif
diff --git a/include/cdi/misc.h b/include/cdi/misc.h
index 2a130f6..2049c62 100644
--- a/include/cdi/misc.h
+++ b/include/cdi/misc.h
@@ -15,6 +15,10 @@
#include "cdi.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* Registiert einen neuen IRQ-Handler.
*
@@ -89,5 +93,9 @@ int cdi_ioports_free(uint16_t start, uint16_t count);
*/
void cdi_sleep_ms(uint32_t ms);
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
#endif
diff --git a/include/cdi/net.h b/include/cdi/net.h
index 89628bd..1fddab6 100644
--- a/include/cdi/net.h
+++ b/include/cdi/net.h
@@ -36,6 +36,10 @@ struct cdi_net_driver {
};
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* Initialisiert die Datenstrukturen fuer einen Netzerktreiber
* (erzeugt die devices-Liste)
@@ -60,6 +64,10 @@ void cdi_net_device_init(struct cdi_net_device* device);
void cdi_net_receive(
struct cdi_net_device* device, void* buffer, size_t size);
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
#endif
/*\@}*/
diff --git a/include/cdi/pci.h b/include/cdi/pci.h
index 8a9cc18..6a3be7a 100644
--- a/include/cdi/pci.h
+++ b/include/cdi/pci.h
@@ -14,6 +14,7 @@
#include <stdint.h>
#include "cdi.h"
+#include "cdi-osdep.h"
#include "cdi/lists.h"
struct cdi_pci_device {
@@ -33,6 +34,8 @@ struct cdi_pci_device {
uint8_t irq;
cdi_list_t resources;
+
+ os_pci_meta meta;
};
typedef enum {
diff --git a/include/cdi/storage.h b/include/cdi/storage.h
index d19fc6f..4963b68 100644
--- a/include/cdi/storage.h
+++ b/include/cdi/storage.h
@@ -57,6 +57,9 @@ struct cdi_storage_driver {
uint64_t count, void* buffer);
};
+#ifdef __cplusplus
+extern "C" {
+#endif
/**
* Initialisiert die Datenstrukturen fuer einen Massenspeichertreiber
@@ -80,6 +83,9 @@ void cdi_storage_driver_register(struct cdi_storage_driver* driver);
*/
void cdi_storage_device_init(struct cdi_storage_device* device);
+#ifdef __cplusplus
+}; // extern "C"
+#endif
#endif
--
1.6.0.4