Skip to content

Commit 1d71fb1

Browse files
Yossi LevyYossi Levy
authored andcommitted
Add get_type method to block devices.
1 parent a8fa6ec commit 1d71fb1

36 files changed

+340
-4
lines changed

components/storage/blockdevice/COMPONENT_DATAFLASH/DataFlashBlockDevice.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,11 @@ bd_size_t DataFlashBlockDevice::size() const
527527
return device_size;
528528
}
529529

530+
const char * DataFlashBlockDevice::get_type()
531+
{
532+
return "DATAFLASH";
533+
}
534+
530535
/**
531536
* @brief Function for reading a specific register.
532537
* @details Used for reading either the Status Register or Manufacture and ID Register.

components/storage/blockdevice/COMPONENT_DATAFLASH/DataFlashBlockDevice.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ class DataFlashBlockDevice : public mbed::BlockDevice {
153153
*/
154154
virtual mbed::bd_size_t size() const;
155155

156+
/** Get the BlockDevice class type.
157+
*
158+
* @return A string represent the BlockDevice class type.
159+
*/
160+
virtual const char * get_type();
161+
156162
private:
157163
// Master side hardware
158164
mbed::SPI _spi;

components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,9 @@ bd_size_t FlashIAPBlockDevice::size() const
248248
return _size;
249249
}
250250

251+
const char * FlashIAPBlockDevice::get_type()
252+
{
253+
return "FLASHIAP";
254+
}
255+
251256
#endif /* DEVICE_FLASH */

components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ class FlashIAPBlockDevice : public mbed::BlockDevice {
121121
*/
122122
virtual mbed::bd_size_t size() const;
123123

124+
/** Get the BlockDevice class type.
125+
*
126+
* @return A string represent the BlockDevice class type.
127+
*/
128+
virtual const char * get_type();
129+
124130
private:
125131
// Device configuration
126132
mbed::FlashIAP _flash;

components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@ bd_size_t QSPIFBlockDevice::get_erase_size() const
477477
return _min_common_erase_size;
478478
}
479479

480+
const char * QSPIFBlockDevice::get_type()
481+
{
482+
return "QSPIF";
483+
}
484+
480485
// Find minimal erase size supported by the region to which the address belongs to
481486
bd_size_t QSPIFBlockDevice::get_erase_size(bd_addr_t addr)
482487
{

components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
211211
*/
212212
virtual mbed::bd_size_t size() const;
213213

214+
/** Get the BlockDevice class type.
215+
*
216+
* @return A string represent the BlockDevice class type.
217+
*/
218+
virtual const char * get_type();
219+
214220
private:
215221
// Internal functions
216222

@@ -307,8 +313,6 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
307313
int _utils_iterate_next_largest_erase_type(uint8_t &bitfield, int size, int offset, int boundry);
308314

309315
private:
310-
// Internal Members
311-
312316
// QSPI Driver Object
313317
mbed::QSPI _qspi;
314318

components/storage/blockdevice/COMPONENT_RSPIF/SPIFReducedBlockDevice.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ enum ops {
4848
#define SPIF_WEL 0x2
4949
#define SPIF_WIP 0x1
5050

51-
5251
SPIFReducedBlockDevice::SPIFReducedBlockDevice(
5352
PinName mosi, PinName miso, PinName sclk, PinName cs, int freq)
5453
: _spi(mosi, miso, sclk), _cs(cs), _size(0)
@@ -344,3 +343,9 @@ bd_size_t SPIFReducedBlockDevice::size() const
344343
{
345344
return _size;
346345
}
346+
347+
const char * SPIFReducedBlockDevice::get_type()
348+
{
349+
return "SPIFR";
350+
}
351+

components/storage/blockdevice/COMPONENT_RSPIF/SPIFReducedBlockDevice.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ class SPIFReducedBlockDevice : public mbed::BlockDevice {
155155
*/
156156
virtual mbed::bd_size_t size() const;
157157

158+
/** Get the BlockDevice class type.
159+
*
160+
* @return A string represent the BlockDevice class type.
161+
*/
162+
virtual const char * get_type();
163+
158164
private:
159165
// Master side hardware
160166
mbed::SPI _spi;

components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,11 @@ bd_size_t SDBlockDevice::size() const
632632
return _block_size * _sectors;
633633
}
634634

635+
const char * SDBlockDevice::get_type()
636+
{
637+
return "SD";
638+
}
639+
635640
void SDBlockDevice::debug(bool dbg)
636641
{
637642
_dbg = dbg;

components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ class SDBlockDevice : public mbed::BlockDevice {
116116
*/
117117
virtual int frequency(uint64_t freq);
118118

119+
/** Get the BlockDevice class type.
120+
*
121+
* @return A string represent the BlockDevice class type.
122+
*/
123+
virtual const char * get_type();
119124

120125
private:
121126
/* Commands : Listed below are commands supported

0 commit comments

Comments
 (0)