diff --git a/drivers/usb/include/usb/USBMSD.h b/drivers/usb/include/usb/USBMSD.h index f26e07c..dc956fb 100644 --- a/drivers/usb/include/usb/USBMSD.h +++ b/drivers/usb/include/usb/USBMSD.h @@ -76,7 +76,7 @@ * @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 @@ -95,7 +95,7 @@ * @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 @@ -263,7 +263,7 @@ events::Task _control_task; events::Task _configure_task; - BlockDevice *_bd; + mbed::BlockDevice *_bd; rtos::Mutex _mutex_init; rtos::Mutex _mutex; diff --git a/drivers/usb/source/PolledQueue.cpp b/drivers/usb/source/PolledQueue.cpp index 3f8cd9d..7f0adbb 100644 --- a/drivers/usb/source/PolledQueue.cpp +++ b/drivers/usb/source/PolledQueue.cpp @@ -21,17 +21,17 @@ #include "platform/Callback.h" -PolledQueue::PolledQueue(mbed::Callback cb): _cb(cb) +events::PolledQueue::PolledQueue(mbed::Callback 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)]; @@ -60,7 +60,7 @@ core_util_critical_section_exit(); } -void PolledQueue::attach(mbed::Callback cb) +void events::PolledQueue::attach(mbed::Callback cb) { core_util_critical_section_enter(); @@ -69,7 +69,7 @@ core_util_critical_section_exit(); } -void PolledQueue::post(TaskBase *task) +void events::PolledQueue::post(TaskBase *task) { core_util_critical_section_enter(); @@ -83,7 +83,7 @@ core_util_critical_section_exit(); } -void PolledQueue::cancel(TaskBase *task) +void events::PolledQueue::cancel(TaskBase *task) { core_util_critical_section_enter(); diff --git a/drivers/usb/source/TaskBase.cpp b/drivers/usb/source/TaskBase.cpp index a8292ed..f86cae3 100644 --- a/drivers/usb/source/TaskBase.cpp +++ b/drivers/usb/source/TaskBase.cpp @@ -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) { @@ -150,3 +152,4 @@ _flush_sem = NULL; } } +} diff --git a/drivers/usb/source/USBMSD.cpp b/drivers/usb/source/USBMSD.cpp index 6845c02..fcf416c 100644 --- a/drivers/usb/source/USBMSD.cpp +++ b/drivers/usb/source/USBMSD.cpp @@ -65,7 +65,7 @@ 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), @@ -81,7 +81,7 @@ } } -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), @@ -230,15 +230,15 @@ 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; diff --git a/storage/blockdevice/COMPONENT_DATAFLASH/include/DataFlash/DataFlashBlockDevice.h b/storage/blockdevice/COMPONENT_DATAFLASH/include/DataFlash/DataFlashBlockDevice.h index 215f859..53dd0f1 100644 --- a/storage/blockdevice/COMPONENT_DATAFLASH/include/DataFlash/DataFlashBlockDevice.h +++ b/storage/blockdevice/COMPONENT_DATAFLASH/include/DataFlash/DataFlashBlockDevice.h @@ -197,7 +197,7 @@ 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; diff --git a/storage/blockdevice/COMPONENT_FLASHIAP/include/FlashIAP/FlashIAPBlockDevice.h b/storage/blockdevice/COMPONENT_FLASHIAP/include/FlashIAP/FlashIAPBlockDevice.h index 1ba0e98..4a44a27 100644 --- a/storage/blockdevice/COMPONENT_FLASHIAP/include/FlashIAP/FlashIAPBlockDevice.h +++ b/storage/blockdevice/COMPONENT_FLASHIAP/include/FlashIAP/FlashIAPBlockDevice.h @@ -134,7 +134,7 @@ * @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: diff --git a/storage/blockdevice/COMPONENT_I2CEE/include/I2CEE/I2CEEBlockDevice.h b/storage/blockdevice/COMPONENT_I2CEE/include/I2CEE/I2CEEBlockDevice.h index 8bc1368..09cc127 100644 --- a/storage/blockdevice/COMPONENT_I2CEE/include/I2CEE/I2CEEBlockDevice.h +++ b/storage/blockdevice/COMPONENT_I2CEE/include/I2CEE/I2CEEBlockDevice.h @@ -72,7 +72,7 @@ */ 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); @@ -89,7 +89,7 @@ */ 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 @@ -116,7 +116,7 @@ * @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 * @@ -127,7 +127,7 @@ * @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 * @@ -137,33 +137,33 @@ * @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. * @@ -189,7 +189,7 @@ * @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); }; diff --git a/storage/blockdevice/COMPONENT_OSPIF/include/OSPIF/OSPIFBlockDevice.h b/storage/blockdevice/COMPONENT_OSPIF/include/OSPIF/OSPIFBlockDevice.h index 98b0873..b61f0eb 100644 --- a/storage/blockdevice/COMPONENT_OSPIF/include/OSPIF/OSPIFBlockDevice.h +++ b/storage/blockdevice/COMPONENT_OSPIF/include/OSPIF/OSPIFBlockDevice.h @@ -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 */ @@ -331,7 +331,7 @@ 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 */ diff --git a/storage/blockdevice/COMPONENT_QSPIF/include/QSPIF/QSPIFBlockDevice.h b/storage/blockdevice/COMPONENT_QSPIF/include/QSPIF/QSPIFBlockDevice.h index 44e5a85..1aae02b 100644 --- a/storage/blockdevice/COMPONENT_QSPIF/include/QSPIF/QSPIFBlockDevice.h +++ b/storage/blockdevice/COMPONENT_QSPIF/include/QSPIF/QSPIFBlockDevice.h @@ -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 */ @@ -289,7 +289,7 @@ 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 */ diff --git a/storage/blockdevice/COMPONENT_SPIF/include/SPIF/SPIFBlockDevice.h b/storage/blockdevice/COMPONENT_SPIF/include/SPIF/SPIFBlockDevice.h index 23da6f6..13b7bfd 100644 --- a/storage/blockdevice/COMPONENT_SPIF/include/SPIF/SPIFBlockDevice.h +++ b/storage/blockdevice/COMPONENT_SPIF/include/SPIF/SPIFBlockDevice.h @@ -280,7 +280,7 @@ 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 diff --git a/storage/kvstore/kv_config/source/kv_config.cpp b/storage/kvstore/kv_config/source/kv_config.cpp index 3edb34e..fa430cf 100644 --- a/storage/kvstore/kv_config/source/kv_config.cpp +++ b/storage/kvstore/kv_config/source/kv_config.cpp @@ -147,7 +147,7 @@ * * @returns pointer to other block device. */ -BlockDevice *get_other_blockdevice(); +mbed::BlockDevice *get_other_blockdevice(); static const char *filesystemstore_folder_path = NULL; @@ -559,10 +559,10 @@ * 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;