]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/switch.c
Rename RISC-V_RV32_SiFive_HiFive1-FreedomStudio directory to RISC-V_RV32_SiFive_HiFiv...
[freertos] / FreeRTOS / Demo / RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio / freedom-metal / src / switch.c
diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/switch.c b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/switch.c
new file mode 100644 (file)
index 0000000..4f17229
--- /dev/null
@@ -0,0 +1,27 @@
+/* Copyright 2018 SiFive, Inc */
+/* SPDX-License-Identifier: Apache-2.0 */
+
+#include <metal/switch.h>
+#include <metal/machine.h>
+
+struct metal_switch* metal_switch_get (char *label)
+{
+    int i;
+    struct metal_switch *flip;
+
+    if ((__METAL_DT_MAX_BUTTONS == 0) || (label == NULL)) {
+        return NULL;
+    }
+
+    for (i = 0; i < __METAL_DT_MAX_BUTTONS; i++) {
+        flip = (struct metal_switch*)__metal_switch_table[i];
+        if (flip->vtable->switch_exist(flip, label)) {
+            return flip;
+        }
+    }
+    return NULL;
+}
+
+extern __inline__ struct metal_interrupt*
+    metal_switch_interrupt_controller(struct metal_switch *flip);
+extern __inline__ int metal_switch_get_interrupt_id(struct metal_switch *flip);