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

Subversion Repositories neorv32

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

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

powered by: WebSVN 2.1.0

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