SD card support on ersky9x board

Little animation at Tx start
Backlight support for simu
Mixes slow down / up now go 2 times faster
This commit is contained in:
bsongis
2012-06-17 21:01:07 +00:00
18 changed files with 1006 additions and 276 deletions
+21 -2
View File
@@ -36,7 +36,26 @@ void init_SDcard()
#ifndef SIMU
configure_pins( 0xFC000000, PIN_PERIPHERAL | PIN_INPUT | PIN_PER_C | PIN_PORTA | PIN_NO_PULLUP ) ;
configure_pins( PIO_PB7, PIN_INPUT | PIN_PORTB | PIN_NO_PULLUP | PIN_NO_PULLDOWN ) ;
SD_Init() ;
unsigned short clkDiv;
Hsmci *pMciHw = HSMCI ;
/* Enable the MCI peripheral */
PMC->PMC_PCER0 |= 1 << ID_HSMCI ; // Enable peripheral clock to HSMCI
pMciHw->HSMCI_CR = HSMCI_CR_SWRST; /* Reset the MCI */
pMciHw->HSMCI_CR = HSMCI_CR_MCIDIS | HSMCI_CR_PWSDIS; /* Disable the MCI */
pMciHw->HSMCI_IDR = 0xFFFFFFFF; /* Disable all the interrupts */
pMciHw->HSMCI_DTOR = HSMCI_DTOR_DTOCYC_Msk | HSMCI_DTOR_DTOMUL_Msk ; /* Set the Data Timeout Register */
pMciHw->HSMCI_CSTOR = HSMCI_CSTOR_CSTOCYC_Msk | HSMCI_CSTOR_CSTOMUL_Msk ; /* CSTOR ? */
/* Set the Mode Register: 400KHz for MCK = 48MHz (CLKDIV = 58) */
clkDiv = (Master_frequency / (MCI_INITIAL_SPEED * 2)) - 1;
pMciHw->HSMCI_MR = clkDiv | (7 << 8) ;
/* Set the SDCard Register 1-bit, slot A */
pMciHw->HSMCI_SDCR = HSMCI_SDCR_SDCSEL_SLOTA | HSMCI_SDCR_SDCBUS_1 ;
/* Enable the MCI and the Power Saving */
pMciHw->HSMCI_CR = HSMCI_CR_MCIEN | HSMCI_CR_PWSEN ;
/* Configure MCI */
pMciHw->HSMCI_CFG = HSMCI_CFG_FIFOMODE | ((1 << 4) & HSMCI_CFG_FERRCTRL);
#endif
}