RTEMS  5.0.0
alt_dma.h
Go to the documentation of this file.
1 
7 /******************************************************************************
8 *
9 * Copyright 2013 Altera Corporation. All Rights Reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * 3. The name of the author may not be used to endorse or promote products
22 * derived from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO
27 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
29 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
33 * OF SUCH DAMAGE.
34 *
35 ******************************************************************************/
36 
37 #ifndef __ALT_DMA_H__
38 #define __ALT_DMA_H__
39 
40 #include "hwlib.h"
41 #include "alt_dma_common.h"
42 #include "alt_dma_program.h"
43 
44 #ifdef __cplusplus
45 extern "C"
46 {
47 #endif /* __cplusplus */
48 
76 #ifndef ALT_DMA_PERIPH_PROVISION_16550_SUPPORT
77 #define ALT_DMA_PERIPH_PROVISION_16550_SUPPORT (1)
78 #endif
79 
80 #ifndef ALT_DMA_PERIPH_PROVISION_QSPI_SUPPORT
81 #define ALT_DMA_PERIPH_PROVISION_QSPI_SUPPORT (1)
82 #endif
83 
102 {
109 }
111 
117 {
129 }
131 
137 {
142  ALT_DMA_MANAGER_FAULT_DBG_INSTR = (int32_t)(1UL << 30),
143 
148 
153  ALT_DMA_MANAGER_FAULT_MGR_EVNT_ERR = (int32_t)(1UL << 5),
154 
159  ALT_DMA_MANAGER_FAULT_DMAGO_ERR = (int32_t)(1UL << 4),
160 
166 
170  ALT_DMA_MANAGER_FAULT_UNDEF_INSTR = (int32_t)(1UL << 0)
171 }
173 
179 {
183  ALT_DMA_CHANNEL_FAULT_LOCKUP_ERR = (int32_t)(1UL << 31),
184 
189  ALT_DMA_CHANNEL_FAULT_DBG_INSTR = (int32_t)(1UL << 30),
190 
194  ALT_DMA_CHANNEL_FAULT_DATA_READ_ERR = (int32_t)(1UL << 18),
195 
199  ALT_DMA_CHANNEL_FAULT_DATA_WRITE_ERR = (int32_t)(1UL << 17),
200 
205 
210 
215  ALT_DMA_CHANNEL_FAULT_MFIFO_ERR = (int32_t)(1UL << 12),
216 
221  ALT_DMA_CHANNEL_FAULT_CH_RDWR_ERR = (int32_t)(1UL << 7),
222 
227  ALT_DMA_CHANNEL_FAULT_CH_PERIPH_ERR = (int32_t)(1UL << 6),
228 
234  ALT_DMA_CHANNEL_FAULT_CH_EVNT_ERR = (int32_t)(1UL << 5),
235 
241 
245  ALT_DMA_CHANNEL_FAULT_UNDEF_INSTR = (int32_t)(1UL << 0)
246 }
248 
254 {
260 
266 }
268 
274 {
279 
284 
289 }
291 
297 typedef struct ALT_DMA_CFG_s
298 {
303 
310 
317 
325 }
327 
355 
366 
377 
391 
403 
418  ALT_DMA_PROGRAM_t * pgm);
419 
437 
456  ALT_DMA_PROGRAM_REG_t reg, uint32_t * val);
457 
494 
506 
522  ALT_DMA_CHANNEL_STATE_t * state);
523 
535 
551  ALT_DMA_CHANNEL_FAULT_t * fault);
552 
571  ALT_DMA_EVENT_SELECT_t opt);
572 
589 
606 
623 
705  ALT_DMA_PROGRAM_t * program,
706  void * dest,
707  const void * src,
708  size_t size,
709  bool send_evt,
710  ALT_DMA_EVENT_t evt);
711 
742  ALT_DMA_PROGRAM_t * program,
743  void * buf,
744  size_t size,
745  bool send_evt,
746  ALT_DMA_EVENT_t evt);
747 
788  ALT_DMA_PROGRAM_t * program,
789  void * dst_reg,
790  const void * src_buf,
791  size_t count,
792  uint32_t register_width_bits,
793  bool send_evt,
794  ALT_DMA_EVENT_t evt);
795 
836  ALT_DMA_PROGRAM_t * program,
837  void * dst_buf,
838  const void * src_reg,
839  size_t count,
840  uint32_t register_width_bits,
841  bool send_evt,
842  ALT_DMA_EVENT_t evt);
843 
915  ALT_DMA_PROGRAM_t * program,
916  ALT_DMA_PERIPH_t dest,
917  const void * src,
918  size_t size,
919  void * periph_info,
920  bool send_evt,
921  ALT_DMA_EVENT_t evt);
922 
993  ALT_DMA_PROGRAM_t * program,
994  void * dest,
995  ALT_DMA_PERIPH_t src,
996  size_t size,
997  void * periph_info,
998  bool send_evt,
999  ALT_DMA_EVENT_t evt);
1000 
1009 #ifdef __cplusplus
1010 }
1011 #endif /* __cplusplus */
1012 
1013 #endif /* __ALT_DMA_H__ */
Definition: alt_dma.h:240
enum ALT_DMA_CHANNEL_STATE_e ALT_DMA_CHANNEL_STATE_t
Definition: alt_dma.h:288
ALT_STATUS_CODE alt_dma_register_to_memory(ALT_DMA_CHANNEL_t channel, ALT_DMA_PROGRAM_t *program, void *dst_buf, const void *src_reg, size_t count, uint32_t register_width_bits, bool send_evt, ALT_DMA_EVENT_t evt)
Definition: alt_dma.c:1780
ALT_STATUS_CODE alt_dma_send_event(ALT_DMA_EVENT_t evt_num)
Definition: alt_dma.c:619
ALT_STATUS_CODE alt_dma_event_int_status_get_raw(ALT_DMA_EVENT_t evt_num)
Definition: alt_dma.c:772
enum ALT_DMA_CHANNEL_FAULT_e ALT_DMA_CHANNEL_FAULT_t
ALT_STATUS_CODE alt_dma_channel_alloc_any(ALT_DMA_CHANNEL_t *allocated)
Definition: alt_dma.c:355
ALT_STATUS_CODE alt_dma_zero_to_memory(ALT_DMA_CHANNEL_t channel, ALT_DMA_PROGRAM_t *program, void *buf, size_t size, bool send_evt, ALT_DMA_EVENT_t evt)
Definition: alt_dma.c:1269
Definition: alt_dma.h:245
ALT_STATUS_CODE alt_dma_memory_to_memory(ALT_DMA_CHANNEL_t channel, ALT_DMA_PROGRAM_t *program, void *dest, const void *src, size_t size, bool send_evt, ALT_DMA_EVENT_t evt)
Definition: alt_dma.c:866
ALT_DMA_PERIPH_MUX_t periph_mux[4]
Definition: alt_dma.h:324
Definition: alt_dma.h:278
enum ALT_DMA_EVENT_e ALT_DMA_EVENT_t
Definition: alt_dma.h:118
ALT_STATUS_CODE alt_dma_int_clear(ALT_DMA_EVENT_t irq_num)
Definition: alt_dma.c:838
enum ALT_DMA_PERIPH_MUX_e ALT_DMA_PERIPH_MUX_t
ALT_STATUS_CODE alt_dma_event_int_select(ALT_DMA_EVENT_t evt_num, ALT_DMA_EVENT_SELECT_t opt)
Definition: alt_dma.c:735
ALT_DMA_SECURITY_t irq_sec[8]
Definition: alt_dma.h:309
Definition: alt_dma.h:142
enum ALT_DMA_MANAGER_FAULT_e ALT_DMA_MANAGER_FAULT_t
ALT_STATUS_CODE alt_dma_channel_fault_status_get(ALT_DMA_CHANNEL_t channel, ALT_DMA_CHANNEL_FAULT_t *fault)
Definition: alt_dma.c:709
Definition: alt_dma.h:165
ALT_DMA_SECURITY_t manager_sec
Definition: alt_dma.h:302
Definition: alt_dma.h:107
ALT_DMA_EVENT_SELECT_e
Definition: alt_dma.h:253
Definition: alt_dma.h:283
enum ALT_DMA_PERIPH_e ALT_DMA_PERIPH_t
ALT_STATUS_CODE alt_dma_memory_to_periph(ALT_DMA_CHANNEL_t channel, ALT_DMA_PROGRAM_t *program, ALT_DMA_PERIPH_t dest, const void *src, size_t size, void *periph_info, bool send_evt, ALT_DMA_EVENT_t evt)
Definition: alt_dma.c:3508
ALT_DMA_CHANNEL_FAULT_e
Definition: alt_dma.h:178
ALT_STATUS_CODE alt_dma_memory_to_register(ALT_DMA_CHANNEL_t channel, ALT_DMA_PROGRAM_t *program, void *dst_reg, const void *src_buf, size_t count, uint32_t register_width_bits, bool send_evt, ALT_DMA_EVENT_t evt)
Definition: alt_dma.c:1504
ALT_STATUS_CODE alt_dma_uninit(void)
Definition: alt_dma.c:304
ALT_STATUS_CODE alt_dma_manager_fault_status_get(ALT_DMA_MANAGER_FAULT_t *fault)
Definition: alt_dma.c:700
Definition: alt_dma.h:128
enum ALT_DMA_MANAGER_STATE_e ALT_DMA_MANAGER_STATE_t
Definition: alt_dma.h:108
ALT_STATUS_CODE alt_dma_init(const ALT_DMA_CFG_t *dma_cfg)
Definition: alt_dma.c:213
Definition: alt_dma.h:194
enum ALT_DMA_CHANNEL_e ALT_DMA_CHANNEL_t
Definition: alt_dma.h:265
ALT_STATUS_CODE alt_dma_channel_alloc(ALT_DMA_CHANNEL_t channel)
Definition: alt_dma.c:323
Definition: alt_dma.h:221
ALT_DMA_CHANNEL_STATE_e
Definition: alt_dma.h:116
enum ALT_DMA_SECURITY_e ALT_DMA_SECURITY_t
Definition: alt_dma.h:126
ALT_STATUS_CODE alt_dma_periph_to_memory(ALT_DMA_CHANNEL_t channel, ALT_DMA_PROGRAM_t *program, void *dest, ALT_DMA_PERIPH_t src, size_t size, void *periph_info, bool send_evt, ALT_DMA_EVENT_t evt)
Definition: alt_dma.c:3601
ALT_DMA_MANAGER_FAULT_e
Definition: alt_dma.h:136
Definition: alt_dma.h:297
Definition: alt_dma.h:259
Definition: alt_dma.h:122
Definition: alt_dma.h:170
Definition: alt_dma.h:125
ALT_STATUS_CODE alt_dma_manager_state_get(ALT_DMA_MANAGER_STATE_t *state)
Definition: alt_dma.c:661
ALT_DMA_SECURITY_t periph_sec[32]
Definition: alt_dma.h:316
Definition: alt_dma.h:234
ALT_STATUS_CODE alt_dma_int_status_get(ALT_DMA_EVENT_t irq_num)
Definition: alt_dma.c:805
Definition: alt_dma.h:104
ALT_STATUS_CODE alt_dma_channel_free(ALT_DMA_CHANNEL_t channel)
Definition: alt_dma.c:379
ALT_STATUS_CODE alt_dma_channel_state_get(ALT_DMA_CHANNEL_t channel, ALT_DMA_CHANNEL_STATE_t *state)
Definition: alt_dma.c:672
Definition: alt_dma.h:124
Definition: alt_dma.h:120
ALT_DMA_PERIPH_MUX_e
Definition: alt_dma.h:273
Definition: alt_dma.h:147
ALT_STATUS_CODE alt_dma_channel_kill(ALT_DMA_CHANNEL_t channel)
Definition: alt_dma.c:501
Definition: alt_dma.h:227
Definition: alt_dma.h:199
int32_t ALT_STATUS_CODE
Definition: hwlib.h:60
Definition: alt_dma.h:189
Definition: alt_dma_program.h:110
struct ALT_DMA_CFG_s ALT_DMA_CFG_t
ALT_STATUS_CODE alt_dma_channel_exec(ALT_DMA_CHANNEL_t channel, ALT_DMA_PROGRAM_t *pgm)
Definition: alt_dma.c:424
ALT_STATUS_CODE alt_dma_channel_reg_get(ALT_DMA_CHANNEL_t channel, ALT_DMA_PROGRAM_REG_t reg, uint32_t *val)
Definition: alt_dma.c:578
Definition: alt_dma.h:183
ALT_DMA_MANAGER_STATE_e
Definition: alt_dma.h:101
Definition: alt_dma.h:103
enum ALT_DMA_PROGRAM_REG_e ALT_DMA_PROGRAM_REG_t
Definition: alt_dma.h:204
Definition: alt_dma.h:215
unsigned size
Definition: tte.h:74
Definition: alt_dma.h:153
enum ALT_DMA_EVENT_SELECT_e ALT_DMA_EVENT_SELECT_t
Definition: alt_dma.h:119
Definition: alt_dma.h:121
Definition: alt_dma.h:123
Definition: alt_dma.h:106
Definition: alt_dma.h:105
Definition: alt_dma.h:159