2020-06-06 14:35:55 +02:00
|
|
|
/** library to communicate with an SD card flash memory using the SPI mode
|
|
|
|
* @file
|
2017-06-27 16:02:01 +02:00
|
|
|
* @author King Kévin <kingkevin@cuvoodoo.info>
|
2020-06-06 14:35:55 +02:00
|
|
|
* @copyright SPDX-License-Identifier: GPL-3.0-or-later
|
2017-06-27 16:02:01 +02:00
|
|
|
* @date 2017
|
|
|
|
* @note peripherals used: SPI @ref flash_sdcard_spi
|
|
|
|
* @warning all calls are blocking
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/** setup communication with SD card
|
|
|
|
* @return if card has been initialized correctly
|
|
|
|
*/
|
|
|
|
bool flash_sdcard_setup(void);
|
2017-07-02 12:11:39 +02:00
|
|
|
/** get size of SD card flash memory
|
|
|
|
* @return size of SD card flash memory (in bytes)
|
2017-07-01 18:43:58 +02:00
|
|
|
*/
|
|
|
|
uint64_t flash_sdcard_size(void);
|
2017-07-02 12:11:39 +02:00
|
|
|
/** get size of a erase block
|
|
|
|
* @return size of a erase block (in bytes)
|
|
|
|
*/
|
|
|
|
uint32_t flash_sdcard_erase_size(void);
|
2017-07-03 15:00:21 +02:00
|
|
|
/** read data on flash of SD card
|
|
|
|
* @param[in] block address of data to read (in block in 512 bytes unit)
|
|
|
|
* @param[out] data data block to read (with a size of 512 bytes)
|
|
|
|
* @return if read succeeded
|
|
|
|
*/
|
|
|
|
bool flash_sdcard_read_data(uint32_t block, uint8_t* data);
|
|
|
|
/** write data on flash of SD card
|
|
|
|
* @param[in] block address of data to write (in block in 512 bytes unit)
|
|
|
|
* @param[in] data data block to write (with a size of 512 bytes)
|
|
|
|
* @return if write succeeded
|
|
|
|
*/
|
|
|
|
bool flash_sdcard_write_data(uint32_t block, uint8_t* data);
|