From: asterix Date: Wed, 30 Mar 2011 10:33:27 +0000 (+0000) Subject: Fix variable name. Remove for now the api from doxygen. Add callback for streaming. X-Git-Tag: 2.7.0~143 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=af4f2c25961192e1f670f6cc2fad65d371e1b241;p=bertos.git Fix variable name. Remove for now the api from doxygen. Add callback for streaming. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4823 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cpu/cortex-m3/drv/dac_sam3.c b/bertos/cpu/cortex-m3/drv/dac_sam3.c index 89f5aa71..b10ff62c 100644 --- a/bertos/cpu/cortex-m3/drv/dac_sam3.c +++ b/bertos/cpu/cortex-m3/drv/dac_sam3.c @@ -197,12 +197,12 @@ static bool sam3x_dac_isFinished(struct Dac *dac) return 0; } -static void sam3x_dac_start(struct Dac *dac, void *buf, size_t len, size_t slicelen) +static void sam3x_dac_start(struct Dac *dac, void *buf, size_t len, size_t slice_len) { (void)dac; (void)buf; (void)len; - (void)slicelen; + (void)slice_len; } static void sam3x_dac_stop(struct Dac *dac) diff --git a/bertos/drv/dac.h b/bertos/drv/dac.h index 82a59a0c..0a6ab0bd 100644 --- a/bertos/drv/dac.h +++ b/bertos/drv/dac.h @@ -64,8 +64,9 @@ typedef void (*SetChannelMaskFunc_t) (struct Dac *dac, uint32_t mask); typedef void (*SetSamplingRate_t) (struct Dac *dac, uint32_t rate); typedef void (*DmaConversionBufFunc_t) (struct Dac *dac, void *buf, size_t len); typedef bool (*DmaConversionIsFinished_t) (struct Dac *dac); -typedef void (*DmaStartStreamingFunc_t) (struct Dac *dac, void *buf, size_t len, size_t slicelen); +typedef void (*DmaStartStreamingFunc_t) (struct Dac *dac, void *buf, size_t len, size_t slice_len); typedef void (*DmaStopFunc_t) (struct Dac *dac); +typedef void (*DmaCallbackFunc_t) (struct Dac *dac); typedef struct DacContext { @@ -76,7 +77,8 @@ typedef struct DacContext DmaConversionIsFinished_t isFinished; DmaStartStreamingFunc_t start; DmaStopFunc_t stop; - size_t slicelen; + DmaCallbackFunc_t callback; + size_t slice_len; DB(id_t _type); @@ -106,7 +108,7 @@ INLINE void dac_setSamplingRate(Dac *dac, uint32_t rate) dac->ctx.setSampleRate(dac, rate); } -/** +/* * Convert \param len samples stored into \param buf. */ INLINE void dac_dmaConversionBuffer(Dac *dac, void *buf, size_t len) @@ -115,7 +117,7 @@ INLINE void dac_dmaConversionBuffer(Dac *dac, void *buf, size_t len) dac->ctx.conversion(dac, buf, len); } -/** +/* * Check if a dma transfer is finished. * * Useful for kernel-less applications. @@ -126,15 +128,18 @@ INLINE bool dac_dmaIsFinished(Dac *dac) return dac->ctx.isFinished(dac); } -/** +/* * \param slicelen Must be a divisor of len, ie. len % slicelen == 0. */ -INLINE void dac_dmaStartStreaming(Dac *dac, void *buf, size_t len, size_t slicelen) +INLINE void dac_dmaStartStreaming(Dac *dac, void *buf, size_t len, size_t slice_len, DmaCallbackFunc_t *callback) { ASSERT(dac->ctx.start); - ASSERT(len % slicelen == 0); - dac->ctx.slicelen = slicelen; - dac->ctx.start(dac, buf, len, slicelen); + ASSERT(len % slice_len == 0); + ASSERT(callback); + + dac->ctx.callback = callback; + dac->ctx.slicelen = slice_len; + dac->ctx.start(dac, buf, len, slice_len); } INLINE void dac_dmaStop(Dac *dac)