aboutsummaryrefslogtreecommitdiff
path: root/src/drv/ps1/event
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-07-07 13:22:53 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2025-11-11 00:08:15 +0100
commit7861a52adf92a083bb2aed4c35f98d8035dce032 (patch)
tree28cd3c40e4c878f730f5df3c1d93bdf91af490c3 /src/drv/ps1/event
parent7fc48e9216ff809da5f8055a50b0be17628ef1df (diff)
downloadwnix-7861a52adf92a083bb2aed4c35f98d8035dce032.tar.gz
Setup project skeleton
Diffstat (limited to 'src/drv/ps1/event')
-rw-r--r--src/drv/ps1/event/CMakeLists.txt20
-rw-r--r--src/drv/ps1/event/include/drv/ps1/event.h31
-rw-r--r--src/drv/ps1/event/src/CMakeLists.txt23
-rw-r--r--src/drv/ps1/event/src/close.c25
-rw-r--r--src/drv/ps1/event/src/disable.c25
-rw-r--r--src/drv/ps1/event/src/enable.c25
-rw-r--r--src/drv/ps1/event/src/open.c31
-rw-r--r--src/drv/ps1/event/src/test.c28
8 files changed, 208 insertions, 0 deletions
diff --git a/src/drv/ps1/event/CMakeLists.txt b/src/drv/ps1/event/CMakeLists.txt
new file mode 100644
index 0000000..2b00aaa
--- /dev/null
+++ b/src/drv/ps1/event/CMakeLists.txt
@@ -0,0 +1,20 @@
+# wnix, a Unix-like operating system for WebAssembly applications.
+# Copyright (C) 2025 Xavier Del Campo Romero
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+add_library(drv_ps1_event)
+add_subdirectory(src)
+target_include_directories(drv_ps1_event PUBLIC include)
+target_link_libraries(drv_ps1_event PUBLIC c drv_ps1_bios)
diff --git a/src/drv/ps1/event/include/drv/ps1/event.h b/src/drv/ps1/event/include/drv/ps1/event.h
new file mode 100644
index 0000000..2c34b02
--- /dev/null
+++ b/src/drv/ps1/event/include/drv/ps1/event.h
@@ -0,0 +1,31 @@
+/*
+ * wnix, a Unix-like operating system for WebAssembly applications.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef DRV_PS1_EVENT_H
+#define DRV_PS1_EVENT_H
+
+#include <drv/ps1/bios.h>
+
+int drv_ps1_event_open(int class, int spec, int mode, int (*f)(void));
+int drv_ps1_event_test(int event);
+int drv_ps1_event_wait(int event);
+int drv_ps1_event_enable(int event);
+int drv_ps1_event_disable(int event);
+int drv_ps1_event_close(int event);
+
+#endif
diff --git a/src/drv/ps1/event/src/CMakeLists.txt b/src/drv/ps1/event/src/CMakeLists.txt
new file mode 100644
index 0000000..e741edc
--- /dev/null
+++ b/src/drv/ps1/event/src/CMakeLists.txt
@@ -0,0 +1,23 @@
+# wnix, a Unix-like operating system for WebAssembly applications.
+# Copyright (C) 2025 Xavier Del Campo Romero
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+target_sources(drv_ps1_event PRIVATE
+ close.c
+ disable.c
+ enable.c
+ open.c
+ test.c
+)
diff --git a/src/drv/ps1/event/src/close.c b/src/drv/ps1/event/src/close.c
new file mode 100644
index 0000000..01c9a33
--- /dev/null
+++ b/src/drv/ps1/event/src/close.c
@@ -0,0 +1,25 @@
+/*
+ * wnix, a Unix-like operating system for WebAssembly applications.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <drv/ps1/event.h>
+#include <drv/ps1/bios.h>
+
+int drv_ps1_event_close(const int event)
+{
+ return CloseEvent(event);
+}
diff --git a/src/drv/ps1/event/src/disable.c b/src/drv/ps1/event/src/disable.c
new file mode 100644
index 0000000..6d32b2b
--- /dev/null
+++ b/src/drv/ps1/event/src/disable.c
@@ -0,0 +1,25 @@
+/*
+ * wnix, a Unix-like operating system for WebAssembly applications.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <drv/ps1/event.h>
+#include <drv/ps1/bios.h>
+
+int drv_ps1_event_disable(const int event)
+{
+ return DisableEvent(event);
+}
diff --git a/src/drv/ps1/event/src/enable.c b/src/drv/ps1/event/src/enable.c
new file mode 100644
index 0000000..3368ac4
--- /dev/null
+++ b/src/drv/ps1/event/src/enable.c
@@ -0,0 +1,25 @@
+/*
+ * wnix, a Unix-like operating system for WebAssembly applications.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <drv/ps1/event.h>
+#include <drv/ps1/bios.h>
+
+int drv_ps1_event_enable(const int event)
+{
+ return EnableEvent(event);
+}
diff --git a/src/drv/ps1/event/src/open.c b/src/drv/ps1/event/src/open.c
new file mode 100644
index 0000000..6bb55f1
--- /dev/null
+++ b/src/drv/ps1/event/src/open.c
@@ -0,0 +1,31 @@
+/*
+ * wnix, a Unix-like operating system for WebAssembly applications.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <drv/ps1/event.h>
+#include <drv/ps1/bios.h>
+
+int drv_ps1_event_open(const int class, const int spec, const int mode,
+ int (*const f)(void))
+{
+ int ret;
+
+ EnterCriticalSection();
+ ret = OpenEvent(class, spec, mode, f);
+ ExitCriticalSection();
+ return ret;
+}
diff --git a/src/drv/ps1/event/src/test.c b/src/drv/ps1/event/src/test.c
new file mode 100644
index 0000000..358bd8e
--- /dev/null
+++ b/src/drv/ps1/event/src/test.c
@@ -0,0 +1,28 @@
+/*
+ * wnix, a Unix-like operating system for WebAssembly applications.
+ * Copyright (C) 2025 Xavier Del Campo Romero
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <drv/ps1/event.h>
+#include <drv/ps1/bios.h>
+
+int drv_ps1_event_test(const int event)
+{
+ int ret;
+
+ ret = TestEvent(event);
+ return ret;
+}