1 |
145 |
lanttu |
/**
|
2 |
|
|
* @file hpd_functions.h
|
3 |
|
|
* @author Lasse Lehtonen
|
4 |
|
|
* @date 2012-02-14
|
5 |
|
|
*
|
6 |
|
|
* @brief Platform independed C functions.
|
7 |
|
|
*
|
8 |
|
|
* @details This file introduces a set of functions for handling
|
9 |
|
|
* HIBI_PE_DMA more easily. Functions are written in platform
|
10 |
|
|
* independed C using macros defined in hdp_macros.h.
|
11 |
|
|
*
|
12 |
|
|
* @warning These functions store the HIBI_PE_DMA configuration
|
13 |
|
|
* information in an internal structure to avoid unnessery
|
14 |
|
|
* configuration. This implies that all communication with HIBI_PE_DMA
|
15 |
|
|
* must be done with these functions or their behaviour may become
|
16 |
|
|
* undefined.
|
17 |
|
|
*
|
18 |
|
|
* @par Copyright
|
19 |
|
|
* Funbase IP library Copyright (C) 2012 TUT Department of
|
20 |
|
|
* Computer Systems
|
21 |
|
|
* @par
|
22 |
|
|
* This file is part of HIBI_PE_DMA
|
23 |
|
|
* @par
|
24 |
|
|
* This source file may be used and distributed without
|
25 |
|
|
* restriction provided that this copyright statement is not
|
26 |
|
|
* removed from the file and that any derivative work contains
|
27 |
|
|
* the original copyright notice and the associated disclaimer.
|
28 |
|
|
* This source file is free software; you can redistribute it
|
29 |
|
|
* and/or modify it under the terms of the GNU Lesser General
|
30 |
|
|
* Public License as published by the Free Software Foundation;
|
31 |
|
|
* either version 2.1 of the License, or (at your option) any
|
32 |
|
|
* later version.
|
33 |
|
|
* @par
|
34 |
|
|
* This source is distributed in the hope that it will be
|
35 |
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied
|
36 |
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
37 |
|
|
* PURPOSE. See the GNU Lesser General Public License for more
|
38 |
|
|
* details.
|
39 |
|
|
* @par
|
40 |
|
|
* You should have received a copy of the GNU Lesser General
|
41 |
|
|
* Public License along with this source; if not, download it
|
42 |
|
|
* from http://www.opencores.org/lgpl.shtml
|
43 |
|
|
*
|
44 |
|
|
*/
|
45 |
|
|
|
46 |
|
|
#ifndef HPD_FUNCTIONS_H
|
47 |
|
|
#define HPD_FUNCTIONS_H
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
/**
|
51 |
|
|
* @defgroup GEN_FUNCTIONS General Functions
|
52 |
|
|
* @{
|
53 |
|
|
*/
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
/**
|
57 |
|
|
* @brief Initializes HIBI_PE_DMA component according to
|
58 |
|
|
* hpd_config.c.
|
59 |
|
|
*
|
60 |
|
|
* @details Reads settings from the data structure defined in
|
61 |
|
|
* hpd_config.c and configures memory address, buffer size and hibi
|
62 |
|
|
* address registers on all HIBI_PE_DMA interfaces but doesn't start
|
63 |
|
|
* RX channel receiving.
|
64 |
|
|
*/
|
65 |
|
|
void hpd_initialize();
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
/**
|
69 |
|
|
* @}
|
70 |
|
|
*/
|
71 |
|
|
|
72 |
|
|
/**
|
73 |
|
|
* @defgroup TX_FUNCTIONS TX Functions
|
74 |
|
|
* @{
|
75 |
|
|
*/
|
76 |
|
|
|
77 |
|
|
/**
|
78 |
|
|
* @brief Configures HIBI_PE_DMA's TX base settings for interface \e
|
79 |
|
|
* iface.
|
80 |
|
|
*
|
81 |
|
|
* @param[in] base TX buffer's base address.
|
82 |
|
|
* @param[in] words Size of the TX buffer in words.
|
83 |
|
|
*/
|
84 |
|
|
void hpd_tx_base_conf_gen(int base, int words, int iface);
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
/**
|
88 |
|
|
* @brief Configures HIBI_PE_DMA's TX base settings for default interface.
|
89 |
|
|
*
|
90 |
|
|
* @param[in] base TX buffer's base address.
|
91 |
|
|
* @param[in] words Size of the TX buffer in words.
|
92 |
|
|
*/
|
93 |
|
|
void hpd_tx_base_conf(int base, int words);
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
/**
|
97 |
|
|
* @brief Send packet through HIBI_PE_DMA interface \e iface. Data
|
98 |
|
|
* must be in a memory accessible by HIBI_PE_DMA.
|
99 |
|
|
*
|
100 |
|
|
* @param[in] daddr Beginning address for the data to be sent.
|
101 |
|
|
* @param[in] words How many words to sent.
|
102 |
|
|
* @param[in] haddr Where to send the packet on HIBI.
|
103 |
|
|
* @param[in] iface Which interface to use.
|
104 |
|
|
*
|
105 |
|
|
* @details This function configures registers on HIBI_PE_DMA and
|
106 |
|
|
* starts the transfer. It sends \e words amount of words starting
|
107 |
|
|
* from \e daddr. Address \e daddr must be accessible by HIBI_PE_DMA.
|
108 |
|
|
*
|
109 |
|
|
*/
|
110 |
|
|
void hpd_tx_send_gen(int daddr, int words, int haddr, int iface);
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
/**
|
114 |
|
|
* @brief Send packet through HIBI_PE_DMA default interface. Data
|
115 |
|
|
* must be in a memory accessible by HIBI_PE_DMA.
|
116 |
|
|
*
|
117 |
|
|
* @param[in] daddr Beginning address for the data to be sent.
|
118 |
|
|
* @param[in] words How many words to sent.
|
119 |
|
|
* @param[in] haddr Where to send the packet on HIBI.
|
120 |
|
|
*
|
121 |
|
|
* @details This function configures registers on HIBI_PE_DMA and
|
122 |
|
|
* starts the transfer. It sends \e words amount of words starting
|
123 |
|
|
* from \e daddr. Address \e daddr must be accessible by HIBI_PE_DMA.
|
124 |
|
|
*
|
125 |
|
|
*/
|
126 |
|
|
void hpd_tx_send(int daddr, int words, int haddr);
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
/**
|
130 |
|
|
* @brief Send packet through HIBI_PE_DMA interface \e iface. Copies
|
131 |
|
|
* the data first to the memory accessible by HIBI_PE_DMA.
|
132 |
|
|
*
|
133 |
|
|
* @param[in] daddr Beginning address for the data to be sent.
|
134 |
|
|
* @param[in] words How many words to sent.
|
135 |
|
|
* @param[in] haddr Where to send the packet on HIBI.
|
136 |
|
|
* @param[in] iface Which interface to use.
|
137 |
|
|
*
|
138 |
|
|
* @details This function configures registers on HIBI_PE_DMA and
|
139 |
|
|
* starts the transfer. It sends \e words amount of words starting
|
140 |
|
|
* from \e daddr. This function copies the data from \e daddr to the
|
141 |
|
|
* shared memory accessible by HIBI_PE_DMA before sending. If packet
|
142 |
|
|
* is larger than TX buffer it's sent in pieces.
|
143 |
|
|
*
|
144 |
|
|
*/
|
145 |
|
|
void hpd_tx_send_copy_gen(int daddr, int words, int haddr, int iface);
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
/**
|
149 |
|
|
* @brief Send packet through HIBI_PE_DMA default interface. Copies
|
150 |
|
|
* the data first to the memory accessible by HIBI_PE_DMA.
|
151 |
|
|
*
|
152 |
|
|
* @param[in] daddr Beginning address for the data to be sent.
|
153 |
|
|
* @param[in] words How many words to sent.
|
154 |
|
|
* @param[in] haddr Where to send the packet on HIBI.
|
155 |
|
|
*
|
156 |
|
|
* @details This function configures registers on HIBI_PE_DMA and
|
157 |
|
|
* starts the transfer. It sends \e words amount of words starting
|
158 |
|
|
* from \e daddr. This function copies the data from \e daddr to the
|
159 |
|
|
* shared memory accessible by HIBI_PE_DMA before sending. If packet
|
160 |
|
|
* is larger than TX buffer it's sent in pieces.
|
161 |
|
|
*
|
162 |
|
|
*/
|
163 |
|
|
void hpd_tx_send_copy(int daddr, int words, int haddr);
|
164 |
|
|
|
165 |
|
|
|
166 |
|
|
/**
|
167 |
|
|
* @}
|
168 |
|
|
*/
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
/**
|
172 |
|
|
* @defgroup RX_PACKET RX Packet Functions
|
173 |
|
|
* @{
|
174 |
|
|
*/
|
175 |
|
|
|
176 |
|
|
|
177 |
|
|
/**
|
178 |
|
|
* @brief Initialize packet channel for reception on interface \e iface.
|
179 |
|
|
* @param[in] chan Which channel.
|
180 |
|
|
* @param[in] daddr Where to store the packet.
|
181 |
|
|
* @param[in] words How many to expect.
|
182 |
|
|
* @param[in] haddr Hibi address to listen to.
|
183 |
|
|
* @param[in] iface Which interface to use.
|
184 |
|
|
*
|
185 |
|
|
*/
|
186 |
|
|
void hpd_rx_packet_init_gen(int chan, int daddr,
|
187 |
|
|
int words, int haddr, int iface);
|
188 |
|
|
|
189 |
|
|
/**
|
190 |
|
|
* @brief Initialize packet channel for reception on default interface.
|
191 |
|
|
* @param[in] chan Which channel.
|
192 |
|
|
* @param[in] daddr Where to store the packet.
|
193 |
|
|
* @param[in] words How many to expect.
|
194 |
|
|
* @param[in] haddr Hibi address to listen to.
|
195 |
|
|
*/
|
196 |
|
|
void hpd_rx_packet_init(int chan, int daddr, int words, int haddr);
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
/**
|
200 |
|
|
* @brief Reinitializes packet channel with previous settings on
|
201 |
|
|
* interface \e iface.
|
202 |
|
|
*
|
203 |
|
|
* @param[in] chan Which channel.
|
204 |
|
|
* @param[in] iface Which interface to use.
|
205 |
|
|
*/
|
206 |
|
|
void hpd_rx_packet_reinit_gen(int chan, int iface);
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
/**
|
210 |
|
|
* @brief Reinitializes packet channel with previous settings on
|
211 |
|
|
* default interface.
|
212 |
|
|
*
|
213 |
|
|
* @warning Undefined bahaviour if used for stream channels.
|
214 |
|
|
*
|
215 |
|
|
* @param[in] chan Which channel.
|
216 |
|
|
*/
|
217 |
|
|
void hpd_rx_packet_reinit(int chan);
|
218 |
|
|
|
219 |
|
|
|
220 |
|
|
/**
|
221 |
|
|
* @brief Read RX packet from channel \e chan to \e buffer without
|
222 |
|
|
* checking the channel's status from interface \e iface.
|
223 |
|
|
*
|
224 |
|
|
* @param[in] chan Which channel to read.
|
225 |
|
|
* @param[out] buffer Place to store the data.
|
226 |
|
|
* @param[in] iface Interface to use.
|
227 |
|
|
*
|
228 |
|
|
* @details This function copies channels RX buffer without checking
|
229 |
|
|
* wether or not it has received anything. Used when it's already
|
230 |
|
|
* known that there is whole packet available e.g. through interrupts
|
231 |
|
|
* or polling.
|
232 |
|
|
*/
|
233 |
|
|
void hpd_rx_packet_read_gen(int chan, void* buffer, int iface);
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
/**
|
237 |
|
|
* @brief Read RX packet from channel \e chan to \e buffer without
|
238 |
|
|
* checking the channel's status from default interface.
|
239 |
|
|
*
|
240 |
|
|
* @param[in] chan Which channel to read.
|
241 |
|
|
* @param[out] buffer Place to store the data.
|
242 |
|
|
*
|
243 |
|
|
* @details This function copies channels RX buffer without checking
|
244 |
|
|
* wether or not it has received anything. Used when it's already
|
245 |
|
|
* known that there is whole packet available e.g. through interrupts
|
246 |
|
|
* or polling.
|
247 |
|
|
*/
|
248 |
|
|
void hpd_rx_packet_read(int chan, void* buffer);
|
249 |
|
|
|
250 |
|
|
|
251 |
|
|
/**
|
252 |
|
|
* @brief Gets the configuration information of packet channel \e chan
|
253 |
|
|
* from interface \e iface.
|
254 |
|
|
*
|
255 |
|
|
* @param[in] chan Which channel to read.
|
256 |
|
|
* @param[out] rx_base Base address where channel stores the data.
|
257 |
|
|
* @param[out] rx_bytes Size of the RX buffer in bytes.
|
258 |
|
|
* @param[out] rx_haddr HIBI address that this channel is listening to.
|
259 |
|
|
* @param[in] iface Which inteface to read from.
|
260 |
|
|
*
|
261 |
|
|
* @details Gets configuration information from one RX packet
|
262 |
|
|
* channel. Use NULL to disable returning particular parameter.
|
263 |
|
|
*/
|
264 |
|
|
void hpd_rx_packet_get_conf_gen(int chan, int* rx_base, int* rx_bytes,
|
265 |
|
|
int* rx_haddr, int iface);
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
/**
|
269 |
|
|
* @brief Gets the configuration information of packet channel \e chan
|
270 |
|
|
* from default interface.
|
271 |
|
|
*
|
272 |
|
|
* @param[in] chan Which channel to read.
|
273 |
|
|
* @param[out] rx_base Base address where channel stores the data.
|
274 |
|
|
* @param[out] rx_bytes Size of the RX buffer in bytes.
|
275 |
|
|
* @param[out] rx_haddr HIBI address that this channel is listening to.
|
276 |
|
|
*
|
277 |
|
|
* @details Gets configuration information from one RX packet
|
278 |
|
|
* channel. Use NULL to disable returning particular parameter.
|
279 |
|
|
*/
|
280 |
|
|
void hpd_rx_packet_get_conf(int chan, int* rx_base, int* rx_bytes,
|
281 |
|
|
int* rx_haddr);
|
282 |
|
|
|
283 |
|
|
|
284 |
|
|
/**
|
285 |
|
|
* @brief Poll RX packet channel \e chan from interface \e iface to
|
286 |
|
|
* check if it's received all data.
|
287 |
|
|
*
|
288 |
|
|
* @param[in] chan Which channel to check.
|
289 |
|
|
* @param[in] iface From which interface.
|
290 |
|
|
* @return One if packet channel has received a packet, zero otherwise.
|
291 |
|
|
*
|
292 |
|
|
* @warning Undefined behaviour if used for stream or unitialized channels.
|
293 |
|
|
*/
|
294 |
|
|
int hpd_rx_packet_poll_gen(int chan, int iface);
|
295 |
|
|
|
296 |
|
|
|
297 |
|
|
/**
|
298 |
|
|
* @brief Poll RX packet channel \e chan from default interface to
|
299 |
|
|
* check if it's received all data.
|
300 |
|
|
*
|
301 |
|
|
* @param[in] chan Which channel to check.
|
302 |
|
|
* @return One if packet channel has received a full packet, zero otherwise.
|
303 |
|
|
*
|
304 |
|
|
* @warning Undefined behavior if used for stream or unitialized channels.
|
305 |
|
|
*/
|
306 |
|
|
int hpd_rx_packet_poll(int chan);
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
/**
|
310 |
|
|
* @}
|
311 |
|
|
*/
|
312 |
|
|
|
313 |
|
|
/**
|
314 |
|
|
* @defgroup RX_STREAM RX Stream Functions
|
315 |
|
|
* @{
|
316 |
|
|
*/
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
/**
|
320 |
|
|
* @brief Initialize stream channel for reception on interface \e iface.
|
321 |
|
|
* @param[in] chan Which channel.
|
322 |
|
|
* @param[in] daddr Starting address of the buffer.
|
323 |
|
|
* @param[in] words Size of the receive buffer.
|
324 |
|
|
* @param[in] haddr Hibi address to listen to.
|
325 |
|
|
* @param[in] iface Which interface to use.
|
326 |
|
|
*
|
327 |
|
|
*/
|
328 |
|
|
void hpd_rx_stream_init_gen(int chan, int daddr,
|
329 |
|
|
int words, int haddr, int iface);
|
330 |
|
|
|
331 |
|
|
/**
|
332 |
|
|
* @brief Initialize stream channel for reception on default interface.
|
333 |
|
|
* @param[in] chan Which channel.
|
334 |
|
|
* @param[in] daddr Starting address of the buffer.
|
335 |
|
|
* @param[in] words Size of the receive buffer.
|
336 |
|
|
* @param[in] haddr Hibi address to listen to.
|
337 |
|
|
*/
|
338 |
|
|
void hpd_rx_stream_init(int chan, int daddr, int words, int haddr);
|
339 |
|
|
|
340 |
|
|
|
341 |
|
|
/**
|
342 |
|
|
* @brief Reinitializes stream channel with previous settings on
|
343 |
|
|
* interface \e iface.
|
344 |
|
|
*
|
345 |
|
|
* @param[in] chan Which channel.
|
346 |
|
|
* @param[in] iface Which interface to use.
|
347 |
|
|
*/
|
348 |
|
|
void hpd_rx_stream_reinit_gen(int chan, int iface);
|
349 |
|
|
|
350 |
|
|
|
351 |
|
|
/**
|
352 |
|
|
* @brief Reinitializes stream channel with previous settings on
|
353 |
|
|
* default interface.
|
354 |
|
|
*
|
355 |
|
|
* @warning Undefined bahaviour if used for packet channels.
|
356 |
|
|
*
|
357 |
|
|
* @param[in] chan Which channel.
|
358 |
|
|
*/
|
359 |
|
|
void hpd_rx_stream_reinit(int chan);
|
360 |
|
|
|
361 |
|
|
|
362 |
|
|
/**
|
363 |
|
|
* @brief Gets the configuration information of stream channel \e chan
|
364 |
|
|
* from interface \e iface.
|
365 |
|
|
*
|
366 |
|
|
* @param[in] chan Which channel to read.
|
367 |
|
|
* @param[out] rx_base Base address where channel stores the data.
|
368 |
|
|
* @param[out] rx_bytes Size of the RX buffer in bytes.
|
369 |
|
|
* @param[out] rx_haddr HIBI address that this channel is listening to.
|
370 |
|
|
* @param[in] iface Which inteface to read from.
|
371 |
|
|
*
|
372 |
|
|
* @details Gets configuration information from one RX stream
|
373 |
|
|
* channel. Use NULL to disable returning particular parameter.
|
374 |
|
|
*/
|
375 |
|
|
void hpd_rx_stream_get_conf_gen(int chan, int* rx_base, int* rx_bytes,
|
376 |
|
|
int* rx_haddr, int iface);
|
377 |
|
|
|
378 |
|
|
|
379 |
|
|
/**
|
380 |
|
|
* @brief Gets the configuration information of stream channel \e chan
|
381 |
|
|
* from default interface.
|
382 |
|
|
*
|
383 |
|
|
* @param[in] chan Which channel to read.
|
384 |
|
|
* @param[out] rx_base Base address where channel stores the data.
|
385 |
|
|
* @param[out] rx_bytes Size of the RX buffer in bytes.
|
386 |
|
|
* @param[out] rx_haddr HIBI address that this channel is listening to.
|
387 |
|
|
*
|
388 |
|
|
* @details Gets configuration information from one RX steram
|
389 |
|
|
* channel. Use NULL to disable returning particular parameter.
|
390 |
|
|
*/
|
391 |
|
|
void hpd_rx_stream_get_conf(int chan, int* rx_base, int* rx_bytes,
|
392 |
|
|
int* rx_haddr);
|
393 |
|
|
|
394 |
|
|
|
395 |
|
|
/**
|
396 |
|
|
* @brief Poll if RX stream channel \e chan on interface \e iface has
|
397 |
|
|
* receivedy any words.
|
398 |
|
|
*
|
399 |
|
|
* @param[in] chan Which channel to check.
|
400 |
|
|
* @param[in] iface From which interface.
|
401 |
|
|
* @return Number of received words.
|
402 |
|
|
*
|
403 |
|
|
* @warning Undefined behavior if used on packet or unitialized channel.
|
404 |
|
|
*/
|
405 |
|
|
int hpd_rx_stream_poll_gen(int chan, int iface);
|
406 |
|
|
|
407 |
|
|
|
408 |
|
|
/**
|
409 |
|
|
* @brief Poll if RX stream channel \e chan on default interface has
|
410 |
|
|
* receivedy any words.
|
411 |
|
|
*
|
412 |
|
|
* @param[in] chan Which channel to check.
|
413 |
|
|
* @return Number of received words.
|
414 |
|
|
*
|
415 |
|
|
* @warning Undefined behavior if used on packet or unitialized channel.
|
416 |
|
|
*/
|
417 |
|
|
int hpd_rx_stream_poll(int chan);
|
418 |
|
|
|
419 |
|
|
|
420 |
|
|
/**
|
421 |
|
|
* @brief Read \e words amount of words from channel \e chan on
|
422 |
|
|
* interface \e iface and store them to \e buffer.
|
423 |
|
|
*
|
424 |
|
|
* @param[in] chan Which channel to check.
|
425 |
|
|
* @param[in] words How many words to read.
|
426 |
|
|
* @param[in] buffer Where to store read words.
|
427 |
|
|
* @param[in] iface From which interface.
|
428 |
|
|
*
|
429 |
|
|
* @details Reads from a stream channel and acknowledges the channel
|
430 |
|
|
* about the amount read. This function should be used only when it's
|
431 |
|
|
* known that the channel has received at least \e words words of
|
432 |
|
|
* data.
|
433 |
|
|
*
|
434 |
|
|
* @warning Don't use ack function after this function because
|
435 |
|
|
* acknowledging is handled in this function. Undefined behaviour if
|
436 |
|
|
* used for packet channels.
|
437 |
|
|
*/
|
438 |
|
|
void hpd_rx_stream_read_gen(int chan, int words, int* buffer, int iface);
|
439 |
|
|
|
440 |
|
|
|
441 |
|
|
/**
|
442 |
|
|
* @brief Read \e words amount of words from channel \e chan on
|
443 |
|
|
* default interface store them to \e buffer.
|
444 |
|
|
*
|
445 |
|
|
* @param[in] chan Which channel to check.
|
446 |
|
|
* @param[in] words How many words to read.
|
447 |
|
|
* @param[in] buffer Where to store read words.
|
448 |
|
|
*
|
449 |
|
|
* @details Reads from a stream channel and acknowledges the channel
|
450 |
|
|
* about the amount read. This function should be used only when it's
|
451 |
|
|
* known that the channel has received at least \e words words of
|
452 |
|
|
* data.
|
453 |
|
|
*
|
454 |
|
|
* @warning No need to use ack function after this function because
|
455 |
|
|
* acknowledging is handled in this function. Undefined behaviour if
|
456 |
|
|
* used for packet channels.
|
457 |
|
|
*/
|
458 |
|
|
void hpd_rx_stream_read(int chan, int words, int* buffer);
|
459 |
|
|
|
460 |
|
|
|
461 |
|
|
/**
|
462 |
|
|
* @brief Acknowledege to stream channel on interface \e iface that \e
|
463 |
|
|
* words amount of words have been read from it.
|
464 |
|
|
*
|
465 |
|
|
* @param[in] chan Which channel to check.
|
466 |
|
|
* @param[in] words How many words was read.
|
467 |
|
|
* @param[in] iface From which interface.
|
468 |
|
|
*
|
469 |
|
|
* @details This functions is used to tell HIBI_PE_DMA that some words
|
470 |
|
|
* have been read from its RX stream channel so it can use that buffer
|
471 |
|
|
* again for receiving data.
|
472 |
|
|
*
|
473 |
|
|
* @warning Undefined behaviour if used for packet channels.
|
474 |
|
|
*/
|
475 |
|
|
void hpd_rx_stream_ack_gen(int chan, int words, int iface);
|
476 |
|
|
|
477 |
|
|
|
478 |
|
|
/**
|
479 |
|
|
* @brief Acknowledege to stream channel on default interface that \e
|
480 |
|
|
* words amount of words have been read from it.
|
481 |
|
|
*
|
482 |
|
|
* @param[in] chan Which channel to check.
|
483 |
|
|
* @param[in] words How many words was read.
|
484 |
|
|
* @param[in] iface From which interface.
|
485 |
|
|
*
|
486 |
|
|
* @details This functions is used to tell HIBI_PE_DMA that some words
|
487 |
|
|
* have been read from its RX stream channel so it can use that buffer
|
488 |
|
|
* again for receiving data.
|
489 |
|
|
*
|
490 |
|
|
* @warning Undefined behaviour if used for packet channels.
|
491 |
|
|
*/
|
492 |
|
|
void hpd_rx_stream_ack(int chan, int words);
|
493 |
|
|
|
494 |
|
|
/**
|
495 |
|
|
* @}
|
496 |
|
|
*/
|
497 |
|
|
|
498 |
|
|
/**
|
499 |
|
|
* @defgroup IRQ_FUNCS IRQ Functions
|
500 |
|
|
* @{
|
501 |
|
|
*/
|
502 |
|
|
|
503 |
|
|
|
504 |
|
|
/**
|
505 |
|
|
* @brief Enable HIBI_PE_DMA interrupts on interface \e iface.
|
506 |
|
|
*
|
507 |
|
|
* @param[in] iface Which interface.
|
508 |
|
|
*/
|
509 |
|
|
void hpd_irq_enable_gen(int iface);
|
510 |
|
|
|
511 |
|
|
|
512 |
|
|
/**
|
513 |
|
|
* @brief Enable HIBI_PE_DMA interrupts on default interface.
|
514 |
|
|
*
|
515 |
|
|
* @details Enables interrupts.
|
516 |
|
|
*/
|
517 |
|
|
void hpd_irq_enable();
|
518 |
|
|
|
519 |
|
|
|
520 |
|
|
/**
|
521 |
|
|
* @brief Disable HIBI_PE_DMA interrupts on interface \e iface.
|
522 |
|
|
*
|
523 |
|
|
* @param[in] iface Which interface.
|
524 |
|
|
*/
|
525 |
|
|
void hpd_irq_disable_gen(int iface);
|
526 |
|
|
|
527 |
|
|
|
528 |
|
|
/**
|
529 |
|
|
* @brief Disable HIBI_PE_DMA interrupts on default interface.
|
530 |
|
|
*
|
531 |
|
|
* @details Disables interrupts.
|
532 |
|
|
*/
|
533 |
|
|
void hpd_irq_disable();
|
534 |
|
|
|
535 |
|
|
|
536 |
|
|
/**
|
537 |
|
|
* @brief Acknowledge IRQ for packet channel \e chan on interface \e
|
538 |
|
|
* iface.
|
539 |
|
|
*
|
540 |
|
|
* @param[in] chan Channel to acknowledge.
|
541 |
|
|
* @param[in] iface Which interface.
|
542 |
|
|
*
|
543 |
|
|
*/
|
544 |
|
|
void hpd_irq_packet_ack_gen(int chan, int iface);
|
545 |
|
|
|
546 |
|
|
|
547 |
|
|
/**
|
548 |
|
|
* @brief Acknowledge IRQ for packet channel \e chan on default
|
549 |
|
|
* interface.
|
550 |
|
|
*
|
551 |
|
|
* @param[in] chan Channel to acknowledge.
|
552 |
|
|
*
|
553 |
|
|
*/
|
554 |
|
|
void hpd_irq_packet_ack(int chan);
|
555 |
|
|
|
556 |
|
|
|
557 |
|
|
/**
|
558 |
|
|
* @brief Acknowledge IRQ for stream channel \e chan on interface \e
|
559 |
|
|
* iface.
|
560 |
|
|
*
|
561 |
|
|
* @param[in] chan Channel to acknowledge.
|
562 |
|
|
* @param[in] iface Which interface.
|
563 |
|
|
*
|
564 |
|
|
*/
|
565 |
|
|
void hpd_irq_stream_ack_gen(int chan, int iface);
|
566 |
|
|
|
567 |
|
|
|
568 |
|
|
/**
|
569 |
|
|
* @brief Acknowledge IRQ for stream channel \e chan on default
|
570 |
|
|
* interface.
|
571 |
|
|
*
|
572 |
|
|
* @param[in] chan Channel to acknowledge.
|
573 |
|
|
*
|
574 |
|
|
*/
|
575 |
|
|
void hpd_irq_stream_ack(int chan);
|
576 |
|
|
|
577 |
|
|
|
578 |
|
|
/**
|
579 |
|
|
* @brief Returns IRQ vector from HIBI_PE_DMA interface \e iface.
|
580 |
|
|
*
|
581 |
|
|
* @details Returns a vector in which a high bit indicates an active
|
582 |
|
|
* interrupt source.
|
583 |
|
|
*
|
584 |
|
|
* @param[in] iface Which interface.
|
585 |
|
|
* @return IRQ vector.
|
586 |
|
|
*/
|
587 |
|
|
int hpd_irq_get_vector_gen(int iface);
|
588 |
|
|
|
589 |
|
|
|
590 |
|
|
/**
|
591 |
|
|
* @brief Returns IRQ vector from HIBI_PE_DMA default interface.
|
592 |
|
|
*
|
593 |
|
|
* @return IRQ vector.
|
594 |
|
|
*/
|
595 |
|
|
int hpd_irq_get_vector();
|
596 |
|
|
|
597 |
|
|
|
598 |
|
|
/**
|
599 |
|
|
* @brief Clear interrupts by mask on interface \e iface.
|
600 |
|
|
*
|
601 |
|
|
* @details Every bit high in the mask will clear the corresponding
|
602 |
|
|
* interrupt source.
|
603 |
|
|
*
|
604 |
|
|
* @param[in] mask Clear interrupt mask.
|
605 |
|
|
* @param[in] iface Which interface.
|
606 |
|
|
*
|
607 |
|
|
*/
|
608 |
|
|
void hpd_irq_clear_vector_gen(int mask, int iface);
|
609 |
|
|
|
610 |
|
|
|
611 |
|
|
/**
|
612 |
|
|
* @brief Clear interrupts by mask on default interface.
|
613 |
|
|
*
|
614 |
|
|
* @details Every bit high in the mask will clear the corresponding
|
615 |
|
|
* interrupt source.
|
616 |
|
|
*
|
617 |
|
|
* @param[in] mask Clear interrupt mask.
|
618 |
|
|
* @param[in] iface Which interface.
|
619 |
|
|
*
|
620 |
|
|
*/
|
621 |
|
|
void hpd_irq_clear_vector(int mask);
|
622 |
|
|
|
623 |
|
|
|
624 |
|
|
|
625 |
|
|
|
626 |
|
|
/**
|
627 |
|
|
* @}
|
628 |
|
|
*/
|
629 |
|
|
|
630 |
|
|
|
631 |
|
|
#endif
|
632 |
|
|
|
633 |
|
|
|
634 |
|
|
|
635 |
|
|
|