This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC2468 USB-MSD ChanFs FAT32

Dear All

i have a problem with modified version of USB hostlite with Mr Chans FS SFAT32.

DRESULT disk_ioctl(BYTE drv, /* Physical drive number (0..) */
BYTE ctrl, /* Control code */
void *buff /* Buffer to send/receive control data */
)
{
        DRESULT res;
        int result;

        (void) result;

                //The FatFs module uses only device independent commands described below. Any device dependent function is not used.
                //Command Description
                //CTRL_SYNC Make sure that the disk drive has finished pending write process. When the disk I/O module has a write back cache, flush the dirty sector immediately. This command is not required in read-only configuration.
                //GET_SECTOR_SIZE Returns sector size of the drive into the WORD variable pointed by Buffer. This command is not required in single sector size configuration, _MAX_SS is 512.
                //GET_SECTOR_COUNT Returns total sectors on the drive into the DWORD variable pointed by Buffer. This command is used by only f_mkfs function to determine the volume size to be created.
                //GET_BLOCK_SIZE Returns erase block size of the flash memory in unit of sector into the DWORD variable pointed by Buffer. This command is used by only f_mkfs function and it attempts to align data area to the erase block boundary. The allowable value is 1 to 32768 in power of 2. Return 1 if the erase block size is unknown or disk devices.
                if ( drv != 0)  return RES_PARERR;
                if (usb_status & STA_NOINIT) return RES_NOTRDY;
                res = RES_OK;
                switch(ctrl) {
                        case CTRL_SYNC:
                                // TODO
                                break;
                        case GET_SECTOR_SIZE:
                                *(WORD*)buff = blkSize;
                                break;
                        case GET_SECTOR_COUNT:
                                *(DWORD*)buff = numBlks;
                                break;
                        case GET_BLOCK_SIZE:
                                *(DWORD*)buff = 1;
                                break;
                        default:
                                res = RES_PARERR;
                                break;
                }
                return res;
}


This function CTRL_SYNC case is flushing the last f_write call, since it is empty.

Someboby could help me?

V.Nagarajan