disk_write

The disk_write writes sector(s) to the disk.

DRESULT disk_write (
  BYTE Drive,          /* Physical drive number */
  const BYTE* Buffer,  /* Pointer to the write data (may be non aligned) */
  DWORD SectorNumber,  /* Sector number to write */
  BYTE SectorCount     /* Number of sectors to write */
);

Parameters

Drive
Specifies the physical drive number.
Buffer
Pointer to the byte array to be written. Note that the specified memory address is not that always aligned to word boundary. If the hardware does not support misaligned data transfer, it must be solved in this function.
SectorNumber
Specifies the start sector number in logical block address (LBA).
SectorCount
Specifies the number of sectors to write. The value can be 1 to 128. Generally, a multiple sector transfer request must not be split into single sector transactions to the device, or you will never get good write performance.

Return Values

RES_OK (0)
The function succeeded.
RES_ERROR
Any hard error occured during the write operation and could not recover it.
RES_WRPRT
The medium is write protected.
RES_PARERR
Invalid parameter.
RES_NOTRDY
The disk drive has not been initialized.

Description

This function is not required in read only configuration.

Return