summaryrefslogtreecommitdiffstats
path: root/include/driver.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-07-05 18:01:23 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-07-05 18:01:23 +0200
commitabfbbad1eb897c58d2ebc918a8b91cf1ea226c5f (patch)
treedd9ea8d7369c4c8e8c04da9725b3eb437980db30 /include/driver.h
parent11a0b5a0dd5f092777de41db00f3ffa8a95d698c (diff)
downloadbarebox-abfbbad1eb897c58d2ebc918a8b91cf1ea226c5f.tar.gz
barebox-abfbbad1eb897c58d2ebc918a8b91cf1ea226c5f.tar.xz
svn_rev_109
do not know anymore
Diffstat (limited to 'include/driver.h')
-rw-r--r--include/driver.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/include/driver.h b/include/driver.h
new file mode 100644
index 0000000000..428a3b961a
--- /dev/null
+++ b/include/driver.h
@@ -0,0 +1,52 @@
+#ifndef DRIVER_H
+#define DRIVER_H
+
+#define MAX_DRIVER_NAME 16
+
+#define MAP_READ 1
+#define MAP_WRITE 2
+
+struct memarea_info;
+
+struct device_d {
+ char name[MAX_DRIVER_NAME];
+
+ unsigned long size;
+
+ /* For devices which are directly mapped into memory, i.e. NOR Flash or
+ * SDRAM.
+ */
+ unsigned long map_base;
+ unsigned long map_flags;
+
+ void *platform_data;
+
+ /* The driver for this device */
+ struct driver_d *driver;
+
+ struct device_d *next;
+
+ struct partition *part;
+};
+
+struct driver_d {
+ char name[MAX_DRIVER_NAME];
+
+ void *priv;
+
+ struct driver_d *next;
+
+ int (*probe) (struct device_d *);
+ ssize_t (*read) (struct device_d*, void* buf, size_t count, unsigned long offset);
+ ssize_t (*write) (struct device_d*, void* buf, size_t count, unsigned long offset);
+ ssize_t (*erase) (struct device_d*, struct memarea_info *);
+};
+
+int register_driver(struct driver_d *);
+int register_device(struct device_d *);
+void unregister_device(struct device_d *);
+
+struct device_d *device_from_spec_str(const char *str, char **endp);
+struct device_d *get_device_by_name(char *name);
+#endif /* DRIVER_H */
+