34#ifndef LIBBSP_SHARED_FSL_EDMA_H
35#define LIBBSP_SHARED_FSL_EDMA_H
46#ifdef LIBBSP_ARM_IMXRT_BSP_H
47 #define EDMA_CHANNEL_COUNT 32U
48#elif MPC55XX_CHIP_FAMILY == 551
49 #define EDMA_CHANNEL_COUNT 16U
50#elif MPC55XX_CHIP_FAMILY == 564
51 #define EDMA_CHANNEL_COUNT 16U
52#elif MPC55XX_CHIP_FAMILY == 567
53 #define EDMA_CHANNEL_COUNT 96U
55 #define EDMA_CHANNEL_COUNT 64U
58#define EDMA_MODULE_COUNT ((EDMA_CHANNEL_COUNT + 63U) / 64U)
60#define EDMA_CHANNELS_PER_MODULE 64U
62volatile struct fsl_edma_tcd *fsl_edma_tcd_of_channel_index(
unsigned index);
63unsigned fsl_edma_channel_index_of_tcd(
volatile struct fsl_edma_tcd *edma_tcd);
65#ifdef LIBBSP_POWERPC_MPC55XXEVB_BSP_H
66 #error Legacy stuff. Move to compatibility layer.
67 #if EDMA_MODULE_COUNT == 1
68 #define EDMA_TCD_BY_CHANNEL_INDEX(channel_index) \
69 (&EDMA.TCD[(channel_index)])
70 #elif EDMA_MODULE_COUNT == 2
71 #define EDMA_TCD_BY_CHANNEL_INDEX(channel_index) \
72 ((channel_index) < EDMA_CHANNELS_PER_MODULE ? \
73 &EDMA_A.TCD[(channel_index)] \
74 : &EDMA_B.TCD[(channel_index) - EDMA_CHANNELS_PER_MODULE])
76 #error "unsupported module count"
80#ifdef LIBBSP_POWERPC_MPC55XXEVB_BSP_H
83 EDMA_EQADC_A_FISR0_CFFF0 = 0,
84 EDMA_EQADC_A_FISR0_RFDF0 = 1,
85 EDMA_EQADC_A_FISR1_CFFF1 = 2,
86 EDMA_EQADC_A_FISR1_RFDF1 = 3,
87 EDMA_EQADC_A_FISR2_CFFF2 = 4,
88 EDMA_EQADC_A_FISR2_RFDF2 = 5,
89 EDMA_EQADC_A_FISR3_CFFF3 = 6,
90 EDMA_EQADC_A_FISR3_RFDF3 = 7,
91 EDMA_EQADC_A_FISR4_CFFF4 = 8,
92 EDMA_EQADC_A_FISR4_RFDF4 = 9,
93 EDMA_EQADC_A_FISR5_CFFF5 = 10,
94 EDMA_EQADC_A_FISR5_RFDF5 = 11,
95 EDMA_DSPI_B_SR_TFFF = 12,
96 EDMA_DSPI_B_SR_RFDF = 13,
97 EDMA_DSPI_C_SR_TFFF = 14,
98 EDMA_DSPI_C_SR_RFDF = 15,
99 EDMA_DSPI_D_SR_TFFF = 16,
100 EDMA_DSPI_D_SR_RFDF = 17,
101 EDMA_ESCI_A_COMBTX = 18,
102 EDMA_ESCI_A_COMBRX = 19,
103 EDMA_EMIOS_GFR_F0 = 20,
104 EDMA_EMIOS_GFR_F1 = 21,
105 EDMA_EMIOS_GFR_F2 = 22,
106 EDMA_EMIOS_GFR_F3 = 23,
107 EDMA_EMIOS_GFR_F4 = 24,
108 EDMA_EMIOS_GFR_F8 = 25,
109 EDMA_EMIOS_GFR_F9 = 26,
110 EDMA_ETPU_CDTRSR_A_DTRS0 = 27,
111 EDMA_ETPU_CDTRSR_A_DTRS1 = 28,
112 EDMA_ETPU_CDTRSR_A_DTRS2 = 29,
113 EDMA_ETPU_CDTRSR_A_DTRS14 = 30,
114 EDMA_ETPU_CDTRSR_A_DTRS15 = 31,
115 EDMA_DSPI_A_SR_TFFF = 32,
116 EDMA_DSPI_A_SR_RFDF = 33,
117 EDMA_ESCI_B_COMBTX = 34,
118 EDMA_ESCI_B_COMBRX = 35,
119 EDMA_EMIOS_GFR_F6 = 36,
120 EDMA_EMIOS_GFR_F7 = 37,
121 EDMA_EMIOS_GFR_F10 = 38,
122 EDMA_EMIOS_GFR_F11 = 39,
123 EDMA_EMIOS_GFR_F16 = 40,
124 EDMA_EMIOS_GFR_F17 = 41,
125 EDMA_EMIOS_GFR_F18 = 42,
126 EDMA_EMIOS_GFR_F19 = 43,
127 EDMA_ETPU_CDTRSR_A_DTRS12 = 44,
128 EDMA_ETPU_CDTRSR_A_DTRS13 = 45,
129 EDMA_ETPU_CDTRSR_A_DTRS28 = 46,
130 EDMA_ETPU_CDTRSR_A_DTRS29 = 47,
131 EDMA_SIU_EISR_EIF0 = 48,
132 EDMA_SIU_EISR_EIF1 = 49,
133 EDMA_SIU_EISR_EIF2 = 50,
134 EDMA_SIU_EISR_EIF3 = 51,
135 EDMA_ETPU_CDTRSR_B_DTRS0 = 52,
136 EDMA_ETPU_CDTRSR_B_DTRS1 = 53,
137 EDMA_ETPU_CDTRSR_B_DTRS2 = 54,
138 EDMA_ETPU_CDTRSR_B_DTRS3 = 55,
139 EDMA_ETPU_CDTRSR_B_DTRS12 = 56,
140 EDMA_ETPU_CDTRSR_B_DTRS13 = 57,
141 EDMA_ETPU_CDTRSR_B_DTRS14 = 58,
142 EDMA_ETPU_CDTRSR_B_DTRS15 = 59,
143 EDMA_ETPU_CDTRSR_B_DTRS28 = 60,
144 EDMA_ETPU_CDTRSR_B_DTRS29 = 61,
145 EDMA_ETPU_CDTRSR_B_DTRS30 = 62,
146 EDMA_ETPU_CDTRSR_B_DTRS31 = 63
147 #if MPC55XX_CHIP_FAMILY == 567
149 EDMA_EQADC_B_FISR0_CFFF0 = 64 + 0,
150 EDMA_EQADC_B_FISR0_RFDF0 = 64 + 1,
151 EDMA_EQADC_B_FISR1_CFFF1 = 64 + 2,
152 EDMA_EQADC_B_FISR1_RFDF1 = 64 + 3,
153 EDMA_EQADC_B_FISR2_CFFF2 = 64 + 4,
154 EDMA_EQADC_B_FISR2_RFDF2 = 64 + 5,
155 EDMA_EQADC_B_FISR3_CFFF3 = 64 + 6,
156 EDMA_EQADC_B_FISR3_RFDF3 = 64 + 7,
157 EDMA_EQADC_B_FISR4_CFFF4 = 64 + 8,
158 EDMA_EQADC_B_FISR4_RFDF4 = 64 + 9,
159 EDMA_EQADC_B_FISR5_CFFF5 = 64 + 10,
160 EDMA_EQADC_B_FISR5_RFDF5 = 64 + 11,
161 EDMA_DECFILTER_A_IB = 64 + 12,
162 EDMA_DECFILTER_A_OB = 64 + 13,
163 EDMA_DECFILTER_B_IB = 64 + 14,
164 EDMA_DECFILTER_B_OB = 64 + 15,
165 EDMA_DECFILTER_C_IB = 64 + 16,
166 EDMA_DECFILTER_C_OB = 64 + 17,
167 EDMA_DECFILTER_D_IB = 64 + 18,
168 EDMA_DECFILTER_D_OB = 64 + 19,
169 EDMA_DECFILTER_E_IB = 64 + 20,
170 EDMA_DECFILTER_E_OB = 64 + 21,
171 EDMA_DECFILTER_F_IB = 64 + 22,
172 EDMA_DECFILTER_F_OB = 64 + 23,
173 EDMA_DECFILTER_G_IB = 64 + 24,
174 EDMA_DECFILTER_G_OB = 64 + 25,
175 EDMA_DECFILTER_H_IB = 64 + 26,
176 EDMA_DECFILTER_H_OB = 64 + 27
183 volatile struct fsl_edma_tcd *edma_tcd;
187void fsl_edma_init(
void);
196 volatile struct fsl_edma_tcd *edma_tcd
199void fsl_edma_release_channel_by_tcd(
volatile struct fsl_edma_tcd *edma_tcd);
221 unsigned irq_priority
257 volatile struct fsl_edma_tcd *edma_tcd,
258 const struct fsl_edma_tcd *source_tcd
268 volatile struct fsl_edma_tcd *edma_tcd,
269 const struct fsl_edma_tcd *source_tcd
272void fsl_edma_sg_link(
273 volatile struct fsl_edma_tcd *edma_tcd,
274 const struct fsl_edma_tcd *source_tcd
277static inline volatile struct fsl_edma *fsl_edma_by_tcd(
278 volatile struct fsl_edma_tcd *edma_tcd
282 ((uintptr_t) edma_tcd & ~(uintptr_t) 0x1fff);
285static inline unsigned fsl_edma_channel_by_tcd(
286 volatile struct fsl_edma_tcd *edma_tcd
289 volatile struct fsl_edma *edma = fsl_edma_by_tcd(edma_tcd);
291 return edma_tcd - &edma->TCD[0];
294static inline void fsl_edma_enable_hardware_requests(
295 volatile struct fsl_edma_tcd *edma_tcd
298 volatile struct fsl_edma *edma = fsl_edma_by_tcd(edma_tcd);
299 unsigned channel = edma_tcd - &edma->TCD[0];
301 edma->SERQR = (uint8_t) channel;
304static inline void fsl_edma_disable_hardware_requests(
305 volatile struct fsl_edma_tcd *edma_tcd
308 volatile struct fsl_edma *edma = fsl_edma_by_tcd(edma_tcd);
309 unsigned channel = edma_tcd - &edma->TCD[0];
311 edma->CERQR = (uint8_t) channel;
314static inline void fsl_edma_enable_error_interrupts(
315 volatile struct fsl_edma_tcd *edma_tcd
318 volatile struct fsl_edma *edma = fsl_edma_by_tcd(edma_tcd);
319 unsigned channel = edma_tcd - &edma->TCD[0];
321 edma->SEEIR = (uint8_t) channel;
324static inline void fsl_edma_disable_error_interrupts(
325 volatile struct fsl_edma_tcd *edma_tcd
328 volatile struct fsl_edma *edma = fsl_edma_by_tcd(edma_tcd);
329 unsigned channel = edma_tcd - &edma->TCD[0];
331 edma->CEEIR = (uint8_t) channel;
334static inline void fsl_edma_set_start(
335 volatile struct fsl_edma_tcd *edma_tcd
338 volatile struct fsl_edma *edma = fsl_edma_by_tcd(edma_tcd);
339 unsigned channel = edma_tcd - &edma->TCD[0];
341 edma->SSBR = (uint8_t) channel;
344static inline void fsl_edma_clear_done(
345 volatile struct fsl_edma_tcd *edma_tcd
348 volatile struct fsl_edma *edma = fsl_edma_by_tcd(edma_tcd);
349 unsigned channel = edma_tcd - &edma->TCD[0];
351 edma->CDSBR = (uint8_t) channel;
354static inline void fsl_edma_clear_interrupts(
355 volatile struct fsl_edma_tcd *edma_tcd
358 volatile struct fsl_edma *edma = fsl_edma_by_tcd(edma_tcd);
359 unsigned channel = edma_tcd - &edma->TCD[0];
361 edma->CIRQR = (uint8_t) channel;
364static inline bool fsl_edma_is_done(
365 volatile struct fsl_edma_tcd *edma_tcd
368 return ((edma_tcd->BMF & EDMA_TCD_BMF_DONE) != 0);
This header file provides the Chains API.
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
void fsl_edma_copy(volatile struct fsl_edma_tcd *edma_tcd, const struct fsl_edma_tcd *source_tcd)
Copies a source TCD to an eDMA TCD.
Definition: fsl-edma.c:432
rtems_status_code fsl_edma_obtain_next_free_channel(fsl_edma_channel_context *ctx)
Obtains a free eDMA channel and registers the channel context.
Definition: fsl-edma.c:388
void fsl_edma_copy_and_enable_hardware_requests(volatile struct fsl_edma_tcd *edma_tcd, const struct fsl_edma_tcd *source_tcd)
Copies a source TCD to an eDMA TCD and enables hardware requests.
Definition: fsl-edma.c:450
rtems_status_code fsl_edma_obtain_channel_by_tcd(volatile struct fsl_edma_tcd *edma_tcd)
Obtains an eDMA channel.
Definition: fsl-edma.c:300
rtems_status_code fsl_edma_obtain_channel(fsl_edma_channel_context *ctx, unsigned irq_priority)
Obtains a specific eDMA channel and registers the channel context.
Definition: fsl-edma.c:375
This header file defines the RTEMS Classic API.
This structure represents a chain node.
Definition: chain.h:78
Definition: regs-edma.h:95