Skip to content

BlockDevices: specify mbed namespace where needed #14031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions drivers/usb/include/usb/USBMSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class USBMSD: public USBDevice {
* @param product_id Your product_id
* @param product_release Your preoduct_release
*/
USBMSD(BlockDevice *bd, bool connect_blocking = true, uint16_t vendor_id = 0x0703, uint16_t product_id = 0x0104, uint16_t product_release = 0x0001);
USBMSD(mbed::BlockDevice *bd, bool connect_blocking = true, uint16_t vendor_id = 0x0703, uint16_t product_id = 0x0104, uint16_t product_release = 0x0001);

/**
* Fully featured constructor
Expand All @@ -95,7 +95,7 @@ class USBMSD: public USBDevice {
* @param product_id Your product_id
* @param product_release Your preoduct_release
*/
USBMSD(USBPhy *phy, BlockDevice *bd, uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
USBMSD(USBPhy *phy, mbed::BlockDevice *bd, uint16_t vendor_id, uint16_t product_id, uint16_t product_release);

/**
* Destroy this object
Expand Down Expand Up @@ -263,7 +263,7 @@ class USBMSD: public USBDevice {
events::Task<void(const setup_packet_t *)> _control_task;
events::Task<void()> _configure_task;

BlockDevice *_bd;
mbed::BlockDevice *_bd;
rtos::Mutex _mutex_init;
rtos::Mutex _mutex;

Expand Down
12 changes: 6 additions & 6 deletions drivers/usb/source/PolledQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
#include "platform/Callback.h"


PolledQueue::PolledQueue(mbed::Callback<void()> cb): _cb(cb)
events::PolledQueue::PolledQueue(mbed::Callback<void()> cb): _cb(cb)
{

}

PolledQueue::~PolledQueue()
events::PolledQueue::~PolledQueue()
{

}

void PolledQueue::dispatch()
void events::PolledQueue::dispatch()
{
core_util_critical_section_enter();
uint64_t buf[MBED_MAX_TASK_SIZE / sizeof(uint64_t)];
Expand Down Expand Up @@ -60,7 +60,7 @@ void PolledQueue::dispatch()
core_util_critical_section_exit();
}

void PolledQueue::attach(mbed::Callback<void()> cb)
void events::PolledQueue::attach(mbed::Callback<void()> cb)
{
core_util_critical_section_enter();

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

void PolledQueue::post(TaskBase *task)
void events::PolledQueue::post(TaskBase *task)
{
core_util_critical_section_enter();

Expand All @@ -83,7 +83,7 @@ void PolledQueue::post(TaskBase *task)
core_util_critical_section_exit();
}

void PolledQueue::cancel(TaskBase *task)
void events::PolledQueue::cancel(TaskBase *task)
{
core_util_critical_section_enter();

Expand Down
3 changes: 3 additions & 0 deletions drivers/usb/source/TaskBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "rtos/Semaphore.h"
#include "platform/mbed_critical.h"

namespace events {

TaskBase::TaskBase(TaskQueue *q)
: _queue(q), _posted(false), _start_count(0), _flush_sem(NULL)
{
Expand Down Expand Up @@ -150,3 +152,4 @@ void TaskBase::_wake_check()
_flush_sem = NULL;
}
}
}
12 changes: 6 additions & 6 deletions drivers/usb/source/USBMSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ enum Status {
CSW_ERROR,
};

USBMSD::USBMSD(BlockDevice *bd, bool connect_blocking, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
USBMSD::USBMSD(mbed::BlockDevice *bd, bool connect_blocking, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
: USBDevice(get_usb_phy(), vendor_id, product_id, product_release),
_initialized(false), _media_removed(false),
_addr(0), _length(0), _mem_ok(false), _block_size(0), _memory_size(0), _block_count(0),
Expand All @@ -81,7 +81,7 @@ USBMSD::USBMSD(BlockDevice *bd, bool connect_blocking, uint16_t vendor_id, uint1
}
}

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

int USBMSD::disk_read(uint8_t *data, uint64_t block, uint8_t count)
{
bd_addr_t addr = block * _bd->get_erase_size();
bd_size_t size = count * _bd->get_erase_size();
mbed::bd_addr_t addr = block * _bd->get_erase_size();
mbed::bd_size_t size = count * _bd->get_erase_size();
return _bd->read(data, addr, size);
}

int USBMSD::disk_write(const uint8_t *data, uint64_t block, uint8_t count)
{
bd_addr_t addr = block * _bd->get_erase_size();
bd_size_t size = count * _bd->get_erase_size();
mbed::bd_addr_t addr = block * _bd->get_erase_size();
mbed::bd_size_t size = count * _bd->get_erase_size();
int ret = _bd->erase(addr, size);
if (ret != 0) {
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class DataFlashBlockDevice : public mbed::BlockDevice {
void _write_enable(bool enable);
int _sync(void);
int _write_page(const uint8_t *buffer, uint32_t addr, uint32_t offset, uint32_t size);
uint32_t _translate_address(bd_addr_t addr);
uint32_t _translate_address(mbed::bd_addr_t addr);

// Mutex for thread safety
mutable PlatformMutex _mutex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class FlashIAPBlockDevice : public mbed::BlockDevice {
* @param size Size to erase in bytes
* @return True if erase is valid for underlying block device
*/
virtual bool is_valid_erase(bd_addr_t addr, bd_size_t size) const;
virtual bool is_valid_erase(mbed::bd_addr_t addr, mbed::bd_size_t size) const;


private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class I2CEEBlockDevice : public BlockDevice {
*/
I2CEEBlockDevice(
PinName sda, PinName scl, uint8_t address,
bd_size_t size, bd_size_t block = 32,
mbed::bd_size_t size, mbed::bd_size_t block = 32,
int bus_speed = 400000,
bool address_is_eight_bit = false);

Expand All @@ -89,7 +89,7 @@ class I2CEEBlockDevice : public BlockDevice {
*/
I2CEEBlockDevice(
mbed::I2C *i2c_obj, uint8_t address,
bd_size_t size, bd_size_t block = 32,
mbed::bd_size_t size, mbed::bd_size_t block = 32,
bool address_is_eight_bit = false);

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

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

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

/** Get the size of a readable block
*
* @return Size of a readable block in bytes
*/
virtual bd_size_t get_read_size() const;
virtual mbed::bd_size_t get_read_size() const;

/** Get the size of a programable block
*
* @return Size of a programable block in bytes
* @note Must be a multiple of the read size
*/
virtual bd_size_t get_program_size() const;
virtual mbed::bd_size_t get_program_size() const;

/** Get the size of a eraseable block
*
* @return Size of a eraseable block in bytes
* @note Must be a multiple of the program size
*/
virtual bd_size_t get_erase_size() const;
virtual mbed::bd_size_t get_erase_size() const;

/** Get the total size of the underlying device
*
* @return Size of the underlying device in bytes
*/
virtual bd_size_t size() const;
virtual mbed::bd_size_t size() const;

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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
*/
enum ospif_bd_error {
OSPIF_BD_ERROR_OK = 0, /*!< no error */
OSPIF_BD_ERROR_DEVICE_ERROR = BD_ERROR_DEVICE_ERROR, /*!< device specific error -4001 */
OSPIF_BD_ERROR_DEVICE_ERROR = mbed::BD_ERROR_DEVICE_ERROR, /*!< device specific error -4001 */
OSPIF_BD_ERROR_PARSING_FAILED = -4002, /* SFDP Parsing failed */
OSPIF_BD_ERROR_READY_FAILED = -4003, /* Wait for Mem Ready failed */
OSPIF_BD_ERROR_WREN_FAILED = -4004, /* Write Enable Failed */
Expand Down Expand Up @@ -331,7 +331,7 @@ class OSPIFBlockDevice : public mbed::BlockDevice {
ospi_status_t _ospi_set_frequency(int freq);

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

/*********************************/
/* Flash Configuration Functions */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
*/
enum qspif_bd_error {
QSPIF_BD_ERROR_OK = 0, /*!< no error */
QSPIF_BD_ERROR_DEVICE_ERROR = BD_ERROR_DEVICE_ERROR, /*!< device specific error -4001 */
QSPIF_BD_ERROR_DEVICE_ERROR = mbed::BD_ERROR_DEVICE_ERROR, /*!< device specific error -4001 */
QSPIF_BD_ERROR_PARSING_FAILED = -4002, /* SFDP Parsing failed */
QSPIF_BD_ERROR_READY_FAILED = -4003, /* Wait for Mem Ready failed */
QSPIF_BD_ERROR_WREN_FAILED = -4004, /* Write Enable Failed */
Expand Down Expand Up @@ -289,7 +289,7 @@ class QSPIFBlockDevice : public mbed::BlockDevice {
qspi_status_t _qspi_set_frequency(int freq);

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

/*********************************/
/* Flash Configuration Functions */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class SPIFBlockDevice : public mbed::BlockDevice {
mbed::sfdp_hdr_info _sfdp_info;

unsigned int _page_size_bytes; // Page size - 256 Bytes default
bd_size_t _device_size_bytes;
mbed::bd_size_t _device_size_bytes;

// Bus configuration
unsigned int _address_size; // number of bytes for address
Expand Down
8 changes: 4 additions & 4 deletions storage/kvstore/kv_config/source/kv_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ int _storage_config_filesystem_common();
*
* @returns pointer to other block device.
*/
BlockDevice *get_other_blockdevice();
mbed::BlockDevice *get_other_blockdevice();

static const char *filesystemstore_folder_path = NULL;

Expand Down Expand Up @@ -559,10 +559,10 @@ BlockDevice *_get_blockdevice_default(bd_addr_t start_address, bd_size_t size)
* get_other_blockdevice() */
BlockDevice *_get_blockdevice_other(bd_addr_t start_address, bd_size_t size)
{
bd_addr_t aligned_end_address;
bd_addr_t aligned_start_address;
mbed::bd_addr_t aligned_end_address;
mbed::bd_addr_t aligned_start_address;

BlockDevice *bd = get_other_blockdevice();
mbed::BlockDevice *bd = get_other_blockdevice();
if (bd == NULL) {
tr_error("KV Config: \"other\" block device init fail");
return NULL;
Expand Down