Documnent changes and adding const to get_type method

pull/9135/head
Yossi Levy 2018-12-23 14:27:14 +02:00
parent 9590441288
commit b17d13e75e
34 changed files with 43 additions and 36 deletions

View File

@ -527,7 +527,7 @@ bd_size_t DataFlashBlockDevice::size() const
return device_size;
}
const char *DataFlashBlockDevice::get_type()
const char *DataFlashBlockDevice::get_type() const
{
return "DATAFLASH";
}

View File

@ -157,7 +157,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
private:
// Master side hardware

View File

@ -248,7 +248,7 @@ bd_size_t FlashIAPBlockDevice::size() const
return _size;
}
const char *FlashIAPBlockDevice::get_type()
const char *FlashIAPBlockDevice::get_type() const
{
return "FLASHIAP";
}

View File

@ -125,7 +125,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
private:
// Device configuration

View File

@ -477,7 +477,7 @@ bd_size_t QSPIFBlockDevice::get_erase_size() const
return _min_common_erase_size;
}
const char *QSPIFBlockDevice::get_type()
const char *QSPIFBlockDevice::get_type() const
{
return "QSPIF";
}

View File

@ -215,7 +215,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
private:
// Internal functions

View File

@ -344,7 +344,7 @@ bd_size_t SPIFReducedBlockDevice::size() const
return _size;
}
const char *SPIFReducedBlockDevice::get_type()
const char *SPIFReducedBlockDevice::get_type() const
{
return "SPIFR";
}

View File

@ -159,7 +159,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
private:
// Master side hardware

View File

@ -632,7 +632,7 @@ bd_size_t SDBlockDevice::size() const
return _block_size * _sectors;
}
const char *SDBlockDevice::get_type()
const char *SDBlockDevice::get_type() const
{
return "SD";
}

View File

@ -120,7 +120,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
private:
/* Commands : Listed below are commands supported

View File

@ -472,7 +472,7 @@ int SPIFBlockDevice::get_erase_value() const
return 0xFF;
}
const char *SPIFBlockDevice::get_type()
const char *SPIFBlockDevice::get_type() const
{
return "SPIF";
}

View File

@ -193,7 +193,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
private:

View File

@ -34,7 +34,7 @@ In fact it might be worth to consider adding the get_type to any interface with
## Dive into details
we should add the following method to BlockDevice interface class.
```virtual const char * get_type() = 0;```
```virtual const char * get_type() const = 0;```
then every physical BlockDevice class which implements the interface should also implement this method and return a string
representing its type. Furthermore, a nonphysical BlockDevice like SlicingBlockDevice should return the underlying physical
@ -42,7 +42,7 @@ BlockDevice type.
### Physical BlockDevice:
```
const char * HeapBlockDevice::get_type()
const char * HeapBlockDevice::get_type() const
{
return "HEAP";
}
@ -50,7 +50,7 @@ const char * HeapBlockDevice::get_type()
### Logical BlockDevice:
```
const char * SlicingBlockDevice::get_type()
const char * SlicingBlockDevice::get_type() const
{
if (_bd != NULL) {
return _bd->get_type();
@ -60,6 +60,12 @@ const char * SlicingBlockDevice::get_type()
}
```
### Open issue
The ChainingBlockDevice which chains different type of physical block devices into one block device is unable
to return the underneath physical as it contains two or more types. Therefore it will return CHAINING as its
identity and its left for the user to decide how the application will treat this information.
The below table describes physical BlockDevice and its tyep names
@ -72,3 +78,4 @@ The below table describes physical BlockDevice and its tyep names
| SDBlockDevice | "SD" |
| FlashIAPBlockDevice | "FLASHIAP" |
| DataFlashBlockDevice | "DATAFLASH" |
| ChainingBlockDevice | "CHAINING" |

View File

@ -238,7 +238,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type() = 0;
virtual const char *get_type() const = 0;
};
} // namespace mbed

View File

@ -330,7 +330,7 @@ bd_size_t BufferedBlockDevice::size() const
return _bd_size;
}
const char *BufferedBlockDevice::get_type()
const char *BufferedBlockDevice::get_type() const
{
if (_bd != NULL) {
return _bd->get_type();

View File

@ -156,7 +156,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
protected:
BlockDevice *_bd;

View File

@ -283,7 +283,7 @@ bd_size_t ChainingBlockDevice::size() const
return _size;
}
const char *ChainingBlockDevice::get_type()
const char *ChainingBlockDevice::get_type() const
{
return "CHAINING";
}

View File

@ -176,7 +176,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
protected:
BlockDevice **_bds;

View File

@ -194,7 +194,7 @@ bd_size_t ExhaustibleBlockDevice::size() const
return _bd->size();
}
const char *ExhaustibleBlockDevice::get_type()
const char *ExhaustibleBlockDevice::get_type() const
{
if (_bd != NULL) {
return _bd->get_type();

View File

@ -158,7 +158,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
private:
BlockDevice *_bd;

View File

@ -212,7 +212,7 @@ int FlashSimBlockDevice::get_erase_value() const
return _erase_value;
}
const char *FlashSimBlockDevice::get_type()
const char *FlashSimBlockDevice::get_type() const
{
if (_bd != NULL) {
return _bd->get_type();

View File

@ -140,7 +140,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
private:
uint8_t _erase_value;

View File

@ -183,7 +183,7 @@ int HeapBlockDevice::erase(bd_addr_t addr, bd_size_t size)
return 0;
}
const char *HeapBlockDevice::get_type()
const char *HeapBlockDevice::get_type() const
{
return "HEAP";
}

View File

@ -154,7 +154,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
private:
bd_size_t _read_size;

View File

@ -423,7 +423,7 @@ int MBRBlockDevice::get_partition_number() const
return _part;
}
const char *MBRBlockDevice::get_type()
const char *MBRBlockDevice::get_type() const
{
if (_bd != NULL) {
return _bd->get_type();

View File

@ -253,7 +253,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
protected:
BlockDevice *_bd;

View File

@ -111,7 +111,7 @@ bd_size_t ObservingBlockDevice::size() const
return _bd->size();
}
const char *ObservingBlockDevice::get_type()
const char *ObservingBlockDevice::get_type() const
{
if (_bd != NULL) {
return _bd->get_type();

View File

@ -144,7 +144,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
private:
BlockDevice *_bd;

View File

@ -121,7 +121,7 @@ bd_size_t ProfilingBlockDevice::get_erase_count() const
return _erase_count;
}
const char *ProfilingBlockDevice::get_type()
const char *ProfilingBlockDevice::get_type() const
{
if (_bd != NULL) {
return _bd->get_type();

View File

@ -183,7 +183,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
private:
BlockDevice *_bd;

View File

@ -101,7 +101,7 @@ bd_size_t ReadOnlyBlockDevice::size() const
return _bd->size();
}
const char *ReadOnlyBlockDevice::get_type()
const char *ReadOnlyBlockDevice::get_type() const
{
if (_bd != NULL) {
return _bd->get_type();

View File

@ -137,7 +137,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
private:
BlockDevice *_bd;

View File

@ -121,7 +121,7 @@ bd_size_t SlicingBlockDevice::size() const
return _stop - _start;
}
const char *SlicingBlockDevice::get_type()
const char *SlicingBlockDevice::get_type() const
{
if (_bd != NULL) {
return _bd->get_type();

View File

@ -167,7 +167,7 @@ public:
*
* @return A string represent the BlockDevice class type.
*/
virtual const char *get_type();
virtual const char *get_type() const;
protected:
BlockDevice *_bd;