summaryrefslogtreecommitdiffhomepage
path: root/src/loader/dev.c
diff options
context:
space:
mode:
authorMarvin Borner2021-07-05 23:22:24 +0200
committerMarvin Borner2021-07-05 23:27:40 +0200
commit23aa6f84539ba320a91235fb81681d0754178f62 (patch)
tree972b0a4abc41900538bda23f4ac2145abf94e369 /src/loader/dev.c
parentd1476974cd612412eefc40c6dc72ba66191136fd (diff)
ACPI and config parsing
Diffstat (limited to 'src/loader/dev.c')
-rw-r--r--src/loader/dev.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/loader/dev.c b/src/loader/dev.c
index e529dfa..591d5a2 100644
--- a/src/loader/dev.c
+++ b/src/loader/dev.c
@@ -25,6 +25,16 @@ struct dev *dev_get(u8 id)
return &devices[id];
}
+void dev_foreach(enum dev_type type, u8 (*cb)(struct dev *))
+{
+ for (u8 i = 0; i < COUNT(devices); i++) {
+ struct dev *dev = &devices[i];
+ if (dev->type == type)
+ if (cb(dev))
+ break;
+ }
+}
+
u8 dev_register(enum dev_type type, char *name, u32 data,
s32 (*read)(void *, u32, u32, struct dev *),
s32 (*write)(const void *, u32, u32, struct dev *))