mirror of https://github.com/ARMmbed/mbed-os.git
SPIFReducedBlockDevice: Makes default configuration to use mbed_lib.json settings
SPIFReducedBlockDevice parameters come from mbed_lib.json if not provided explicitly. Introduced an app config file for running filesystem tests with RSPIF block devicepull/12143/head
parent
23f87877a1
commit
67676dc123
|
@ -20,6 +20,22 @@
|
||||||
#include "drivers/DigitalOut.h"
|
#include "drivers/DigitalOut.h"
|
||||||
#include "features/storage/blockdevice/BlockDevice.h"
|
#include "features/storage/blockdevice/BlockDevice.h"
|
||||||
|
|
||||||
|
#ifndef MBED_CONF_RSPIF_DRIVER_SPI_MOSI
|
||||||
|
#define MBED_CONF_RSPIF_DRIVER_SPI_MOSI NC
|
||||||
|
#endif
|
||||||
|
#ifndef MBED_CONF_RSPIF_DRIVER_SPI_MISO
|
||||||
|
#define MBED_CONF_RSPIF_DRIVER_SPI_MISO NC
|
||||||
|
#endif
|
||||||
|
#ifndef MBED_CONF_RSPIF_DRIVER_SPI_CLK
|
||||||
|
#define MBED_CONF_RSPIF_DRIVER_SPI_CLK NC
|
||||||
|
#endif
|
||||||
|
#ifndef MBED_CONF_RSPIF_DRIVER_SPI_CS
|
||||||
|
#define MBED_CONF_RSPIF_DRIVER_SPI_CS NC
|
||||||
|
#endif
|
||||||
|
#ifndef MBED_CONF_RSPIF_DRIVER_SPI_FREQ
|
||||||
|
#define MBED_CONF_RSPIF_DRIVER_SPI_FREQ 40000000
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Reduced BlockDevice for SPI based flash devices
|
/** Reduced BlockDevice for SPI based flash devices
|
||||||
* *Should only be used by Boot Loader*
|
* *Should only be used by Boot Loader*
|
||||||
*
|
*
|
||||||
|
@ -66,7 +82,11 @@ public:
|
||||||
* @param csel SPI chip select pin
|
* @param csel SPI chip select pin
|
||||||
* @param freq Clock speed of the SPI bus (defaults to 40MHz)
|
* @param freq Clock speed of the SPI bus (defaults to 40MHz)
|
||||||
*/
|
*/
|
||||||
SPIFReducedBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName csel, int freq = 40000000);
|
SPIFReducedBlockDevice(PinName mosi = MBED_CONF_RSPIF_DRIVER_SPI_MOSI,
|
||||||
|
PinName miso = MBED_CONF_RSPIF_DRIVER_SPI_MISO,
|
||||||
|
PinName sclk = MBED_CONF_RSPIF_DRIVER_SPI_CLK,
|
||||||
|
PinName csel = MBED_CONF_RSPIF_DRIVER_SPI_CS,
|
||||||
|
int freq = MBED_CONF_RSPIF_DRIVER_SPI_FREQ);
|
||||||
|
|
||||||
/** Initialize a block device
|
/** Initialize a block device
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "rspif-driver",
|
"name": "rspif-driver",
|
||||||
"config": {
|
"config": {
|
||||||
"SPI_MOSI": "NC",
|
"SPI_MOSI": "SPI_MOSI",
|
||||||
"SPI_MISO": "NC",
|
"SPI_MISO": "SPI_MISO",
|
||||||
"SPI_CLK": "NC",
|
"SPI_CLK": "SPI_SCK",
|
||||||
"SPI_CS": "NC",
|
"SPI_CS": "SPI_CS",
|
||||||
"SPI_FREQ": "40000000"
|
"SPI_FREQ":"40000000"
|
||||||
},
|
},
|
||||||
"target_overrides": {
|
"target_overrides": {
|
||||||
"K82F": {
|
"K82F": {
|
||||||
|
|
|
@ -70,13 +70,7 @@ MBED_WEAK BlockDevice *BlockDevice::get_default_instance()
|
||||||
|
|
||||||
#elif COMPONENT_RSPIF
|
#elif COMPONENT_RSPIF
|
||||||
|
|
||||||
static SPIFReducedBlockDevice default_bd(
|
static SPIFReducedBlockDevice default_bd;
|
||||||
MBED_CONF_RSPIF_DRIVER_SPI_MOSI,
|
|
||||||
MBED_CONF_RSPIF_DRIVER_SPI_MISO,
|
|
||||||
MBED_CONF_RSPIF_DRIVER_SPI_CLK,
|
|
||||||
MBED_CONF_RSPIF_DRIVER_SPI_CS,
|
|
||||||
MBED_CONF_RSPIF_DRIVER_SPI_FREQ
|
|
||||||
);
|
|
||||||
|
|
||||||
return &default_bd;
|
return &default_bd;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"sim-blockdevice": {
|
||||||
|
"help": "Simulated block device, requires sufficient heap",
|
||||||
|
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
|
||||||
|
"value": "HeapBlockDevice"
|
||||||
|
},
|
||||||
|
"test-blockdevice": {
|
||||||
|
"help": "Used blockdevice",
|
||||||
|
"macro_name": "MBED_TEST_BLOCKDEVICE",
|
||||||
|
"value": "SPIFReducedBlockDevice"
|
||||||
|
},
|
||||||
|
"test-filesystem": {
|
||||||
|
"help": "Used filesystem",
|
||||||
|
"macro_name": "MBED_TEST_FILESYSTEM",
|
||||||
|
"value": "LittleFileSystem"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"target_overrides": {
|
||||||
|
"NRF52840_DK": {
|
||||||
|
"target.components_remove": ["QSPI", "QSPIF"],
|
||||||
|
"target.components_add" : ["SPI", "RSPIF"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue