aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/SPC5xx/EDMA_v1
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/platforms/SPC5xx/EDMA_v1')
-rw-r--r--os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.c42
-rw-r--r--os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.h77
2 files changed, 77 insertions, 42 deletions
diff --git a/os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.c b/os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.c
index b48cb1c30..4504afd68 100644
--- a/os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.c
+++ b/os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.c
@@ -1363,48 +1363,6 @@ void edmaChannelRelease(edma_channel_t channel) {
channels[channel] = NULL;
}
-/**
- * @brief EDMA channel setup.
- *
- * @param[in] channel eDMA channel number
- * @param[in] src source address
- * @param[in] dst destination address
- * @param[in] soff source address offset
- * @param[in] doff destination address offset
- * @param[in] ssize source transfer size
- * @param[in] dsize destination transfer size
- * @param[in] nbytes minor loop count
- * @param[in] iter major loop count
- * @param[in] dlast_sga Last Destination Address Adjustment or
- * Scatter Gather Address
- * @param[in] slast last source address adjustment
- * @param[in] mode LSW of TCD register 7
- */
-void edmaChannelSetupx(edma_channel_t channel,
- void *src,
- void *dst,
- uint32_t soff,
- uint32_t doff,
- uint32_t ssize,
- uint32_t dsize,
- uint32_t nbytes,
- uint32_t iter,
- uint32_t slast,
- uint32_t dlast,
- uint32_t mode) {
-
- edma_tcd_t *tcdp = edmaGetTCD(channel);
-
- tcdp->word[0] = (uint32_t)src;
- tcdp->word[1] = (ssize << 24) | (dsize << 16) | soff;
- tcdp->word[2] = nbytes;
- tcdp->word[3] = slast;
- tcdp->word[0] = (uint32_t)dst;
- tcdp->word[5] = (iter << 16) | doff;
- tcdp->word[6] = dlast;
- tcdp->word[7] = (iter << 16) | mode;
-}
-
#endif /* SPC5_HAS_EDMA */
/** @} */
diff --git a/os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.h b/os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.h
index 1e20b41e7..767eb11ff 100644
--- a/os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.h
+++ b/os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.h
@@ -44,8 +44,14 @@
#define EDMA_TCD_MODE_INT_END (1U << 1)
#define EDMA_TCD_MODE_INT_HALF (1U << 2)
#define EDMA_TCD_MODE_DREQ (1U << 3)
+#define EDMA_TCD_MODE_SG (1U << 4)
+#define EDMA_TCD_MODE_MELINK (1U << 5)
#define EDMA_TCD_MODE_ACTIVE (1U << 6)
#define EDMA_TCD_MODE_DONE (1U << 7)
+#define EDMA_TCD_MODE_MLINKCH_MASK (63U << 8)
+#define EDMA_TCD_MODE_MLINKCH(n) ((uint32_t)(n) << 8)
+#define EDMA_TCD_MODE_BWC_MASK (3U << 14)
+#define EDMA_TCD_MODE_BWC(n) ((uint32_t)(n) << 14)
/** @} */
/*===========================================================================*/
@@ -736,6 +742,24 @@ typedef struct {
((uint32_t)(doff) << 0)))
/**
+ * @brief Sets the word 5 fields into a TCD.
+ * @note Transfers are limited to 511 operations using this modality
+ * (citer parameter).
+ *
+ * @param[in] tcdp pointer to an @p edma_tcd_t structure
+ * @param[in] linkch channel linked on minor loop counter
+ * @param[in] citer the current outer counter value
+ * @param[in] doff the destination increment value
+ *
+ * @api
+ */
+#define edmaTCDSetWord5LinkedOnMinor(tcdp, linkch, citer, doff) \
+ ((tcdp)->word[5] = (((uint32_t)0x80000000) | \
+ ((uint32_t)(linkch) << 25) | \
+ ((uint32_t)(citer) << 16) | \
+ ((uint32_t)(doff) << 0)))
+
+/**
* @brief Sets the word 6 fields into a TCD.
*
* @param[in] tcdp pointer to an @p edma_tcd_t structure
@@ -760,6 +784,24 @@ typedef struct {
((uint32_t)(mode) << 0)))
/**
+ * @brief Sets the word 7 fields into a TCD.
+ * @note Transfers are limited to 511 operations using this modality
+ * (biter parameter).
+ *
+ * @param[in] tcdp pointer to an @p edma_tcd_t structure
+ * @param[in] linkch channel linked on minor loop counter
+ * @param[in] biter the base outer counter value
+ * @param[in] mode the mode value
+ *
+ * @api
+ */
+#define edmaTCDSetWord7LinkedOnMinor(tcdp, linkch, biter, mode) \
+ ((tcdp)->word[7] = (((uint32_t)0x80000000) | \
+ ((uint32_t)(linkch) << 25) | \
+ ((uint32_t)(biter) << 16) | \
+ ((uint32_t)(mode) << 0)))
+
+/**
* @brief Starts or restarts an EDMA channel.
*
* @param[in] channel the channel number
@@ -811,6 +853,41 @@ typedef struct {
edmaTCDSetWord7(tcdp, iter, mode); \
}
+/**
+ * @brief EDMA channel setup with linked channel on minor loop counter.
+ * @note Transfers are limited to 511 operations using this modality
+ * (iter parameter).
+ *
+ * @param[in] channel eDMA channel number
+ * @param[in] linkch channel linked on minor loop counter
+ * @param[in] src source address
+ * @param[in] dst destination address
+ * @param[in] soff source address offset
+ * @param[in] doff destination address offset
+ * @param[in] ssize source transfer size
+ * @param[in] dsize destination transfer size
+ * @param[in] nbytes minor loop count
+ * @param[in] iter major loop count
+ * @param[in] dlast last destination address adjustment
+ * @param[in] slast last source address adjustment
+ * @param[in] mode LSW of TCD register 7
+ *
+ * @api
+ */
+#define edmaChannelSetupLinkedOnMinor(channel, linkch, src, dst, soff, \
+ doff, ssize, dsize, nbytes, iter, \
+ slast, dlast, mode) { \
+ edma_tcd_t *tcdp = edmaGetTCD(channel); \
+ edmaTCDSetWord0(tcdp, src); \
+ edmaTCDSetWord1(tcdp, ssize, dsize, soff); \
+ edmaTCDSetWord2(tcdp, nbytes); \
+ edmaTCDSetWord3(tcdp, slast); \
+ edmaTCDSetWord4(tcdp, dst); \
+ edmaTCDSetWord5LinkedOnMinor(tcdp, linkch, iter, doff); \
+ edmaTCDSetWord6(tcdp, dlast); \
+ edmaTCDSetWord7LinkedOnMinor(tcdp, linkch, iter, mode); \
+}
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/