Merge pull request #8008 from deepikabhavnani/cleanup_features

Add required header file and namespace element instead add all
pull/8448/head
Cruz Monrreal 2018-10-16 21:37:20 -05:00 committed by GitHub
commit d30ae07b6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 52 additions and 29 deletions

View File

@ -38,6 +38,7 @@
using namespace utest::v1; using namespace utest::v1;
using namespace mbed;
static LoRaRadio *radio = NULL; static LoRaRadio *radio = NULL;
rtos::Semaphore event_sem(0); rtos::Semaphore event_sem(0);

View File

@ -18,14 +18,13 @@
#include "platform/FileHandle.h" #include "platform/FileHandle.h"
#define POS_IS_VALID(pos) (pos >= 0 && pos < _end) #define POS_IS_VALID(pos) (pos >= 0 && pos < _end)
#define NEW_POS_IS_VALID(pos) (pos >= 0 && pos < (int32_t)FILE_SIZE) #define NEW_POS_IS_VALID(pos) (pos >= 0 && pos < (int32_t)FILE_SIZE)
#define SEEK_POS_IS_VALID(pos) (pos >= 0 && pos <= _end) #define SEEK_POS_IS_VALID(pos) (pos >= 0 && pos <= _end)
#define INVALID_POS (-1) #define INVALID_POS (-1)
template<uint32_t FILE_SIZE> template<uint32_t FILE_SIZE>
class TestFile : public FileHandle { class TestFile : public mbed::FileHandle {
public: public:
TestFile(): _pos(0), _end(0) {} TestFile(): _pos(0), _end(0) {}
~TestFile() {} ~TestFile() {}

View File

@ -18,6 +18,7 @@
#include "utest.h" #include "utest.h"
#include "SPIFBlockDevice.h" #include "SPIFBlockDevice.h"
#include "mbed_trace.h" #include "mbed_trace.h"
#include "rtos/Thread.h"
#include <stdlib.h> #include <stdlib.h>
using namespace utest::v1; using namespace utest::v1;

View File

@ -25,6 +25,7 @@
#endif #endif
using namespace utest::v1; using namespace utest::v1;
using namespace mbed;
#define MSG_VALUE_DUMMY "0" #define MSG_VALUE_DUMMY "0"
#define MSG_VALUE_LEN 32 #define MSG_VALUE_LEN 32

View File

@ -15,14 +15,10 @@
* limitations under the License. * limitations under the License.
*/ */
#include "mbed.h"
#include "rtos.h"
#include "mbed_stats.h"
#include "cmsis_os2.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "greentea-client/greentea_metrics.h" #include "greentea-client/greentea_metrics.h"
#include "SingletonPtr.h" #include "platform/mbed_stats.h"
#include "CircularBuffer.h" #include <stdint.h>
#define THREAD_BUF_COUNT 16 #define THREAD_BUF_COUNT 16
@ -33,6 +29,21 @@ typedef struct {
} thread_info_t; } thread_info_t;
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED #if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
#if !defined(MBED_CONF_RTOS_PRESENT) || !(MBED_CONF_RTOS_PRESENT)
#error "RTOS required for Stack stats"
#endif
#include "rtos/Mutex.h"
#include "rtos/Thread.h"
#include "rtos/Kernel.h"
#include "mbed_stats.h"
#include "cmsis_os2.h"
#include "platform/SingletonPtr.h"
#include "platform/CircularBuffer.h"
using namespace mbed;
using namespace rtos;
// Mutex to protect "buf" // Mutex to protect "buf"
static SingletonPtr<Mutex> mutex; static SingletonPtr<Mutex> mutex;
static char buf[128]; static char buf[128];
@ -43,7 +54,9 @@ static SingletonPtr<CircularBuffer<thread_info_t, THREAD_BUF_COUNT> > queue;
static void send_CPU_info(void); static void send_CPU_info(void);
#endif #endif
#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
static void send_heap_info(void); static void send_heap_info(void);
#endif
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED #if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
static void send_stack_info(void); static void send_stack_info(void);
static void on_thread_terminate(osThreadId_t id); static void on_thread_terminate(osThreadId_t id);
@ -64,7 +77,9 @@ void greentea_metrics_setup()
void greentea_metrics_report() void greentea_metrics_report()
{ {
#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
send_heap_info(); send_heap_info();
#endif
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED #if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
send_stack_info(); send_stack_info();
Kernel::attach_thread_terminate_hook(NULL); Kernel::attach_thread_terminate_hook(NULL);
@ -87,6 +102,7 @@ static void send_CPU_info()
} }
#endif #endif
#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
static void send_heap_info() static void send_heap_info()
{ {
mbed_stats_heap_t heap_stats; mbed_stats_heap_t heap_stats;
@ -94,6 +110,7 @@ static void send_heap_info()
greentea_send_kv("max_heap_usage",heap_stats.max_size); greentea_send_kv("max_heap_usage",heap_stats.max_size);
greentea_send_kv("reserved_heap",heap_stats.reserved_size); greentea_send_kv("reserved_heap",heap_stats.reserved_size);
} }
#endif
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED #if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
MBED_UNUSED static void send_stack_info() MBED_UNUSED static void send_stack_info()

View File

@ -18,7 +18,6 @@
#include <ctype.h> #include <ctype.h>
#include <cstdio> #include <cstdio>
#include <string.h> #include <string.h>
#include "mbed.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "greentea-client/greentea_serial.h" #include "greentea-client/greentea_serial.h"
#include "greentea-client/greentea_metrics.h" #include "greentea-client/greentea_metrics.h"

View File

@ -15,7 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
#include "mbed.h"
#include "mbed_critical.h" #include "mbed_critical.h"
#include "utest/utest.h" #include "utest/utest.h"

View File

@ -58,7 +58,9 @@ utest_v1_scheduler_t utest_v1_get_scheduler()
#ifdef YOTTA_MBED_HAL_VERSION_STRING #ifdef YOTTA_MBED_HAL_VERSION_STRING
# include "mbed-hal/us_ticker_api.h" # include "mbed-hal/us_ticker_api.h"
#else #else
# include "mbed.h" #include "platform/SingletonPtr.h"
#include "Timeout.h"
using mbed::Timeout;
#endif #endif
// only one callback is active at any given time // only one callback is active at any given time

View File

@ -17,7 +17,6 @@
#ifdef UTEST_STACK_TRACE #ifdef UTEST_STACK_TRACE
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "mbed.h"
#include "utest/utest.h" #include "utest/utest.h"
#include "unity/unity.h" #include "unity/unity.h"
#include "utest/utest_stack_trace.h" #include "utest/utest_stack_trace.h"

View File

@ -22,7 +22,7 @@
#ifndef UTEST_SCHEDULER_H #ifndef UTEST_SCHEDULER_H
#define UTEST_SCHEDULER_H #define UTEST_SCHEDULER_H
#include "mbed.h" #include "hal/ticker_api.h"
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>

View File

@ -35,7 +35,7 @@ Nanostack::LoWPANNDInterface *LoWPANNDInterface::get_interface() const
nsapi_error_t LoWPANNDInterface::do_initialize() nsapi_error_t LoWPANNDInterface::do_initialize()
{ {
if (!_interface) { if (!_interface) {
_interface = new (nothrow) Nanostack::LoWPANNDInterface(*_phy); _interface = new (std::nothrow) Nanostack::LoWPANNDInterface(*_phy);
if (!_interface) { if (!_interface) {
return NSAPI_ERROR_NO_MEMORY; return NSAPI_ERROR_NO_MEMORY;
} }

View File

@ -2,12 +2,11 @@
* Copyright (c) 2017 ARM Limited. All rights reserved. * Copyright (c) 2017 ARM Limited. All rights reserved.
*/ */
#include "Nanostack.h"
#include "NanostackEthernetInterface.h" #include "NanostackEthernetInterface.h"
#include "NanostackEthernetPhy.h" #include "NanostackEthernetPhy.h"
#include "EMAC.h"
#include "nsdynmemLIB.h" #include "nsdynmemLIB.h"
#include "arm_hal_phy.h" #include "arm_hal_phy.h"
#include "EMAC.h"
class EMACPhy : public NanostackEthernetPhy class EMACPhy : public NanostackEthernetPhy
{ {
@ -138,7 +137,7 @@ int8_t EMACPhy::phy_register()
phy.phy_tx_done_cb = NULL; phy.phy_tx_done_cb = NULL;
emac.set_memory_manager(memory_manager); emac.set_memory_manager(memory_manager);
emac.set_link_input_cb(callback(this, &EMACPhy::emac_phy_rx)); emac.set_link_input_cb(mbed::callback(this, &EMACPhy::emac_phy_rx));
if (!emac.power_up()) { if (!emac.power_up()) {
return -1; return -1;
@ -183,7 +182,7 @@ nsapi_error_t Nanostack::add_ethernet_interface(EMAC &emac, bool default_if, Nan
return NSAPI_ERROR_DEVICE_ERROR; return NSAPI_ERROR_DEVICE_ERROR;
} }
single_phy = new (nothrow) EMACPhy(this->memory_manager, emac); single_phy = new (std::nothrow) EMACPhy(this->memory_manager, emac);
if (!single_phy) { if (!single_phy) {
return NSAPI_ERROR_NO_MEMORY; return NSAPI_ERROR_NO_MEMORY;
} }
@ -194,7 +193,7 @@ nsapi_error_t Nanostack::add_ethernet_interface(EMAC &emac, bool default_if, Nan
Nanostack::EthernetInterface *interface; Nanostack::EthernetInterface *interface;
interface = new (nothrow) Nanostack::EthernetInterface(*single_phy); interface = new (std::nothrow) Nanostack::EthernetInterface(*single_phy);
if (!interface) { if (!interface) {
return NSAPI_ERROR_NO_MEMORY; return NSAPI_ERROR_NO_MEMORY;
} }

View File

@ -38,7 +38,7 @@ nsapi_error_t NanostackEthernetInterface::initialize(NanostackEthernetPhy *phy)
return NSAPI_ERROR_PARAMETER; return NSAPI_ERROR_PARAMETER;
} }
_interface = new (nothrow) Nanostack::EthernetInterface(*phy); _interface = new (std::nothrow) Nanostack::EthernetInterface(*phy);
if (!_interface) { if (!_interface) {
return NSAPI_ERROR_NO_MEMORY; return NSAPI_ERROR_NO_MEMORY;
} }

View File

@ -79,7 +79,7 @@ Nanostack::ThreadInterface *ThreadInterface::get_interface() const
nsapi_error_t ThreadInterface::do_initialize() nsapi_error_t ThreadInterface::do_initialize()
{ {
if (!_interface) { if (!_interface) {
_interface = new (nothrow) Nanostack::ThreadInterface(*_phy); _interface = new (std::nothrow) Nanostack::ThreadInterface(*_phy);
if (!_interface) { if (!_interface) {
return NSAPI_ERROR_NO_MEMORY; return NSAPI_ERROR_NO_MEMORY;
} }

View File

@ -17,11 +17,17 @@
// Include before mbed.h to properly get UINT*_C() // Include before mbed.h to properly get UINT*_C()
#include "ns_types.h" #include "ns_types.h"
#include "mbed.h"
#include "platform/SingletonPtr.h" #include "platform/SingletonPtr.h"
#include "platform/arm_hal_timer.h" #include "platform/arm_hal_timer.h"
#include "platform/arm_hal_interrupt.h" #include "platform/arm_hal_interrupt.h"
#include <mbed_assert.h> #include "platform/mbed_assert.h"
#include "Timeout.h"
#include "Timer.h"
#include "events/Event.h"
#include "events/mbed_shared_queues.h"
using namespace mbed;
using namespace events;
static SingletonPtr<Timer> timer; static SingletonPtr<Timer> timer;
static SingletonPtr<Timeout> timeout; static SingletonPtr<Timeout> timeout;

View File

@ -17,8 +17,6 @@
/* Nanostack implementation of NetworkSocketAPI */ /* Nanostack implementation of NetworkSocketAPI */
#include "mbed.h"
#include "rtos.h"
#include "Nanostack.h" #include "Nanostack.h"
#include "NanostackLockGuard.h" #include "NanostackLockGuard.h"

View File

@ -18,7 +18,6 @@
#ifndef NANOSTACK_H_ #ifndef NANOSTACK_H_
#define NANOSTACK_H_ #define NANOSTACK_H_
#include "mbed.h"
#include "OnboardNetworkStack.h" #include "OnboardNetworkStack.h"
#include "NanostackMemoryManager.h" #include "NanostackMemoryManager.h"
#include "MeshInterface.h" #include "MeshInterface.h"

View File

@ -15,6 +15,7 @@
*/ */
#include "EMACInterface.h" #include "EMACInterface.h"
using namespace mbed;
/* Interface implementation */ /* Interface implementation */
EMACInterface::EMACInterface(EMAC &emac, OnboardNetworkStack &stack) : EMACInterface::EMACInterface(EMAC &emac, OnboardNetworkStack &stack) :

View File

@ -18,7 +18,6 @@
#define EMAC_INTERFACE_H #define EMAC_INTERFACE_H
#include "nsapi.h" #include "nsapi.h"
#include "rtos.h"
#include "EMAC.h" #include "EMAC.h"
#include "OnboardNetworkStack.h" #include "OnboardNetworkStack.h"

View File

@ -18,7 +18,6 @@
#define ETHERNET_INTERFACE_H #define ETHERNET_INTERFACE_H
#include "nsapi.h" #include "nsapi.h"
#include "rtos.h"
#include "EMACInterface.h" #include "EMACInterface.h"

View File

@ -15,7 +15,8 @@
*/ */
#include "TCPServer.h" #include "TCPServer.h"
#include "mbed.h"
using mbed::Callback;
TCPServer::TCPServer() TCPServer::TCPServer()
{ {

View File

@ -18,6 +18,8 @@
#include "utest/utest.h" #include "utest/utest.h"
#include "BlockDevice.h" #include "BlockDevice.h"
#include "FileSystem.h" #include "FileSystem.h"
#include <stdlib.h>
#if COMPONENT_SPIF #if COMPONENT_SPIF
#include "SPIFBlockDevice.h" #include "SPIFBlockDevice.h"
#include "LittleFileSystem.h" #include "LittleFileSystem.h"
@ -32,6 +34,7 @@
#endif #endif
using namespace utest::v1; using namespace utest::v1;
using namespace mbed;
static const size_t small_buf_size = 10; static const size_t small_buf_size = 10;
static const size_t medium_buf_size = 250; static const size_t medium_buf_size = 250;