OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [lib/] [include/] [neorv32_slink.h] - Blame information for rev 61

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 61 zero_gravi
// #################################################################################################
2
// # << NEORV32: neorv32_slink.h - Stream Link Interface HW Driver >>                              #
3
// # ********************************************************************************************* #
4
// # BSD 3-Clause License                                                                          #
5
// #                                                                                               #
6
// # Copyright (c) 2021, Stephan Nolting. All rights reserved.                                     #
7
// #                                                                                               #
8
// # Redistribution and use in source and binary forms, with or without modification, are          #
9
// # permitted provided that the following conditions are met:                                     #
10
// #                                                                                               #
11
// # 1. Redistributions of source code must retain the above copyright notice, this list of        #
12
// #    conditions and the following disclaimer.                                                   #
13
// #                                                                                               #
14
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of     #
15
// #    conditions and the following disclaimer in the documentation and/or other materials        #
16
// #    provided with the distribution.                                                            #
17
// #                                                                                               #
18
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to  #
19
// #    endorse or promote products derived from this software without specific prior written      #
20
// #    permission.                                                                                #
21
// #                                                                                               #
22
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS   #
23
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF               #
24
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE    #
25
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,     #
26
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
27
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED    #
28
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING     #
29
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED  #
30
// # OF THE POSSIBILITY OF SUCH DAMAGE.                                                            #
31
// # ********************************************************************************************* #
32
// # The NEORV32 Processor - https://github.com/stnolting/neorv32              (c) Stephan Nolting #
33
// #################################################################################################
34
 
35
 
36
/**********************************************************************//**
37
 * @file neorv32_slink.h
38
 * @author Stephan Nolting
39
 * @brief Stream Link Interface HW driver header file.
40
 **************************************************************************/
41
 
42
#ifndef neorv32_slink_h
43
#define neorv32_slink_h
44
 
45
// prototypes
46
int neorv32_slink_available(void);
47
void neorv32_slink_enable(void);
48
void neorv32_slink_disable(void);
49
int neorv32_slink_get_rx_num(void);
50
int neorv32_slink_get_tx_num(void);
51
int neorv32_slink_get_rx_depth(void);
52
int neorv32_slink_get_tx_depth(void);
53
// non-blocking transmit
54
int neorv32_slink_tx0_nonblocking(uint32_t tx_data);
55
int neorv32_slink_tx1_nonblocking(uint32_t tx_data);
56
int neorv32_slink_tx2_nonblocking(uint32_t tx_data);
57
int neorv32_slink_tx3_nonblocking(uint32_t tx_data);
58
int neorv32_slink_tx4_nonblocking(uint32_t tx_data);
59
int neorv32_slink_tx5_nonblocking(uint32_t tx_data);
60
int neorv32_slink_tx6_nonblocking(uint32_t tx_data);
61
int neorv32_slink_tx7_nonblocking(uint32_t tx_data);
62
// non-blocking receive
63
int neorv32_slink_rx0_nonblocking(uint32_t *rx_data);
64
int neorv32_slink_rx1_nonblocking(uint32_t *rx_data);
65
int neorv32_slink_rx2_nonblocking(uint32_t *rx_data);
66
int neorv32_slink_rx3_nonblocking(uint32_t *rx_data);
67
int neorv32_slink_rx4_nonblocking(uint32_t *rx_data);
68
int neorv32_slink_rx5_nonblocking(uint32_t *rx_data);
69
int neorv32_slink_rx6_nonblocking(uint32_t *rx_data);
70
int neorv32_slink_rx7_nonblocking(uint32_t *rx_data);
71
 
72
 
73
/**********************************************************************//**
74
 * Write data to TX stream link 0 (blocking!)
75
 *
76
 * @warning This function will raise an exception when the bus access times out!
77
 *
78
 * @param[in] tx_data Data to send to link.
79
 **************************************************************************/
80
inline void __attribute__ ((always_inline)) neorv32_slink_tx0_blocking(uint32_t tx_data) {
81
  SLINK_CH0 = tx_data;
82
}
83
 
84
 
85
/**********************************************************************//**
86
 * Write data to TX stream link 1 (blocking!)
87
 *
88
 * @warning This function will raise an exception when the bus access times out!
89
 *
90
 * @param[in] tx_data Data to send to link.
91
 **************************************************************************/
92
inline void __attribute__ ((always_inline)) neorv32_slink_tx1_blocking(uint32_t tx_data) {
93
  SLINK_CH1 = tx_data;
94
}
95
 
96
 
97
/**********************************************************************//**
98
 * Write data to TX stream link 2 (blocking!)
99
 *
100
 * @warning This function will raise an exception when the bus access times out!
101
 *
102
 * @param[in] tx_data Data to send to link.
103
 **************************************************************************/
104
inline void __attribute__ ((always_inline)) neorv32_slink_tx2_blocking(uint32_t tx_data) {
105
  SLINK_CH2 = tx_data;
106
}
107
 
108
 
109
/**********************************************************************//**
110
 * Write data to TX stream link 3 (blocking!)
111
 *
112
 * @warning This function will raise an exception when the bus access times out!
113
 *
114
 * @param[in] tx_data Data to send to link.
115
 **************************************************************************/
116
inline void __attribute__ ((always_inline)) neorv32_slink_tx3_blocking(uint32_t tx_data) {
117
  SLINK_CH3 = tx_data;
118
}
119
 
120
 
121
/**********************************************************************//**
122
 * Write data to TX stream link 4 (blocking!)
123
 *
124
 * @warning This function will raise an exception when the bus access times out!
125
 *
126
 * @param[in] tx_data Data to send to link.
127
 **************************************************************************/
128
inline void __attribute__ ((always_inline)) neorv32_slink_tx4_blocking(uint32_t tx_data) {
129
  SLINK_CH4 = tx_data;
130
}
131
 
132
 
133
/**********************************************************************//**
134
 * Write data to TX stream link 5 (blocking!)
135
 *
136
 * @warning This function will raise an exception when the bus access times out!
137
 *
138
 * @param[in] tx_data Data to send to link.
139
 **************************************************************************/
140
inline void __attribute__ ((always_inline)) neorv32_slink_tx5_blocking(uint32_t tx_data) {
141
  SLINK_CH5 = tx_data;
142
}
143
 
144
 
145
/**********************************************************************//**
146
 * Write data to TX stream link 6 (blocking!)
147
 *
148
 * @warning This function will raise an exception when the bus access times out!
149
 *
150
 * @param[in] tx_data Data to send to link.
151
 **************************************************************************/
152
inline void __attribute__ ((always_inline)) neorv32_slink_tx6_blocking(uint32_t tx_data) {
153
  SLINK_CH6 = tx_data;
154
}
155
 
156
 
157
/**********************************************************************//**
158
 * Write data to TX stream link 7 (blocking!)
159
 *
160
 * @warning This function will raise an exception when the bus access times out!
161
 *
162
 * @param[in] tx_data Data to send to link.
163
 **************************************************************************/
164
inline void __attribute__ ((always_inline)) neorv32_slink_tx7_blocking(uint32_t tx_data) {
165
  SLINK_CH7 = tx_data;
166
}
167
 
168
 
169
/**********************************************************************//**
170
 * Read data from RX stream link 0 (blocking!)
171
 *
172
 * @warning This function will raise an exception when the bus access times out!
173
 *
174
 * @param[in,out] rx_data Pointer to return read data.
175
 **************************************************************************/
176
inline void __attribute__ ((always_inline)) neorv32_slink_rx0_blocking(uint32_t *rx_data) {
177
  *rx_data = SLINK_CH0;
178
}
179
 
180
 
181
/**********************************************************************//**
182
 * Read data from RX stream link 1 (blocking!)
183
 *
184
 * @warning This function will raise an exception when the bus access times out!
185
 *
186
 * @param[in,out] rx_data Pointer to return read data.
187
 **************************************************************************/
188
inline void __attribute__ ((always_inline)) neorv32_slink_rx1_blocking(uint32_t *rx_data) {
189
  *rx_data = SLINK_CH1;
190
}
191
 
192
 
193
/**********************************************************************//**
194
 * Read data from RX stream link 2 (blocking!)
195
 *
196
 * @warning This function will raise an exception when the bus access times out!
197
 *
198
 * @param[in,out] rx_data Pointer to return read data.
199
 **************************************************************************/
200
inline void __attribute__ ((always_inline)) neorv32_slink_rx2_blocking(uint32_t *rx_data) {
201
  *rx_data = SLINK_CH2;
202
}
203
 
204
 
205
/**********************************************************************//**
206
 * Read data from RX stream link 3 (blocking!)
207
 *
208
 * @warning This function will raise an exception when the bus access times out!
209
 *
210
 * @param[in,out] rx_data Pointer to return read data.
211
 **************************************************************************/
212
inline void __attribute__ ((always_inline)) neorv32_slink_rx3_blocking(uint32_t *rx_data) {
213
  *rx_data = SLINK_CH3;
214
}
215
 
216
 
217
/**********************************************************************//**
218
 * Read data from RX stream link 4 (blocking!)
219
 *
220
 * @warning This function will raise an exception when the bus access times out!
221
 *
222
 * @param[in,out] rx_data Pointer to return read data.
223
 **************************************************************************/
224
inline void __attribute__ ((always_inline)) neorv32_slink_rx4_blocking(uint32_t *rx_data) {
225
  *rx_data = SLINK_CH4;
226
}
227
 
228
 
229
/**********************************************************************//**
230
 * Read data from RX stream link 5 (blocking!)
231
 *
232
 * @warning This function will raise an exception when the bus access times out!
233
 *
234
 * @param[in,out] rx_data Pointer to return read data.
235
 **************************************************************************/
236
inline void __attribute__ ((always_inline)) neorv32_slink_rx5_blocking(uint32_t *rx_data) {
237
  *rx_data = SLINK_CH5;
238
}
239
 
240
 
241
/**********************************************************************//**
242
 * Read data from RX stream link 6 (blocking!)
243
 *
244
 * @warning This function will raise an exception when the bus access times out!
245
 *
246
 * @param[in,out] rx_data Pointer to return read data.
247
 **************************************************************************/
248
inline void __attribute__ ((always_inline)) neorv32_slink_rx6_blocking(uint32_t *rx_data) {
249
  *rx_data = SLINK_CH6;
250
}
251
 
252
 
253
/**********************************************************************//**
254
 * Read data from RX stream link 7 (blocking!)
255
 *
256
 * @warning This function will raise an exception when the bus access times out!
257
 *
258
 * @param[in,out] rx_data Pointer to return read data.
259
 **************************************************************************/
260
inline void __attribute__ ((always_inline)) neorv32_slink_rx7_blocking(uint32_t *rx_data) {
261
  *rx_data = SLINK_CH7;
262
}
263
 
264
 
265
#endif // neorv32_slink_h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.