Compare commits
No commits in common. "4b07178f3deeced68406c166e0a8236a992f1ad6" and "ad02c17e0cf22542a0fb48d7a57064043d93e81a" have entirely different histories.
4b07178f3d
...
ad02c17e0c
14
.gitignore
vendored
14
.gitignore
vendored
@ -7,11 +7,11 @@ Debug
|
|||||||
*.user.*
|
*.user.*
|
||||||
*.lss
|
*.lss
|
||||||
*.d
|
*.d
|
||||||
*.cflags
|
stm32f4-sdio.cflags
|
||||||
*.config
|
stm32f4-sdio.config
|
||||||
*.creator
|
stm32f4-sdio.creator
|
||||||
*.cxxflags
|
stm32f4-sdio.cxxflags
|
||||||
*.files
|
stm32f4-sdio.files
|
||||||
*.includes
|
stm32f4-sdio.includes
|
||||||
|
|
||||||
|
|
||||||
*.jdebug
|
|
||||||
|
@ -78,64 +78,6 @@ DSTATUS SDIO_status(){
|
|||||||
volatile uint32_t debug;
|
volatile uint32_t debug;
|
||||||
volatile uint32_t debug_timeout;
|
volatile uint32_t debug_timeout;
|
||||||
volatile int debug_acmd = 0;
|
volatile int debug_acmd = 0;
|
||||||
|
|
||||||
sdio_write_buffer(uint32_t dlen, uint32_t blklen, uint8_t *buff)
|
|
||||||
{
|
|
||||||
int count;
|
|
||||||
int byte_count;
|
|
||||||
int byte_max;
|
|
||||||
uint32_t fifo;
|
|
||||||
|
|
||||||
SDIO->DLEN = dlen;
|
|
||||||
|
|
||||||
/* Init Transfer */
|
|
||||||
SDIO->ICR = SDIO_ICR_CCRCFAILC | SDIO_ICR_DCRCFAILC | SDIO_ICR_CTIMEOUTC | SDIO_ICR_DTIMEOUTC |
|
|
||||||
SDIO_ICR_TXUNDERRC | SDIO_ICR_RXOVERRC | SDIO_ICR_CMDRENDC | SDIO_ICR_CMDSENTC | SDIO_ICR_DATAENDC |
|
|
||||||
SDIO_ICR_STBITERRC | SDIO_ICR_DBCKENDC | SDIO_ICR_SDIOITC | SDIO_ICR_CEATAENDC;
|
|
||||||
SDIO->DCTRL = (blklen<<4) | SDIO_DCTRL_DTEN;
|
|
||||||
|
|
||||||
for (count = 0; count < dlen; count += 4) {
|
|
||||||
fifo = 0;
|
|
||||||
|
|
||||||
if ((dlen - count) < 4)
|
|
||||||
byte_max = dlen - count;
|
|
||||||
else
|
|
||||||
byte_max = 4;
|
|
||||||
|
|
||||||
for (byte_count = 0; byte_count < byte_max; byte_count++)
|
|
||||||
{
|
|
||||||
fifo >>= 8;
|
|
||||||
fifo |= (((uint32_t)*(buff++)) << 24) & 0xFF000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (SDIO->STA & SDIO_STA_TXFIFOF);
|
|
||||||
|
|
||||||
SDIO->FIFO = fifo;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
while (SDIO->STA & SDIO_STA_TXACT);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
uint8_t data1[512] = {(1<<1), 16, 0xC9, 0x9A, 0x20, 0x84, 0x3E, 0xD7, 0xD9, 0x0B, 0x68, 0x01,
|
|
||||||
0xE4, 0x9F, 0x2B, 0xC8, 0x02, 0x77};
|
|
||||||
sdio_unlock_card()
|
|
||||||
{
|
|
||||||
|
|
||||||
uint32_t resp[10];
|
|
||||||
|
|
||||||
//SDIO_send_block_length_CMD16(18U);
|
|
||||||
|
|
||||||
SDIO_send_cmd(42, 0, SHORT_ANS);
|
|
||||||
SDIO_get_response(42, SHORT_ANS, resp);
|
|
||||||
|
|
||||||
sdio_write_buffer(512, 9, data1);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
DSTATUS SDIO_initialize(){
|
DSTATUS SDIO_initialize(){
|
||||||
int timeout = 0x3000;
|
int timeout = 0x3000;
|
||||||
CMD8_RESP_t res8;
|
CMD8_RESP_t res8;
|
||||||
@ -205,9 +147,6 @@ DSTATUS SDIO_initialize(){
|
|||||||
if (SDIO_send_block_length_CMD16((uint32_t)(1<<BLOCKSIZE)))
|
if (SDIO_send_block_length_CMD16((uint32_t)(1<<BLOCKSIZE)))
|
||||||
return STA_NOINIT;
|
return STA_NOINIT;
|
||||||
|
|
||||||
//sdio_unlock_card();
|
|
||||||
|
|
||||||
|
|
||||||
if (SDIO_send_bus_width_ACMD6(BUSWIDTH))
|
if (SDIO_send_bus_width_ACMD6(BUSWIDTH))
|
||||||
return STA_NOINIT;
|
return STA_NOINIT;
|
||||||
|
|
||||||
@ -253,7 +192,7 @@ DRESULT SDIO_disk_read(BYTE *buff, DWORD sector, UINT count){
|
|||||||
SDIO->ICR = SDIO_ICR_CCRCFAILC | SDIO_ICR_DCRCFAILC | SDIO_ICR_CTIMEOUTC | SDIO_ICR_DTIMEOUTC |
|
SDIO->ICR = SDIO_ICR_CCRCFAILC | SDIO_ICR_DCRCFAILC | SDIO_ICR_CTIMEOUTC | SDIO_ICR_DTIMEOUTC |
|
||||||
SDIO_ICR_TXUNDERRC | SDIO_ICR_RXOVERRC | SDIO_ICR_CMDRENDC | SDIO_ICR_CMDSENTC | SDIO_ICR_DATAENDC |
|
SDIO_ICR_TXUNDERRC | SDIO_ICR_RXOVERRC | SDIO_ICR_CMDRENDC | SDIO_ICR_CMDSENTC | SDIO_ICR_DATAENDC |
|
||||||
SDIO_ICR_STBITERRC | SDIO_ICR_DBCKENDC | SDIO_ICR_SDIOITC | SDIO_ICR_CEATAENDC;
|
SDIO_ICR_STBITERRC | SDIO_ICR_DBCKENDC | SDIO_ICR_SDIOITC | SDIO_ICR_CEATAENDC;
|
||||||
SDIO->DCTRL = (BLOCKSIZE<<4) | SDIO_DCTRL_DTDIR | /*SDIO_DCTRL_DMAEN |*/ SDIO_DCTRL_DTEN;
|
SDIO->DCTRL = (BLOCKSIZE<<4) | SDIO_DCTRL_DTDIR | SDIO_DCTRL_DMAEN | SDIO_DCTRL_DTEN;
|
||||||
|
|
||||||
debug=0;
|
debug=0;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user