From: asterix Date: Fri, 2 Sep 2011 16:15:48 +0000 (+0000) Subject: The dmac trigger is differnt for rx and tx. X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=64b58c3028c86c7af96e38427648db55c7ba2474;p=bertos.git The dmac trigger is differnt for rx and tx. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5012 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cpu/cortex-m3/drv/hsmci_sam3.c b/bertos/cpu/cortex-m3/drv/hsmci_sam3.c index b32d688b..cc9b2718 100644 --- a/bertos/cpu/cortex-m3/drv/hsmci_sam3.c +++ b/bertos/cpu/cortex-m3/drv/hsmci_sam3.c @@ -167,6 +167,18 @@ void hsmci_prgTxDMA(uint32_t *buf, size_t word_num, size_t blk_size) hsmci_setBlockSize(blk_size); + //init DMAC + DMAC_EBCIDR = 0x3FFFFF; + DMAC_CHDR = 0x1F; + DMAC_CFG0 = BV(DMAC_CFG_DST_H2SEL) | DMAC_CFG_FIFOCFG_ALAP_CFG | (0x1 << DMAC_CFG_AHB_PROT_SHIFT); + + pmc_periphEnable(DMAC_ID); + DMAC_EN = BV(DMAC_EN_ENABLE); + sysirq_setHandler(INT_DMAC, dmac_irq); + + DMAC_EBCIER = BV(DMAC_EBCIER_BTC0) | BV(DMAC_EBCIER_ERR0); + + DMAC_CHDR = BV(DMAC_CHDR_DIS0); DMAC_SADDR0 = (uint32_t)buf; @@ -194,6 +206,17 @@ void hsmci_prgRxDMA(uint32_t *buf, size_t word_num, size_t blk_size) { hsmci_setBlockSize(blk_size); + //init DMAC + DMAC_EBCIDR = 0x3FFFFF; + DMAC_CHDR = 0x1F; + DMAC_CFG0 = BV(DMAC_CFG_SRC_H2SEL) | DMAC_CFG_FIFOCFG_ALAP_CFG | (0x1 << DMAC_CFG_AHB_PROT_SHIFT); + + pmc_periphEnable(DMAC_ID); + DMAC_EN = BV(DMAC_EN_ENABLE); + sysirq_setHandler(INT_DMAC, dmac_irq); + + DMAC_EBCIER = BV(DMAC_EBCIER_BTC0) | BV(DMAC_EBCIER_ERR0); + DMAC_CHDR = BV(DMAC_CHDR_DIS0); DMAC_SADDR0 = (uint32_t)&HSMCI_RDR; @@ -256,16 +279,4 @@ void hsmci_init(Hsmci *hsmci) HSMCI_CR = BV(HSMCI_CR_MCIEN); HSMCI_DMA = 0; - - //init DMAC - DMAC_EBCIDR = 0x3FFFFF; - DMAC_CHDR = 0x1F; - DMAC_CFG0 = BV(DMAC_CFG_SRC_H2SEL) | DMAC_CFG_FIFOCFG_ALAP_CFG | (0x1 << DMAC_CFG_AHB_PROT_SHIFT); - - pmc_periphEnable(DMAC_ID); - DMAC_EN = BV(DMAC_EN_ENABLE); - sysirq_setHandler(INT_DMAC, dmac_irq); - - DMAC_EBCIER = BV(DMAC_EBCIER_BTC0) | BV(DMAC_EBCIER_ERR0); - }