summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/switch.c
diff options
context:
space:
mode:
Diffstat (limited to 'FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/switch.c')
-rw-r--r--FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/switch.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/switch.c b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/switch.c
new file mode 100644
index 000000000..f101537ac
--- /dev/null
+++ b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/switch.c
@@ -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);