Function SDC Write Sector

From Uzebox Wiki
Jump to: navigation, search
Prototype

uint8_t SDC_Write_Sector(sdc_struct_t* sds, uint32_t sector);

Description

Performs a single sector write (attempts a retry on fault).

Parameters
  • sds: SD data structure. The bufp field must point to a valid 512 byte buffer.
  • sector: 512 byte sector to write.
Returns

Zero on success, error code on failure.

Video Modes

All

Since

V.5.x.x bootloaders

The error codes returned by this function:

  • 1: Card is not initialized
  • 2: CMD24 failed
  • 3: Timed out during waiting for completion (card should be reinitialized)
  • 4: CRC error (SD card rejected the data due to bad CRC)

Note that this function can take a long time to complete (several frames).