1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #14279 from bergzand/pr/sam0_common/dma_const_src

sam0_common/dma: Mark src parameter as const
This commit is contained in:
benpicco 2020-06-13 21:30:05 +02:00 committed by GitHub
commit 7bb3aa6560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View File

@ -760,8 +760,8 @@ void dma_setup(dma_t dma, unsigned trigger, uint8_t prio, bool irq);
* @param len Number of beats to transfer * @param len Number of beats to transfer
* @param incr Which of the addresses to increment after a beat * @param incr Which of the addresses to increment after a beat
*/ */
void dma_prepare(dma_t dma, uint8_t width, void *src, void *dst, size_t len, void dma_prepare(dma_t dma, uint8_t width, const void *src, void *dst,
dma_incr_t incr); size_t len, dma_incr_t incr);
/** /**
* @brief Prepare a transfer without modifying the destination address * @brief Prepare a transfer without modifying the destination address
@ -780,7 +780,7 @@ void dma_prepare(dma_t dma, uint8_t width, void *src, void *dst, size_t len,
* @param len Number of beats to transfer * @param len Number of beats to transfer
* @param incr Whether to increment the source address after a beat * @param incr Whether to increment the source address after a beat
*/ */
void dma_prepare_src(dma_t dma, void *src, size_t len, bool incr); void dma_prepare_src(dma_t dma, const void *src, size_t len, bool incr);
/** /**
* @brief Prepare a transfer without modifying the source address * @brief Prepare a transfer without modifying the source address
@ -817,7 +817,7 @@ void dma_prepare_dst(dma_t dma, void *dst, size_t len, bool incr);
* @param incr Which of the addresses to increment after a beat * @param incr Which of the addresses to increment after a beat
*/ */
void dma_append(dma_t dma, DmacDescriptor *descriptor, uint8_t width, void dma_append(dma_t dma, DmacDescriptor *descriptor, uint8_t width,
void *src, void *dst, size_t len, dma_incr_t incr); const void *src, void *dst, size_t len, dma_incr_t incr);
/** /**
* @brief Append a second transfer descriptor after the default channel * @brief Append a second transfer descriptor after the default channel
@ -833,8 +833,8 @@ void dma_append(dma_t dma, DmacDescriptor *descriptor, uint8_t width,
* @param len Number of beats to transfer * @param len Number of beats to transfer
* @param incr Whether to increment the source address after a beat * @param incr Whether to increment the source address after a beat
*/ */
void dma_append_src(dma_t dma, DmacDescriptor *next, void *src, size_t len, void dma_append_src(dma_t dma, DmacDescriptor *next, const void *src,
bool incr); size_t len, bool incr);
/** /**
* @brief Append a second transfer descriptor after the default channel * @brief Append a second transfer descriptor after the default channel

View File

@ -124,7 +124,7 @@ void dma_release_channel(dma_t dma)
irq_restore(state); irq_restore(state);
} }
static inline void _set_source(DmacDescriptor *descr, void *src) static inline void _set_source(DmacDescriptor *descr, const void *src)
{ {
descr->SRCADDR.reg = (uint32_t)src; descr->SRCADDR.reg = (uint32_t)src;
} }
@ -170,7 +170,7 @@ void dma_setup(dma_t dma, unsigned trigger, uint8_t prio, bool irq)
#endif #endif
} }
void dma_prepare(dma_t dma, uint8_t width, void *src, void *dst, size_t len, void dma_prepare(dma_t dma, uint8_t width, const void *src, void *dst, size_t len,
uint8_t incr) uint8_t incr)
{ {
DEBUG("[DMA]: Prepare %u, len: %u\n", dma, (unsigned)len); DEBUG("[DMA]: Prepare %u, len: %u\n", dma, (unsigned)len);
@ -184,7 +184,7 @@ void dma_prepare(dma_t dma, uint8_t width, void *src, void *dst, size_t len,
DMAC_BTCTRL_VALID; DMAC_BTCTRL_VALID;
} }
void dma_prepare_src(dma_t dma, void *src, size_t len, void dma_prepare_src(dma_t dma, const void *src, size_t len,
bool incr) bool incr)
{ {
DEBUG("[dma]: %u: prep src %p, %u, %u\n", dma, src, (unsigned)len, incr); DEBUG("[dma]: %u: prep src %p, %u, %u\n", dma, src, (unsigned)len, incr);
@ -209,7 +209,7 @@ void dma_prepare_dst(dma_t dma, void *dst, size_t len,
} }
void _fmt_append(DmacDescriptor *descr, DmacDescriptor *next, void _fmt_append(DmacDescriptor *descr, DmacDescriptor *next,
void *src, void *dst, size_t len) const void *src, void *dst, size_t len)
{ {
/* Configure the full descriptor besides the BTCTRL data */ /* Configure the full descriptor besides the BTCTRL data */
_set_next_descriptor(descr, next); _set_next_descriptor(descr, next);
@ -220,7 +220,7 @@ void _fmt_append(DmacDescriptor *descr, DmacDescriptor *next,
} }
void dma_append(dma_t dma, DmacDescriptor *next, uint8_t width, void dma_append(dma_t dma, DmacDescriptor *next, uint8_t width,
void *src, void *dst, size_t len, dma_incr_t incr) const void *src, void *dst, size_t len, dma_incr_t incr)
{ {
DmacDescriptor *descr = &descriptors[dma]; DmacDescriptor *descr = &descriptors[dma];
@ -230,8 +230,8 @@ void dma_append(dma_t dma, DmacDescriptor *next, uint8_t width,
_fmt_append(descr, next, src, dst, len); _fmt_append(descr, next, src, dst, len);
} }
void dma_append_src(dma_t dma, DmacDescriptor *next, void *src, size_t len, void dma_append_src(dma_t dma, DmacDescriptor *next, const void *src,
bool incr) size_t len, bool incr)
{ {
DmacDescriptor *descr = &descriptors[dma]; DmacDescriptor *descr = &descriptors[dma];