libpynq (release 5EWC0-2023 version 0.2.3 of 2023-10-06 18:15)
Loading...
Searching...
No Matches
switchbox.h
Go to the documentation of this file.
1/*
2Copyright (c) 2023 Eindhoven University of Technology
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all
12copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20SOFTWARE.
21*/
22#ifndef SWITCHBOX_H
23#define SWITCHBOX_H
24#include <pinmap.h>
25#include <stdbool.h>
26#include <stdint.h>
27
62typedef enum io_configuration {
64 SWB_GPIO = 0x00,
96 SWB_PWM0 = 0x10,
98 SWB_PWM1 = 0x11,
100 SWB_PWM2 = 0x12,
102 SWB_PWM3 = 0x13,
104 SWB_PWM4 = 0x14,
106 SWB_PWM5 = 0x15,
134
135#define NUM_SWITCHBOX_NAMES 40
140extern char *const switchbox_names[NUM_SWITCHBOX_NAMES];
141
147extern void switchbox_init(void);
148
155extern void switchbox_set_pin(const io_t pin_number,
156 const io_configuration_t pin_type);
157
162extern void switchbox_reset(void);
163
167extern void switchbox_destroy(void);
168
175extern io_configuration_t switchbox_get_pin(const io_t pin_number);
176
180#endif // SWITCHBOX_H
io_t
Definition pinmap.h:45
io_configuration
Definition switchbox.h:62
void switchbox_destroy(void)
Resets all pins of the switch box to be input.
Definition switchbox.c:112
io_configuration_t switchbox_get_pin(const io_t pin_number)
Sets the mode of a specified pin.
Definition switchbox.c:162
#define NUM_SWITCHBOX_NAMES
Definition switchbox.h:135
void switchbox_reset(void)
Resets all pins of the switch box to be input.
Definition switchbox.c:118
void switchbox_init(void)
Initializes the switch box.
Definition switchbox.c:105
char *const switchbox_names[NUM_SWITCHBOX_NAMES]
Taken from scpi_names.h, lookup table for channels in the mapping_info function.
Definition switchbox.c:25
void switchbox_set_pin(const io_t pin_number, const io_configuration_t pin_type)
Set the type of a switch pin.
Definition switchbox.c:126
enum io_configuration io_configuration_t
@ SWB_TIMER_G2
Definition switchbox.h:110
@ SWB_TIMER_IC3
Definition switchbox.h:126
@ SWB_IIC1_SCL
Definition switchbox.h:94
@ SWB_TIMER_G5
Definition switchbox.h:116
@ SWB_TIMER_IC2
Definition switchbox.h:125
@ SWB_PWM0
Definition switchbox.h:96
@ SWB_SPI1_MISO
Definition switchbox.h:82
@ SWB_TIMER_IC7
Definition switchbox.h:130
@ SWB_TIMER_G0
Definition switchbox.h:107
@ SWB_PWM5
Definition switchbox.h:106
@ SWB_SPI1_MOSI
Definition switchbox.h:84
@ SWB_TIMER_IC1
Definition switchbox.h:124
@ SWB_UART0_TX
Definition switchbox.h:68
@ NUM_IO_CONFIGURATIONS
Definition switchbox.h:132
@ SWB_TIMER_G6
Definition switchbox.h:118
@ SWB_IIC0_SDA
Definition switchbox.h:88
@ SWB_Interrupt_In
Definition switchbox.h:66
@ SWB_TIMER_G1
Definition switchbox.h:108
@ SWB_SPI0_MISO
Definition switchbox.h:74
@ SWB_PWM2
Definition switchbox.h:100
@ SWB_PWM3
Definition switchbox.h:102
@ SWB_TIMER_G7
Definition switchbox.h:120
@ SWB_IIC0_SCL
Definition switchbox.h:90
@ SWB_UART1_TX
Definition switchbox.h:121
@ SWB_IIC1_SDA
Definition switchbox.h:92
@ SWB_TIMER_G3
Definition switchbox.h:112
@ SWB_TIMER_IC0
Definition switchbox.h:123
@ SWB_SPI1_SS
Definition switchbox.h:86
@ SWB_SPI0_CLK
Definition switchbox.h:72
@ SWB_TIMER_G4
Definition switchbox.h:114
@ SWB_PWM4
Definition switchbox.h:104
@ SWB_TIMER_IC5
Definition switchbox.h:128
@ SWB_TIMER_IC6
Definition switchbox.h:129
@ SWB_PWM1
Definition switchbox.h:98
@ SWB_GPIO
Definition switchbox.h:64
@ SWB_UART1_RX
Definition switchbox.h:122
@ SWB_SPI1_CLK
Definition switchbox.h:80
@ SWB_TIMER_IC4
Definition switchbox.h:127
@ SWB_SPI0_MOSI
Definition switchbox.h:76
@ SWB_SPI0_SS
Definition switchbox.h:78
@ SWB_UART0_RX
Definition switchbox.h:70