# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# MLA -- File I/O Library

- 1
- 2
…
- 74
- 75
- 76
- 77
- 78
…
- 82
- 83

Module
SD (SPI) Driver
Side Effects
None
Description
The FILEIO_SD_SectorRead function reads a sector of data uint8_ts (512 uint8_ts) of data from the SD card starting at the
sector address and stores them in the location pointed to by 'buffer.'
Remarks
The card expects the address field in the command packet to be a uint8_t address. The sector_addr value is converted to a
uint8_t address by shifting it left nine times (multiplying by 512).
This function performs a synchronous read operation. In other uint16_ts, this function is a blocking function, and will not
return until either the data has fully been read, or, a timeout or other error occurred.
Preconditions
The FILEIO_SD_SectorRead function pointer must be pointing towards this function.
Parameters
Parameters Description
config An SD Drive configuration structure pointer
sectorAddress The address of the sector on the card.
buffer The buffer where the retrieved data will be stored. If buffer is
NULL, do not store the data anywhere.
Return Values
Return Values Description
true The sector was read successfully
false The sector could not be read
Function
uint8_t FILEIO_SD_SectorRead (uint32_t sector_addr, uint8_t * buffer)
1.7.2.1.9 FILEIO_SD_SectorWrite Function
Writes a sector of data to an SD card.
File
sd_spi.h
Syntax
bool FILEIO_SD_SectorWrite(FILEIO_SD_DRIVE_CONFIG * config, uint32_t sector_addr, uint8_t *
buffer, bool allowWriteToZero);
Module
SD (SPI) Driver
Side Effects
None.
Description
The FILEIO_SD_SectorWrite function writes one sector of data (512 uint8_ts) of data from the location pointed to by 'buffer'
to the specified sector of the SD card.
1.7 Library Interface MLA - File I/O Library Help Physical Layer
76

- 1
- 2
…
- 74
- 75
- 76
- 77
- 78
…
- 82
- 83