IOCTL 80percent done
This commit is contained in:
		@@ -55,7 +55,27 @@ DRESULT SDIO_disk_write(const BYTE *buff, DWORD sector, UINT count){
 | 
			
		||||
	return RES_OK;
 | 
			
		||||
}
 | 
			
		||||
DRESULT SDIO_disk_ioctl(BYTE cmd, void* buff){
 | 
			
		||||
	return RES_OK;
 | 
			
		||||
    DRESULT res = RES_OK;
 | 
			
		||||
    switch(cmd) {
 | 
			
		||||
    case GET_BLOCK_SIZE:
 | 
			
		||||
        *((DWORD*)buff) = 0x01;
 | 
			
		||||
        break;
 | 
			
		||||
     case GET_SECTOR_SIZE:
 | 
			
		||||
        *((WORD*)buff) = (1<<BLOCKSIZE);
 | 
			
		||||
        break;
 | 
			
		||||
     case GET_SECTOR_COUNT:
 | 
			
		||||
        res = RES_ERROR;
 | 
			
		||||
        //TODO: Implement
 | 
			
		||||
        break;
 | 
			
		||||
      case CTRL_SYNC:
 | 
			
		||||
        res = RES_ERROR;
 | 
			
		||||
        //TODO: Implement
 | 
			
		||||
        break;
 | 
			
		||||
     default:
 | 
			
		||||
        res = RES_PARERR;
 | 
			
		||||
     break;
 | 
			
		||||
    }
 | 
			
		||||
    return res;
 | 
			
		||||
}
 | 
			
		||||
DWORD __attribute__((weak)) get_fattime(){
 | 
			
		||||
	return 0;
 | 
			
		||||
@@ -133,7 +153,7 @@ int SDIO_getResp(uint8_t expectedCMD, uint8_t typeOfAns, uint32_t *responseBuffe
 | 
			
		||||
 | 
			
		||||
    //Wait for error or success
 | 
			
		||||
    while (1) {
 | 
			
		||||
        if (SDIO->STA & SDIO_STA_CMDREND) break; //Corrct Respone Received
 | 
			
		||||
        if (SDIO->STA & SDIO_STA_CMDREND) break; //Correct Respone Received
 | 
			
		||||
 | 
			
		||||
        //Exclude ACMD41 from valid CRC check
 | 
			
		||||
        if ((SDIO->STA & SDIO_STA_CCRCFAIL)) {
 | 
			
		||||
@@ -151,9 +171,9 @@ int SDIO_getResp(uint8_t expectedCMD, uint8_t typeOfAns, uint32_t *responseBuffe
 | 
			
		||||
    //Valid Respone Received
 | 
			
		||||
    if ((SDIO->RESPCMD & SDIO_RESPCMD_RESPCMD) != expectedCMD) return -1; //Not the expected respose
 | 
			
		||||
 | 
			
		||||
    //Correct Response
 | 
			
		||||
    //If case of a correct Response
 | 
			
		||||
    *(responseBuffer++) = SDIO->RESP1;
 | 
			
		||||
    //Long response. Never needed with SD Cards
 | 
			
		||||
    //Long response.
 | 
			
		||||
    if (typeOfAns == LONG_ANS) {
 | 
			
		||||
        *(responseBuffer++) = SDIO->RESP2;
 | 
			
		||||
        *(responseBuffer++) = SDIO->RESP3;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user