Skip to content

Commit 436644b

Browse files
authored
Merge pull request #7760 from ARMmbed/feature_namespace
Give an option to remove 'using namespace'
2 parents 2009f02 + da69da9 commit 436644b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+355
-118
lines changed

components/storage/blockdevice/COMPONENT_DATAFLASH/DataFlashBlockDevice.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include <inttypes.h>
2121

22+
using namespace mbed;
23+
2224
/* constants */
2325
#define DATAFLASH_READ_SIZE 1
2426
#define DATAFLASH_PROG_SIZE 1

components/storage/blockdevice/COMPONENT_DATAFLASH/DataFlashBlockDevice.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
* }
6060
* @endcode
6161
*/
62-
class DataFlashBlockDevice : public BlockDevice {
62+
class DataFlashBlockDevice : public mbed::BlockDevice {
6363
public:
6464
/** Creates a DataFlashBlockDevice on a SPI bus specified by pins
6565
*
@@ -96,7 +96,7 @@ class DataFlashBlockDevice : public BlockDevice {
9696
* @param size Size to read in bytes, must be a multiple of read block size
9797
* @return 0 on success, negative error code on failure
9898
*/
99-
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size);
99+
virtual int read(void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
100100

101101
/** Program blocks to a block device
102102
*
@@ -107,7 +107,7 @@ class DataFlashBlockDevice : public BlockDevice {
107107
* @param size Size to write in bytes, must be a multiple of program block size
108108
* @return 0 on success, negative error code on failure
109109
*/
110-
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size);
110+
virtual int program(const void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
111111

112112
/** Erase blocks on a block device
113113
*
@@ -117,47 +117,47 @@ class DataFlashBlockDevice : public BlockDevice {
117117
* @param size Size to erase in bytes, must be a multiple of erase block size
118118
* @return 0 on success, negative error code on failure
119119
*/
120-
virtual int erase(bd_addr_t addr, bd_size_t size);
120+
virtual int erase(mbed::bd_addr_t addr, mbed::bd_size_t size);
121121

122122
/** Get the size of a readable block
123123
*
124124
* @return Size of a readable block in bytes
125125
*/
126-
virtual bd_size_t get_read_size() const;
126+
virtual mbed::bd_size_t get_read_size() const;
127127

128128
/** Get the size of a programable block
129129
*
130130
* @return Size of a programable block in bytes
131131
* @note Must be a multiple of the read size
132132
*/
133-
virtual bd_size_t get_program_size() const;
133+
virtual mbed::bd_size_t get_program_size() const;
134134

135135
/** Get the size of a eraseable block
136136
*
137137
* @return Size of a eraseable block in bytes
138138
* @note Must be a multiple of the program size
139139
*/
140-
virtual bd_size_t get_erase_size() const;
140+
virtual mbed::bd_size_t get_erase_size() const;
141141

142142
/** Get the size of an erasable block given address
143143
*
144144
* @param addr Address within the erasable block
145145
* @return Size of an erasable block in bytes
146146
* @note Must be a multiple of the program size
147147
*/
148-
virtual bd_size_t get_erase_size(bd_addr_t addr) const;
148+
virtual mbed::bd_size_t get_erase_size(mbed::bd_addr_t addr) const;
149149

150150
/** Get the total size of the underlying device
151151
*
152152
* @return Size of the underlying device in bytes
153153
*/
154-
virtual bd_size_t size() const;
154+
virtual mbed::bd_size_t size() const;
155155

156156
private:
157157
// Master side hardware
158-
SPI _spi;
159-
DigitalOut _cs;
160-
DigitalOut _nwp;
158+
mbed::SPI _spi;
159+
mbed::DigitalOut _cs;
160+
mbed::DigitalOut _nwp;
161161

162162
// Device configuration
163163
uint32_t _device_size;

components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "mbed_critical.h"
2121

2222
#include "mbed.h"
23-
23+
using namespace mbed;
2424
#include <inttypes.h>
2525

2626
#define FLASHIAP_READ_SIZE 1

components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/** BlockDevice using the FlashIAP API
2727
*
2828
*/
29-
class FlashIAPBlockDevice : public BlockDevice {
29+
class FlashIAPBlockDevice : public mbed::BlockDevice {
3030
public:
3131

3232
/** Creates a FlashIAPBlockDevice
@@ -58,7 +58,7 @@ class FlashIAPBlockDevice : public BlockDevice {
5858
* @param size Size to read in bytes, must be a multiple of read block size
5959
* @return 0 on success, negative error code on failure
6060
*/
61-
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size);
61+
virtual int read(void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
6262

6363
/** Program blocks to a block device
6464
*
@@ -69,7 +69,7 @@ class FlashIAPBlockDevice : public BlockDevice {
6969
* @param size Size to write in bytes, must be a multiple of program block size
7070
* @return 0 on success, negative error code on failure
7171
*/
72-
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size);
72+
virtual int program(const void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
7373

7474
/** Erase blocks on a block device
7575
*
@@ -79,35 +79,35 @@ class FlashIAPBlockDevice : public BlockDevice {
7979
* @param size Size to erase in bytes, must be a multiple of erase block size
8080
* @return 0 on success, negative error code on failure
8181
*/
82-
virtual int erase(bd_addr_t addr, bd_size_t size);
82+
virtual int erase(mbed::bd_addr_t addr, mbed::bd_size_t size);
8383

8484
/** Get the size of a readable block
8585
*
8686
* @return Size of a readable block in bytes
8787
*/
88-
virtual bd_size_t get_read_size() const;
88+
virtual mbed::bd_size_t get_read_size() const;
8989

9090
/** Get the size of a programable block
9191
*
9292
* @return Size of a programable block in bytes
9393
* @note Must be a multiple of the read size
9494
*/
95-
virtual bd_size_t get_program_size() const;
95+
virtual mbed::bd_size_t get_program_size() const;
9696

9797
/** Get the size of a eraseable block
9898
*
9999
* @return Size of a eraseable block in bytes
100100
* @note Must be a multiple of the program size
101101
*/
102-
virtual bd_size_t get_erase_size() const;
102+
virtual mbed::bd_size_t get_erase_size() const;
103103

104104
/** Get the size of an erasable block given address
105105
*
106106
* @param addr Address within the erasable block
107107
* @return Size of an erasable block in bytes
108108
* @note Must be a multiple of the program size
109109
*/
110-
virtual bd_size_t get_erase_size(bd_addr_t addr) const;
110+
virtual mbed::bd_size_t get_erase_size(mbed::bd_addr_t addr) const;
111111

112112
/** Get the value of storage when erased
113113
*
@@ -119,13 +119,13 @@ class FlashIAPBlockDevice : public BlockDevice {
119119
*
120120
* @return Size of the underlying device in bytes
121121
*/
122-
virtual bd_size_t size() const;
122+
virtual mbed::bd_size_t size() const;
123123

124124
private:
125125
// Device configuration
126126
mbed::FlashIAP _flash;
127-
bd_addr_t _base;
128-
bd_size_t _size;
127+
mbed::bd_addr_t _base;
128+
mbed::bd_size_t _size;
129129
bool _is_initialized;
130130
uint32_t _init_ref_count;
131131
};

components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ enum qspif_polarity_mode {
8585
* }
8686
* @endcode
8787
*/
88-
class QSPIFBlockDevice : public BlockDevice {
88+
class QSPIFBlockDevice : public mbed::BlockDevice {
8989
public:
9090
/** Create QSPIFBlockDevice - An SFDP based Flash Block Device over QSPI bus
9191
*
@@ -134,7 +134,7 @@ class QSPIFBlockDevice : public BlockDevice {
134134
* @return QSPIF_BD_ERROR_OK(0) - success
135135
* QSPIF_BD_ERROR_DEVICE_ERROR - device driver transaction failed
136136
*/
137-
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size);
137+
virtual int read(void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
138138

139139
/** Program blocks to a block device
140140
*
@@ -149,7 +149,7 @@ class QSPIFBlockDevice : public BlockDevice {
149149
* QSPIF_BD_ERROR_WREN_FAILED - Write Enable failed
150150
* QSPIF_BD_ERROR_PARSING_FAILED - unexpected format or values in one of the SFDP tables
151151
*/
152-
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size);
152+
virtual int program(const void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
153153

154154
/** Erase blocks on a block device
155155
*
@@ -164,35 +164,35 @@ class QSPIFBlockDevice : public BlockDevice {
164164
* QSPIF_BD_ERROR_PARSING_FAILED - unexpected format or values in one of the SFDP tables
165165
* QSPIF_BD_ERROR_INVALID_ERASE_PARAMS - Trying to erase unaligned address or size
166166
*/
167-
virtual int erase(bd_addr_t addr, bd_size_t size);
167+
virtual int erase(mbed::bd_addr_t addr, mbed::bd_size_t size);
168168

169169
/** Get the size of a readable block
170170
*
171171
* @return Size of a readable block in bytes
172172
*/
173-
virtual bd_size_t get_read_size() const;
173+
virtual mbed::bd_size_t get_read_size() const;
174174

175175
/** Get the size of a programable block
176176
*
177177
* @return Size of a program block size in bytes
178178
* @note Must be a multiple of the read size
179179
*/
180-
virtual bd_size_t get_program_size() const;
180+
virtual mbed::bd_size_t get_program_size() const;
181181

182182
/** Get the size of a eraseable block
183183
*
184184
* @return Size of a minimal erase block, common to all regions, in bytes
185185
* @note Must be a multiple of the program size
186186
*/
187-
virtual bd_size_t get_erase_size() const;
187+
virtual mbed::bd_size_t get_erase_size() const;
188188

189189
/** Get the size of minimal eraseable sector size of given address
190190
*
191191
* @param addr Any address within block queried for erase sector size (can be any address within flash size offset)
192192
* @return Size of minimal erase sector size, in given address region, in bytes
193193
* @note Must be a multiple of the program size
194194
*/
195-
virtual bd_size_t get_erase_size(bd_addr_t addr);
195+
virtual mbed::bd_size_t get_erase_size(mbed::bd_addr_t addr);
196196

197197
/** Get the value of storage byte after it was erased
198198
*
@@ -209,7 +209,7 @@ class QSPIFBlockDevice : public BlockDevice {
209209
*
210210
* @return Size of the underlying device in bytes
211211
*/
212-
virtual bd_size_t size() const;
212+
virtual mbed::bd_size_t size() const;
213213

214214
private:
215215
// Internal functions
@@ -229,17 +229,17 @@ class QSPIFBlockDevice : public BlockDevice {
229229
/* Calls to QSPI Driver APIs */
230230
/********************************/
231231
// Send Program => Write command to Driver
232-
qspi_status_t _qspi_send_program_command(unsigned int prog_instruction, const void *buffer, bd_addr_t addr,
233-
bd_size_t *size);
232+
qspi_status_t _qspi_send_program_command(unsigned int prog_instruction, const void *buffer, mbed::bd_addr_t addr,
233+
mbed::bd_size_t *size);
234234

235235
// Send Read command to Driver
236-
qspi_status_t _qspi_send_read_command(unsigned int read_instruction, void *buffer, bd_addr_t addr, bd_size_t size);
236+
qspi_status_t _qspi_send_read_command(unsigned int read_instruction, void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
237237

238238
// Send Erase Instruction using command_transfer command to Driver
239-
qspi_status_t _qspi_send_erase_command(unsigned int erase_instruction, bd_addr_t addr, bd_size_t size);
239+
qspi_status_t _qspi_send_erase_command(unsigned int erase_instruction, mbed::bd_addr_t addr, mbed::bd_size_t size);
240240

241241
// Send Generic command_transfer command to Driver
242-
qspi_status_t _qspi_send_general_command(unsigned int instruction_int, bd_addr_t addr, const char *tx_buffer,
242+
qspi_status_t _qspi_send_general_command(unsigned int instruction_int, mbed::bd_addr_t addr, const char *tx_buffer,
243243
size_t tx_length, const char *rx_buffer, size_t rx_length);
244244

245245
// Send Bus configure_format command to Driver
@@ -300,7 +300,7 @@ class QSPIFBlockDevice : public BlockDevice {
300300
/* Utilities Functions */
301301
/***********************/
302302
// Find the region to which the given offset belong to
303-
int _utils_find_addr_region(bd_size_t offset);
303+
int _utils_find_addr_region(mbed::bd_size_t offset);
304304

305305
// Iterate on all supported Erase Types of the Region to which the offset belong to.
306306
// Iterates from highest type to lowest

components/storage/blockdevice/COMPONENT_RSPIF/SPIFReducedBlockDevice.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "SPIFReducedBlockDevice.h"
1818
#include "mbed_wait_api.h"
1919

20+
using namespace mbed;
21+
2022
// Read/write/erase sizes
2123
#define SPIF_READ_SIZE 1
2224
#define SPIF_PROG_SIZE 1

components/storage/blockdevice/COMPONENT_RSPIF/SPIFReducedBlockDevice.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
* }
5757
* @endcode
5858
*/
59-
class SPIFReducedBlockDevice : public BlockDevice {
59+
class SPIFReducedBlockDevice : public mbed::BlockDevice {
6060
public:
6161
/** Creates a SPIFReducedBlockDevice on a SPI bus specified by pins
6262
*
@@ -87,7 +87,7 @@ class SPIFReducedBlockDevice : public BlockDevice {
8787
* @param size Size to read in bytes, must be a multiple of read block size
8888
* @return 0 on success, negative error code on failure
8989
*/
90-
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size);
90+
virtual int read(void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
9191

9292
/** Program blocks to a block device
9393
*
@@ -98,7 +98,7 @@ class SPIFReducedBlockDevice : public BlockDevice {
9898
* @param size Size to write in bytes, must be a multiple of program block size
9999
* @return 0 on success, negative error code on failure
100100
*/
101-
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size);
101+
virtual int program(const void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
102102

103103
/** Erase blocks on a block device
104104
*
@@ -108,35 +108,35 @@ class SPIFReducedBlockDevice : public BlockDevice {
108108
* @param size Size to erase in bytes, must be a multiple of erase block size
109109
* @return 0 on success, negative error code on failure
110110
*/
111-
virtual int erase(bd_addr_t addr, bd_size_t size);
111+
virtual int erase(mbed::bd_addr_t addr, mbed::bd_size_t size);
112112

113113
/** Get the size of a readable block
114114
*
115115
* @return Size of a readable block in bytes
116116
*/
117-
virtual bd_size_t get_read_size() const;
117+
virtual mbed::bd_size_t get_read_size() const;
118118

119119
/** Get the size of a programable block
120120
*
121121
* @return Size of a programable block in bytes
122122
* @note Must be a multiple of the read size
123123
*/
124-
virtual bd_size_t get_program_size() const;
124+
virtual mbed::bd_size_t get_program_size() const;
125125

126126
/** Get the size of a eraseable block
127127
*
128128
* @return Size of a eraseable block in bytes
129129
* @note Must be a multiple of the program size
130130
*/
131-
virtual bd_size_t get_erase_size() const;
131+
virtual mbed::bd_size_t get_erase_size() const;
132132

133133
/** Get the size of a eraseable block
134134
*
135135
* @param addr Address of block to query erase size
136136
* @return Size of a eraseable block in bytes
137137
* @note Must be a multiple of the program size
138138
*/
139-
virtual bd_size_t get_erase_size(bd_addr_t addr) const;
139+
virtual mbed::bd_size_t get_erase_size(mbed::bd_addr_t addr) const;
140140

141141
/** Get the value of storage byte after it was erased
142142
*
@@ -153,15 +153,15 @@ class SPIFReducedBlockDevice : public BlockDevice {
153153
*
154154
* @return Size of the underlying device in bytes
155155
*/
156-
virtual bd_size_t size() const;
156+
virtual mbed::bd_size_t size() const;
157157

158158
private:
159159
// Master side hardware
160160
mbed::SPI _spi;
161161
mbed::DigitalOut _cs;
162162

163163
// Device configuration discovered through sfdp
164-
bd_size_t _size;
164+
mbed::bd_size_t _size;
165165

166166
// Internal functions
167167
int _wren();

components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@
147147
#include <inttypes.h>
148148
#include <errno.h>
149149

150+
using namespace mbed;
151+
150152
#ifndef MBED_CONF_SD_CMD_TIMEOUT
151153
#define MBED_CONF_SD_CMD_TIMEOUT 5000 /*!< Timeout in ms for response */
152154
#endif

0 commit comments

Comments
 (0)