From 1aa458af0b11f83627f7c8365acf6b74f52f18d3 Mon Sep 17 00:00:00 2001 From: asterix Date: Fri, 16 Sep 2011 14:10:41 +0000 Subject: [PATCH] Clean up and reformart. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5060 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/cortex-m3/drv/dmac_sam3.c | 14 +------------- bertos/cpu/cortex-m3/drv/dmac_sam3.h | 15 +-------------- bertos/cpu/cortex-m3/drv/i2s_sam3.c | 14 +++++++------- 3 files changed, 9 insertions(+), 34 deletions(-) diff --git a/bertos/cpu/cortex-m3/drv/dmac_sam3.c b/bertos/cpu/cortex-m3/drv/dmac_sam3.c index 764bb866..7c551174 100644 --- a/bertos/cpu/cortex-m3/drv/dmac_sam3.c +++ b/bertos/cpu/cortex-m3/drv/dmac_sam3.c @@ -111,22 +111,10 @@ struct DmacCh dmac_ch[] = /* We use event to signal the end of conversion */ -static Event data_ready; static Dmac dmac[DMAC_CHANNEL_CNT]; static uint8_t dmac_ch_enabled; -void dmac_configureDmacLLI(int ch, DmacDesc *lli, size_t transfer_size, uint32_t cfg, uint32_t ctrla, uint32_t ctrlb) -{ - DMAC_CHDR = BV(ch); - - *dmac_ch[ch].cfg = cfg | DMAC_CFG_FIFOCFG_ALAP_CFG | (0x1 << DMAC_CFG_AHB_PROT_SHIFT); - lli->ctrla = ctrla | (transfer_size & DMAC_CTRLA_BTSIZE_MASK); - lli->ctrlb = ctrlb;// & ~BV(DMAC_CTRLB_IEN); - *dmac_ch[ch].desc = (uint32_t)lli; -} - - -void dmac_configureDmaCfgLLI(int ch, DmacDesc *lli, uint32_t cfg) +void dmac_setLLITransfer(int ch, DmacDesc *lli, uint32_t cfg) { DMAC_CHDR = BV(ch); diff --git a/bertos/cpu/cortex-m3/drv/dmac_sam3.h b/bertos/cpu/cortex-m3/drv/dmac_sam3.h index 8650ac7f..041fac83 100644 --- a/bertos/cpu/cortex-m3/drv/dmac_sam3.h +++ b/bertos/cpu/cortex-m3/drv/dmac_sam3.h @@ -67,20 +67,7 @@ typedef struct Dmac #define DMAC_ERR_CH_ALREDY_ON BV(0) -INLINE void dmac_setSourcesLLI(int ch, DmacDesc *lli, uint32_t src, uint32_t dst, uint32_t desc) -{ - ASSERT(lli); - DMAC_CHDR = BV(ch); - - lli->src_addr = src; - lli->dst_addr = dst; - lli->dsc_addr = desc; -} - -void dmac_configureDmaCfgLLI(int ch, DmacDesc *lli, uint32_t cfg); -void dmac_setSourcesLLI(int ch, DmacDesc *lli, uint32_t src, uint32_t dst, uint32_t desc); -void dmac_configureDmacLLI(int ch, DmacDesc *lli, size_t transfer_size, uint32_t cfg, uint32_t ctrla, uint32_t ctrlb); - +void dmac_setLLITransfer(int ch, DmacDesc *lli, uint32_t cfg); void dmac_setSources(int ch, uint32_t src, uint32_t dst); void dmac_configureDmac(int ch, size_t transfer_size, uint32_t cfg, uint32_t ctrla, uint32_t ctrlb); int dmac_start(int ch); diff --git a/bertos/cpu/cortex-m3/drv/i2s_sam3.c b/bertos/cpu/cortex-m3/drv/i2s_sam3.c index 3da6dbc3..4b17b801 100644 --- a/bertos/cpu/cortex-m3/drv/i2s_sam3.c +++ b/bertos/cpu/cortex-m3/drv/i2s_sam3.c @@ -72,6 +72,11 @@ DmacDesc *curr; DmacDesc *next; DmacDesc *prev; +bool error = false; +uint32_t cfg; +uint32_t ctrla; +uint32_t ctrlb; + static int16_t *sample_buff; static size_t next_idx = 0; static size_t chunk_size = 0; @@ -97,11 +102,6 @@ static void sam3_i2s_txWait(I2s *i2s) event_wait(&data_ready); } -bool error = false; -uint32_t cfg; -uint32_t ctrla; -uint32_t ctrlb; - static void i2s_dmac_irq(uint32_t status) { I2S_STROBE_ON(); @@ -203,7 +203,7 @@ static void sam3_i2s_txStart(I2s *i2s, void *buf, size_t len, size_t slice_len) next_idx += chunk_size; } - dmac_configureDmaCfgLLI(I2S_DMAC_CH, &lli0, cfg); + dmac_setLLITransfer(I2S_DMAC_CH, &lli0, cfg); if (dmac_start(I2S_DMAC_CH) < 0) { @@ -213,7 +213,7 @@ static void sam3_i2s_txStart(I2s *i2s, void *buf, size_t len, size_t slice_len) error = false; SSC_CR = BV(SSC_TXEN); - PIOA_CODR = BV(13); + I2S_STROBE_OFF(); while (1) { -- 2.25.1