Import Mbed OS hard-float snapshot
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2015 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "common_functions.h"
|
||||
|
||||
//TODO: create uint8 value to return
|
||||
|
||||
uint8_t *bitcopy(uint8_t *restrict dst, const uint8_t *restrict src, uint_fast8_t bits)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool bitsequal(const uint8_t *a, const uint8_t *b, uint_fast8_t bits)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2015 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ip6string.h"
|
||||
#include "ip6tos_stub.h"
|
||||
|
||||
ip6tos_def ip6tos_stub;
|
||||
|
||||
void ip6tos(const void *ip6addr, char *p)
|
||||
{
|
||||
if (ip6tos_stub.h) {
|
||||
p[0] = ip6tos_stub.c;
|
||||
p[1] = '\0';
|
||||
} else {
|
||||
p[0] = '\0';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2015 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __IP6TOS_STUB_H__
|
||||
#define __IP6TOS_STUB_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct ip6tos {
|
||||
char c;
|
||||
bool h;
|
||||
} ip6tos_def;
|
||||
|
||||
extern ip6tos_def ip6tos_stub;
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2015 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef IPV6_TEST_VALUES_H
|
||||
#define IPV6_TEST_VALUES_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct ip6_addresses_and_its_binary_form_t {
|
||||
char *addr;
|
||||
uint8_t bin[16];
|
||||
} ipv6_test_values[] = {
|
||||
{ "2001:db8::1:0:0:1", { 0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 }},
|
||||
{ "2001:db8:aaaa:bbbb:cccc:dddd:eeee:1", { 0x20, 0x01, 0xd, 0xb8, 0xaa, 0xaa, 0xbb, 0xbb, 0xcc, 0xcc, 0xdd, 0xdd, 0xee, 0xee, 0x00, 0x01 }},
|
||||
{ "2001:db8::1", { 0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }},
|
||||
{ "2001:db8::2:1", { 0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1 }},
|
||||
{ "2001:db8:aaaa:bbbb:cccc:dddd:0:1", { 0x20, 0x01, 0xd, 0xb8, 0xaa, 0xaa, 0xbb, 0xbb, 0xcc, 0xcc, 0xdd, 0xdd, 0, 0, 0x00, 0x01 }},
|
||||
{ "2001:db8::aaaa:0:0:1", { 0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0xaa, 0xaa, 0, 0, 0, 0, 0, 1 }},
|
||||
{ "2001:0:0:1::1", { 0x20, 0x01, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 }},
|
||||
{ "2001:0:0:1::", { 0x20, 0x01, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }},
|
||||
{ "2001:db8::", { 0x20, 0x01, 0xd, 0xb8 }},
|
||||
{ "::aaaa:0:0:1", { 0, 0, 0, 0, 0, 0, 0, 0, 0xaa, 0xaa, 0, 0, 0, 0, 0, 1 }},
|
||||
{ "::1", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }},
|
||||
{ "fe80::1", { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}},
|
||||
{ "::", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }},
|
||||
{ "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
|
||||
{NULL, {0}}
|
||||
};
|
||||
|
||||
#endif /* IPV6_TEST_VALUES_H */
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2017 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef MBED_CONF_MBED_TRACE_ENABLE
|
||||
#define MBED_CONF_MBED_TRACE_ENABLE 1
|
||||
#define MBED_CONF_MBED_TRACE_FEA_IPV6 1
|
||||
#endif
|
||||
|
||||
#include "mbed-trace/mbed_trace.h"
|
||||
#if MBED_CONF_MBED_TRACE_FEA_IPV6 == 1
|
||||
#include "mbed-client-libservice/ip6string.h"
|
||||
#include "mbed-client-libservice/common_functions.h"
|
||||
#endif
|
||||
|
||||
|
||||
int mbed_trace_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void mbed_trace_free(void)
|
||||
{
|
||||
}
|
||||
|
||||
void mbed_trace_buffer_sizes(int lineLength, int tmpLength)
|
||||
{
|
||||
}
|
||||
|
||||
void mbed_trace_config_set(uint8_t config)
|
||||
{
|
||||
}
|
||||
|
||||
uint8_t mbed_trace_config_get(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mbed_trace_prefix_function_set(char *(*pref_f)(size_t))
|
||||
{
|
||||
}
|
||||
|
||||
void mbed_trace_suffix_function_set(char *(*suffix_f)(void))
|
||||
{
|
||||
}
|
||||
|
||||
void mbed_trace_print_function_set(void (*printf)(const char *))
|
||||
{
|
||||
}
|
||||
|
||||
void mbed_trace_cmdprint_function_set(void (*printf)(const char *))
|
||||
{
|
||||
}
|
||||
|
||||
void mbed_trace_exclude_filters_set(char *filters)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const char *mbed_trace_exclude_filters_get(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *mbed_trace_include_filters_get(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void mbed_trace_include_filters_set(char *filters)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void mbed_tracef(uint8_t dlevel, const char *grp, const char *fmt, ...)
|
||||
{
|
||||
}
|
||||
|
||||
void mbed_vtracef(uint8_t dlevel, const char *grp, const char *fmt, va_list ap)
|
||||
{
|
||||
}
|
||||
|
||||
const char *mbed_trace_last(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Helping functions */
|
||||
#if MBED_CONF_MBED_TRACE_FEA_IPV6 == 1
|
||||
char *mbed_trace_ipv6(const void *addr_ptr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *mbed_trace_ipv6_prefix(const uint8_t *prefix, uint8_t prefix_len)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif //MBED_CONF_MBED_TRACE_FEA_IPV6
|
||||
|
||||
char *mbed_trace_array(const uint8_t *buf, uint16_t len)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2015 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define NS_LIST_FN extern
|
||||
|
||||
#include "ns_list.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "nsdynmemLIB_stub.h"
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <nsdynmemLIB.h>
|
||||
#include "platform/arm_hal_interrupt.h"
|
||||
#ifdef STANDARD_MALLOC
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
nsdynmemlib_stub_data_t nsdynmemlib_stub;
|
||||
|
||||
void ns_dyn_mem_init(void *heap, ns_mem_heap_size_t h_size, void (*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr)
|
||||
{
|
||||
}
|
||||
|
||||
void *ns_dyn_mem_alloc(ns_mem_block_size_t alloc_size)
|
||||
{
|
||||
if (nsdynmemlib_stub.returnCounter > 0) {
|
||||
nsdynmemlib_stub.returnCounter--;
|
||||
return malloc(alloc_size);
|
||||
} else {
|
||||
return (nsdynmemlib_stub.expectedPointer);
|
||||
}
|
||||
}
|
||||
|
||||
void *ns_dyn_mem_temporary_alloc(ns_mem_block_size_t alloc_size)
|
||||
{
|
||||
if (nsdynmemlib_stub.returnCounter > 0) {
|
||||
nsdynmemlib_stub.returnCounter--;
|
||||
return malloc(alloc_size);
|
||||
} else {
|
||||
return (nsdynmemlib_stub.expectedPointer);
|
||||
}
|
||||
}
|
||||
|
||||
void ns_dyn_mem_free(void *block)
|
||||
{
|
||||
free(block);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef __NSDYNMEMLIB_STUB_H__
|
||||
#define __NSDYNMEMLIB_STUB_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
typedef struct {
|
||||
uint8_t returnCounter;
|
||||
void *expectedPointer;
|
||||
} nsdynmemlib_stub_data_t;
|
||||
|
||||
extern nsdynmemlib_stub_data_t nsdynmemlib_stub;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2015 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
void platform_enter_critical() {};
|
||||
void platform_exit_critical() {};
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (c) 2016 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ns_types.h"
|
||||
#include "platform/arm_hal_nvm.h"
|
||||
|
||||
typedef struct {
|
||||
platform_nvm_status status;
|
||||
nvm_callback *saved_callback;
|
||||
void *saved_context;
|
||||
} test_platform_nvm_api_data;
|
||||
|
||||
test_platform_nvm_api_data test_data = {0, NULL, NULL};
|
||||
|
||||
|
||||
void test_platform_nvm_api_set_retval(platform_nvm_status return_value)
|
||||
{
|
||||
test_data.status = return_value;
|
||||
}
|
||||
|
||||
void test_platform_nvm_api_callback()
|
||||
{
|
||||
test_data.saved_callback(test_data.status, test_data.saved_context);
|
||||
}
|
||||
|
||||
platform_nvm_status platform_nvm_init(nvm_callback *callback, void *context)
|
||||
{
|
||||
test_data.saved_callback = callback;
|
||||
test_data.saved_context = context;
|
||||
return test_data.status;
|
||||
}
|
||||
|
||||
platform_nvm_status platform_nvm_finalize(nvm_callback *callback, void *context)
|
||||
{
|
||||
(void) callback;
|
||||
(void) context;
|
||||
return test_data.status;
|
||||
}
|
||||
|
||||
platform_nvm_status platform_nvm_key_create(nvm_callback *callback, const char *key_name, uint16_t value_len, uint32_t flags, void *context)
|
||||
{
|
||||
(void) key_name;
|
||||
(void) value_len;
|
||||
(void) flags;
|
||||
test_data.saved_callback = callback;
|
||||
test_data.saved_context = context;
|
||||
return test_data.status;
|
||||
}
|
||||
|
||||
platform_nvm_status platform_nvm_key_delete(nvm_callback *callback, const char *key_name, void *context)
|
||||
{
|
||||
(void) callback;
|
||||
(void) key_name;
|
||||
(void) context;
|
||||
test_data.saved_callback = callback;
|
||||
test_data.saved_context = context;
|
||||
return test_data.status;
|
||||
}
|
||||
|
||||
platform_nvm_status platform_nvm_write(nvm_callback *callback, const char *key_name, const void *data, uint16_t *data_len, void *context)
|
||||
{
|
||||
(void) key_name;
|
||||
(void) data;
|
||||
(void) data_len;
|
||||
test_data.saved_callback = callback;
|
||||
test_data.saved_context = context;
|
||||
return test_data.status;
|
||||
}
|
||||
|
||||
platform_nvm_status platform_nvm_read(nvm_callback *callback, const char *key_name, void *buf, uint16_t *buf_len, void *context)
|
||||
{
|
||||
(void) key_name;
|
||||
(void) buf;
|
||||
(void) buf_len;
|
||||
test_data.saved_callback = callback;
|
||||
test_data.saved_context = context;
|
||||
return test_data.status;
|
||||
}
|
||||
|
||||
platform_nvm_status platform_nvm_flush(nvm_callback *callback, void *context)
|
||||
{
|
||||
(void) callback;
|
||||
(void) context;
|
||||
test_data.saved_callback = callback;
|
||||
test_data.saved_context = context;
|
||||
return test_data.status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user