Skip to content

Commit adeb5be

Browse files
authored
Merge pull request #9334 from yossi2le/yossi_write-a-thon2
Doxygen fixes in block devices
2 parents fd6ceda + 6954c39 commit adeb5be

File tree

4 files changed

+28
-108
lines changed

4 files changed

+28
-108
lines changed

features/storage/blockdevice/BlockDevice.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ class BlockDevice {
4949

5050
/** Return the default block device
5151
*
52-
* Returns the default BlockDevice base on configuration json.
52+
* Returns the default block device based on the configuration JSON.
5353
* Use the components in target.json or application config to change
5454
* the default block device.
5555
*
5656
* An application can override all target settings by implementing
57-
* BlockDevice::get_default_instance() themselves - the default
57+
* BlockDevice::get_default_instance() - the default
5858
* definition is weak, and calls get_target_default_instance().
5959
*/
6060
static BlockDevice *get_default_instance();
@@ -90,8 +90,8 @@ class BlockDevice {
9090
*
9191
* @param buffer Buffer to write blocks to
9292
* @param addr Address of block to begin reading from
93-
* @param size Size to read in bytes, must be a multiple of read block size
94-
* @return 0 on success, negative error code on failure
93+
* @param size Size to read in bytes, must be a multiple of the read block size
94+
* @return 0 on success or a negative error code on failure
9595
*/
9696
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size) = 0;
9797

@@ -103,8 +103,8 @@ class BlockDevice {
103103
*
104104
* @param buffer Buffer of data to write to blocks
105105
* @param addr Address of block to begin writing to
106-
* @param size Size to write in bytes, must be a multiple of program block size
107-
* @return 0 on success, negative error code on failure
106+
* @param size Size to write in bytes, must be a multiple of the program block size
107+
* @return 0 on success or a negative error code on failure
108108
*/
109109
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size) = 0;
110110

@@ -114,8 +114,8 @@ class BlockDevice {
114114
* unless get_erase_value returns a non-negative byte value
115115
*
116116
* @param addr Address of block to begin erasing
117-
* @param size Size to erase in bytes, must be a multiple of erase block size
118-
* @return 0 on success, negative error code on failure
117+
* @param size Size to erase in bytes, must be a multiple of the erase block size
118+
* @return 0 on success or a negative error code on failure
119119
*/
120120
virtual int erase(bd_addr_t addr, bd_size_t size)
121121
{
@@ -130,8 +130,8 @@ class BlockDevice {
130130
* the device is not busy.
131131
*
132132
* @param addr Address of block to mark as unused
133-
* @param size Size to mark as unused in bytes, must be a multiple of erase block size
134-
* @return 0 on success, negative error code on failure
133+
* @param size Size to mark as unused in bytes, must be a multiple of the erase block size
134+
* @return 0 on success or a negative error code on failure
135135
*/
136136
virtual int trim(bd_addr_t addr, bd_size_t size)
137137
{
@@ -179,7 +179,7 @@ class BlockDevice {
179179
* that value can be programmed without another erase.
180180
*
181181
* @return The value of storage when erased, or -1 if you can't
182-
* rely on the value of erased storage
182+
* rely on the value of the erased storage
183183
*/
184184
virtual int get_erase_value() const
185185
{

features/storage/blockdevice/MBRBlockDevice.h

Lines changed: 11 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -41,52 +41,6 @@ enum {
4141
/** Block device for managing a Master Boot Record
4242
* https://en.wikipedia.org/wiki/Master_boot_record
4343
*
44-
* Here is an example of partitioning a heap backed block device
45-
* @code
46-
* #include "mbed.h"
47-
* #include "HeapBlockDevice.h"
48-
* #include "MBRBlockDevice.h"
49-
*
50-
* // Create a block device with 64 blocks of size 512
51-
* HeapBlockDevice mem(64*512, 512);
52-
*
53-
* // Partition into two partitions with ~half the blocks
54-
* MBRBlockDevice::partition(&mem, 1, 0x83, 0*512, 32*512);
55-
* MBRBlockDevice::partition(&mem, 2, 0x83, 32*512);
56-
*
57-
* // Create a block device that maps to the first 32 blocks (excluding MBR block)
58-
* MBRBlockDevice part1(&mem, 1);
59-
*
60-
* // Create a block device that maps to the last 32 blocks
61-
* MBRBlockDevice part2(&mem, 2);
62-
* @endcode
63-
*
64-
* Here is a more realistic example where the MBRBlockDevice is used
65-
* to partition a region of space on an SD card. When plugged into a computer,
66-
* the partitions will be recognized appropriately.
67-
* @code
68-
* #include "mbed.h"
69-
* #include "SDBlockDevice.h"
70-
* #include "MBRBlockDevice.h"
71-
* #include "FATFileSystem.h"
72-
*
73-
* // Create an SD card
74-
* SDBlockDevice sd(s0, s1, s2, s3);
75-
*
76-
* // Create a partition with 1 GB of space
77-
* MBRBlockDevice::partition(&sd, 1, 0x83, 0, 1024*1024);
78-
*
79-
* // Create the block device that represents the partition
80-
* MBRBlockDevice part1(&sd, 1);
81-
*
82-
* // Format the partition with a FAT filesystem
83-
* FATFileSystem::format(&part1);
84-
*
85-
* // Create the FAT filesystem instance, files can now be written to
86-
* // the FAT filesystem in partition 1
87-
* FATFileSystem fat("fat", &part1);
88-
* @endcode
89-
*
9044
* @note
9145
* The MBR partition table is relatively limited:
9246
* - At most 4 partitions are supported
@@ -98,12 +52,12 @@ class MBRBlockDevice : public BlockDevice {
9852
*
9953
* @param bd Block device to partition
10054
* @param part Partition to use, 1-4
101-
* @param type 8-bit partition type to identitfy partition's contents
102-
* @param start Start block address to map to block 0 of partition,
103-
* negative addresses are calculated from the end of the
55+
* @param type 8-bit partition type to identify partition contents
56+
* @param start Start block address to map to block 0 of partition.
57+
* Negative addresses are calculated from the end of the
10458
* underlying block devices. Block 0 is implicitly ignored
10559
* from the range to store the MBR.
106-
* @return 0 on success or a negative error code on failure
60+
* @return 0 on success or a negative error code on failure.
10761
* @note This is the same as partition(bd, part, type, start, bd->size())
10862
*/
10963
static int partition(BlockDevice *bd, int part, uint8_t type, bd_addr_t start);
@@ -112,15 +66,15 @@ class MBRBlockDevice : public BlockDevice {
11266
*
11367
* @param bd Block device to partition
11468
* @param part Partition to use, 1-4
115-
* @param type 8-bit partition type to identitfy partition's contents
69+
* @param type 8-bit partition type to identify partition contents
11670
* @param start Start block address to map to block 0 of partition,
11771
* negative addresses are calculated from the end of the
11872
* underlying block devices. Block 0 is implicitly ignored
11973
* from the range to store the MBR.
120-
* @param stop End block address to mark the end of the partition,
121-
* this block is not mapped, negative addresses are calculated
74+
* @param stop End block address to mark the end of the partition.
75+
* This block is not mapped: negative addresses are calculated
12276
* from the end of the underlying block device.
123-
* @return 0 on success or a negative error code on failure
77+
* @return 0 on success or a negative error code on failure.
12478
*/
12579
static int partition(BlockDevice *bd, int part, uint8_t type, bd_addr_t start, bd_addr_t stop);
12680

@@ -158,7 +112,7 @@ class MBRBlockDevice : public BlockDevice {
158112
* @param buffer Buffer to read blocks into
159113
* @param addr Address of block to begin reading from
160114
* @param size Size to read in bytes, must be a multiple of read block size
161-
* @return 0 on success, negative error code on failure
115+
* @return 0 on success or a negative error code on failure
162116
*/
163117
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size);
164118

@@ -169,7 +123,7 @@ class MBRBlockDevice : public BlockDevice {
169123
* @param buffer Buffer of data to write to blocks
170124
* @param addr Address of block to begin writing to
171125
* @param size Size to write in bytes, must be a multiple of program block size
172-
* @return 0 on success, negative error code on failure
126+
* @return 0 on success or a negative error code on failure
173127
*/
174128
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size);
175129

@@ -180,7 +134,7 @@ class MBRBlockDevice : public BlockDevice {
180134
*
181135
* @param addr Address of block to begin erasing
182136
* @param size Size to erase in bytes, must be a multiple of erase block size
183-
* @return 0 on success, negative error code on failure
137+
* @return 0 on success or a negative error code on failure
184138
*/
185139
virtual int erase(bd_addr_t addr, bd_size_t size);
186140

features/storage/blockdevice/ProfilingBlockDevice.h

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,6 @@ namespace mbed {
3232

3333

3434
/** Block device for measuring storage operations of another block device
35-
*
36-
* @code
37-
* #include "mbed.h"
38-
* #include "HeapBlockDevice.h"
39-
* #include "ProfilingBlockDevice.h"
40-
*
41-
* // Create a heap block device and profiling block device
42-
* HeapBlockDevice mem(64*512, 512);
43-
* ProfilingBlockDevice profiler(&mem);
44-
*
45-
* // do block device work....
46-
*
47-
* printf("read count: %lld\n", profiler.get_read_count());
48-
* printf("program count: %lld\n", profiler.get_program_count());
49-
* printf("erase count: %lld\n", profiler.get_erase_count());
50-
* @endcode
5135
*/
5236
class ProfilingBlockDevice : public BlockDevice {
5337
public:
@@ -86,7 +70,7 @@ class ProfilingBlockDevice : public BlockDevice {
8670
* @param buffer Buffer to read blocks into
8771
* @param addr Address of block to begin reading from
8872
* @param size Size to read in bytes, must be a multiple of read block size
89-
* @return 0 on success, negative error code on failure
73+
* @return 0 on success or a negative error code on failure
9074
*/
9175
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size);
9276

@@ -97,7 +81,7 @@ class ProfilingBlockDevice : public BlockDevice {
9781
* @param buffer Buffer of data to write to blocks
9882
* @param addr Address of block to begin writing to
9983
* @param size Size to write in bytes, must be a multiple of program block size
100-
* @return 0 on success, negative error code on failure
84+
* @return 0 on success or a negative error code on failure
10185
*/
10286
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size);
10387

@@ -108,7 +92,7 @@ class ProfilingBlockDevice : public BlockDevice {
10892
*
10993
* @param addr Address of block to begin erasing
11094
* @param size Size to erase in bytes, must be a multiple of erase block size
111-
* @return 0 on success, negative error code on failure
95+
* @return 0 on success or a negative error code on failure
11296
*/
11397
virtual int erase(bd_addr_t addr, bd_size_t size);
11498

features/storage/blockdevice/SlicingBlockDevice.h

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,6 @@
3232
namespace mbed {
3333

3434
/** Block device for mapping to a slice of another block device
35-
*
36-
* @code
37-
* #include "mbed.h"
38-
* #include "HeapBlockDevice.h"
39-
* #include "SlicingBlockDevice.h"
40-
*
41-
* // Create a block device with 64 blocks of size 512
42-
* HeapBlockDevice mem(64*512, 512);
43-
*
44-
* // Create a block device that maps to the first 32 blocks
45-
* SlicingBlockDevice slice1(&mem, 0*512, 32*512);
46-
*
47-
* // Create a block device that maps to the last 32 blocks
48-
* SlicingBlockDevice slice2(&mem, 32*512);
49-
*
50-
* // Create a block device that maps to the middle 32 blocks
51-
* SlicingBlockDevice slice3(&mem, 16*512, -16*512);
52-
* @endcode
5335
*/
5436
class SlicingBlockDevice : public BlockDevice {
5537
public:
@@ -92,7 +74,7 @@ class SlicingBlockDevice : public BlockDevice {
9274
* @param buffer Buffer to read blocks into
9375
* @param addr Address of block to begin reading from
9476
* @param size Size to read in bytes, must be a multiple of read block size
95-
* @return 0 on success, negative error code on failure
77+
* @return 0 on success or a negative error code on failure
9678
*/
9779
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size);
9880

@@ -103,7 +85,7 @@ class SlicingBlockDevice : public BlockDevice {
10385
* @param buffer Buffer of data to write to blocks
10486
* @param addr Address of block to begin writing to
10587
* @param size Size to write in bytes, must be a multiple of program block size
106-
* @return 0 on success, negative error code on failure
88+
* @return 0 on success or a negative error code on failure
10789
*/
10890
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size);
10991

@@ -114,7 +96,7 @@ class SlicingBlockDevice : public BlockDevice {
11496
*
11597
* @param addr Address of block to begin erasing
11698
* @param size Size to erase in bytes, must be a multiple of erase block size
117-
* @return 0 on success, negative error code on failure
99+
* @return 0 on success or a negative error code on failure
118100
*/
119101
virtual int erase(bd_addr_t addr, bd_size_t size);
120102

0 commit comments

Comments
 (0)