libpynq (release 5EWC0-2023 version 0.2.2 of 2023-09-24 22:22)
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
63 SWB_GPIO = 0x00,
95 SWB_PWM0 = 0x10,
97 SWB_PWM1 = 0x11,
99 SWB_PWM2 = 0x12,
101 SWB_PWM3 = 0x13,
103 SWB_PWM4 = 0x14,
105 SWB_PWM5 = 0x15,
132};
133
134#define NUM_SWITCHBOX_NAMES 40
139extern char *const switchbox_names[NUM_SWITCHBOX_NAMES];
140
146extern void switchbox_init(void);
147
154extern void switchbox_set_pin(const pin_t pin_number, const uint8_t pin_type);
155
160extern void switchbox_reset(void);
161
165extern void switchbox_destroy(void);
166
175extern uint8_t switchbox_get_pin(const pin_t pin_number);
176
180#endif // SWITCHBOX_H
pin_t
Definition pinmap.h:45
io_configuration
Definition switchbox.h:61
void switchbox_destroy(void)
Resets all pins of the switch box to be input.
Definition switchbox.c:112
#define NUM_SWITCHBOX_NAMES
Definition switchbox.h:134
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
uint8_t switchbox_get_pin(const pin_t pin_number)
Sets the mode of a specified pin.
Definition switchbox.c:163
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 pin_t pin_number, const uint8_t pin_type)
Set the type of a switch pin.
Definition switchbox.c:128
@ SWB_TIMER_G2
Definition switchbox.h:109
@ SWB_TIMER_IC3
Definition switchbox.h:125
@ SWB_IIC1_SCL
Definition switchbox.h:93
@ SWB_TIMER_G5
Definition switchbox.h:115
@ SWB_TIMER_IC2
Definition switchbox.h:124
@ SWB_PWM0
Definition switchbox.h:95
@ SWB_SPI1_MISO
Definition switchbox.h:81
@ SWB_TIMER_IC7
Definition switchbox.h:129
@ SWB_TIMER_G0
Definition switchbox.h:106
@ SWB_PWM5
Definition switchbox.h:105
@ SWB_SPI1_MOSI
Definition switchbox.h:83
@ SWB_TIMER_IC1
Definition switchbox.h:123
@ SWB_UART0_TX
Definition switchbox.h:67
@ NUM_IO_CONFIGURATIONS
Definition switchbox.h:131
@ SWB_TIMER_G6
Definition switchbox.h:117
@ SWB_IIC0_SDA
Definition switchbox.h:87
@ SWB_Interrupt_In
Definition switchbox.h:65
@ SWB_TIMER_G1
Definition switchbox.h:107
@ SWB_SPI0_MISO
Definition switchbox.h:73
@ SWB_PWM2
Definition switchbox.h:99
@ SWB_PWM3
Definition switchbox.h:101
@ SWB_TIMER_G7
Definition switchbox.h:119
@ SWB_IIC0_SCL
Definition switchbox.h:89
@ SWB_UART1_TX
Definition switchbox.h:120
@ SWB_IIC1_SDA
Definition switchbox.h:91
@ SWB_TIMER_G3
Definition switchbox.h:111
@ SWB_TIMER_IC0
Definition switchbox.h:122
@ SWB_SPI1_SS
Definition switchbox.h:85
@ SWB_SPI0_CLK
Definition switchbox.h:71
@ SWB_TIMER_G4
Definition switchbox.h:113
@ SWB_PWM4
Definition switchbox.h:103
@ SWB_TIMER_IC5
Definition switchbox.h:127
@ SWB_TIMER_IC6
Definition switchbox.h:128
@ SWB_PWM1
Definition switchbox.h:97
@ SWB_GPIO
Definition switchbox.h:63
@ SWB_UART1_RX
Definition switchbox.h:121
@ SWB_SPI1_CLK
Definition switchbox.h:79
@ SWB_TIMER_IC4
Definition switchbox.h:126
@ SWB_SPI0_MOSI
Definition switchbox.h:75
@ SWB_SPI0_SS
Definition switchbox.h:77
@ SWB_UART0_RX
Definition switchbox.h:69