Skip to content

Commit e6565a4

Browse files
authored
Merge pull request #14031 from arduino/blockdevices_namespaces
BlockDevices: specify mbed namespace where needed
2 parents fef6a6a + 6b0215c commit e6565a4

File tree

11 files changed

+39
-36
lines changed

11 files changed

+39
-36
lines changed

drivers/usb/include/usb/USBMSD.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class USBMSD: public USBDevice {
7676
* @param product_id Your product_id
7777
* @param product_release Your preoduct_release
7878
*/
79-
USBMSD(BlockDevice *bd, bool connect_blocking = true, uint16_t vendor_id = 0x0703, uint16_t product_id = 0x0104, uint16_t product_release = 0x0001);
79+
USBMSD(mbed::BlockDevice *bd, bool connect_blocking = true, uint16_t vendor_id = 0x0703, uint16_t product_id = 0x0104, uint16_t product_release = 0x0001);
8080

8181
/**
8282
* Fully featured constructor
@@ -95,7 +95,7 @@ class USBMSD: public USBDevice {
9595
* @param product_id Your product_id
9696
* @param product_release Your preoduct_release
9797
*/
98-
USBMSD(USBPhy *phy, BlockDevice *bd, uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
98+
USBMSD(USBPhy *phy, mbed::BlockDevice *bd, uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
9999

100100
/**
101101
* Destroy this object
@@ -263,7 +263,7 @@ class USBMSD: public USBDevice {
263263
events::Task<void(const setup_packet_t *)> _control_task;
264264
events::Task<void()> _configure_task;
265265

266-
BlockDevice *_bd;
266+
mbed::BlockDevice *_bd;
267267
rtos::Mutex _mutex_init;
268268
rtos::Mutex _mutex;
269269

drivers/usb/source/PolledQueue.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
#include "platform/Callback.h"
2222

2323

24-
PolledQueue::PolledQueue(mbed::Callback<void()> cb): _cb(cb)
24+
events::PolledQueue::PolledQueue(mbed::Callback<void()> cb): _cb(cb)
2525
{
2626

2727
}
2828

29-
PolledQueue::~PolledQueue()
29+
events::PolledQueue::~PolledQueue()
3030
{
3131

3232
}
3333

34-
void PolledQueue::dispatch()
34+
void events::PolledQueue::dispatch()
3535
{
3636
core_util_critical_section_enter();
3737
uint64_t buf[MBED_MAX_TASK_SIZE / sizeof(uint64_t)];
@@ -60,7 +60,7 @@ void PolledQueue::dispatch()
6060
core_util_critical_section_exit();
6161
}
6262

63-
void PolledQueue::attach(mbed::Callback<void()> cb)
63+
void events::PolledQueue::attach(mbed::Callback<void()> cb)
6464
{
6565
core_util_critical_section_enter();
6666

@@ -69,7 +69,7 @@ void PolledQueue::attach(mbed::Callback<void()> cb)
6969
core_util_critical_section_exit();
7070
}
7171

72-
void PolledQueue::post(TaskBase *task)
72+
void events::PolledQueue::post(TaskBase *task)
7373
{
7474
core_util_critical_section_enter();
7575

@@ -83,7 +83,7 @@ void PolledQueue::post(TaskBase *task)
8383
core_util_critical_section_exit();
8484
}
8585

86-
void PolledQueue::cancel(TaskBase *task)
86+
void events::PolledQueue::cancel(TaskBase *task)
8787
{
8888
core_util_critical_section_enter();
8989

drivers/usb/source/TaskBase.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "rtos/Semaphore.h"
2222
#include "platform/mbed_critical.h"
2323

24+
namespace events {
25+
2426
TaskBase::TaskBase(TaskQueue *q)
2527
: _queue(q), _posted(false), _start_count(0), _flush_sem(NULL)
2628
{
@@ -150,3 +152,4 @@ void TaskBase::_wake_check()
150152
_flush_sem = NULL;
151153
}
152154
}
155+
}

drivers/usb/source/USBMSD.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ enum Status {
6565
CSW_ERROR,
6666
};
6767

68-
USBMSD::USBMSD(BlockDevice *bd, bool connect_blocking, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
68+
USBMSD::USBMSD(mbed::BlockDevice *bd, bool connect_blocking, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
6969
: USBDevice(get_usb_phy(), vendor_id, product_id, product_release),
7070
_initialized(false), _media_removed(false),
7171
_addr(0), _length(0), _mem_ok(false), _block_size(0), _memory_size(0), _block_count(0),
@@ -81,7 +81,7 @@ USBMSD::USBMSD(BlockDevice *bd, bool connect_blocking, uint16_t vendor_id, uint1
8181
}
8282
}
8383

84-
USBMSD::USBMSD(USBPhy *phy, BlockDevice *bd, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
84+
USBMSD::USBMSD(USBPhy *phy, mbed::BlockDevice *bd, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
8585
: USBDevice(phy, vendor_id, product_id, product_release),
8686
_initialized(false), _media_removed(false),
8787
_addr(0), _length(0), _mem_ok(false), _block_size(0), _memory_size(0), _block_count(0),
@@ -230,15 +230,15 @@ bool USBMSD::media_removed()
230230

231231
int USBMSD::disk_read(uint8_t *data, uint64_t block, uint8_t count)
232232
{
233-
bd_addr_t addr = block * _bd->get_erase_size();
234-
bd_size_t size = count * _bd->get_erase_size();
233+
mbed::bd_addr_t addr = block * _bd->get_erase_size();
234+
mbed::bd_size_t size = count * _bd->get_erase_size();
235235
return _bd->read(data, addr, size);
236236
}
237237

238238
int USBMSD::disk_write(const uint8_t *data, uint64_t block, uint8_t count)
239239
{
240-
bd_addr_t addr = block * _bd->get_erase_size();
241-
bd_size_t size = count * _bd->get_erase_size();
240+
mbed::bd_addr_t addr = block * _bd->get_erase_size();
241+
mbed::bd_size_t size = count * _bd->get_erase_size();
242242
int ret = _bd->erase(addr, size);
243243
if (ret != 0) {
244244
return ret;

storage/blockdevice/COMPONENT_DATAFLASH/include/DataFlash/DataFlashBlockDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class DataFlashBlockDevice : public mbed::BlockDevice {
197197
void _write_enable(bool enable);
198198
int _sync(void);
199199
int _write_page(const uint8_t *buffer, uint32_t addr, uint32_t offset, uint32_t size);
200-
uint32_t _translate_address(bd_addr_t addr);
200+
uint32_t _translate_address(mbed::bd_addr_t addr);
201201

202202
// Mutex for thread safety
203203
mutable PlatformMutex _mutex;

storage/blockdevice/COMPONENT_FLASHIAP/include/FlashIAP/FlashIAPBlockDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class FlashIAPBlockDevice : public mbed::BlockDevice {
134134
* @param size Size to erase in bytes
135135
* @return True if erase is valid for underlying block device
136136
*/
137-
virtual bool is_valid_erase(bd_addr_t addr, bd_size_t size) const;
137+
virtual bool is_valid_erase(mbed::bd_addr_t addr, mbed::bd_size_t size) const;
138138

139139

140140
private:

storage/blockdevice/COMPONENT_I2CEE/include/I2CEE/I2CEEBlockDevice.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class I2CEEBlockDevice : public BlockDevice {
7272
*/
7373
I2CEEBlockDevice(
7474
PinName sda, PinName scl, uint8_t address,
75-
bd_size_t size, bd_size_t block = 32,
75+
mbed::bd_size_t size, mbed::bd_size_t block = 32,
7676
int bus_speed = 400000,
7777
bool address_is_eight_bit = false);
7878

@@ -89,7 +89,7 @@ class I2CEEBlockDevice : public BlockDevice {
8989
*/
9090
I2CEEBlockDevice(
9191
mbed::I2C *i2c_obj, uint8_t address,
92-
bd_size_t size, bd_size_t block = 32,
92+
mbed::bd_size_t size, mbed::bd_size_t block = 32,
9393
bool address_is_eight_bit = false);
9494

9595
/** Destructor of I2CEEBlockDevice
@@ -116,7 +116,7 @@ class I2CEEBlockDevice : public BlockDevice {
116116
* @param size Size to read in bytes, must be a multiple of read block size
117117
* @return 0 on success, negative error code on failure
118118
*/
119-
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size);
119+
virtual int read(void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
120120

121121
/** Program blocks to a block device
122122
*
@@ -127,7 +127,7 @@ class I2CEEBlockDevice : public BlockDevice {
127127
* @param size Size to write in bytes, must be a multiple of program block size
128128
* @return 0 on success, negative error code on failure
129129
*/
130-
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size);
130+
virtual int program(const void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size);
131131

132132
/** Erase blocks on a block device
133133
*
@@ -137,33 +137,33 @@ class I2CEEBlockDevice : public BlockDevice {
137137
* @param size Size to erase in bytes, must be a multiple of erase block size
138138
* @return 0 on success, negative error code on failure
139139
*/
140-
virtual int erase(bd_addr_t addr, bd_size_t size);
140+
virtual int erase(mbed::bd_addr_t addr, mbed::bd_size_t size);
141141

142142
/** Get the size of a readable block
143143
*
144144
* @return Size of a readable block in bytes
145145
*/
146-
virtual bd_size_t get_read_size() const;
146+
virtual mbed::bd_size_t get_read_size() const;
147147

148148
/** Get the size of a programable block
149149
*
150150
* @return Size of a programable block in bytes
151151
* @note Must be a multiple of the read size
152152
*/
153-
virtual bd_size_t get_program_size() const;
153+
virtual mbed::bd_size_t get_program_size() const;
154154

155155
/** Get the size of a eraseable block
156156
*
157157
* @return Size of a eraseable block in bytes
158158
* @note Must be a multiple of the program size
159159
*/
160-
virtual bd_size_t get_erase_size() const;
160+
virtual mbed::bd_size_t get_erase_size() const;
161161

162162
/** Get the total size of the underlying device
163163
*
164164
* @return Size of the underlying device in bytes
165165
*/
166-
virtual bd_size_t size() const;
166+
virtual mbed::bd_size_t size() const;
167167

168168
/** Get the BlockDevice class type.
169169
*
@@ -189,7 +189,7 @@ class I2CEEBlockDevice : public BlockDevice {
189189
* @param address An address in the requested page.
190190
* @return The device's I2C address for that page
191191
*/
192-
uint8_t get_paged_device_address(bd_addr_t address);
192+
uint8_t get_paged_device_address(mbed::bd_addr_t address);
193193
};
194194

195195

storage/blockdevice/COMPONENT_OSPIF/include/OSPIF/OSPIFBlockDevice.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
*/
6969
enum ospif_bd_error {
7070
OSPIF_BD_ERROR_OK = 0, /*!< no error */
71-
OSPIF_BD_ERROR_DEVICE_ERROR = BD_ERROR_DEVICE_ERROR, /*!< device specific error -4001 */
71+
OSPIF_BD_ERROR_DEVICE_ERROR = mbed::BD_ERROR_DEVICE_ERROR, /*!< device specific error -4001 */
7272
OSPIF_BD_ERROR_PARSING_FAILED = -4002, /* SFDP Parsing failed */
7373
OSPIF_BD_ERROR_READY_FAILED = -4003, /* Wait for Mem Ready failed */
7474
OSPIF_BD_ERROR_WREN_FAILED = -4004, /* Write Enable Failed */
@@ -331,7 +331,7 @@ class OSPIFBlockDevice : public mbed::BlockDevice {
331331
ospi_status_t _ospi_set_frequency(int freq);
332332

333333
// Update the 4-byte addressing extension register with the MSB of the address if it is in use
334-
ospi_status_t _ospi_update_4byte_ext_addr_reg(bd_addr_t addr);
334+
ospi_status_t _ospi_update_4byte_ext_addr_reg(mbed::bd_addr_t addr);
335335

336336
/*********************************/
337337
/* Flash Configuration Functions */

storage/blockdevice/COMPONENT_QSPIF/include/QSPIF/QSPIFBlockDevice.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
*/
5454
enum qspif_bd_error {
5555
QSPIF_BD_ERROR_OK = 0, /*!< no error */
56-
QSPIF_BD_ERROR_DEVICE_ERROR = BD_ERROR_DEVICE_ERROR, /*!< device specific error -4001 */
56+
QSPIF_BD_ERROR_DEVICE_ERROR = mbed::BD_ERROR_DEVICE_ERROR, /*!< device specific error -4001 */
5757
QSPIF_BD_ERROR_PARSING_FAILED = -4002, /* SFDP Parsing failed */
5858
QSPIF_BD_ERROR_READY_FAILED = -4003, /* Wait for Mem Ready failed */
5959
QSPIF_BD_ERROR_WREN_FAILED = -4004, /* Write Enable Failed */
@@ -289,7 +289,7 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
289289
qspi_status_t _qspi_set_frequency(int freq);
290290

291291
// Update the 4-byte addressing extension register with the MSB of the address if it is in use
292-
qspi_status_t _qspi_update_4byte_ext_addr_reg(bd_addr_t addr);
292+
qspi_status_t _qspi_update_4byte_ext_addr_reg(mbed::bd_addr_t addr);
293293

294294
/*********************************/
295295
/* Flash Configuration Functions */

storage/blockdevice/COMPONENT_SPIF/include/SPIF/SPIFBlockDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ class SPIFBlockDevice : public mbed::BlockDevice {
280280
mbed::sfdp_hdr_info _sfdp_info;
281281

282282
unsigned int _page_size_bytes; // Page size - 256 Bytes default
283-
bd_size_t _device_size_bytes;
283+
mbed::bd_size_t _device_size_bytes;
284284

285285
// Bus configuration
286286
unsigned int _address_size; // number of bytes for address

0 commit comments

Comments
 (0)