mirror of https://github.com/ARMmbed/mbed-os.git
Add storage related files to baseline unittest.
* Refactor some headers to use relative path from Mbed OS root. * Refactor some data types to compile on 64bit machines. * Refactor some debug traces to use mbed_trace.pull/11797/head
parent
7f089ac074
commit
168b51c415
|
@ -13,11 +13,42 @@ set(unittest-includes ${unittest-includes}
|
|||
|
||||
set(unittest-sources
|
||||
../features/device_key/source/DeviceKey.cpp
|
||||
../components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp
|
||||
../components/storage/blockdevice/COMPONENT_I2CEE/I2CEEBlockDevice.cpp
|
||||
../components/storage/blockdevice/COMPONENT_DATAFLASH/DataFlashBlockDevice.cpp
|
||||
../components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.cpp
|
||||
../components/storage/blockdevice/COMPONENT_RSPIF/SPIFReducedBlockDevice.cpp
|
||||
../components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.cpp
|
||||
../components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp
|
||||
../features/storage/filesystem/Dir.cpp
|
||||
../features/storage/filesystem/FileSystem.cpp
|
||||
../features/storage/filesystem/File.cpp
|
||||
../features/storage/kvstore/global_api/kvstore_global_api.cpp
|
||||
../features/storage/kvstore/securestore/SecureStore.cpp
|
||||
../features/storage/kvstore/kv_map/KVMap.cpp
|
||||
../features/storage/kvstore/tdbstore/TDBStore.cpp
|
||||
../features/storage/kvstore/direct_access_devicekey/DirectAccessDevicekey.cpp
|
||||
../features/storage/kvstore/conf/kv_config.cpp
|
||||
../features/storage/kvstore/filesystemstore/FileSystemStore.cpp
|
||||
../features/storage/system_storage/SystemStorage.cpp
|
||||
../features/storage/nvstore/source/nvstore.cpp
|
||||
../features/storage/blockdevice/ChainingBlockDevice.cpp
|
||||
../features/storage/blockdevice/ReadOnlyBlockDevice.cpp
|
||||
../features/storage/blockdevice/SlicingBlockDevice.cpp
|
||||
../features/storage/blockdevice/MBRBlockDevice.cpp
|
||||
../features/storage/blockdevice/HeapBlockDevice.cpp
|
||||
../features/storage/blockdevice/FlashSimBlockDevice.cpp
|
||||
../features/storage/blockdevice/ObservingBlockDevice.cpp
|
||||
../features/storage/blockdevice/ProfilingBlockDevice.cpp
|
||||
../features/storage/blockdevice/BufferedBlockDevice.cpp
|
||||
../features/storage/blockdevice/ExhaustibleBlockDevice.cpp
|
||||
)
|
||||
|
||||
set(unittest-test-sources
|
||||
empty_baseline/empty_baseline.cpp
|
||||
)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMBED_CONF_PLATFORM_CTHUNK_COUNT_MAX=10 -DDEVICE_ANALOGIN -DDEVICE_ANALOGOUT -DDEVICE_CAN -DDEVICE_CRC -DDEVICE_ETHERNET -DDEVICE_FLASH -DDEVICE_I2C -DDEVICE_I2CSLAVE -DDEVICE_I2C_ASYNCH -DDEVICE_INTERRUPTIN -DDEVICE_LPTICKER -DDEVICE_PORTIN -DDEVICE_PORTINOUT -DDEVICE_PORTOUT -DDEVICE_PWMOUT -DDEVICE_QSPI -DDEVICE_SERIAL -DDEVICE_SERIAL_ASYNCH -DDEVICE_SERIAL_FC -DDEVICE_SPI -DDEVICE_SPISLAVE -DDEVICE_SPI_ASYNCH -DDEVICE_FLASH -DCOMPONENT_FLASHIAP")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMBED_CONF_PLATFORM_CTHUNK_COUNT_MAX=10 -DDEVICE_ANALOGIN -DDEVICE_ANALOGOUT -DDEVICE_CAN -DDEVICE_CRC -DDEVICE_ETHERNET -DDEVICE_FLASH -DDEVICE_I2C -DDEVICE_I2CSLAVE -DDEVICE_I2C_ASYNCH -DDEVICE_INTERRUPTIN -DDEVICE_LPTICKER -DDEVICE_PORTIN -DDEVICE_PORTINOUT -DDEVICE_PORTOUT -DDEVICE_PWMOUT -DDEVICE_QSPI -DDEVICE_SERIAL -DDEVICE_SERIAL_ASYNCH -DDEVICE_SERIAL_FC -DDEVICE_SPI -DDEVICE_SPISLAVE -DDEVICE_SPI_ASYNCH -DDEVICE_FLASH -DCOMPONENT_FLASHIAP")
|
||||
set(DEVICE_FLAGS "-DDEVICE_ANALOGIN -DDEVICE_ANALOGOUT -DDEVICE_CAN -DDEVICE_CRC -DDEVICE_ETHERNET -DDEVICE_FLASH -DDEVICE_I2C -DDEVICE_I2CSLAVE -DDEVICE_I2C_ASYNCH -DDEVICE_INTERRUPTIN -DDEVICE_LPTICKER -DDEVICE_PORTIN -DDEVICE_PORTINOUT -DDEVICE_PORTOUT -DDEVICE_PWMOUT -DDEVICE_QSPI -DDEVICE_SERIAL -DDEVICE_SERIAL_ASYNCH -DDEVICE_SERIAL_FC -DDEVICE_SPI -DDEVICE_SPISLAVE -DDEVICE_SPI_ASYNCH -DDEVICE_FLASH -DCOMPONENT_FLASHIAP")
|
||||
set(CONF_FLAGS "-DMBED_CONF_PLATFORM_CTHUNK_COUNT_MAX=10 -DMBED_CONF_DATAFLASH_SPI_FREQ=1 -DMBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS=0 -DMBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE=0 -DMBED_CONF_QSPIF_QSPI_FREQ=1 -DMBED_CONF_QSPIF_QSPI_MIN_READ_SIZE=1 -DMBED_CONF_QSPIF_QSPI_MIN_PROG_SIZE=1 -DMBED_LFS_READ_SIZE=64 -DMBED_LFS_PROG_SIZE=64 -DMBED_LFS_BLOCK_SIZE=512 -DMBED_LFS_LOOKAHEAD=512 -DFLASHIAP_APP_ROM_END_ADDR=0x80000 -DMBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE=1024 -DMBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS=0x80000 -DMBED_CONF_STORAGE_STORAGE_TYPE=default")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DEVICE_FLAGS} ${CONF_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DEVICE_FLAGS} ${CONF_FLAGS}")
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "DataFlashBlockDevice.h"
|
||||
#include "mbed_atomic.h"
|
||||
|
||||
#include "rtos/ThisThread.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
using namespace mbed;
|
||||
|
|
|
@ -17,8 +17,11 @@
|
|||
#ifndef MBED_DATAFLASH_BLOCK_DEVICE_H
|
||||
#define MBED_DATAFLASH_BLOCK_DEVICE_H
|
||||
|
||||
#include <mbed.h>
|
||||
#include "BlockDevice.h"
|
||||
#include "platform/PlatformMutex.h"
|
||||
#include "PinNames.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
#include "drivers/SPI.h"
|
||||
#include "drivers/DigitalOut.h"
|
||||
|
||||
|
||||
/** BlockDevice for DataFlash flash devices
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#if DEVICE_FLASH
|
||||
|
||||
#include "FlashIAP.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
#include "platform/mbed_toolchain.h"
|
||||
|
||||
/** BlockDevice using the FlashIAP API
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#ifndef MBED_I2CEEPROM_BLOCK_DEVICE_H
|
||||
#define MBED_I2CEEPROM_BLOCK_DEVICE_H
|
||||
|
||||
#include "BlockDevice.h"
|
||||
#include "I2C.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
#include "drivers/I2C.h"
|
||||
|
||||
/** BlockDevice for I2C based flash device such as
|
||||
* Microchip's 24LC or ATMEL's AT24C ranges
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#ifndef MBED_QSPIF_BLOCK_DEVICE_H
|
||||
#define MBED_QSPIF_BLOCK_DEVICE_H
|
||||
|
||||
#include "QSPI.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "drivers/QSPI.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
|
||||
/** Enum qspif standard error codes
|
||||
*
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
#ifndef MBED_RSPIF_BLOCK_DEVICE_H
|
||||
#define MBED_RSPIF_BLOCK_DEVICE_H
|
||||
|
||||
#include "SPI.h"
|
||||
#include "DigitalOut.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "drivers/SPI.h"
|
||||
#include "drivers/DigitalOut.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
|
||||
/** Reduced BlockDevice for SPI based flash devices
|
||||
* *Should only be used by Boot Loader*
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/* If the target has no SPI support, then SD Card is not supported. */
|
||||
#if DEVICE_SPI
|
||||
|
||||
#include "BlockDevice.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
#include "drivers/SPI.h"
|
||||
#include "drivers/Timer.h"
|
||||
#include "drivers/MbedCRC.h"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <inttypes.h>
|
||||
|
||||
#include "mbed_trace.h"
|
||||
#include "mbed_debug.h"
|
||||
#define TRACE_GROUP "SPIF"
|
||||
using namespace mbed;
|
||||
|
||||
|
@ -158,7 +157,7 @@ int SPIFBlockDevice::init()
|
|||
status = SPIF_BD_ERROR_DEVICE_ERROR;
|
||||
goto exit_point;
|
||||
} else {
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: Initialize flash memory OK\n");
|
||||
tr_debug("Initialize flash memory OK\n");
|
||||
}
|
||||
|
||||
/* Read Manufacturer ID (1byte), and Device ID (2bytes)*/
|
||||
|
@ -207,7 +206,7 @@ int SPIFBlockDevice::init()
|
|||
_region_high_boundary[0] = _device_size_bytes - 1;
|
||||
|
||||
if ((sector_map_table_addr != 0) && (0 != sector_map_table_size)) {
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: init - Parsing Sector Map Table - addr: 0x%" PRIx32 "h, Size: %d", sector_map_table_addr,
|
||||
tr_debug("init - Parsing Sector Map Table - addr: 0x%" PRIx32 "h, Size: %d", sector_map_table_addr,
|
||||
sector_map_table_size);
|
||||
if (0 != _sfdp_parse_sector_map_table(sector_map_table_addr, sector_map_table_size)) {
|
||||
tr_error("init - Parse Sector Map Table Failed");
|
||||
|
@ -272,7 +271,7 @@ int SPIFBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
|
|||
}
|
||||
|
||||
int status = SPIF_BD_ERROR_OK;
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG Read - Inst: 0x%xh", _read_instruction);
|
||||
tr_debug("Read - Inst: 0x%xh", _read_instruction);
|
||||
_mutex->lock();
|
||||
|
||||
// Set Dummy Cycles for Specific Read Command Mode
|
||||
|
@ -298,7 +297,7 @@ int SPIFBlockDevice::program(const void *buffer, bd_addr_t addr, bd_size_t size)
|
|||
uint32_t offset = 0;
|
||||
uint32_t chunk = 0;
|
||||
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: program - Buff: 0x%" PRIx32 "h, addr: %llu, size: %llu", (uint32_t)buffer, addr, size);
|
||||
tr_debug("program - Buff: 0x%" PRIx32 "h, addr: %llu, size: %llu", (uint32_t)buffer, addr, size);
|
||||
|
||||
while (size > 0) {
|
||||
|
||||
|
@ -361,7 +360,7 @@ int SPIFBlockDevice::erase(bd_addr_t addr, bd_size_t in_size)
|
|||
// Erase Types of selected region
|
||||
uint8_t bitfield = _region_erase_types_bitfield[region];
|
||||
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: erase - addr: %llu, in_size: %llu", addr, in_size);
|
||||
tr_debug("erase - addr: %llu, in_size: %llu", addr, in_size);
|
||||
|
||||
if ((addr + in_size) > _device_size_bytes) {
|
||||
tr_error("erase exceeds flash device size");
|
||||
|
@ -383,9 +382,9 @@ int SPIFBlockDevice::erase(bd_addr_t addr, bd_size_t in_size)
|
|||
offset = addr % _erase_type_size_arr[type];
|
||||
chunk = ((offset + size) < _erase_type_size_arr[type]) ? size : (_erase_type_size_arr[type] - offset);
|
||||
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: erase - addr: %llu, size:%d, Inst: 0x%xh, chunk: %" PRIu32 " , ",
|
||||
tr_debug("erase - addr: %llu, size:%d, Inst: 0x%xh, chunk: %" PRIu32 " , ",
|
||||
addr, size, cur_erase_inst, chunk);
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: erase - Region: %d, Type:%d",
|
||||
tr_debug("erase - Region: %d, Type:%d",
|
||||
region, type);
|
||||
|
||||
_mutex->lock();
|
||||
|
@ -571,7 +570,7 @@ spif_bd_error SPIFBlockDevice::_spi_send_program_command(int prog_inst, const vo
|
|||
|
||||
spif_bd_error SPIFBlockDevice::_spi_send_erase_command(int erase_inst, bd_addr_t addr, bd_size_t size)
|
||||
{
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: Erase Inst: 0x%xh, addr: %llu, size: %llu", erase_inst, addr, size);
|
||||
tr_debug("Erase Inst: 0x%xh, addr: %llu, size: %llu", erase_inst, addr, size);
|
||||
addr = (((int)addr) & 0xFFFFF000);
|
||||
_spi_send_general_command(erase_inst, addr, NULL, 0, NULL, 0);
|
||||
return SPIF_BD_ERROR_OK;
|
||||
|
@ -745,12 +744,12 @@ int SPIFBlockDevice::_sfdp_parse_sfdp_headers(uint32_t &basic_table_addr, size_t
|
|||
tr_error("init - _verify SFDP signature and version Failed");
|
||||
return -1;
|
||||
} else {
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: init - verified SFDP Signature and version Successfully");
|
||||
tr_debug("init - verified SFDP Signature and version Successfully");
|
||||
}
|
||||
|
||||
// Discover Number of Parameter Headers
|
||||
int number_of_param_headers = (int)(sfdp_header[6]) + 1;
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: number of Param Headers: %d", number_of_param_headers);
|
||||
tr_debug("number of Param Headers: %d", number_of_param_headers);
|
||||
|
||||
addr += SPIF_SFDP_HEADER_SIZE;
|
||||
data_length = SPIF_PARAM_HEADER_SIZE;
|
||||
|
@ -773,14 +772,14 @@ int SPIFBlockDevice::_sfdp_parse_sfdp_headers(uint32_t &basic_table_addr, size_t
|
|||
|
||||
if ((param_header[0] == 0) && (param_header[7] == 0xFF)) {
|
||||
// Found Basic Params Table: LSB=0x00, MSB=0xFF
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: Found Basic Param Table at Table: %d", i_ind + 1);
|
||||
tr_debug("Found Basic Param Table at Table: %d", i_ind + 1);
|
||||
basic_table_addr = ((param_header[6] << 16) | (param_header[5] << 8) | (param_header[4]));
|
||||
// Supporting up to 64 Bytes Table (16 DWORDS)
|
||||
basic_table_size = ((param_header[3] * 4) < SFDP_DEFAULT_BASIC_PARAMS_TABLE_SIZE_BYTES) ? (param_header[3] * 4) : 64;
|
||||
|
||||
} else if ((param_header[0] == 81) && (param_header[7] == 0xFF)) {
|
||||
// Found Sector Map Table: LSB=0x81, MSB=0xFF
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: Found Sector Map Table at Table: %d", i_ind + 1);
|
||||
tr_debug("Found Sector Map Table at Table: %d", i_ind + 1);
|
||||
sector_map_table_addr = ((param_header[6] << 16) | (param_header[5] << 8) | (param_header[4]));
|
||||
sector_map_table_size = param_header[3] * 4;
|
||||
|
||||
|
@ -799,9 +798,9 @@ unsigned int SPIFBlockDevice::_sfdp_detect_page_size(uint8_t *basic_param_table_
|
|||
// Page Size is specified by 4 Bits (N), calculated by 2^N
|
||||
int page_to_power_size = ((int)basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_PAGE_SIZE_BYTE]) >> 4;
|
||||
page_size = local_math_power(2, page_to_power_size);
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: Detected Page Size: %d", page_size);
|
||||
tr_debug("Detected Page Size: %d", page_size);
|
||||
} else {
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: Using Default Page Size: %d", page_size);
|
||||
tr_debug("Using Default Page Size: %d", page_size);
|
||||
}
|
||||
return page_size;
|
||||
}
|
||||
|
@ -823,7 +822,7 @@ int SPIFBlockDevice::_sfdp_detect_erase_types_inst_and_size(uint8_t *basic_param
|
|||
erase_type_inst_arr[i_ind] = 0xff; //0xFF default for unsupported type
|
||||
erase_type_size_arr[i_ind] = local_math_power(2,
|
||||
basic_param_table_ptr[SPIF_BASIC_PARAM_ERASE_TYPE_1_SIZE_BYTE + 2 * i_ind]); // Size given as 2^N
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: Erase Type(A) %d - Inst: 0x%xh, Size: %d", (i_ind + 1), erase_type_inst_arr[i_ind],
|
||||
tr_debug("Erase Type(A) %d - Inst: 0x%xh, Size: %d", (i_ind + 1), erase_type_inst_arr[i_ind],
|
||||
erase_type_size_arr[i_ind]);
|
||||
if (erase_type_size_arr[i_ind] > 1) {
|
||||
// if size==1 type is not supported
|
||||
|
@ -846,7 +845,7 @@ int SPIFBlockDevice::_sfdp_detect_erase_types_inst_and_size(uint8_t *basic_param
|
|||
}
|
||||
_region_erase_types_bitfield[0] |= bitfield; // If there's no region map, set region "0" types bitfield as defualt;
|
||||
}
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "INFO: Erase Type %d - Inst: 0x%xh, Size: %d", (i_ind + 1),
|
||||
tr_info("Erase Type %d - Inst: 0x%xh, Size: %d", (i_ind + 1),
|
||||
erase_type_inst_arr[i_ind], erase_type_size_arr[i_ind]);
|
||||
bitfield = bitfield << 1;
|
||||
}
|
||||
|
@ -874,7 +873,7 @@ int SPIFBlockDevice::_sfdp_detect_best_bus_read_mode(uint8_t *basic_param_table_
|
|||
read_inst = basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_222_READ_INST_BYTE];
|
||||
_read_dummy_and_mode_cycles = (basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_222_READ_INST_BYTE - 1] >> 5)
|
||||
+ (basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_222_READ_INST_BYTE - 1] & 0x1F);
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "\nDEBUG: Read Bus Mode set to 2-2-2, Instruction: 0x%xh", read_inst);
|
||||
tr_debug("\nRead Bus Mode set to 2-2-2, Instruction: 0x%xh", read_inst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -884,7 +883,7 @@ int SPIFBlockDevice::_sfdp_detect_best_bus_read_mode(uint8_t *basic_param_table_
|
|||
read_inst = basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_122_READ_INST_BYTE];
|
||||
_read_dummy_and_mode_cycles = (basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_122_READ_INST_BYTE - 1] >> 5)
|
||||
+ (basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_122_READ_INST_BYTE - 1] & 0x1F);
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "\nDEBUG: Read Bus Mode set to 1-2-2, Instruction: 0x%xh", read_inst);
|
||||
tr_debug("\nRead Bus Mode set to 1-2-2, Instruction: 0x%xh", read_inst);
|
||||
break;
|
||||
}
|
||||
if (examined_byte & 0x01) {
|
||||
|
@ -892,12 +891,12 @@ int SPIFBlockDevice::_sfdp_detect_best_bus_read_mode(uint8_t *basic_param_table_
|
|||
read_inst = basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_112_READ_INST_BYTE];
|
||||
_read_dummy_and_mode_cycles = (basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_112_READ_INST_BYTE - 1] >> 5)
|
||||
+ (basic_param_table_ptr[SPIF_BASIC_PARAM_TABLE_112_READ_INST_BYTE - 1] & 0x1F);
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "\nDEBUG: Read Bus Mode set to 1-1-2, Instruction: 0x%xh", _read_instruction);
|
||||
tr_debug("\nRead Bus Mode set to 1-1-2, Instruction: 0x%xh", _read_instruction);
|
||||
break;
|
||||
}
|
||||
*/
|
||||
_read_dummy_and_mode_cycles = 0;
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "\nDEBUG: Read Bus Mode set to 1-1-1, Instruction: 0x%xh", read_inst);
|
||||
tr_debug("Read Bus Mode set to 1-1-1, Instruction: 0x%xh", read_inst);
|
||||
} while (false);
|
||||
|
||||
return 0;
|
||||
|
@ -908,13 +907,13 @@ int SPIFBlockDevice::_reset_flash_mem()
|
|||
// Perform Soft Reset of the Device prior to initialization
|
||||
int status = 0;
|
||||
char status_value[2] = {0};
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "INFO: _reset_flash_mem:\n");
|
||||
tr_info("_reset_flash_mem:\n");
|
||||
//Read the Status Register from device
|
||||
if (SPIF_BD_ERROR_OK == _spi_send_general_command(SPIF_RDSR, SPI_NO_ADDRESS_COMMAND, NULL, 0, status_value, 1)) {
|
||||
// store received values in status_value
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: Reading Status Register Success: value = 0x%x\n", (int)status_value[0]);
|
||||
tr_debug("Reading Status Register Success: value = 0x%x\n", (int)status_value[0]);
|
||||
} else {
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "ERROR: Reading Status Register failed\n");
|
||||
tr_error("Reading Status Register failed\n");
|
||||
status = -1;
|
||||
}
|
||||
|
||||
|
@ -922,7 +921,7 @@ int SPIFBlockDevice::_reset_flash_mem()
|
|||
//Send Reset Enable
|
||||
if (SPIF_BD_ERROR_OK == _spi_send_general_command(SPIF_RSTEN, SPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0)) {
|
||||
// store received values in status_value
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: Sending RSTEN Success\n");
|
||||
tr_debug("Sending RSTEN Success\n");
|
||||
} else {
|
||||
tr_error("Sending RSTEN failed");
|
||||
status = -1;
|
||||
|
@ -932,7 +931,7 @@ int SPIFBlockDevice::_reset_flash_mem()
|
|||
//Send Reset
|
||||
if (SPIF_BD_ERROR_OK == _spi_send_general_command(SPIF_RST, SPI_NO_ADDRESS_COMMAND, NULL, 0, NULL, 0)) {
|
||||
// store received values in status_value
|
||||
debug_if(MBED_CONF_SPIF_DRIVER_DEBUG, "DEBUG: Sending RST Success\n");
|
||||
tr_debug("Sending RST Success\n");
|
||||
} else {
|
||||
tr_error("Sending RST failed");
|
||||
status = -1;
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
#define MBED_SPIF_BLOCK_DEVICE_H
|
||||
|
||||
#include "platform/SingletonPtr.h"
|
||||
#include "SPI.h"
|
||||
#include "DigitalOut.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "drivers/SPI.h"
|
||||
#include "drivers/DigitalOut.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
|
||||
/** Enum spif standard error codes
|
||||
*
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef DIR_H
|
||||
#define DIR_H
|
||||
|
||||
#include "filesystem/FileSystem.h"
|
||||
#include "features/storage/filesystem/FileSystem.h"
|
||||
#include "platform/DirHandle.h"
|
||||
|
||||
namespace mbed {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef FILE_H
|
||||
#define FILE_H
|
||||
|
||||
#include "filesystem/FileSystem.h"
|
||||
#include "features/storage/filesystem/FileSystem.h"
|
||||
#include "platform/FileHandle.h"
|
||||
|
||||
namespace mbed {
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "filesystem/Dir.h"
|
||||
#include "filesystem/File.h"
|
||||
#include "filesystem/FileSystem.h"
|
||||
#include "features/storage/filesystem/Dir.h"
|
||||
#include "features/storage/filesystem/File.h"
|
||||
#include "features/storage/filesystem/FileSystem.h"
|
||||
#include <errno.h>
|
||||
|
||||
namespace mbed {
|
||||
|
|
|
@ -19,11 +19,12 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include "diskio.h"
|
||||
#include "ffconf.h"
|
||||
#include "features/storage/filesystem/fat/ChaN/diskio.h"
|
||||
#include "features/storage/filesystem/fat/ChaN/ffconf.h"
|
||||
#include "features/storage/filesystem/fat/ChaN/ff.h"
|
||||
#include "platform/mbed_debug.h"
|
||||
#include "platform/mbed_critical.h"
|
||||
#include "filesystem/mbed_filesystem.h"
|
||||
#include "features/storage/filesystem/mbed_filesystem.h"
|
||||
#include "FATFileSystem.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
|
|
@ -26,12 +26,12 @@
|
|||
#ifndef MBED_FATFILESYSTEM_H
|
||||
#define MBED_FATFILESYSTEM_H
|
||||
|
||||
#include "FileSystem.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "features/storage/filesystem/FileSystem.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
#include "FileHandle.h"
|
||||
#include "ff.h"
|
||||
#include <stdint.h>
|
||||
#include "PlatformMutex.h"
|
||||
#include "features/storage/filesystem/fat/ChaN/ff.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "filesystem/mbed_filesystem.h"
|
||||
#include "features/storage/filesystem/mbed_filesystem.h"
|
||||
#include "LittleFileSystem.h"
|
||||
#include "errno.h"
|
||||
#include "lfs.h"
|
||||
#include "lfs_util.h"
|
||||
#include "features/storage/filesystem/littlefs/littlefs/lfs.h"
|
||||
#include "features/storage/filesystem/littlefs/littlefs/lfs_util.h"
|
||||
#include "MbedCRC.h"
|
||||
|
||||
namespace mbed {
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
#ifndef MBED_LFSFILESYSTEM_H
|
||||
#define MBED_LFSFILESYSTEM_H
|
||||
|
||||
#include "FileSystem.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "PlatformMutex.h"
|
||||
#include "lfs.h"
|
||||
#include "features/storage/filesystem/FileSystem.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
#include "platform/PlatformMutex.h"
|
||||
#include "features/storage/filesystem/littlefs/littlefs/lfs.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
|
|
|
@ -23,16 +23,15 @@
|
|||
#include "platform/platform.h"
|
||||
|
||||
// FileSystem classes
|
||||
#include "filesystem/FileSystem.h"
|
||||
#include "filesystem/File.h"
|
||||
#include "filesystem/Dir.h"
|
||||
#include "features/storage/filesystem/FileSystem.h"
|
||||
#include "features/storage/filesystem/File.h"
|
||||
#include "features/storage/filesystem/Dir.h"
|
||||
|
||||
// BlockDevice classes
|
||||
#include "BlockDevice.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "ChainingBlockDevice.h"
|
||||
#include "SlicingBlockDevice.h"
|
||||
#include "HeapBlockDevice.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
#include "features/storage/blockdevice/ChainingBlockDevice.h"
|
||||
#include "features/storage/blockdevice/SlicingBlockDevice.h"
|
||||
#include "features/storage/blockdevice/HeapBlockDevice.h"
|
||||
|
||||
/** @}*/
|
||||
#endif
|
||||
|
|
|
@ -15,40 +15,40 @@
|
|||
*/
|
||||
|
||||
#include "kv_config.h"
|
||||
#include "KVStore.h"
|
||||
#include "KVMap.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "FileSystem.h"
|
||||
#include "FileSystemStore.h"
|
||||
#include "SlicingBlockDevice.h"
|
||||
#include "FATFileSystem.h"
|
||||
#include "LittleFileSystem.h"
|
||||
#include "TDBStore.h"
|
||||
#include "features/storage/kvstore/include/KVStore.h"
|
||||
#include "features/storage/kvstore/kv_map/KVMap.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
#include "features/storage/filesystem/FileSystem.h"
|
||||
#include "features/storage/kvstore/filesystemstore/FileSystemStore.h"
|
||||
#include "features/storage/blockdevice/SlicingBlockDevice.h"
|
||||
#include "features/storage/filesystem/fat/FATFileSystem.h"
|
||||
#include "features/storage/filesystem/littlefs/LittleFileSystem.h"
|
||||
#include "features/storage/kvstore/tdbstore/TDBStore.h"
|
||||
#include "mbed_error.h"
|
||||
#include "FlashIAP.h"
|
||||
#include "FlashSimBlockDevice.h"
|
||||
#include "drivers/FlashIAP.h"
|
||||
#include "features/storage/blockdevice/FlashSimBlockDevice.h"
|
||||
#include "mbed_trace.h"
|
||||
#include "SecureStore.h"
|
||||
#include "features/storage/kvstore/securestore/SecureStore.h"
|
||||
#define TRACE_GROUP "KVCFG"
|
||||
|
||||
#if COMPONENT_FLASHIAP
|
||||
#include "FlashIAPBlockDevice.h"
|
||||
#include "components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.h"
|
||||
#endif
|
||||
|
||||
#if COMPONENT_QSPIF
|
||||
#include "QSPIFBlockDevice.h"
|
||||
#include "components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h"
|
||||
#endif
|
||||
|
||||
#if COMPONENT_SPIF
|
||||
#include "SPIFBlockDevice.h"
|
||||
#include "components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.h"
|
||||
#endif
|
||||
|
||||
#if COMPONENT_DATAFLASH
|
||||
#include "DataFlashBlockDevice.h"
|
||||
#include "components/storage/blockdevice/COMPONENT_DATAFLASH/DataFlashBlockDevice.h"
|
||||
#endif
|
||||
|
||||
#if COMPONENT_SD
|
||||
#include "SDBlockDevice.h"
|
||||
#include "components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
// ----------------------------------------------------------- Includes -----------------------------------------------------------
|
||||
#if DEVICE_FLASH
|
||||
#include "DirectAccessDevicekey.h"
|
||||
#include "drivers/FlashIAP.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "mbed_error.h"
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
*/
|
||||
|
||||
#include "FileSystemStore.h"
|
||||
#include "kv_config.h"
|
||||
#include "Dir.h"
|
||||
#include "File.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "features/storage/kvstore/conf/kv_config.h"
|
||||
#include "features/storage/filesystem/Dir.h"
|
||||
#include "features/storage/filesystem/File.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
#include "mbed_error.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
#ifndef MBED_FILE_SYSTEM_STORE_H
|
||||
#define MBED_FILE_SYSTEM_STORE_H
|
||||
|
||||
#include "KVStore.h"
|
||||
#include "FileSystem.h"
|
||||
#include "features/storage/kvstore/include/KVStore.h"
|
||||
#include "features/storage/filesystem/FileSystem.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
*/
|
||||
#include "kvstore_global_api.h"
|
||||
|
||||
#include "kv_config.h"
|
||||
#include "KVMap.h"
|
||||
#include "KVStore.h"
|
||||
#include "features/storage/kvstore/conf/kv_config.h"
|
||||
#include "features/storage/kvstore/kv_map/KVMap.h"
|
||||
#include "features/storage/kvstore/include/KVStore.h"
|
||||
#include "mbed_error.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#include "DeviceKey.h"
|
||||
#include "features/device_key/source/DeviceKey.h"
|
||||
|
||||
#define SECURESTORE_ENABLED 1
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "MbedCRC.h"
|
||||
//Bypass the check of NVStore co existance if compiled for TARGET_TFM
|
||||
#if !(BYPASS_NVSTORE_CHECK)
|
||||
#include "SystemStorage.h"
|
||||
#include "features/storage/system_storage/SystemStorage.h"
|
||||
#endif
|
||||
|
||||
using namespace mbed;
|
||||
|
@ -251,7 +251,7 @@ int TDBStore::read_record(uint8_t area, uint32_t offset, char *key,
|
|||
return MBED_ERROR_INVALID_SIZE;
|
||||
}
|
||||
|
||||
actual_data_size = std::min(data_buf_size, data_size - data_offset);
|
||||
actual_data_size = std::min((size_t)data_buf_size, (size_t)data_size - data_offset);
|
||||
|
||||
if (copy_data && actual_data_size && !data_buf) {
|
||||
return MBED_ERROR_INVALID_ARGUMENT;
|
||||
|
@ -295,7 +295,7 @@ int TDBStore::read_record(uint8_t area, uint32_t offset, char *key,
|
|||
// 3. After actual part is finished - read to work buffer
|
||||
// 4. Copy data flag not set - read to work buffer
|
||||
if (curr_data_offset < data_offset) {
|
||||
chunk_size = std::min(work_buf_size, data_offset - curr_data_offset);
|
||||
chunk_size = std::min((size_t)work_buf_size, (size_t)(data_offset - curr_data_offset));
|
||||
dest_buf = _work_buf;
|
||||
} else if (copy_data && (curr_data_offset < data_offset + actual_data_size)) {
|
||||
chunk_size = actual_data_size;
|
||||
|
|
|
@ -14,35 +14,35 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "SystemStorage.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "FileSystem.h"
|
||||
#include "FATFileSystem.h"
|
||||
#include "LittleFileSystem.h"
|
||||
#include "features/storage/blockdevice/BlockDevice.h"
|
||||
#include "features/storage/filesystem/FileSystem.h"
|
||||
#include "features/storage/filesystem/fat/FATFileSystem.h"
|
||||
#include "features/storage/filesystem/littlefs/LittleFileSystem.h"
|
||||
#include "mbed_error.h"
|
||||
|
||||
|
||||
#if COMPONENT_SPIF
|
||||
#include "SPIFBlockDevice.h"
|
||||
#include "components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.h"
|
||||
#endif
|
||||
|
||||
#if COMPONENT_RSPIF
|
||||
#include "SPIFReducedBlockDevice.h"
|
||||
#include "components/storage/blockdevice/COMPONENT_RSPIF/SPIFReducedBlockDevice.h"
|
||||
#endif
|
||||
|
||||
#if COMPONENT_QSPIF
|
||||
#include "QSPIFBlockDevice.h"
|
||||
#include "components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h"
|
||||
#endif
|
||||
|
||||
#if COMPONENT_DATAFLASH
|
||||
#include "DataFlashBlockDevice.h"
|
||||
#include "components/storage/blockdevice/COMPONENT_DATAFLASH/DataFlashBlockDevice.h"
|
||||
#endif
|
||||
|
||||
#if COMPONENT_SD
|
||||
#include "SDBlockDevice.h"
|
||||
#include "components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h"
|
||||
#endif
|
||||
|
||||
#if COMPONENT_FLASHIAP
|
||||
#include "FlashIAPBlockDevice.h"
|
||||
#include "components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.h"
|
||||
#endif
|
||||
|
||||
using namespace mbed;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "PinNames.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
Loading…
Reference in New Issue