From a5cc64b8fb7daebbb65b96034757c4daee115649 Mon Sep 17 00:00:00 2001 From: asterix Date: Tue, 6 Sep 2011 12:16:20 +0000 Subject: [PATCH] Move all pins init into sd hw file. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5032 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/cortex-m3/drv/hsmci_sam3.c | 29 ++++----------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/bertos/cpu/cortex-m3/drv/hsmci_sam3.c b/bertos/cpu/cortex-m3/drv/hsmci_sam3.c index 134a972c..51b79d9c 100644 --- a/bertos/cpu/cortex-m3/drv/hsmci_sam3.c +++ b/bertos/cpu/cortex-m3/drv/hsmci_sam3.c @@ -36,11 +36,13 @@ #include "hsmci_sam3.h" +#include "hw/hw_sd.h" #include -#include #include +#include + #include /** DMA Transfer Descriptor as well as Linked List Item */ @@ -53,9 +55,6 @@ typedef struct DmacDesc uint32_t dsc_addr; /**< Next descriptor address */ } DmacDesc; - - - #define HSMCI_CLK_DIV(RATE) ((CPU_FREQ / (RATE << 1)) - 1) @@ -76,21 +75,6 @@ typedef struct DmacDesc cpu_relax(); \ } while (!(HSMCI_SR & BV(HSMCI_SR_RXRDY))) -#define HSMCI_HW_INIT() \ -do { \ - PIOA_PDR = BV(19) | BV(20) | BV(21) | BV(22) | BV(23) | BV(24); \ - PIO_PERIPH_SEL(PIOA_BASE, BV(19) | BV(20) | BV(21) | BV(22) | BV(23) | BV(24), PIO_PERIPH_A); \ -} while (0) - - -#define STROBE_ON() PIOB_SODR = BV(13) -#define STROBE_OFF() PIOB_CODR = BV(13) -#define STROBE_INIT() \ - do { \ - PIOB_OER = BV(13); \ - PIOB_PER = BV(13); \ - } while(0) - static DECLARE_ISR(hsmci_irq) { uint32_t status = HSMCI_SR; @@ -99,7 +83,6 @@ static DECLARE_ISR(hsmci_irq) } } - static DECLARE_ISR(dmac_irq) { uint32_t stat = DMAC_EBCISR; @@ -120,7 +103,6 @@ void hsmci_readResp(uint32_t *resp, size_t len) bool hsmci_sendCmd(uint8_t index, uint32_t argument, uint32_t reply_type) { - STROBE_ON(); HSMCI_WAIT(); HSMCI_ARGR = argument; @@ -137,7 +119,6 @@ bool hsmci_sendCmd(uint8_t index, uint32_t argument, uint32_t reply_type) status = HSMCI_SR; } - STROBE_OFF(); return 0; } @@ -212,8 +193,7 @@ void hsmci_init(Hsmci *hsmci) { (void)hsmci; - HSMCI_HW_INIT(); - STROBE_INIT(); + SD_PIN_INIT(); pmc_periphEnable(HSMCI_ID); HSMCI_CR = BV(HSMCI_CR_SWRST); @@ -233,7 +213,6 @@ void hsmci_init(Hsmci *hsmci) DMAC_EBCIDR = 0x3FFFFF; DMAC_CHDR = 0x1F; - pmc_periphEnable(DMAC_ID); DMAC_EN = BV(DMAC_EN_ENABLE); sysirq_setHandler(INT_DMAC, dmac_irq); -- 2.25.1