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

Subversion Repositories neorv32

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

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 62 zero_gravi
int neorv32_slink_check_rx_half_full(int link_id);
54
int neorv32_slink_check_tx_half_full(int link_id);
55 61 zero_gravi
// non-blocking transmit
56
int neorv32_slink_tx0_nonblocking(uint32_t tx_data);
57
int neorv32_slink_tx1_nonblocking(uint32_t tx_data);
58
int neorv32_slink_tx2_nonblocking(uint32_t tx_data);
59
int neorv32_slink_tx3_nonblocking(uint32_t tx_data);
60
int neorv32_slink_tx4_nonblocking(uint32_t tx_data);
61
int neorv32_slink_tx5_nonblocking(uint32_t tx_data);
62
int neorv32_slink_tx6_nonblocking(uint32_t tx_data);
63
int neorv32_slink_tx7_nonblocking(uint32_t tx_data);
64
// non-blocking receive
65
int neorv32_slink_rx0_nonblocking(uint32_t *rx_data);
66
int neorv32_slink_rx1_nonblocking(uint32_t *rx_data);
67
int neorv32_slink_rx2_nonblocking(uint32_t *rx_data);
68
int neorv32_slink_rx3_nonblocking(uint32_t *rx_data);
69
int neorv32_slink_rx4_nonblocking(uint32_t *rx_data);
70
int neorv32_slink_rx5_nonblocking(uint32_t *rx_data);
71
int neorv32_slink_rx6_nonblocking(uint32_t *rx_data);
72
int neorv32_slink_rx7_nonblocking(uint32_t *rx_data);
73
 
74
 
75
/**********************************************************************//**
76
 * Write data to TX stream link 0 (blocking!)
77
 *
78
 * @warning This function will raise an exception when the bus access times out!
79
 *
80
 * @param[in] tx_data Data to send to link.
81
 **************************************************************************/
82
inline void __attribute__ ((always_inline)) neorv32_slink_tx0_blocking(uint32_t tx_data) {
83
  SLINK_CH0 = tx_data;
84
}
85
 
86
 
87
/**********************************************************************//**
88
 * Write data to TX stream link 1 (blocking!)
89
 *
90
 * @warning This function will raise an exception when the bus access times out!
91
 *
92
 * @param[in] tx_data Data to send to link.
93
 **************************************************************************/
94
inline void __attribute__ ((always_inline)) neorv32_slink_tx1_blocking(uint32_t tx_data) {
95
  SLINK_CH1 = tx_data;
96
}
97
 
98
 
99
/**********************************************************************//**
100
 * Write data to TX stream link 2 (blocking!)
101
 *
102
 * @warning This function will raise an exception when the bus access times out!
103
 *
104
 * @param[in] tx_data Data to send to link.
105
 **************************************************************************/
106
inline void __attribute__ ((always_inline)) neorv32_slink_tx2_blocking(uint32_t tx_data) {
107
  SLINK_CH2 = tx_data;
108
}
109
 
110
 
111
/**********************************************************************//**
112
 * Write data to TX stream link 3 (blocking!)
113
 *
114
 * @warning This function will raise an exception when the bus access times out!
115
 *
116
 * @param[in] tx_data Data to send to link.
117
 **************************************************************************/
118
inline void __attribute__ ((always_inline)) neorv32_slink_tx3_blocking(uint32_t tx_data) {
119
  SLINK_CH3 = tx_data;
120
}
121
 
122
 
123
/**********************************************************************//**
124
 * Write data to TX stream link 4 (blocking!)
125
 *
126
 * @warning This function will raise an exception when the bus access times out!
127
 *
128
 * @param[in] tx_data Data to send to link.
129
 **************************************************************************/
130
inline void __attribute__ ((always_inline)) neorv32_slink_tx4_blocking(uint32_t tx_data) {
131
  SLINK_CH4 = tx_data;
132
}
133
 
134
 
135
/**********************************************************************//**
136
 * Write data to TX stream link 5 (blocking!)
137
 *
138
 * @warning This function will raise an exception when the bus access times out!
139
 *
140
 * @param[in] tx_data Data to send to link.
141
 **************************************************************************/
142
inline void __attribute__ ((always_inline)) neorv32_slink_tx5_blocking(uint32_t tx_data) {
143
  SLINK_CH5 = tx_data;
144
}
145
 
146
 
147
/**********************************************************************//**
148
 * Write data to TX stream link 6 (blocking!)
149
 *
150
 * @warning This function will raise an exception when the bus access times out!
151
 *
152
 * @param[in] tx_data Data to send to link.
153
 **************************************************************************/
154
inline void __attribute__ ((always_inline)) neorv32_slink_tx6_blocking(uint32_t tx_data) {
155
  SLINK_CH6 = tx_data;
156
}
157
 
158
 
159
/**********************************************************************//**
160
 * Write data to TX stream link 7 (blocking!)
161
 *
162
 * @warning This function will raise an exception when the bus access times out!
163
 *
164
 * @param[in] tx_data Data to send to link.
165
 **************************************************************************/
166
inline void __attribute__ ((always_inline)) neorv32_slink_tx7_blocking(uint32_t tx_data) {
167
  SLINK_CH7 = tx_data;
168
}
169
 
170
 
171
/**********************************************************************//**
172
 * Read data from RX stream link 0 (blocking!)
173
 *
174
 * @warning This function will raise an exception when the bus access times out!
175
 *
176
 * @param[in,out] rx_data Pointer to return read data.
177
 **************************************************************************/
178
inline void __attribute__ ((always_inline)) neorv32_slink_rx0_blocking(uint32_t *rx_data) {
179
  *rx_data = SLINK_CH0;
180
}
181
 
182
 
183
/**********************************************************************//**
184
 * Read data from RX stream link 1 (blocking!)
185
 *
186
 * @warning This function will raise an exception when the bus access times out!
187
 *
188
 * @param[in,out] rx_data Pointer to return read data.
189
 **************************************************************************/
190
inline void __attribute__ ((always_inline)) neorv32_slink_rx1_blocking(uint32_t *rx_data) {
191
  *rx_data = SLINK_CH1;
192
}
193
 
194
 
195
/**********************************************************************//**
196
 * Read data from RX stream link 2 (blocking!)
197
 *
198
 * @warning This function will raise an exception when the bus access times out!
199
 *
200
 * @param[in,out] rx_data Pointer to return read data.
201
 **************************************************************************/
202
inline void __attribute__ ((always_inline)) neorv32_slink_rx2_blocking(uint32_t *rx_data) {
203
  *rx_data = SLINK_CH2;
204
}
205
 
206
 
207
/**********************************************************************//**
208
 * Read data from RX stream link 3 (blocking!)
209
 *
210
 * @warning This function will raise an exception when the bus access times out!
211
 *
212
 * @param[in,out] rx_data Pointer to return read data.
213
 **************************************************************************/
214
inline void __attribute__ ((always_inline)) neorv32_slink_rx3_blocking(uint32_t *rx_data) {
215
  *rx_data = SLINK_CH3;
216
}
217
 
218
 
219
/**********************************************************************//**
220
 * Read data from RX stream link 4 (blocking!)
221
 *
222
 * @warning This function will raise an exception when the bus access times out!
223
 *
224
 * @param[in,out] rx_data Pointer to return read data.
225
 **************************************************************************/
226
inline void __attribute__ ((always_inline)) neorv32_slink_rx4_blocking(uint32_t *rx_data) {
227
  *rx_data = SLINK_CH4;
228
}
229
 
230
 
231
/**********************************************************************//**
232
 * Read data from RX stream link 5 (blocking!)
233
 *
234
 * @warning This function will raise an exception when the bus access times out!
235
 *
236
 * @param[in,out] rx_data Pointer to return read data.
237
 **************************************************************************/
238
inline void __attribute__ ((always_inline)) neorv32_slink_rx5_blocking(uint32_t *rx_data) {
239
  *rx_data = SLINK_CH5;
240
}
241
 
242
 
243
/**********************************************************************//**
244
 * Read data from RX stream link 6 (blocking!)
245
 *
246
 * @warning This function will raise an exception when the bus access times out!
247
 *
248
 * @param[in,out] rx_data Pointer to return read data.
249
 **************************************************************************/
250
inline void __attribute__ ((always_inline)) neorv32_slink_rx6_blocking(uint32_t *rx_data) {
251
  *rx_data = SLINK_CH6;
252
}
253
 
254
 
255
/**********************************************************************//**
256
 * Read data from RX stream link 7 (blocking!)
257
 *
258
 * @warning This function will raise an exception when the bus access times out!
259
 *
260
 * @param[in,out] rx_data Pointer to return read data.
261
 **************************************************************************/
262
inline void __attribute__ ((always_inline)) neorv32_slink_rx7_blocking(uint32_t *rx_data) {
263
  *rx_data = SLINK_CH7;
264
}
265
 
266
 
267
#endif // neorv32_slink_h

powered by: WebSVN 2.1.0

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