Added security Pullups

This commit is contained in:
Mario Hüttel 2015-11-25 18:17:54 +01:00
parent 7065af6477
commit 7c937c879e

View File

@ -67,7 +67,7 @@ void SDIO_DMA_Init(){
DMASTREAM->CR = DMAM2P; DMASTREAM->CR = DMAM2P;
//Address Conffiguration //Address Conffiguration
//Memory address is set by write and read block functions //Memory address is set by write and read block functions
//DMASTREAM->M0AR = (uint32_t)&rxtxbuffer; //Has to be set in red/write func //DMASTREAM->M0AR = (uint32_t)&rxtxbuffer; //Has to be set in read/write func
DMASTREAM->PAR = (uint32_t)&SDIO->FIFO; //Not sure if this works DMASTREAM->PAR = (uint32_t)&SDIO->FIFO; //Not sure if this works
//DMASTREAM->CR |= DMA_SxCR_EN; //DMASTREAM->CR |= DMA_SxCR_EN;
@ -80,10 +80,14 @@ void SDIO_InitModule(){
//Init Alternate Functions //Init Alternate Functions
CLKPORT->MODER |= (2<<CLKPIN*2); CLKPORT->MODER |= (2<<CLKPIN*2);
D0PORT->MODER |= (2<<D0PIN*2); D0PORT->MODER |= (2<<D0PIN*2);
D0PORT->PUPDR |= (1<<D0PIN*2);
#if BUSWIDTH==1 #if BUSWIDTH==1
D1PORT->MODER |= (2<<D1PIN*2); D1PORT->MODER |= (2<<D1PIN*2);
D1PORT->PUPDR |= (1<<D1PIN*2);
D2PORT->MODER |= (2<<D2PIN*2); D2PORT->MODER |= (2<<D2PIN*2);
D2PORT->PUPDR |= (1<<D2PIN*2);
D3PORT->MODER |= (2<<D3PIN*2); D3PORT->MODER |= (2<<D3PIN*2);
D3PORT->PUPDR |= (1<<D3PIN*2);
#endif #endif
//CLKPORT->AFR[(CLKPIN < 8 ? 0 : 1)] |= ALTFUNC << ((CLKPIN < 8 ? CLKPIN : (CLKPIN - 8)) * 4); //CLKPORT->AFR[(CLKPIN < 8 ? 0 : 1)] |= ALTFUNC << ((CLKPIN < 8 ? CLKPIN : (CLKPIN - 8)) * 4);
SETAF(CLKPORT, CLKPIN, ALTFUNC); SETAF(CLKPORT, CLKPIN, ALTFUNC);
@ -93,6 +97,8 @@ void SDIO_InitModule(){
SETAF(D2PORT, D2PIN, ALTFUNC); SETAF(D2PORT, D2PIN, ALTFUNC);
SETAF(D3PORT, D3PIN, ALTFUNC); SETAF(D3PORT, D3PIN, ALTFUNC);
#endif #endif
//Init Module //Init Module
//Set CLK Control Register //Set CLK Control Register
@ -177,7 +183,7 @@ int SDIO_send_CMD55(){
} }
int SDIO_send_ACMD41(){ int SDIO_send_ACMD41(){
int retry = 0x200; int retry = 0x20;
if (SDIO_send_CMD55()) return -1; if (SDIO_send_CMD55()) return -1;
do { do {