libpynq (release 5EWC0-2023 version 0.1.0 of 2023-08-14 14:01)
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 <stdbool.h>
25#include <stdint.h>
26
62 SWB_GPIO = 0x00,
94 SWB_PWM0 = 0x10,
96 SWB_PWM1 = 0x11,
98 SWB_PWM2 = 0x12,
100 SWB_PWM3 = 0x13,
102 SWB_PWM4 = 0x14,
104 SWB_PWM5 = 0x15,
131};
132
133#define NUM_SWITCHBOX_NAMES 40
138extern char *const switchbox_names[NUM_SWITCHBOX_NAMES];
139
145void switchbox_init(void);
146
153void switchbox_set_pin(const int32_t pin_number, const uint8_t pin_type);
154
159void switchbox_reset(void);
160
164void switchbox_destroy(void);
165
174uint8_t switchbox_get_pin(const int32_t pin_number);
175
179#endif // SWITCHBOX_H
io_configuration
Definition switchbox.h:60
void switchbox_destroy(void)
Resets all pins of the switch box to be input.
Definition switchbox.c:112
uint8_t switchbox_get_pin(const int32_t pin_number)
Sets the mode of a specified pin.
Definition switchbox.c:149
void switchbox_set_pin(const int32_t pin_number, const uint8_t pin_type)
Set the type of a switch pin.
Definition switchbox.c:128
#define NUM_SWITCHBOX_NAMES
Definition switchbox.h:133
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
@ SWB_TIMER_G2
Definition switchbox.h:108
@ SWB_TIMER_IC3
Definition switchbox.h:124
@ SWB_IIC1_SCL
Definition switchbox.h:92
@ SWB_TIMER_G5
Definition switchbox.h:114
@ SWB_TIMER_IC2
Definition switchbox.h:123
@ SWB_PWM0
Definition switchbox.h:94
@ SWB_SPI1_MISO
Definition switchbox.h:80
@ SWB_TIMER_IC7
Definition switchbox.h:128
@ SWB_TIMER_G0
Definition switchbox.h:105
@ SWB_PWM5
Definition switchbox.h:104
@ SWB_SPI1_MOSI
Definition switchbox.h:82
@ SWB_TIMER_IC1
Definition switchbox.h:122
@ SWB_UART0_TX
Definition switchbox.h:66
@ SWB_TIMER_G6
Definition switchbox.h:116
@ SWB_IIC0_SDA
Definition switchbox.h:86
@ SWB_Interrupt_In
Definition switchbox.h:64
@ SWB_TIMER_G1
Definition switchbox.h:106
@ SWB_SPI0_MISO
Definition switchbox.h:72
@ SWB_PWM2
Definition switchbox.h:98
@ SWB_PWM3
Definition switchbox.h:100
@ SWB_TIMER_G7
Definition switchbox.h:118
@ SWB_IIC0_SCL
Definition switchbox.h:88
@ SWB_UART1_TX
Definition switchbox.h:119
@ SWB_IIC1_SDA
Definition switchbox.h:90
@ SWB_TIMER_G3
Definition switchbox.h:110
@ SWB_TIMER_IC0
Definition switchbox.h:121
@ NUM_IO_CONFIGURATION
Definition switchbox.h:130
@ SWB_SPI1_SS
Definition switchbox.h:84
@ SWB_SPI0_CLK
Definition switchbox.h:70
@ SWB_TIMER_G4
Definition switchbox.h:112
@ SWB_PWM4
Definition switchbox.h:102
@ SWB_TIMER_IC5
Definition switchbox.h:126
@ SWB_TIMER_IC6
Definition switchbox.h:127
@ SWB_PWM1
Definition switchbox.h:96
@ SWB_GPIO
Definition switchbox.h:62
@ SWB_UART1_RX
Definition switchbox.h:120
@ SWB_SPI1_CLK
Definition switchbox.h:78
@ SWB_TIMER_IC4
Definition switchbox.h:125
@ SWB_SPI0_MOSI
Definition switchbox.h:74
@ SWB_SPI0_SS
Definition switchbox.h:76
@ SWB_UART0_RX
Definition switchbox.h:68