mirror of https://github.com/ARMmbed/mbed-os.git
Documnent changes and adding const to get_type method
parent
9590441288
commit
b17d13e75e
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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" |
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue