]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/switch.c
Update RISCC-V-RV32-SiFive_HiFive1_FreedomStudio project to latest tools and metal...
[freertos] / FreeRTOS / Demo / RISC-V_RV32_SiFive_HiFive1_FreedomStudio / freedom-metal / src / switch.c
1 /* Copyright 2018 SiFive, Inc */
2 /* SPDX-License-Identifier: Apache-2.0 */
3
4 #include <metal/switch.h>
5 #include <metal/machine.h>
6
7 struct metal_switch* metal_switch_get (char *label)
8 {
9     int i;
10     struct metal_switch *flip;
11
12     if ((__METAL_DT_MAX_BUTTONS == 0) || (label == NULL)) {
13         return NULL;
14     }
15
16     for (i = 0; i < __METAL_DT_MAX_BUTTONS; i++) {
17         flip = (struct metal_switch*)__metal_switch_table[i];
18         if (flip->vtable->switch_exist(flip, label)) {
19             return flip;
20         }
21     }
22     return NULL;
23 }
24
25 extern __inline__ struct metal_interrupt*
26     metal_switch_interrupt_controller(struct metal_switch *flip);
27 extern __inline__ int metal_switch_get_interrupt_id(struct metal_switch *flip);