From b5282ea6fbe2d288eb53c8319fa4936e134174bf Mon Sep 17 00:00:00 2001 From: Able Date: Sun, 1 Dec 2024 06:45:34 -0600 Subject: [PATCH] rtc+tempfs skeleton --- sysdata/programs/rtc_driver/README.md | 1 + sysdata/programs/rtc_driver/meta.toml | 11 ++++++ sysdata/programs/rtc_driver/src/main.hb | 12 +++++++ sysdata/programs/tempfs/README.md | 2 ++ sysdata/programs/tempfs/meta.toml | 11 ++++++ sysdata/programs/tempfs/src/main.hb | 12 +++++++ .../programs/test/src/tests/stn/allocators.hb | 34 +++++++++---------- sysdata/system_config.toml | 4 +-- 8 files changed, 68 insertions(+), 19 deletions(-) create mode 100644 sysdata/programs/rtc_driver/README.md create mode 100644 sysdata/programs/rtc_driver/meta.toml create mode 100644 sysdata/programs/rtc_driver/src/main.hb create mode 100644 sysdata/programs/tempfs/README.md create mode 100644 sysdata/programs/tempfs/meta.toml create mode 100644 sysdata/programs/tempfs/src/main.hb diff --git a/sysdata/programs/rtc_driver/README.md b/sysdata/programs/rtc_driver/README.md new file mode 100644 index 0000000..fcdbc3f --- /dev/null +++ b/sysdata/programs/rtc_driver/README.md @@ -0,0 +1 @@ +# rtc_driver \ No newline at end of file diff --git a/sysdata/programs/rtc_driver/meta.toml b/sysdata/programs/rtc_driver/meta.toml new file mode 100644 index 0000000..0bc58c1 --- /dev/null +++ b/sysdata/programs/rtc_driver/meta.toml @@ -0,0 +1,11 @@ +[package] +name = "rtc_driver" +authors = [""] + +[dependants.libraries] + +[dependants.binaries] +hblang.version = "1.0.0" + +[build] +command = "hblang src/main.hb" diff --git a/sysdata/programs/rtc_driver/src/main.hb b/sysdata/programs/rtc_driver/src/main.hb new file mode 100644 index 0000000..cac7f94 --- /dev/null +++ b/sysdata/programs/rtc_driver/src/main.hb @@ -0,0 +1,12 @@ +stn := @use("../../../libraries/stn/src/lib.hb"); +.{sleep, log, memory} := stn + +main := fn(): int { + loop { + log.info("BEFORE\0") + sleep.sleep_until_interrupt(8) + log.info("AFTER\0") + } + + return 0 +} \ No newline at end of file diff --git a/sysdata/programs/tempfs/README.md b/sysdata/programs/tempfs/README.md new file mode 100644 index 0000000..922a5c3 --- /dev/null +++ b/sysdata/programs/tempfs/README.md @@ -0,0 +1,2 @@ +# tempfs +A ram backed filesystem for ableOS. \ No newline at end of file diff --git a/sysdata/programs/tempfs/meta.toml b/sysdata/programs/tempfs/meta.toml new file mode 100644 index 0000000..afc65ec --- /dev/null +++ b/sysdata/programs/tempfs/meta.toml @@ -0,0 +1,11 @@ +[package] +name = "tempfs" +authors = [""] + +[dependants.libraries] + +[dependants.binaries] +hblang.version = "1.0.0" + +[build] +command = "hblang src/main.hb" diff --git a/sysdata/programs/tempfs/src/main.hb b/sysdata/programs/tempfs/src/main.hb new file mode 100644 index 0000000..55ef42e --- /dev/null +++ b/sysdata/programs/tempfs/src/main.hb @@ -0,0 +1,12 @@ +stn := @use("../../../libraries/stn/src/lib.hb"); +.{sleep} := stn + +main := fn(): int { + tmpfs_buffer := buffer.create("TmpFS\0") + loop { + // TODO + // sleep.sleep_until_buffer(tmpfs_buffer) + } + + return 0 +} \ No newline at end of file diff --git a/sysdata/programs/test/src/tests/stn/allocators.hb b/sysdata/programs/test/src/tests/stn/allocators.hb index 8b194b7..ac23ef3 100644 --- a/sysdata/programs/test/src/tests/stn/allocators.hb +++ b/sysdata/programs/test/src/tests/stn/allocators.hb @@ -6,25 +6,25 @@ AStruct := struct { } test := fn(): uint { - // alloc := allocators.FakeAlloc.init() - // astruct := alloc.alloc(AStruct, 2) - // if astruct.ptr != null{ - // panic.panic("FakeAlloc actually allocated.") - // } - // alloc.dealloc(&astruct.ptr, AStruct, 2) - // alloc.deinit() + alloc := allocators.FakeAlloc.init() + astruct := alloc.alloc(AStruct, 2) + if astruct.ptr != null { + panic.panic("FakeAlloc actually allocated.") + } + alloc.dealloc(&astruct.ptr, AStruct, 2) + alloc.deinit() balloc := allocators.BlockAlloc.init() - // defer { - // balloc.deinit() - // } + defer { + balloc.deinit() + } bstruct := balloc.alloc(AStruct, 2) - // if bstruct.ptr == null { - // log.info("Hi\0") - // // panic.panic("BlockAlloc actually didn't allocate.") - // } else { - // log.info("Allocator functioned.\0") - // } - // balloc.dealloc(bstruct_ptr, AStruct, 2) + if bstruct.ptr == null { + log.info("Hi\0") + // panic.panic("BlockAlloc actually didn't allocate.") + } else { + log.info("Allocator functioned.\0") + } + balloc.dealloc(&bstruct.ptr, AStruct, 2) return 0 } \ No newline at end of file diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 297b1b3..79f6f3d 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -49,5 +49,5 @@ path = "boot:///sunset_server.hbf" # [boot.limine.ableos.modules.pcspkr] # path = "boot:///pcspkr.hbf" -# [boot.limine.ableos.modules.test] -# path = "boot:///test.hbf" +[boot.limine.ableos.modules.rtc_driver] +path = "boot:///rtc_driver.hbf"