The disk_write writes sector(s) to the storage device.
DRESULT disk_write ( BYTE drv, /* [IN] Physical drive number */ const BYTE* buff, /* [IN] Pointer to the data to be written */ DWORD sector, /* [IN] Sector number to write from */ UINT count /* [IN] Number of sectors to write */ );
The specified memory address is not that always aligned to word boundary because the type of pointer is defined as BYTE*. For more information, refer to the description of disk_read function.
Generally, a multiple sector transfer request must not be split into single sector transactions to the storage device, or you will never get good write throughput.
FatFs expects delayed write feature of the disk control layer. The write operation to the media need not to be completed due to write operation is in progress or data is stored into the write-back cache when return from this function. But write data on the buff is invalid after return from this function. The write completion request is done by CTRL_SYNC command of disk_ioctl function. Therefore, if a delayed write feature is implemented, the write throughput will be improved.
Application program MUST NOT call this function, or FAT structure on the volume can be collapsed.
This function is not needed when _FS_READONLY == 1.