mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #9805 from ARMmbed/release-candidate
Release candidate for mbed-os-5.11.5mbed-os-5.11 mbed-os-5.11.5
commit
51d55508e8
|
@ -1,15 +1,15 @@
|
|||
### Description
|
||||
|
||||
<!--
|
||||
<!--
|
||||
Required
|
||||
Add here detailed changes summary, testing results, dependencies
|
||||
Add here detailed changes summary, testing results, dependencies
|
||||
Good example: https://os.mbed.com/docs/mbed-os/latest/contributing/workflow.html (Pull request template)
|
||||
-->
|
||||
|
||||
|
||||
### Pull request type
|
||||
|
||||
<!--
|
||||
<!--
|
||||
Required
|
||||
Please add only one X to one of the following types. Do not fill multiple types (split the pull request otherwise).
|
||||
Please note this is not a GitHub task list, indenting the boxes or changing the format to add a '.' or '*' in front
|
||||
|
@ -26,8 +26,15 @@
|
|||
|
||||
### Reviewers
|
||||
|
||||
<!--
|
||||
<!--
|
||||
Optional
|
||||
Request additional reviewers with @username
|
||||
-->
|
||||
|
||||
### Release Notes
|
||||
|
||||
<!--
|
||||
Optional
|
||||
In case of breaking changes, functionality changes or refactors, please add release notes here.
|
||||
For more information, please see [the contributing guidelines](https://os.mbed.com/docs/mbed-os/latest/contributing /workflow.html#pull-request-types).
|
||||
-->
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
Unless specifically indicated otherwise in a file, files are licensed under the Apache 2.0 license,
|
||||
as can be found in: LICENSE-apache-2.0.txt
|
||||
|
||||
Folders containing files under different permissive license than Apache 2.0 are listed below. Each folder should contain its own README file with license specified for its files. The original license text is included in those source files.
|
||||
|
||||
- [cmsis](./cmsis) - MIT, BSD-3-Clause
|
||||
- [components/802.15.4_RF/mcr20a-rf-driver](./components/802.15.4_RF/mcr20a-rf-driver) - BSD-3-Clause
|
||||
- [features/cryptocell/FEATURE_CRYPTOCELL310](./features/cryptocell/FEATURE_CRYPTOCELL310) - ARM Object Code and Header Files License
|
||||
- [features/FEATURE_BOOTLOADER](./features/FEATURE_BOOTLOADER) - PBL
|
||||
- [features/FEATURE_BLE/targets](./features/FEATURE_BLE/targets) - BSD-style, PBL, MIT-style
|
||||
- [features/lorawan](./features/lorawan) - Revised BSD
|
||||
- [features/lwipstack](./features/lwipstack) - BSD-style, MIT-style
|
||||
- [features/nanostack/sal-stack-nanostack](./features/nanostack/sal-stack-nanostack) - BSD-3-Clause
|
||||
- [features/storage](./features/storage) - BSD-style, MIT
|
||||
- [features/netsocket/emac-drivers](./features/netsocket/emac-drivers) - BSD-style
|
||||
- [features/frameworks/unity/unity](./features/frameworks/unity/unity) - MIT
|
||||
- [features/unsupported](./features/unsupported) - MIT-style, BSD-style
|
||||
- [rtos](./rtos) - MIT
|
||||
- [drivers](./drivers) - MIT
|
||||
- [TESTS/mbed_hal/trng/pithy](./TESTS/mbed_hal/trng/pithy) - BSD-3-Clause
|
||||
- [tools/data/rpc](./tools/data/rpc) - MIT
|
||||
- [targets](./targets) - PBL, BSD-style, MIT-style, Zlib-style, Public-domain
|
|
@ -29,9 +29,11 @@ The [release notes](https://os.mbed.com/releases) detail the current release. Yo
|
|||
|
||||
## License and contributions
|
||||
|
||||
The software is provided under [Apache-2.0 license](LICENSE). Contributions to this project are accepted under the same license. Please see [contributing.md](CONTRIBUTING.md) for more info.
|
||||
The software is provided under the [Apache-2.0 license](LICENSE-apache-2.0.txt). Contributions to this project are accepted under the same license. Please see [contributing.md](CONTRIBUTING.md) for more information.
|
||||
|
||||
This project contains code from other projects. The original license text is included in those source files. They must comply with our [license guide](https://os.mbed.com/docs/latest/reference/license.html)
|
||||
This project contains code from other projects. The original license text is included in those source files. They must comply with our [license guide](https://os.mbed.com/docs/latest/reference/license.html).
|
||||
|
||||
Folders containing files under different permissive license than Apache 2.0 are listed in the [LICENSE](LICENSE) file.
|
||||
|
||||
## Getting started for developers
|
||||
|
||||
|
|
|
@ -29,6 +29,17 @@
|
|||
|
||||
#include "mbed.h"
|
||||
|
||||
// Debug available
|
||||
#ifndef FLASHIAP_DEBUG
|
||||
#define FLASHIAP_DEBUG 0
|
||||
#endif
|
||||
|
||||
#if FLASHIAP_DEBUG
|
||||
#define DEBUG_PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_PRINTF(...)
|
||||
#endif
|
||||
|
||||
using namespace utest::v1;
|
||||
|
||||
|
||||
|
@ -37,6 +48,21 @@ void flashiap_init_test()
|
|||
FlashIAP flash_device;
|
||||
uint32_t ret = flash_device.init();
|
||||
TEST_ASSERT_EQUAL_INT32(0, ret);
|
||||
|
||||
uint32_t flash_start = flash_device.get_flash_start();
|
||||
uint32_t flash_size = flash_device.get_flash_size();
|
||||
utest_printf("Flash address: 0x%08x, size: %d\n", flash_start, flash_size);
|
||||
uint32_t address = flash_start;
|
||||
int num = 0;
|
||||
while (flash_size) {
|
||||
uint32_t sector_size = flash_device.get_sector_size(address);
|
||||
// Make sure all sectors sum up to the total flash size
|
||||
TEST_ASSERT(flash_size >= sector_size);
|
||||
DEBUG_PRINTF("\tsector %3d: address 0x%08x, size %8d\n", num++, address, sector_size);
|
||||
flash_size -= sector_size;
|
||||
address += sector_size;
|
||||
}
|
||||
|
||||
ret = flash_device.deinit();
|
||||
TEST_ASSERT_EQUAL_INT32(0, ret);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2019 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 "mbed_toolchain.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2019 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 "mbed_toolchain.h"
|
||||
|
||||
int testWeak1()
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2019 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 "mbed_assert.h"
|
||||
#define THE_ANSWER 42
|
||||
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2019 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 "mbed_assert.h"
|
||||
#define THE_ANSWER 42
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ void ASYNCHRONOUS_DNS_CANCEL()
|
|||
count++;
|
||||
} else {
|
||||
// No memory to initiate DNS query, callback will not be called
|
||||
printf("Error: No memory to initiate DNS query for %s\n", dns_test_hosts[i]);
|
||||
data[i].result = NSAPI_ERROR_NO_MEMORY;
|
||||
data[i].value_set = true;
|
||||
}
|
||||
|
|
|
@ -57,6 +57,15 @@ void drop_bad_packets(TCPSocket &sock, int orig_timeout)
|
|||
sock.set_timeout(orig_timeout);
|
||||
}
|
||||
|
||||
nsapi_version_t get_ip_version()
|
||||
{
|
||||
SocketAddress test;
|
||||
if (!test.set_ip_address(NetworkInterface::get_default_instance()->get_ip_address())) {
|
||||
return NSAPI_UNSPEC;
|
||||
}
|
||||
return test.get_ip_version();
|
||||
}
|
||||
|
||||
static void _ifup()
|
||||
{
|
||||
NetworkInterface *net = NetworkInterface::get_default_instance();
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
NetworkInterface *get_interface();
|
||||
void drop_bad_packets(TCPSocket &sock, int orig_timeout);
|
||||
nsapi_version_t get_ip_version();
|
||||
void fill_tx_buffer_ascii(char *buff, size_t len);
|
||||
nsapi_error_t tcpsocket_connect_to_echo_srv(TCPSocket &sock);
|
||||
nsapi_error_t tcpsocket_connect_to_discard_srv(TCPSocket &sock);
|
||||
|
|
|
@ -39,7 +39,14 @@ void TCPSOCKET_BIND_ADDRESS_INVALID()
|
|||
return;
|
||||
}
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
|
||||
nsapi_error_t bind_result = sock->bind("190.2.3.4", 1024);
|
||||
nsapi_error_t bind_result = NSAPI_ERROR_OK;
|
||||
if (get_ip_version() == NSAPI_IPv4) {
|
||||
bind_result = sock->bind("190.2.3.4", 1024);
|
||||
} else if (get_ip_version() == NSAPI_IPv6) {
|
||||
bind_result = sock->bind("fe80::ff01", 1024);
|
||||
} else {
|
||||
TEST_FAIL_MESSAGE("This stack is neither IPv4 nor IPv6");
|
||||
}
|
||||
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
|
||||
TEST_IGNORE_MESSAGE("bind() not supported");
|
||||
} else {
|
||||
|
|
|
@ -40,7 +40,14 @@ void TCPSOCKET_BIND_WRONG_TYPE()
|
|||
}
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
|
||||
char addr_bytes[16] = {0xfe, 0x80, 0xff, 0x1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
SocketAddress sockAddr = SocketAddress(addr_bytes, NSAPI_IPv4, 80);
|
||||
SocketAddress sockAddr;
|
||||
if (get_ip_version() == NSAPI_IPv4) {
|
||||
sockAddr = SocketAddress(addr_bytes, NSAPI_IPv4, 80);
|
||||
} else if (get_ip_version() == NSAPI_IPv6) {
|
||||
sockAddr = SocketAddress(addr_bytes, NSAPI_IPv6, 80);
|
||||
} else {
|
||||
TEST_FAIL_MESSAGE("This stack is neither IPv4 nor IPv6");
|
||||
}
|
||||
nsapi_error_t bind_result = sock->bind(sockAddr);
|
||||
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
|
||||
TEST_IGNORE_MESSAGE("bind() not supported");
|
||||
|
|
|
@ -195,9 +195,12 @@ Case cases[] = {
|
|||
Case("TLSSOCKET_SEND_REPEAT", TLSSOCKET_SEND_REPEAT),
|
||||
Case("TLSSOCKET_SEND_TIMEOUT", TLSSOCKET_SEND_TIMEOUT),
|
||||
Case("TLSSOCKET_NO_CERT", TLSSOCKET_NO_CERT),
|
||||
#ifndef __IAR_SYSTEMS_ICC__
|
||||
Case("TLSSOCKET_SIMULTANEOUS", TLSSOCKET_SIMULTANEOUS)
|
||||
#endif
|
||||
// Temporarily removing this test, as TLS library consumes too much memory
|
||||
// and we see frequent memory allocation failures on architectures with less
|
||||
// RAM such as DISCO_L475VG_IOT1A and NUCLEO_F207ZG (both have 128 kB RAM)
|
||||
// This test also fails for IAR, due to wrong heap configuration in the linker
|
||||
// script - see https://github.com/ARMmbed/mbed-os/issues/8306
|
||||
// Case("TLSSOCKET_SIMULTANEOUS", TLSSOCKET_SIMULTANEOUS)
|
||||
};
|
||||
|
||||
Specification specification(greentea_setup, cases, greentea_teardown, greentea_continue_handlers);
|
||||
|
|
|
@ -63,8 +63,8 @@ void TLSSOCKET_ECHOTEST()
|
|||
if (tlssocket_connect_to_echo_srv(*sock) != NSAPI_ERROR_OK) {
|
||||
printf("Error from tlssocket_connect_to_echo_srv\n");
|
||||
TEST_FAIL();
|
||||
return;
|
||||
delete sock;
|
||||
return;
|
||||
}
|
||||
|
||||
int recvd;
|
||||
|
|
|
@ -31,8 +31,8 @@ void TLSSOCKET_HANDSHAKE_INVALID()
|
|||
TLSSocket sock;
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.open(NetworkInterface::get_default_instance()));
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.set_root_ca_cert(tls_global::cert));
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_NO_CONNECTION,
|
||||
sock.connect("google.com", MBED_CONF_APP_ECHO_SERVER_DISCARD_PORT_TLS));
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_AUTH_FAILURE,
|
||||
sock.connect("google.com", 443)); // 443 is https port.
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
|
||||
}
|
||||
|
||||
|
|
|
@ -33,10 +33,26 @@
|
|||
|
||||
using namespace utest::v1;
|
||||
|
||||
namespace {
|
||||
Timer tc_bucket; // Timer to limit a test cases run time
|
||||
}
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
mbed_stats_socket_t udp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
||||
#endif
|
||||
|
||||
void drop_bad_packets(UDPSocket &sock, int orig_timeout)
|
||||
{
|
||||
nsapi_error_t err;
|
||||
sock.set_timeout(0);
|
||||
while (true) {
|
||||
err = sock.recv(NULL, 0);
|
||||
if (err == NSAPI_ERROR_WOULD_BLOCK) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
sock.set_timeout(orig_timeout);
|
||||
}
|
||||
static void _ifup()
|
||||
{
|
||||
NetworkInterface *net = NetworkInterface::get_default_instance();
|
||||
|
@ -51,17 +67,14 @@ static void _ifdown()
|
|||
printf("MBED: ifdown\n");
|
||||
}
|
||||
|
||||
void drop_bad_packets(UDPSocket &sock, int orig_timeout)
|
||||
|
||||
nsapi_version_t get_ip_version()
|
||||
{
|
||||
nsapi_error_t err;
|
||||
sock.set_timeout(0);
|
||||
while (true) {
|
||||
err = sock.recvfrom(NULL, 0, 0);
|
||||
if (err == NSAPI_ERROR_WOULD_BLOCK) {
|
||||
break;
|
||||
}
|
||||
SocketAddress test;
|
||||
if (!test.set_ip_address(NetworkInterface::get_default_instance()->get_ip_address())) {
|
||||
return NSAPI_UNSPEC;
|
||||
}
|
||||
sock.set_timeout(orig_timeout);
|
||||
return test.get_ip_version();
|
||||
}
|
||||
|
||||
void fill_tx_buffer_ascii(char *buff, size_t len)
|
||||
|
@ -71,6 +84,11 @@ void fill_tx_buffer_ascii(char *buff, size_t len)
|
|||
}
|
||||
}
|
||||
|
||||
int split2half_rmng_udp_test_time()
|
||||
{
|
||||
return (udp_global::TESTS_TIMEOUT - tc_bucket.read()) / 2;
|
||||
}
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
int fetch_stats()
|
||||
{
|
||||
|
@ -81,20 +99,20 @@ int fetch_stats()
|
|||
// Test setup
|
||||
utest::v1::status_t greentea_setup(const size_t number_of_cases)
|
||||
{
|
||||
GREENTEA_SETUP(480, "default_auto");
|
||||
GREENTEA_SETUP(udp_global::TESTS_TIMEOUT, "default_auto");
|
||||
_ifup();
|
||||
tc_bucket.start();
|
||||
return greentea_test_setup_handler(number_of_cases);
|
||||
}
|
||||
|
||||
void greentea_teardown(const size_t passed, const size_t failed, const failure_t failure)
|
||||
{
|
||||
tc_bucket.stop();
|
||||
_ifdown();
|
||||
return greentea_test_teardown_handler(passed, failed, failure);
|
||||
}
|
||||
|
||||
Case cases[] = {
|
||||
Case("UDPSOCKET_ECHOTEST", UDPSOCKET_ECHOTEST),
|
||||
Case("UDPSOCKET_ECHOTEST_NONBLOCK", UDPSOCKET_ECHOTEST_NONBLOCK),
|
||||
Case("UDPSOCKET_OPEN_CLOSE_REPEAT", UDPSOCKET_OPEN_CLOSE_REPEAT),
|
||||
Case("UDPSOCKET_OPEN_LIMIT", UDPSOCKET_OPEN_LIMIT),
|
||||
Case("UDPSOCKET_RECV_TIMEOUT", UDPSOCKET_RECV_TIMEOUT),
|
||||
|
@ -110,10 +128,11 @@ Case cases[] = {
|
|||
Case("UDPSOCKET_BIND_WRONG_TYPE", UDPSOCKET_BIND_WRONG_TYPE),
|
||||
Case("UDPSOCKET_BIND_UNOPENED", UDPSOCKET_BIND_UNOPENED),
|
||||
Case("UDPSOCKET_SENDTO_INVALID", UDPSOCKET_SENDTO_INVALID),
|
||||
Case("UDPSOCKET_ECHOTEST", UDPSOCKET_ECHOTEST),
|
||||
Case("UDPSOCKET_ECHOTEST_BURST", UDPSOCKET_ECHOTEST_BURST),
|
||||
Case("UDPSOCKET_ECHOTEST_NONBLOCK", UDPSOCKET_ECHOTEST_NONBLOCK),
|
||||
Case("UDPSOCKET_ECHOTEST_BURST_NONBLOCK", UDPSOCKET_ECHOTEST_BURST_NONBLOCK),
|
||||
Case("UDPSOCKET_SENDTO_REPEAT", UDPSOCKET_SENDTO_REPEAT),
|
||||
Case("UDPSOCKET_ECHOTEST", UDPSOCKET_ECHOTEST),
|
||||
Case("UDPSOCKET_ECHOTEST_BURST", UDPSOCKET_ECHOTEST_BURST),
|
||||
};
|
||||
|
||||
Specification specification(greentea_setup, cases, greentea_teardown, greentea_continue_handlers);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
NetworkInterface *get_interface();
|
||||
void drop_bad_packets(UDPSocket &sock, int orig_timeout);
|
||||
nsapi_version_t get_ip_version();
|
||||
void fill_tx_buffer_ascii(char *buff, size_t len);
|
||||
|
||||
#if MBED_CONF_NSAPI_SOCKET_STATS_ENABLE
|
||||
|
@ -27,6 +28,15 @@ extern mbed_stats_socket_t udp_stats[MBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT];
|
|||
int fetch_stats(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Single testcase might take only half of the remaining execution time
|
||||
*/
|
||||
int split2half_rmng_udp_test_time(); // [s]
|
||||
|
||||
namespace udp_global {
|
||||
static const int TESTS_TIMEOUT = 480;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test cases
|
||||
*/
|
||||
|
|
|
@ -38,7 +38,16 @@ void UDPSOCKET_BIND_ADDRESS_INVALID()
|
|||
TEST_FAIL();
|
||||
}
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
|
||||
nsapi_error_t bind_result = sock->bind("190.2.3.4", 1024);
|
||||
|
||||
nsapi_error_t bind_result = NSAPI_ERROR_OK;
|
||||
if (get_ip_version() == NSAPI_IPv4) {
|
||||
bind_result = sock->bind("190.2.3.4", 1024);
|
||||
} else if (get_ip_version() == NSAPI_IPv6) {
|
||||
bind_result = sock->bind("fe80::ff01", 1024);
|
||||
} else {
|
||||
TEST_FAIL_MESSAGE("This stack is neither IPv4 nor IPv6");
|
||||
}
|
||||
|
||||
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
|
||||
TEST_IGNORE_MESSAGE("bind() not supported");
|
||||
} else {
|
||||
|
|
|
@ -39,7 +39,14 @@ void UDPSOCKET_BIND_WRONG_TYPE()
|
|||
}
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock->open(NetworkInterface::get_default_instance()));
|
||||
char addr_bytes[16] = {0xfe, 0x80, 0xff, 0x1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
SocketAddress sockAddr = SocketAddress(addr_bytes, NSAPI_IPv4, 80);
|
||||
SocketAddress sockAddr;
|
||||
if (get_ip_version() == NSAPI_IPv4) {
|
||||
sockAddr = SocketAddress(addr_bytes, NSAPI_IPv4, 80);
|
||||
} else if (get_ip_version() == NSAPI_IPv6) {
|
||||
sockAddr = SocketAddress(addr_bytes, NSAPI_IPv6, 80);
|
||||
} else {
|
||||
TEST_FAIL_MESSAGE("This stack is neither IPv4 nor IPv6");
|
||||
}
|
||||
nsapi_error_t bind_result = sock->bind(sockAddr);
|
||||
if (bind_result == NSAPI_ERROR_UNSUPPORTED) {
|
||||
TEST_IGNORE_MESSAGE("bind() not supported");
|
||||
|
|
|
@ -45,6 +45,8 @@ static const int pkt_sizes[PKTS] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, \
|
|||
100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, \
|
||||
1100, 1200
|
||||
};
|
||||
Timer tc_exec_time;
|
||||
int time_allotted;
|
||||
}
|
||||
|
||||
static void _sigio_handler(osThreadId id)
|
||||
|
@ -106,6 +108,9 @@ void udpsocket_echotest_nonblock_receiver(void *receive_bytes)
|
|||
for (int retry_cnt = 0; retry_cnt <= RETRIES; retry_cnt++) {
|
||||
recvd = sock.recvfrom(NULL, rx_buffer, expt2recv);
|
||||
if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
|
||||
if (tc_exec_time.read() >= time_allotted) {
|
||||
break;
|
||||
}
|
||||
wait_ms(WAIT2RECV_TIMEOUT);
|
||||
--retry_cnt;
|
||||
continue;
|
||||
|
@ -118,7 +123,7 @@ void udpsocket_echotest_nonblock_receiver(void *receive_bytes)
|
|||
}
|
||||
}
|
||||
|
||||
drop_bad_packets(sock, -1); // timeout equivalent to set_blocking(false)
|
||||
drop_bad_packets(sock, 0); // timeout equivalent to set_blocking(false)
|
||||
|
||||
tx_sem.release();
|
||||
}
|
||||
|
@ -132,6 +137,8 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
|
|||
TEST_ASSERT_EQUAL(SOCK_CLOSED, udp_stats[j].state);
|
||||
}
|
||||
#endif
|
||||
tc_exec_time.start();
|
||||
time_allotted = split2half_rmng_udp_test_time(); // [s]
|
||||
|
||||
SocketAddress udp_addr;
|
||||
NetworkInterface::get_default_instance()->gethostbyname(MBED_CONF_APP_ECHO_SERVER_ADDR, &udp_addr);
|
||||
|
@ -166,7 +173,8 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
|
|||
packets_sent++;
|
||||
}
|
||||
if (sent == NSAPI_ERROR_WOULD_BLOCK) {
|
||||
if (osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT).status == osEventTimeout) {
|
||||
if (tc_exec_time.read() >= time_allotted ||
|
||||
osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT).status == osEventTimeout) {
|
||||
continue;
|
||||
}
|
||||
--retry_cnt;
|
||||
|
@ -209,4 +217,5 @@ void UDPSOCKET_ECHOTEST_NONBLOCK()
|
|||
#endif
|
||||
}
|
||||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, sock.close());
|
||||
tc_exec_time.stop();
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ void UDPSOCKET_RECV_TIMEOUT()
|
|||
if (recvd == NSAPI_ERROR_WOULD_BLOCK) {
|
||||
osSignalWait(SIGNAL_SIGIO, SIGIO_TIMEOUT);
|
||||
printf("MBED: recvfrom() took: %dms\n", timer.read_ms());
|
||||
TEST_ASSERT_INT_WITHIN(50, 150, timer.read_ms());
|
||||
TEST_ASSERT_INT_WITHIN(51, 150, timer.read_ms());
|
||||
continue;
|
||||
} else if (recvd < 0) {
|
||||
printf("[bt#%02d] network error %d\n", i, recvd);
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
!defined(TARGET_MTB_ADV_WISE_1530) && \
|
||||
!defined(TARGET_MTB_USI_WM_BN_BM_22) && \
|
||||
!defined(TARGET_MTB_MXCHIP_EMW3166) && \
|
||||
!defined(TARGET_MTB_UBLOX_ODIN_W2)
|
||||
!defined(TARGET_MTB_UBLOX_ODIN_W2) && \
|
||||
!defined(TARGET_UNO_91H)
|
||||
#error [NOT_SUPPORTED] Wifi tests are not valid for the target
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -137,8 +137,6 @@ void NETWORKINTERFACE_STATUS_NONBLOCK()
|
|||
|
||||
void NETWORKINTERFACE_STATUS_GET()
|
||||
{
|
||||
nsapi_connection_status_t status;
|
||||
|
||||
net = NetworkInterface::get_default_instance();
|
||||
net->set_blocking(true);
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ using namespace utest::v1;
|
|||
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||
{
|
||||
GREENTEA_SETUP(240, "default_auto");
|
||||
GREENTEA_SETUP(360, "default_auto");
|
||||
return verbose_test_setup_handler(number_of_cases);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2019, Arm Limited and affiliates.
|
||||
* 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 WIFI_TESTS_H
|
||||
#define WIFI_TESTS_H
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ target_include_directories(gmock_main SYSTEM BEFORE INTERFACE
|
|||
# TESTING
|
||||
####################
|
||||
|
||||
enable_testing()
|
||||
include(CTest)
|
||||
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
|
||||
"${CMAKE_BINARY_DIR}/Testing"
|
||||
|
|
|
@ -181,6 +181,10 @@ TEST_F(Test_LoRaPHYAU915, link_ADR_request)
|
|||
uint8_t nb_rep_out = 0;
|
||||
uint8_t nb_bytes_parsed = 0;
|
||||
|
||||
uint8_t payload [] = {SRV_MAC_LINK_ADR_REQ, 1, 2, 3, 4};
|
||||
params.payload = payload;
|
||||
params.payload_size = 5;
|
||||
|
||||
LoRaPHY_stub::uint8_value = 1;
|
||||
LoRaPHY_stub::ch_mask_value = 6;
|
||||
LoRaPHY_stub::adr_parse_count = 2;
|
||||
|
|
|
@ -206,6 +206,10 @@ TEST_F(Test_LoRaPHYCN470, link_ADR_request)
|
|||
uint8_t nb_rep_out = 0;
|
||||
uint8_t nb_bytes_parsed = 0;
|
||||
|
||||
uint8_t payload [] = {SRV_MAC_LINK_ADR_REQ, 1, 2, 3, 4};
|
||||
params.payload = payload;
|
||||
params.payload_size = 5;
|
||||
|
||||
LoRaPHY_stub::uint8_value = 1;
|
||||
LoRaPHY_stub::ch_mask_value = 6;
|
||||
LoRaPHY_stub::adr_parse_count = 2;
|
||||
|
|
|
@ -177,6 +177,7 @@ TEST_F(Test_LoRaPHYUS915, tx_config)
|
|||
|
||||
TEST_F(Test_LoRaPHYUS915, link_ADR_request)
|
||||
{
|
||||
uint8_t payload [] = {SRV_MAC_LINK_ADR_REQ, 1, 2, 3, 4};
|
||||
adr_req_params_t params;
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
int8_t dr_out = 0;
|
||||
|
@ -184,8 +185,14 @@ TEST_F(Test_LoRaPHYUS915, link_ADR_request)
|
|||
uint8_t nb_rep_out = 0;
|
||||
uint8_t nb_bytes_parsed = 0;
|
||||
|
||||
EXPECT_TRUE(0 == object->link_ADR_request(¶ms, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
|
||||
params.payload = payload;
|
||||
params.payload_size = 4;
|
||||
|
||||
uint8_t status = object->link_ADR_request(¶ms, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed);
|
||||
|
||||
EXPECT_TRUE(0 == nb_bytes_parsed);
|
||||
|
||||
params.payload_size = 5;
|
||||
LoRaPHY_stub::uint8_value = 1;
|
||||
LoRaPHY_stub::ch_mask_value = 6;
|
||||
LoRaPHY_stub::adr_parse_count = 2;
|
||||
|
|
|
@ -494,6 +494,10 @@ TEST_F(Test_LoRaWANStack, handle_rx)
|
|||
ind.buffer = ind_buf;
|
||||
ind.buffer_size = 150;
|
||||
ind.type = MCPS_UNCONFIRMED;
|
||||
ind.port = 15;
|
||||
ind.is_data_recvd = true;
|
||||
ind.fpending_status = false;
|
||||
LoRaMac_stub::dev_class_value = CLASS_A;
|
||||
radio._ev->rx_done(NULL, 0, 0, 0);
|
||||
|
||||
//data == NULL || LENGTH == 0 (2 cases)
|
||||
|
|
|
@ -151,9 +151,12 @@ lorawan_time_t LoRaPHY::update_band_timeoff(bool joined, bool duty_cycle,
|
|||
}
|
||||
|
||||
uint8_t LoRaPHY::parse_link_ADR_req(const uint8_t *payload,
|
||||
uint8_t payload_size,
|
||||
link_adr_params_t *params)
|
||||
{
|
||||
params->ch_mask_ctrl = LoRaPHY_stub::ch_mask_value;
|
||||
params->channel_mask = 0;
|
||||
params->datarate = 0;
|
||||
|
||||
if (LoRaPHY_stub::adr_parse_count) {
|
||||
return --LoRaPHY_stub::adr_parse_count;
|
||||
|
|
|
@ -1,23 +1,18 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2012 ARM Limited
|
||||
/*
|
||||
* Copyright (c) 2018-2019, Arm Limited and affiliates.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* 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
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
* 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 MBED_CMSIS_CONF_H
|
||||
#define MBED_CMSIS_CONF_H
|
||||
|
|
|
@ -47,6 +47,11 @@ void basic_erase_program_read_test(SPIFBlockDevice &block_device, bd_size_t bloc
|
|||
{
|
||||
int err = 0;
|
||||
_mutex->lock();
|
||||
|
||||
// Make sure block address per each test is unique
|
||||
static unsigned block_seed = 1;
|
||||
srand(block_seed++);
|
||||
|
||||
// Find a random block
|
||||
bd_addr_t block = (rand() * block_size) % block_device.size();
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ ESP8266Interface::ESP8266Interface()
|
|||
_if_blocking(true),
|
||||
_if_connected(_cmutex),
|
||||
_initialized(false),
|
||||
_connect_retval(NSAPI_ERROR_OK),
|
||||
_conn_stat(NSAPI_STATUS_DISCONNECTED),
|
||||
_conn_stat_cb(NULL),
|
||||
_global_event_queue(NULL),
|
||||
|
@ -187,8 +188,12 @@ void ESP8266Interface::_connect_async()
|
|||
_cmutex.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_esp.connect(ap_ssid, ap_pass) != NSAPI_ERROR_OK) {
|
||||
_connect_retval = _esp.connect(ap_ssid, ap_pass);
|
||||
if (_connect_retval == NSAPI_ERROR_OK || _connect_retval == NSAPI_ERROR_AUTH_FAILURE
|
||||
|| _connect_retval == NSAPI_ERROR_NO_SSID) {
|
||||
_connect_event_id = 0;
|
||||
_if_connected.notify_all();
|
||||
} else {
|
||||
// Postpone to give other stuff time to run
|
||||
_connect_event_id = _global_event_queue->call_in(ESP8266_CONNECT_TIMEOUT, callback(this, &ESP8266Interface::_connect_async));
|
||||
|
||||
|
@ -196,9 +201,6 @@ void ESP8266Interface::_connect_async()
|
|||
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_ENOMEM), \
|
||||
"_connect_async(): unable to add event to queue");
|
||||
}
|
||||
} else {
|
||||
_connect_event_id = 0;
|
||||
_if_connected.notify_all();
|
||||
}
|
||||
_cmutex.unlock();
|
||||
}
|
||||
|
@ -235,6 +237,7 @@ int ESP8266Interface::connect()
|
|||
|
||||
_cmutex.lock();
|
||||
|
||||
_connect_retval = NSAPI_ERROR_NO_CONNECTION;
|
||||
MBED_ASSERT(!_connect_event_id);
|
||||
_connect_event_id = _global_event_queue->call(callback(this, &ESP8266Interface::_connect_async));
|
||||
|
||||
|
@ -243,13 +246,18 @@ int ESP8266Interface::connect()
|
|||
"connect(): unable to add event to queue");
|
||||
}
|
||||
|
||||
while (_if_blocking && (_conn_status_to_error() != NSAPI_ERROR_IS_CONNECTED)) {
|
||||
while (_if_blocking && (_conn_status_to_error() != NSAPI_ERROR_IS_CONNECTED)
|
||||
&& (_connect_retval == NSAPI_ERROR_NO_CONNECTION)) {
|
||||
_if_connected.wait();
|
||||
}
|
||||
|
||||
_cmutex.unlock();
|
||||
|
||||
return NSAPI_ERROR_OK;
|
||||
if (!_if_blocking) {
|
||||
return NSAPI_ERROR_OK;
|
||||
} else {
|
||||
return _connect_retval;
|
||||
}
|
||||
}
|
||||
|
||||
int ESP8266Interface::set_credentials(const char *ssid, const char *pass, nsapi_security_t security)
|
||||
|
|
|
@ -368,6 +368,7 @@ private:
|
|||
bool _get_firmware_ok();
|
||||
nsapi_error_t _init(void);
|
||||
void _hw_reset();
|
||||
nsapi_error_t _connect_retval;
|
||||
|
||||
//sigio
|
||||
struct {
|
||||
|
|
|
@ -158,6 +158,7 @@ public:
|
|||
AdvertisingDataSimpleBuilder &setAdvertisingInterval(adv_interval_t interval)
|
||||
{
|
||||
MBED_ASSERT(_builder.setAdvertisingInterval(interval) == BLE_ERROR_NONE);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -294,7 +294,7 @@ ble_error_t GattServer::insert_characteristic_value_attribute(
|
|||
attribute_it->settings = ATTS_SET_READ_CBACK;
|
||||
}
|
||||
if (properties & WRITABLE_PROPERTIES) {
|
||||
attribute_it->settings = ATTS_SET_WRITE_CBACK;
|
||||
attribute_it->settings |= ATTS_SET_WRITE_CBACK;
|
||||
}
|
||||
if (value_attribute.getUUID().shortOrLong() == UUID::UUID_TYPE_LONG) {
|
||||
attribute_it->settings |= ATTS_SET_UUID_128;
|
||||
|
|
|
@ -75,11 +75,10 @@ public:
|
|||
|
||||
virtual void do_initialize()
|
||||
{
|
||||
|
||||
Cy_GPIO_Clr(BT_DEVICE_WAKE_PORT, BT_DEVICE_WAKE_PIN);
|
||||
bt_device_wake = 0;
|
||||
wait_ms(500);
|
||||
|
||||
Cy_GPIO_Set(BT_POWER_PORT, BT_POWER_PIN);
|
||||
bt_power = 1;
|
||||
wait_ms(500);
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,6 @@ static uint32_t signalEvent()
|
|||
|
||||
error_t btle_init(void)
|
||||
{
|
||||
nrf_clock_lf_cfg_t clockConfiguration;
|
||||
ret_code_t err_code;
|
||||
|
||||
// register softdevice handler vector
|
||||
|
@ -122,6 +121,7 @@ error_t btle_init(void)
|
|||
err_code = nrf_sdh_enable_request();
|
||||
ASSERT_STATUS(err_code);
|
||||
#else
|
||||
nrf_clock_lf_cfg_t clockConfiguration;
|
||||
// Configure the LF clock according to values provided by btle_clock.h.
|
||||
// It is input from the chain of the yotta configuration system.
|
||||
clockConfiguration.source = LFCLK_CONF_SOURCE;
|
||||
|
|
|
@ -107,15 +107,17 @@ nRF5xSecurityManager::~nRF5xSecurityManager()
|
|||
ble_error_t nRF5xSecurityManager::initialize()
|
||||
{
|
||||
#if defined(MBEDTLS_ECDH_C)
|
||||
if (_crypto.generate_keys(
|
||||
// Note: we do not use the object on the stack as the CryptoToolbox is quite large
|
||||
// Please do not change or we risk a stack overflow.
|
||||
CryptoToolbox* crypto = new CryptoToolbox();
|
||||
bool success = crypto->generate_keys(
|
||||
make_ArrayView(X),
|
||||
make_ArrayView(Y),
|
||||
make_ArrayView(secret)
|
||||
)) {
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
);
|
||||
delete crypto;
|
||||
|
||||
return BLE_ERROR_INTERNAL_STACK_FAILURE;
|
||||
return success ? BLE_ERROR_NONE : BLE_ERROR_INTERNAL_STACK_FAILURE;
|
||||
#endif
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
@ -943,12 +945,16 @@ bool nRF5xSecurityManager::sm_handler(const ble_evt_t *evt)
|
|||
static const size_t key_size = public_key_coord_t::size_;
|
||||
ble_gap_lesc_dhkey_t shared_secret;
|
||||
|
||||
_crypto.generate_shared_secret(
|
||||
// Allocated on the heap to reduce stack pressure.
|
||||
// Risk stack overflows if allocated on stack.
|
||||
CryptoToolbox* crypto = new CryptoToolbox();
|
||||
crypto->generate_shared_secret(
|
||||
make_const_ArrayView<key_size>(dhkey_request.p_pk_peer->pk),
|
||||
make_const_ArrayView<key_size>(dhkey_request.p_pk_peer->pk + key_size),
|
||||
make_const_ArrayView(secret),
|
||||
shared_secret.key
|
||||
);
|
||||
delete crypto;
|
||||
|
||||
sd_ble_gap_lesc_dhkey_reply(connection, &shared_secret);
|
||||
|
||||
|
|
|
@ -360,7 +360,6 @@ private:
|
|||
|
||||
pairing_control_block_t* _control_blocks;
|
||||
#if defined(MBEDTLS_ECDH_C)
|
||||
CryptoToolbox _crypto;
|
||||
ble::public_key_coord_t X;
|
||||
ble::public_key_coord_t Y;
|
||||
ble::public_key_coord_t secret;
|
||||
|
|
|
@ -198,15 +198,21 @@ nsapi_error_t AT_CellularStack::socket_bind(nsapi_socket_t handle, const SocketA
|
|||
}
|
||||
|
||||
if (addr) {
|
||||
socket->localAddress.set_addr(addr.get_addr());
|
||||
}
|
||||
|
||||
if (addr.get_port()) {
|
||||
socket->localAddress.set_port(addr.get_port());
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
_at.lock();
|
||||
|
||||
uint16_t port = addr.get_port();
|
||||
if (port != socket->localAddress.get_port()) {
|
||||
if (port && (get_socket_index_by_port(port) == -1)) {
|
||||
socket->localAddress.set_port(port);
|
||||
} else {
|
||||
_at.unlock();
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
if (!socket->created) {
|
||||
create_socket_impl(socket);
|
||||
}
|
||||
|
@ -340,3 +346,14 @@ void AT_CellularStack::socket_attach(nsapi_socket_t handle, void (*callback)(voi
|
|||
socket->_cb = callback;
|
||||
socket->_data = data;
|
||||
}
|
||||
|
||||
int AT_CellularStack::get_socket_index_by_port(uint16_t port)
|
||||
{
|
||||
int max_socket_count = get_max_socket_count();
|
||||
for (int i = 0; i < max_socket_count; i++) {
|
||||
if (_socket[i]->localAddress.get_port() == port) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -184,6 +184,8 @@ protected:
|
|||
private:
|
||||
int find_socket_index(nsapi_socket_t handle);
|
||||
|
||||
int get_socket_index_by_port(uint16_t port);
|
||||
|
||||
// mutex for write/read to a _socket array, needed when multiple threads may open sockets simultaneously
|
||||
PlatformMutex _socket_mutex;
|
||||
};
|
||||
|
|
|
@ -62,6 +62,10 @@ nsapi_error_t QUECTEL_BG96_CellularStack::socket_connect(nsapi_socket_t handle,
|
|||
handle_open_socket_response(modem_connect_id, err);
|
||||
|
||||
if ((_at.get_last_error() == NSAPI_ERROR_OK) && err) {
|
||||
if (err == BG96_SOCKET_BIND_FAIL) {
|
||||
socket->created = false;
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
_at.cmd_start("AT+QICLOSE=");
|
||||
_at.write_int(modem_connect_id);
|
||||
_at.cmd_stop();
|
||||
|
@ -178,6 +182,10 @@ nsapi_error_t QUECTEL_BG96_CellularStack::create_socket_impl(CellularSocket *soc
|
|||
handle_open_socket_response(modem_connect_id, err);
|
||||
|
||||
if ((_at.get_last_error() == NSAPI_ERROR_OK) && err) {
|
||||
if (err == BG96_SOCKET_BIND_FAIL) {
|
||||
socket->created = false;
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
_at.cmd_start("AT+QICLOSE=");
|
||||
_at.write_int(modem_connect_id);
|
||||
_at.cmd_stop_read_resp();
|
||||
|
@ -206,6 +214,10 @@ nsapi_error_t QUECTEL_BG96_CellularStack::create_socket_impl(CellularSocket *soc
|
|||
handle_open_socket_response(modem_connect_id, err);
|
||||
|
||||
if ((_at.get_last_error() == NSAPI_ERROR_OK) && err) {
|
||||
if (err == BG96_SOCKET_BIND_FAIL) {
|
||||
socket->created = false;
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
_at.cmd_start("AT+QICLOSE=");
|
||||
_at.write_int(modem_connect_id);
|
||||
_at.cmd_stop_read_resp();
|
||||
|
@ -239,6 +251,14 @@ nsapi_error_t QUECTEL_BG96_CellularStack::create_socket_impl(CellularSocket *soc
|
|||
nsapi_size_or_error_t QUECTEL_BG96_CellularStack::socket_sendto_impl(CellularSocket *socket, const SocketAddress &address,
|
||||
const void *data, nsapi_size_t size)
|
||||
{
|
||||
if (size > BG96_MAX_SEND_SIZE) {
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
|
||||
if (!size && socket->proto == NSAPI_UDP) {
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int sent_len = 0;
|
||||
int sent_len_before = 0;
|
||||
int sent_len_after = 0;
|
||||
|
@ -296,6 +316,11 @@ nsapi_size_or_error_t QUECTEL_BG96_CellularStack::socket_recvfrom_impl(CellularS
|
|||
|
||||
_at.cmd_start("AT+QIRD=");
|
||||
_at.write_int(socket->id);
|
||||
if (socket->proto == NSAPI_TCP) {
|
||||
// do not read more than max size
|
||||
size = size > BG96_MAX_RECV_SIZE ? BG96_MAX_RECV_SIZE : size;
|
||||
_at.write_int(size);
|
||||
}
|
||||
_at.cmd_stop();
|
||||
|
||||
_at.resp_start("+QIRD:");
|
||||
|
@ -303,11 +328,15 @@ nsapi_size_or_error_t QUECTEL_BG96_CellularStack::socket_recvfrom_impl(CellularS
|
|||
_at.read_string(ip_address, sizeof(ip_address));
|
||||
port = _at.read_int();
|
||||
if (recv_len > 0) {
|
||||
// do not read more than buffer size
|
||||
recv_len = recv_len > size ? size : recv_len;
|
||||
_at.read_bytes((uint8_t *)buffer, recv_len);
|
||||
}
|
||||
_at.resp_stop();
|
||||
|
||||
if (!recv_len || (_at.get_last_error() != NSAPI_ERROR_OK)) {
|
||||
// We block only if 0 recv length really means no data.
|
||||
// If 0 is followed by ip address and port can be an UDP 0 length packet
|
||||
if (!recv_len && port < 0) {
|
||||
return NSAPI_ERROR_WOULD_BLOCK;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,9 @@ namespace mbed {
|
|||
#define BG96_SOCKET_MAX 12
|
||||
#define BG96_CREATE_SOCKET_TIMEOUT 150000 //150 seconds
|
||||
#define BG96_CLOSE_SOCKET_TIMEOUT 20000 // TCP socket max timeout is >10sec
|
||||
#define BG96_MAX_RECV_SIZE 1500
|
||||
#define BG96_MAX_SEND_SIZE 1460
|
||||
#define BG96_SOCKET_BIND_FAIL 556
|
||||
|
||||
class QUECTEL_BG96_CellularStack : public AT_CellularStack {
|
||||
public:
|
||||
|
|
|
@ -361,10 +361,10 @@ nsapi_size_or_error_t QUECTEL_M26_CellularStack::socket_sendto_impl(CellularSock
|
|||
const void *data, nsapi_size_t size)
|
||||
{
|
||||
int sent_len = (size > M26_SENT_BYTE_MAX) ? M26_SENT_BYTE_MAX : size;
|
||||
int sent_acked = 0;
|
||||
int sent_nacked = 0;
|
||||
int sent_len_before = 0;
|
||||
int sent_len_after = 0;
|
||||
int sent_acked;
|
||||
nsapi_error_t error;
|
||||
|
||||
tr_debug("QUECTEL_M26_CellularStack:%s:%u:[%d-%d]", __FUNCTION__, __LINE__, sent_len, size);
|
||||
|
|
|
@ -38,6 +38,8 @@ AT_CellularNetwork::RegistrationMode UBLOX_AT_CellularNetwork::has_registration(
|
|||
|
||||
nsapi_error_t UBLOX_AT_CellularNetwork::set_access_technology_impl(RadioAccessTechnology opRat)
|
||||
{
|
||||
nsapi_error_t ret = NSAPI_ERROR_OK;
|
||||
|
||||
switch (opRat) {
|
||||
#if defined(TARGET_UBLOX_C030_U201) || defined(TARGET_UBLOX_C027)
|
||||
case RAT_GSM:
|
||||
|
@ -63,9 +65,9 @@ nsapi_error_t UBLOX_AT_CellularNetwork::set_access_technology_impl(RadioAccessTe
|
|||
#endif
|
||||
default: {
|
||||
_op_act = RAT_UNKNOWN;
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
ret = NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
return NSAPI_ERROR_OK;
|
||||
return(ret);
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
# need unity.h:
|
||||
unittest/*
|
||||
test/*
|
||||
doxygen/*
|
||||
|
|
@ -1,5 +1,15 @@
|
|||
# Change Log
|
||||
|
||||
## [v4.7.4](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.7.4)
|
||||
|
||||
- Remove dependency to yotta tool
|
||||
- Do not remove stored (GET) blockwise message when EMPTY ACK received
|
||||
When non piggybacked response mode is used original GET request must not be removed from the stored message list.
|
||||
Message is needed for building the next (GET) blockwise message.
|
||||
- Move definitions to sn_config.h
|
||||
|
||||
-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.7.3...v4.7.4)
|
||||
|
||||
## [v4.7.3](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.7.3)
|
||||
|
||||
- Do not store EMPTY response to blockwise list
|
||||
|
|
|
@ -11,6 +11,28 @@ TESTDIRS := $(UNITTESTS:%=build-%)
|
|||
CLEANTESTDIRS := $(UNITTESTS:%=clean-%)
|
||||
COVERAGEFILE := ./lcov/coverage.info
|
||||
|
||||
TEST_MODULES = ./test_modules
|
||||
TEST_MODULE_MBED_TRACE = $(TEST_MODULES)/mbed-trace
|
||||
TEST_MODULE_NANOSTACK = $(TEST_MODULES)/nanostack-libservice
|
||||
TEST_MODULE_RANDLIB = $(TEST_MODULES)/mbed-client-randlib
|
||||
|
||||
.PHONY: clone
|
||||
clone:
|
||||
if [ ! -d $(TEST_MODULES) ]; \
|
||||
then mkdir $(TEST_MODULES); \
|
||||
fi;
|
||||
|
||||
if [ ! -d $(TEST_MODULE_MBED_TRACE) ]; \
|
||||
then git clone --depth 1 git@github.com:ARMmbed/mbed-trace.git $(TEST_MODULE_MBED_TRACE); \
|
||||
fi;
|
||||
|
||||
if [ ! -d $(TEST_MODULE_NANOSTACK) ]; \
|
||||
then git clone --depth 1 git@github.com:ARMmbed/nanostack-libservice.git $(TEST_MODULE_NANOSTACK); \
|
||||
fi;
|
||||
|
||||
if [ ! -d $(TEST_MODULE_RANDLIB) ]; \
|
||||
then git clone --depth 1 git@github.com:ARMmbed/mbed-client-randlib.git $(TEST_MODULE_RANDLIB); \
|
||||
fi;
|
||||
.PHONY: test
|
||||
test: $(TESTDIRS)
|
||||
@rm -rf ./lcov
|
||||
|
@ -27,7 +49,7 @@ test: $(TESTDIRS)
|
|||
@rm -f lcov/index.xml
|
||||
@find ./ -name '*.gcno' | xargs cp --backup=numbered -t ./coverage/
|
||||
@find ./ -name '*.gcda' | xargs cp --backup=numbered -t ./coverage/
|
||||
@gcovr --object-directory ./coverage --exclude-unreachable-branches -e '.*/builds/.*' -e '.*/test/.*' -e '.*/yotta_modules/.*' -e '.*/stubs/.*' -e '.*/mbed-coap/.*' -x -o ./lcov/gcovr.xml
|
||||
@gcovr --object-directory ./coverage --exclude-unreachable-branches -e '.*/builds/.*' -e '.*/test/.*' -e '.*/stubs/.*' -e '.*/mbed-coap/.*' -x -o ./lcov/gcovr.xml
|
||||
@lcov -d test/. -c -o $(COVERAGEFILE)
|
||||
@lcov -q -r $(COVERAGEFILE) "/usr*" -o $(COVERAGEFILE)
|
||||
@lcov -q -r $(COVERAGEFILE) "/test*" -o $(COVERAGEFILE)
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
#ifndef SN_CONFIG_H
|
||||
#define SN_CONFIG_H
|
||||
|
||||
#ifdef MBED_CLIENT_USER_CONFIG_FILE
|
||||
#include MBED_CLIENT_USER_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Configuration options (set of defines and values)
|
||||
*
|
||||
|
@ -30,9 +34,15 @@
|
|||
* \brief For Message duplication detection
|
||||
* Init value for the maximum count of messages to be stored for duplication detection
|
||||
* Setting of this value to 0 will disable duplication check, also reduce use of ROM memory
|
||||
* Default is set to 1.
|
||||
* Default is set to 0.
|
||||
*/
|
||||
#undef SN_COAP_DUPLICATION_MAX_MSGS_COUNT /* 1 */
|
||||
#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_DUPLICATION_MAX_MSGS_COUNT
|
||||
#define SN_COAP_DUPLICATION_MAX_MSGS_COUNT MBED_CONF_MBED_CLIENT_SN_COAP_DUPLICATION_MAX_MSGS_COUNT
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_DUPLICATION_MAX_MSGS_COUNT
|
||||
#define SN_COAP_DUPLICATION_MAX_MSGS_COUNT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
||||
|
@ -42,7 +52,13 @@
|
|||
* also reduce use of ROM memory.
|
||||
* Note: This define is common for both received and sent Blockwise messages
|
||||
*/
|
||||
#undef SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE /* 0 */ // < Must be 2^x and x is at least 4. Suitable values: 0, 16, 32, 64, 128, 256, 512 and 1024
|
||||
#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
||||
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE MBED_CONF_MBED_CLIENT_SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
||||
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE 0 /**< Must be 2^x and x is at least 4. Suitable values: 0, 16, 32, 64, 128, 256, 512 and 1024 */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_DISABLE_RESENDINGS
|
||||
|
@ -50,21 +66,33 @@
|
|||
* when using CoAP with TCP transport for example. By default resendings are
|
||||
* enabled. Set to 1 to disable.
|
||||
*/
|
||||
#undef SN_COAP_DISABLE_RESENDINGS /* 0 */ // < Default re-sending are not disabled. Set to 1 to disable re-sendings
|
||||
#ifdef SN_COAP_DISABLE_RESENDINGS
|
||||
#define ENABLE_RESENDINGS 0 /** Disable resendings **/
|
||||
#else
|
||||
#define ENABLE_RESENDINGS 1 /**< Enable / Disable resending from library in building */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_RESENDING_QUEUE_SIZE_MSGS
|
||||
* \brief Sets the number of messages stored
|
||||
* in the resending queue. Default is 2
|
||||
*/
|
||||
#undef SN_COAP_RESENDING_QUEUE_SIZE_MSGS /* 2 */ // < Default re-sending queue size - defines how many messages can be stored. Setting this to 0 disables feature
|
||||
#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_MSGS
|
||||
#define SN_COAP_RESENDING_QUEUE_SIZE_MSGS MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_MSGS
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_RESENDING_QUEUE_SIZE_MSGS
|
||||
#define SN_COAP_RESENDING_QUEUE_SIZE_MSGS 2 /**< Default re-sending queue size - defines how many messages can be stored. Setting this to 0 disables feature */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def DEFAULT_RESPONSE_TIMEOUT
|
||||
* \brief Sets the CoAP re-send interval in seconds.
|
||||
* By default is 10 seconds.
|
||||
*/
|
||||
#undef DEFAULT_RESPONSE_TIMEOUT
|
||||
#ifndef DEFAULT_RESPONSE_TIMEOUT
|
||||
#define DEFAULT_RESPONSE_TIMEOUT 10 /**< Default re-sending timeout as seconds */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_RESENDING_QUEUE_SIZE_BYTES
|
||||
|
@ -72,7 +100,13 @@
|
|||
* Setting this to 0 disables this feature.
|
||||
* By default, this feature is disabled.
|
||||
*/
|
||||
#undef SN_COAP_RESENDING_QUEUE_SIZE_BYTES /* 0 */ // Default re-sending queue size - defines size of the re-sending buffer. Setting this to 0 disables feature
|
||||
#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_BYTES
|
||||
#define SN_COAP_RESENDING_QUEUE_SIZE_BYTES MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_BYTES
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_RESENDING_QUEUE_SIZE_BYTES
|
||||
#define SN_COAP_RESENDING_QUEUE_SIZE_BYTES 0 /**< Default re-sending queue size - defines size of the re-sending buffer. Setting this to 0 disables feature */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_MAX_INCOMING_MESSAGE_SIZE
|
||||
|
@ -83,7 +117,9 @@
|
|||
* available storage capability.
|
||||
* By default, maximum size is UINT16_MAX, 65535 bytes.
|
||||
*/
|
||||
#undef SN_COAP_MAX_INCOMING_MESSAGE_SIZE /* UINT16_MAX */
|
||||
#ifndef SN_COAP_MAX_INCOMING_MESSAGE_SIZE
|
||||
#define SN_COAP_MAX_INCOMING_MESSAGE_SIZE UINT16_MAX
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
|
||||
|
@ -98,21 +134,27 @@
|
|||
* Note that value should be less than transport layer maximum fragment size.
|
||||
* Note that value has no effect if blockwise transfer is disabled.
|
||||
*/
|
||||
#undef SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE /* 0 */
|
||||
#ifndef SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
|
||||
#define SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_BLOCKWISE_ENABLED
|
||||
* \brief Enables the blockwise functionality in CoAP library also when blockwise payload
|
||||
* size is set to '0' in SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE.
|
||||
*/
|
||||
#undef SN_COAP_BLOCKWISE_ENABLED /* 0 */
|
||||
#ifndef SN_COAP_BLOCKWISE_ENABLED
|
||||
#define SN_COAP_BLOCKWISE_ENABLED 0 /**< Enable blockwise */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_RESENDING_MAX_COUNT
|
||||
* \brief Defines how many times CoAP library tries to re-send the CoAP packet.
|
||||
* By default value is 3.
|
||||
*/
|
||||
#undef SN_COAP_RESENDING_MAX_COUNT /* 3 */
|
||||
#ifndef SN_COAP_RESENDING_MAX_COUNT
|
||||
#define SN_COAP_RESENDING_MAX_COUNT 3
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_MAX_ALLOWED_RESENDING_COUNT
|
||||
|
@ -120,7 +162,9 @@
|
|||
* 'sn_coap_protocol_set_retransmission_parameters()' API.
|
||||
* By default value is 6.
|
||||
*/
|
||||
#undef SN_COAP_MAX_ALLOWED_RESENDING_COUNT /* 6 */
|
||||
#ifndef SN_COAP_MAX_ALLOWED_RESENDING_COUNT
|
||||
#define SN_COAP_MAX_ALLOWED_RESENDING_COUNT 6 /**< Maximum allowed count of re-sending */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT
|
||||
|
@ -128,7 +172,9 @@
|
|||
* 'sn_coap_protocol_set_retransmission_parameters()' API.
|
||||
* By default value is 40.
|
||||
*/
|
||||
#undef SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT /* 40 */
|
||||
#ifndef SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT
|
||||
#define SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT 40 /**< Maximum allowed re-sending timeout */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_MSGS
|
||||
|
@ -136,7 +182,9 @@
|
|||
* 'sn_coap_protocol_set_retransmission_buffer()' API.
|
||||
* By default value is 6.
|
||||
*/
|
||||
#undef SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_MSGS /* 6 */
|
||||
#ifndef SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_MSGS
|
||||
#define SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_MSGS 6 /**< Maximum allowed number of saved re-sending messages */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES
|
||||
|
@ -144,7 +192,9 @@
|
|||
* 'sn_coap_protocol_set_retransmission_buffer()' API.
|
||||
* By default value is 512.
|
||||
*/
|
||||
#undef SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES /* 512 */
|
||||
#ifndef SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES
|
||||
#define SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES 512 /**< Maximum allowed size of re-sending buffer */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_MAX_ALLOWED_DUPLICATION_MESSAGE_COUNT
|
||||
|
@ -152,14 +202,18 @@
|
|||
* that can be set via 'sn_coap_protocol_set_duplicate_buffer_size' API.
|
||||
* By default value is 6.
|
||||
*/
|
||||
#undef SN_COAP_MAX_ALLOWED_DUPLICATION_MESSAGE_COUNT
|
||||
#ifndef SN_COAP_MAX_ALLOWED_DUPLICATION_MESSAGE_COUNT
|
||||
#define SN_COAP_MAX_ALLOWED_DUPLICATION_MESSAGE_COUNT 6
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED
|
||||
* \brief Maximum time in seconds howe long message is kept for duplicate detection.
|
||||
* By default 60 seconds.
|
||||
*/
|
||||
#undef SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED
|
||||
#ifndef SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED
|
||||
#define SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED 60 /** RESPONSE_TIMEOUT * RESPONSE_RANDOM_FACTOR * (2 ^ MAX_RETRANSMIT - 1) + the expected maximum round trip time **/
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
|
||||
|
@ -167,17 +221,25 @@
|
|||
* Longer time will increase the memory consumption in lossy networks.
|
||||
* By default 60 seconds.
|
||||
*/
|
||||
#undef SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
|
||||
#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
|
||||
#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
|
||||
#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED 60 /**< Maximum time in seconds of data (messages and payload) to be stored for blockwising */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
|
||||
* \brief Maximum size of blockwise message that can be received.
|
||||
* By default 65535 bytes.
|
||||
*/
|
||||
#undef SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
|
||||
#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_MAX_INCOMING_MESSAGE_SIZE
|
||||
#define SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE MBED_CONF_MBED_CLIENT_SN_COAP_MAX_INCOMING_MESSAGE_SIZE
|
||||
#endif
|
||||
|
||||
#ifdef MBED_CLIENT_USER_CONFIG_FILE
|
||||
#include MBED_CLIENT_USER_CONFIG_FILE
|
||||
#ifndef SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
|
||||
#define SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE UINT16_MAX
|
||||
#endif
|
||||
|
||||
#endif // SN_CONFIG_H
|
||||
|
|
|
@ -17,7 +17,6 @@ echo
|
|||
echo "Build mbed-coap C unit tests"
|
||||
echo
|
||||
|
||||
yt target x86-linux-native
|
||||
yt up
|
||||
make -f Makefile.test clone
|
||||
make -f Makefile.test test
|
||||
#make -f Makefile.test test clean
|
||||
|
|
|
@ -34,118 +34,13 @@ extern "C" {
|
|||
|
||||
struct sn_coap_hdr_;
|
||||
|
||||
/* * * * * * * * * * * */
|
||||
/* * * * DEFINES * * * */
|
||||
/* * * * * * * * * * * */
|
||||
|
||||
/* * For Message resending * */
|
||||
#ifdef SN_COAP_DISABLE_RESENDINGS
|
||||
#define ENABLE_RESENDINGS 0 /* Disable resendings */
|
||||
#else
|
||||
#define ENABLE_RESENDINGS 1 /**< Enable / Disable resending from library in building */
|
||||
#endif
|
||||
|
||||
#define SN_COAP_RESENDING_MAX_COUNT 3 /**< Default number of re-sendings */
|
||||
|
||||
#ifdef YOTTA_CFG_COAP_RESENDING_QUEUE_SIZE_MSGS
|
||||
#define SN_COAP_RESENDING_QUEUE_SIZE_MSGS YOTTA_CFG_COAP_RESENDING_QUEUE_SIZE_MSGS
|
||||
#elif defined MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_MSGS
|
||||
#define SN_COAP_RESENDING_QUEUE_SIZE_MSGS MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_MSGS
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_RESENDING_QUEUE_SIZE_MSGS
|
||||
#define SN_COAP_RESENDING_QUEUE_SIZE_MSGS 2 /**< Default re-sending queue size - defines how many messages can be stored. Setting this to 0 disables feature */
|
||||
#endif
|
||||
|
||||
#ifdef YOTTA_CFG_COAP_RESENDING_QUEUE_SIZE_BYTES
|
||||
#define SN_COAP_RESENDING_QUEUE_SIZE_BYTES YOTTA_CFG_COAP_RESENDING_QUEUE_SIZE_BYTES
|
||||
#elif defined MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_BYTES
|
||||
#define SN_COAP_RESENDING_QUEUE_SIZE_BYTES MBED_CONF_MBED_CLIENT_SN_COAP_RESENDING_QUEUE_SIZE_BYTES
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_RESENDING_QUEUE_SIZE_BYTES
|
||||
#define SN_COAP_RESENDING_QUEUE_SIZE_BYTES 0 /**< Default re-sending queue size - defines size of the re-sending buffer. Setting this to 0 disables feature */
|
||||
#endif
|
||||
|
||||
#define DEFAULT_RESPONSE_TIMEOUT 10 /**< Default re-sending timeout as seconds */
|
||||
|
||||
/* These parameters sets maximum values application can set with API */
|
||||
#define SN_COAP_MAX_ALLOWED_RESENDING_COUNT 6 /**< Maximum allowed count of re-sending */
|
||||
#define SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_MSGS 6 /**< Maximum allowed number of saved re-sending messages */
|
||||
#define SN_COAP_MAX_ALLOWED_RESENDING_BUFF_SIZE_BYTES 512 /**< Maximum allowed size of re-sending buffer */
|
||||
#define SN_COAP_MAX_ALLOWED_RESPONSE_TIMEOUT 40 /**< Maximum allowed re-sending timeout */
|
||||
|
||||
#define RESPONSE_RANDOM_FACTOR 1.5 /**< Resending random factor, value is specified in IETF CoAP specification */
|
||||
|
||||
/* * For Message duplication detecting * */
|
||||
|
||||
/* Init value for the maximum count of messages to be stored for duplication detection */
|
||||
/* Setting of this value to 0 will disable duplication check, also reduce use of ROM memory */
|
||||
#ifdef YOTTA_CFG_COAP_DUPLICATION_MAX_MSGS_COUNT
|
||||
#define SN_COAP_DUPLICATION_MAX_MSGS_COUNT YOTTA_CFG_COAP_DUPLICATION_MAX_MSGS_COUNT
|
||||
#elif defined MBED_CONF_MBED_CLIENT_SN_COAP_DUPLICATION_MAX_MSGS_COUNT
|
||||
#define SN_COAP_DUPLICATION_MAX_MSGS_COUNT MBED_CONF_MBED_CLIENT_SN_COAP_DUPLICATION_MAX_MSGS_COUNT
|
||||
#endif
|
||||
|
||||
// Keep the old flag to maintain backward compatibility
|
||||
#ifndef SN_COAP_DUPLICATION_MAX_MSGS_COUNT
|
||||
#define SN_COAP_DUPLICATION_MAX_MSGS_COUNT 0
|
||||
#endif
|
||||
|
||||
/* Maximum allowed number of saved messages for duplicate searching */
|
||||
#define SN_COAP_MAX_ALLOWED_DUPLICATION_MESSAGE_COUNT 6
|
||||
|
||||
/* Maximum time in seconds of messages to be stored for duplication detection */
|
||||
#define SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED 60 /* RESPONSE_TIMEOUT * RESPONSE_RANDOM_FACTOR * (2 ^ MAX_RETRANSMIT - 1) + the expected maximum round trip time */
|
||||
|
||||
/* * For Message blockwising * */
|
||||
|
||||
/* Init value for the maximum payload size to be sent and received at one blockwise message */
|
||||
/* Setting of this value to 0 will disable this feature, and also reduce use of ROM memory */
|
||||
/* Note: This define is common for both received and sent Blockwise messages */
|
||||
|
||||
#ifdef YOTTA_CFG_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
||||
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE YOTTA_CFG_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
||||
#elif defined MBED_CONF_MBED_CLIENT_SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
||||
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE MBED_CONF_MBED_CLIENT_SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_BLOCKWISE_ENABLED
|
||||
#define SN_COAP_BLOCKWISE_ENABLED 0 /**< Enable blockwise */
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
||||
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE 0 /**< Must be 2^x and x is at least 4. Suitable values: 0, 16, 32, 64, 128, 256, 512 and 1024 */
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
|
||||
#define SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE 0
|
||||
#endif
|
||||
|
||||
#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
|
||||
#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
|
||||
#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED 60 /**< Maximum time in seconds of data (messages and payload) to be stored for blockwising */
|
||||
#endif
|
||||
|
||||
#ifdef YOTTA_CFG_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
|
||||
#define SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE YOTTA_CFG_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
|
||||
#elif defined MBED_CONF_MBED_CLIENT_SN_COAP_MAX_INCOMING_MESSAGE_SIZE
|
||||
#define SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE MBED_CONF_MBED_CLIENT_SN_COAP_MAX_INCOMING_MESSAGE_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
|
||||
#define SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE UINT16_MAX
|
||||
#endif
|
||||
#define RESPONSE_RANDOM_FACTOR 1.5 /**< Resending random factor, value is specified in IETF CoAP specification */
|
||||
|
||||
/* * For Option handling * */
|
||||
#define COAP_OPTION_MAX_AGE_DEFAULT 60 /**< Default value of Max-Age if option not present */
|
||||
#define COAP_OPTION_URI_PORT_NONE (-1) /**< Internal value to represent no Uri-Port option */
|
||||
#define COAP_OPTION_BLOCK_NONE (-1) /**< Internal value to represent no Block1/2 option */
|
||||
|
||||
|
||||
int8_t prepare_blockwise_message(struct coap_s *handle, struct sn_coap_hdr_ *coap_hdr_ptr);
|
||||
|
||||
/* Structure which is stored to Linked list for message sending purposes */
|
||||
|
|
|
@ -738,7 +738,10 @@ sn_coap_hdr_s *sn_coap_protocol_parse(struct coap_s *handle, sn_nsdl_addr_s *src
|
|||
(returned_dst_coap_msg_ptr->options_list_ptr->block1 != COAP_OPTION_BLOCK_NONE ||
|
||||
returned_dst_coap_msg_ptr->options_list_ptr->block2 != COAP_OPTION_BLOCK_NONE)) {
|
||||
returned_dst_coap_msg_ptr = sn_coap_handle_blockwise_message(handle, src_addr_ptr, returned_dst_coap_msg_ptr, param);
|
||||
} else {
|
||||
} else if (returned_dst_coap_msg_ptr->msg_code != COAP_MSG_CODE_EMPTY) {
|
||||
// Do not clean stored blockwise message when empty ack is received.
|
||||
// Stored message is mandatory when building a next (GET) blockwise message.
|
||||
// This will happen when non piggybacked response mode is selected.
|
||||
/* Get ... */
|
||||
coap_blockwise_msg_s *stored_blockwise_msg_temp_ptr = NULL;
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, ui
|
|||
int8_t link_adr_dr = DR_0;
|
||||
int8_t link_adr_txpower = TX_POWER_0;
|
||||
uint8_t link_adr_nbtrans = 0;
|
||||
uint8_t link_adr_nb_bytes_pasred = 0;
|
||||
uint8_t link_adr_nb_bytes_parsed = 0;
|
||||
|
||||
// Fill parameter structure
|
||||
link_adr_req.payload = &payload[mac_index - 1];
|
||||
|
@ -165,7 +165,14 @@ lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, ui
|
|||
&link_adr_dr,
|
||||
&link_adr_txpower,
|
||||
&link_adr_nbtrans,
|
||||
&link_adr_nb_bytes_pasred);
|
||||
&link_adr_nb_bytes_parsed);
|
||||
|
||||
// If nothing was consumed, we have a malformed packet at our hand
|
||||
// we bin everything and return. link_adr_nb_bytes_parsed being 0 is
|
||||
// a magic identifier letting us know that there are payload inconsistencies
|
||||
if (link_adr_nb_bytes_parsed == 0) {
|
||||
return LORAWAN_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if ((status & 0x07) == 0x07) {
|
||||
mac_sys_params.channel_data_rate = link_adr_dr;
|
||||
|
@ -174,11 +181,11 @@ lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, ui
|
|||
}
|
||||
|
||||
// Add the answers to the buffer
|
||||
for (uint8_t i = 0; i < (link_adr_nb_bytes_pasred / 5); i++) {
|
||||
for (uint8_t i = 0; i < (link_adr_nb_bytes_parsed / 5); i++) {
|
||||
ret_value = add_link_adr_ans(status);
|
||||
}
|
||||
// Update MAC index
|
||||
mac_index += link_adr_nb_bytes_pasred - 1;
|
||||
mac_index += link_adr_nb_bytes_parsed - 1;
|
||||
}
|
||||
break;
|
||||
case SRV_MAC_DUTY_CYCLE_REQ:
|
||||
|
|
|
@ -309,11 +309,12 @@ lorawan_time_t LoRaPHY::update_band_timeoff(bool joined, bool duty_cycle,
|
|||
}
|
||||
|
||||
uint8_t LoRaPHY::parse_link_ADR_req(const uint8_t *payload,
|
||||
uint8_t payload_size,
|
||||
link_adr_params_t *params)
|
||||
{
|
||||
uint8_t ret_index = 0;
|
||||
|
||||
if (payload[0] == SRV_MAC_LINK_ADR_REQ) {
|
||||
if (payload_size >= 5) {
|
||||
|
||||
// Parse datarate and tx power
|
||||
params->datarate = payload[1];
|
||||
|
@ -973,13 +974,17 @@ uint8_t LoRaPHY::link_ADR_request(adr_req_params_t *link_adr_req,
|
|||
|
||||
verify_adr_params_t verify_params;
|
||||
|
||||
while (bytes_processed < link_adr_req->payload_size) {
|
||||
while (bytes_processed < link_adr_req->payload_size &&
|
||||
link_adr_req->payload[bytes_processed] == SRV_MAC_LINK_ADR_REQ) {
|
||||
// Get ADR request parameters
|
||||
next_index = parse_link_ADR_req(&(link_adr_req->payload[bytes_processed]),
|
||||
link_adr_req->payload_size - bytes_processed,
|
||||
&adr_settings);
|
||||
|
||||
if (next_index == 0) {
|
||||
break; // break loop, since no more request has been found
|
||||
bytes_processed = 0;
|
||||
// break loop, malformed packet
|
||||
break;
|
||||
}
|
||||
|
||||
// Update bytes processed
|
||||
|
@ -1024,6 +1029,11 @@ uint8_t LoRaPHY::link_ADR_request(adr_req_params_t *link_adr_req,
|
|||
}
|
||||
}
|
||||
|
||||
if (bytes_processed == 0) {
|
||||
*nb_bytes_processed = 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (is_datarate_supported(adr_settings.datarate)) {
|
||||
verify_params.status = status;
|
||||
|
||||
|
|
|
@ -608,7 +608,8 @@ protected:
|
|||
/**
|
||||
* Parses the parameter of an LinkAdrRequest.
|
||||
*/
|
||||
uint8_t parse_link_ADR_req(const uint8_t *payload, link_adr_params_t *adr_params);
|
||||
uint8_t parse_link_ADR_req(const uint8_t *payload, uint8_t payload_size,
|
||||
link_adr_params_t *adr_params);
|
||||
|
||||
/**
|
||||
* Verifies and updates the datarate, the TX power and the number of repetitions
|
||||
|
|
|
@ -435,12 +435,16 @@ uint8_t LoRaPHYAU915::link_ADR_request(adr_req_params_t *params,
|
|||
// Initialize local copy of channels mask
|
||||
copy_channel_mask(temp_channel_masks, channel_mask, AU915_CHANNEL_MASK_SIZE);
|
||||
|
||||
while (bytes_processed < params->payload_size) {
|
||||
while (bytes_processed < params->payload_size &&
|
||||
params->payload[bytes_processed] == SRV_MAC_LINK_ADR_REQ) {
|
||||
next_index = parse_link_ADR_req(&(params->payload[bytes_processed]),
|
||||
params->payload_size,
|
||||
&adr_settings);
|
||||
|
||||
if (next_index == 0) {
|
||||
break; // break loop, since no more request has been found
|
||||
bytes_processed = 0;
|
||||
// break loop, malformed packet
|
||||
break;
|
||||
}
|
||||
|
||||
// Update bytes processed
|
||||
|
@ -471,6 +475,11 @@ uint8_t LoRaPHYAU915::link_ADR_request(adr_req_params_t *params,
|
|||
}
|
||||
}
|
||||
|
||||
if (bytes_processed == 0) {
|
||||
*nb_bytes_parsed = 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
// FCC 15.247 paragraph F mandates to hop on at least 2 125 kHz channels
|
||||
if ((adr_settings.datarate < DR_6)
|
||||
&& (num_active_channels(temp_channel_masks, 0, 4) < 2)) {
|
||||
|
|
|
@ -460,13 +460,18 @@ uint8_t LoRaPHYCN470::link_ADR_request(adr_req_params_t *params,
|
|||
// Initialize local copy of channels mask
|
||||
copy_channel_mask(temp_channel_masks, channel_mask, CN470_CHANNEL_MASK_SIZE);
|
||||
|
||||
while (bytes_processed < params->payload_size) {
|
||||
while (bytes_processed < params->payload_size &&
|
||||
params->payload[bytes_processed] == SRV_MAC_LINK_ADR_REQ) {
|
||||
|
||||
// Get ADR request parameters
|
||||
next_index = parse_link_ADR_req(&(params->payload[bytes_processed]), &adr_settings);
|
||||
next_index = parse_link_ADR_req(&(params->payload[bytes_processed]),
|
||||
params->payload_size,
|
||||
&adr_settings);
|
||||
|
||||
if (next_index == 0) {
|
||||
break; // break loop, since no more request has been found
|
||||
bytes_processed = 0;
|
||||
// break loop, malformed packet
|
||||
break;
|
||||
}
|
||||
|
||||
// Update bytes processed
|
||||
|
@ -501,6 +506,11 @@ uint8_t LoRaPHYCN470::link_ADR_request(adr_req_params_t *params,
|
|||
}
|
||||
}
|
||||
|
||||
if (bytes_processed == 0) {
|
||||
*nb_bytes_parsed = 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
verify_params.status = status;
|
||||
verify_params.adr_enabled = params->adr_enabled;
|
||||
verify_params.datarate = adr_settings.datarate;
|
||||
|
|
|
@ -460,12 +460,16 @@ uint8_t LoRaPHYUS915::link_ADR_request(adr_req_params_t *params,
|
|||
// Initialize local copy of channels mask
|
||||
copy_channel_mask(temp_channel_masks, channel_mask, US915_CHANNEL_MASK_SIZE);
|
||||
|
||||
while (bytes_processed < params->payload_size) {
|
||||
while (bytes_processed < params->payload_size &&
|
||||
params->payload[bytes_processed] == SRV_MAC_LINK_ADR_REQ) {
|
||||
next_idx = parse_link_ADR_req(&(params->payload[bytes_processed]),
|
||||
params->payload_size - bytes_processed,
|
||||
&adr_settings);
|
||||
|
||||
if (next_idx == 0) {
|
||||
break; // break loop, since no more request has been found
|
||||
bytes_processed = 0;
|
||||
// break loop, malformed packet
|
||||
break;
|
||||
}
|
||||
|
||||
// Update bytes processed
|
||||
|
@ -501,6 +505,11 @@ uint8_t LoRaPHYUS915::link_ADR_request(adr_req_params_t *params,
|
|||
}
|
||||
}
|
||||
|
||||
if (bytes_processed == 0) {
|
||||
*nb_bytes_parsed = 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
// FCC 15.247 paragraph F mandates to hop on at least 2 125 kHz channels
|
||||
if ((adr_settings.datarate < DR_4) &&
|
||||
(num_active_channels(temp_channel_masks, 0, 4) < 2)) {
|
||||
|
|
|
@ -17,12 +17,17 @@
|
|||
#if DEVICE_TRNG
|
||||
|
||||
#include "hal/trng_api.h"
|
||||
#include "platform/PlatformMutex.h"
|
||||
|
||||
extern "C"
|
||||
int mbedtls_hardware_poll( void *data, unsigned char *output, size_t len, size_t *olen ) {
|
||||
static PlatformMutex trng_mutex;
|
||||
trng_t trng_obj;
|
||||
trng_mutex.lock();
|
||||
trng_init(&trng_obj);
|
||||
int ret = trng_get_bytes(&trng_obj, output, len, olen);
|
||||
trng_free(&trng_obj);
|
||||
trng_mutex.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2018 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2018-2019, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2018 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016-2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2018 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016-2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2015 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2018 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016-2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2016 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2016 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, Arm Limited and affiliates.
|
||||
* 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 "CppUTest/TestHarness.h"
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2015 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, Arm Limited and affiliates.
|
||||
* 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 "CppUTest/CommandLineTestRunner.h"
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2016 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, Arm Limited and affiliates.
|
||||
* 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 <inttypes.h>
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2016 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, Arm Limited and affiliates.
|
||||
* 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 TEST_NS_NVM_HELPER_H
|
||||
#define TEST_NS_NVM_HELPER_H
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2016 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, Arm Limited and affiliates.
|
||||
* 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>
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2016 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, Arm Limited and affiliates.
|
||||
* 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 __CONFIGURATION_STORE_STUB_H__
|
||||
#define __CONFIGURATION_STORE_STUB_H__
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2016 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2014-2016, 2018, Arm Limited and affiliates.
|
||||
* 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>
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2016 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2014-2016, 2018, Arm Limited and affiliates.
|
||||
* 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"
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2016 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2015-2016, 2018, Arm Limited and affiliates.
|
||||
* 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__
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2016 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, Arm Limited and affiliates.
|
||||
* 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 "eventOS_event_timer.h"
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2018 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016-2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2018 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016-2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2018 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2018 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2018 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2018 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016-2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2018 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2016-2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2016, ARM Limited, All Rights Reserved.
|
||||
* Copyright (c) 2016, 2018, Arm Limited and affiliates.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef MBED_CONF_NANOSTACK_HAL_NVM_CFSTORE
|
||||
|
|
|
@ -85,7 +85,7 @@ uint8_t *thread_extension_discover_response_write(protocol_interface_info_entry_
|
|||
#define thread_extension_version_check(version) (false)
|
||||
#define thread_extension_discover_response_read(nwk_info, discover_response_tlv, data_ptr, data_len) ((void) 0)
|
||||
#define thread_extension_discover_response_tlv_write(data, version, securityPolicy) ((void) 0)
|
||||
#define thread_extension_service_init(cur) (0)
|
||||
#define thread_extension_service_init(cur) ((void) 0)
|
||||
#define thread_extension_joining_enabled(interface_id) (false)
|
||||
#define thread_extension_discover_response_len(cur) (0)
|
||||
#define thread_extension_discover_response_write(cur, ptr) (ptr)
|
||||
|
|
|
@ -1084,7 +1084,7 @@ buffer_t *icmpv6_up(buffer_t *buf)
|
|||
|
||||
case ICMPV6_TYPE_INFO_ECHO_REPLY:
|
||||
ipv6_neighbour_reachability_confirmation(buf->src_sa.address, buf->interface->id);
|
||||
/* fall through */
|
||||
/* fall through */
|
||||
|
||||
case ICMPV6_TYPE_ERROR_DESTINATION_UNREACH:
|
||||
#ifdef HAVE_RPL_ROOT
|
||||
|
@ -1092,7 +1092,7 @@ buffer_t *icmpv6_up(buffer_t *buf)
|
|||
buf = rpl_control_source_route_error_handler(buf, cur);
|
||||
}
|
||||
#endif
|
||||
/* no break */
|
||||
/* fall through */
|
||||
|
||||
default:
|
||||
if (buf) {
|
||||
|
|
|
@ -287,7 +287,7 @@ nsapi_error_t TLSSocketWrapper::send(const void *data, nsapi_size_t size)
|
|||
ret = continue_handshake();
|
||||
if (ret != NSAPI_ERROR_IS_CONNECTED) {
|
||||
if (ret == NSAPI_ERROR_ALREADY) {
|
||||
ret = NSAPI_ERROR_NO_CONNECTION;
|
||||
ret = NSAPI_ERROR_WOULD_BLOCK;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ nsapi_size_or_error_t TLSSocketWrapper::recv(void *data, nsapi_size_t size)
|
|||
ret = continue_handshake();
|
||||
if (ret != NSAPI_ERROR_IS_CONNECTED) {
|
||||
if (ret == NSAPI_ERROR_ALREADY) {
|
||||
ret = NSAPI_ERROR_NO_CONNECTION;
|
||||
ret = NSAPI_ERROR_WOULD_BLOCK;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,217 @@
|
|||
/* Copyright (c) 2019 Unisoc Communications Inc.
|
||||
* 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 "WiFiInterface.h"
|
||||
#include "RdaWiFiInterface.h"
|
||||
#include "rda5991h_wland.h"
|
||||
#include "nsapi_types.h"
|
||||
#include "wland_types.h"
|
||||
#include "rda_sys_wrapper.h"
|
||||
|
||||
nsapi_error_t RDAWiFiInterface::set_channel(uint8_t channel)
|
||||
{
|
||||
int ret= 0;
|
||||
init();
|
||||
|
||||
if (channel > 13)
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
|
||||
if (channel == 0) {
|
||||
_channel = 0;
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
ret = rda5981_set_channel(channel);
|
||||
if (ret == 0) {
|
||||
_channel = channel;
|
||||
return NSAPI_ERROR_OK;
|
||||
} else {
|
||||
return NSAPI_ERROR_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
int8_t RDAWiFiInterface::get_rssi()
|
||||
{
|
||||
return rda5981_get_rssi();
|
||||
}
|
||||
|
||||
nsapi_error_t RDAWiFiInterface::init()
|
||||
{
|
||||
if (!_interface) {
|
||||
if (!_emac.power_up()) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG,"power up failed!\n");
|
||||
}
|
||||
nsapi_error_t err = _stack.add_ethernet_interface(_emac, true, &_interface);
|
||||
if (err != NSAPI_ERROR_OK) {
|
||||
_interface = NULL;
|
||||
return err;
|
||||
}
|
||||
_interface->attach(_connection_status_cb);
|
||||
}
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t RDAWiFiInterface::set_credentials(const char *ssid, const char *pass,
|
||||
nsapi_security_t security)
|
||||
{
|
||||
if (ssid == 0 || strlen(ssid) == 0) {
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
if (security != NSAPI_SECURITY_NONE && (pass == 0 || strlen(pass) == 0)) {
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
if (strlen(ssid) > 32 || strlen(pass) > 63) {
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
memcpy((void*)_ssid, (void*)ssid, strlen(ssid));
|
||||
_ssid[strlen(ssid)] = '\0';
|
||||
memcpy((void*)_pass, (void*)pass, strlen(pass));
|
||||
_pass[strlen(pass)] = '\0';
|
||||
_security = security;
|
||||
return NSAPI_ERROR_OK;
|
||||
}
|
||||
|
||||
nsapi_error_t RDAWiFiInterface::connect(const char *ssid, const char *pass,
|
||||
nsapi_security_t security, uint8_t channel)
|
||||
{
|
||||
rda_msg msg;
|
||||
bool find = false;
|
||||
int i = 0;
|
||||
rda5981_scan_result bss;
|
||||
int ret = 0;
|
||||
|
||||
if (ssid == NULL || ssid[0] == 0) {
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
if(rda5981_check_scan_result_name(ssid) != 0) {
|
||||
for (i = 0; i< 5; i++) {
|
||||
rda5981_scan(NULL, 0, 0);
|
||||
if(rda5981_check_scan_result_name(ssid) == 0) {
|
||||
find = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
find = true;
|
||||
}
|
||||
|
||||
if (find == false) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG,"can not find the ap.\r\n");
|
||||
return NSAPI_ERROR_CONNECTION_TIMEOUT;
|
||||
}
|
||||
bss.channel = 15;
|
||||
rda5981_get_scan_result_name(&bss, ssid);
|
||||
if ((channel !=0) && (bss.channel != channel)) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, "invalid channel\r\n");
|
||||
return NSAPI_ERROR_CONNECTION_TIMEOUT;
|
||||
}
|
||||
|
||||
memcpy(gssid, ssid, strlen(ssid));
|
||||
if (pass[0] != 0) {
|
||||
memcpy(gpass, pass, strlen(pass));
|
||||
}
|
||||
memset(gbssid, 0, NSAPI_MAC_BYTES);
|
||||
gssid[strlen(ssid)] = gpass[strlen(pass)] = '\0';
|
||||
|
||||
msg.type = WLAND_CONNECT;
|
||||
rda_mail_put(wland_msgQ, (void*)&msg, osWaitForever);
|
||||
ret = rda_sem_wait(wifi_auth_sem, 10000);
|
||||
if (ret) {
|
||||
return NSAPI_ERROR_CONNECTION_TIMEOUT;
|
||||
}
|
||||
|
||||
ret = _interface->bringup(_dhcp,
|
||||
_ip_address[0] ? _ip_address : 0,
|
||||
_netmask[0] ? _netmask : 0,
|
||||
_gateway[0] ? _gateway : 0,
|
||||
DEFAULT_STACK,
|
||||
_blocking);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
nsapi_error_t RDAWiFiInterface::connect()
|
||||
{
|
||||
return connect(_ssid, _pass, _security, _channel);
|
||||
}
|
||||
|
||||
nsapi_error_t RDAWiFiInterface::disconnect()
|
||||
{
|
||||
rda_msg msg;
|
||||
|
||||
if(sta_state < 2) {
|
||||
return NSAPI_ERROR_NO_CONNECTION;
|
||||
}
|
||||
msg.type = WLAND_DISCONNECT;
|
||||
rda_mail_put(wland_msgQ, (void*)&msg, osWaitForever);
|
||||
if (_interface) {
|
||||
return _interface->bringdown();
|
||||
}
|
||||
|
||||
return NSAPI_ERROR_NO_CONNECTION;
|
||||
}
|
||||
|
||||
nsapi_size_or_error_t RDAWiFiInterface::scan(WiFiAccessPoint *res, nsapi_size_t count)
|
||||
{
|
||||
int bss_num = 0, i;
|
||||
rda5981_scan_result *bss;
|
||||
nsapi_wifi_ap_t ap;
|
||||
|
||||
init();
|
||||
|
||||
rda5981_scan(NULL, 0, 0);
|
||||
bss_num = rda5981_get_scan_num();
|
||||
if (count != 0) {
|
||||
bss_num = (bss_num < count) ? bss_num : count;
|
||||
}
|
||||
if (res) {
|
||||
bss = (rda5981_scan_result *)malloc(bss_num * sizeof(rda5981_scan_result));
|
||||
rda5981_get_scan_result(bss, bss_num);
|
||||
for (i=0; i<bss_num; i++) {
|
||||
memset(&ap, 0, sizeof(nsapi_wifi_ap_t));
|
||||
memcpy(ap.bssid, bss[i].BSSID, 6);
|
||||
memcpy(ap.ssid, bss[i].SSID, bss[i].SSID_len);
|
||||
ap.channel = bss[i].channel;
|
||||
ap.rssi = bss[i].RSSI;
|
||||
if (bss[i].secure_type == ENCRYPT_NONE) {
|
||||
ap.security = NSAPI_SECURITY_NONE;
|
||||
} else if(bss[i].secure_type & ENCRYPT_WEP) {
|
||||
ap.security = NSAPI_SECURITY_WEP;
|
||||
} else if((bss[i].secure_type & (ENCRYPT_WPA_TKIP | ENCRYPT_WPA_CCMP)) && \
|
||||
(bss[i].secure_type & (ENCRYPT_WPA2_TKIP | ENCRYPT_WPA2_CCMP))) {
|
||||
ap.security = NSAPI_SECURITY_WPA_WPA2;
|
||||
} else if((bss[i].secure_type & (ENCRYPT_WPA_TKIP | ENCRYPT_WPA_CCMP))) {
|
||||
ap.security = NSAPI_SECURITY_WPA;
|
||||
} else {
|
||||
ap.security = NSAPI_SECURITY_WPA2;
|
||||
}
|
||||
WiFiAccessPoint ap_temp(ap);
|
||||
memcpy(&res[i], &ap_temp, sizeof(WiFiAccessPoint));
|
||||
}
|
||||
free(bss);
|
||||
}
|
||||
return bss_num;
|
||||
|
||||
}
|
||||
|
||||
WiFiInterface *WiFiInterface::get_default_instance() {
|
||||
static RDAWiFiInterface wifinet;
|
||||
return &wifinet;
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
/* LWIP implementation of NetworkInterfaceAPI
|
||||
* Copyright (c) 2019 Unisoc Communications Inc.
|
||||
* 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 RDA_WIFI_INTERFACE_H
|
||||
#define RDA_WIFI_INTERFACE_H
|
||||
|
||||
#include "nsapi.h"
|
||||
#include "rtos.h"
|
||||
#include "EMACInterface.h"
|
||||
#include "WiFiInterface.h"
|
||||
|
||||
|
||||
/** RDAWiFiInterface class
|
||||
* Implementation of the NetworkStack for an EMAC-based Ethernet driver
|
||||
*/
|
||||
class RDAWiFiInterface : public EMACInterface, public WiFiInterface
|
||||
{
|
||||
public:
|
||||
/** Create an EMAC-based ethernet interface.
|
||||
*
|
||||
* The default arguments obtain the default EMAC, which will be target-
|
||||
* dependent (and the target may have some JSON option to choose which
|
||||
* is the default, if there are multiple). The default stack is configured
|
||||
* by JSON option nsapi.default-stack.
|
||||
*
|
||||
* Due to inability to return errors from the constructor, no real
|
||||
* work is done until the first call to connect().
|
||||
*
|
||||
* @param emac Reference to EMAC to use
|
||||
* @param stack Reference to onboard-network stack to use
|
||||
*/
|
||||
RDAWiFiInterface(
|
||||
EMAC &emac = EMAC::get_default_instance(),
|
||||
OnboardNetworkStack &stack = OnboardNetworkStack::get_default_instance()) : EMACInterface(emac, stack) {
|
||||
_ssid[0] = '\0';
|
||||
_pass[0] = '\0';
|
||||
_channel = 0;
|
||||
_security = NSAPI_SECURITY_NONE;
|
||||
}
|
||||
|
||||
//static RDAWiFiInterface *get_target_default_instance();
|
||||
|
||||
/** Set the WiFi network credentials
|
||||
*
|
||||
* @param ssid Name of the network to connect to
|
||||
* @param pass Security passphrase to connect to the network
|
||||
* @param security Type of encryption for connection
|
||||
* (defaults to NSAPI_SECURITY_NONE)
|
||||
* @return 0 on success, or error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t set_credentials(const char *ssid, const char *pass,
|
||||
nsapi_security_t security = NSAPI_SECURITY_NONE);
|
||||
|
||||
/** Set the WiFi network channel
|
||||
*
|
||||
* @param channel Channel on which the connection is to be made, or 0 for any (Default: 0)
|
||||
* @return 0 on success, or error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t set_channel(uint8_t channel);
|
||||
|
||||
/** Gets the current radio signal strength for active connection
|
||||
*
|
||||
* @return Connection strength in dBm (negative value),
|
||||
* or 0 if measurement impossible
|
||||
*/
|
||||
virtual int8_t get_rssi();
|
||||
|
||||
/** Start the interface
|
||||
*
|
||||
* Attempts to connect to a WiFi network.
|
||||
*
|
||||
* @param ssid Name of the network to connect to
|
||||
* @param pass Security passphrase to connect to the network
|
||||
* @param security Type of encryption for connection (Default: NSAPI_SECURITY_NONE)
|
||||
* @param channel Channel on which the connection is to be made, or 0 for any (Default: 0)
|
||||
* @return 0 on success, or error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t connect(const char *ssid, const char *pass,
|
||||
nsapi_security_t security = NSAPI_SECURITY_NONE, uint8_t channel = 0);
|
||||
|
||||
/** Start the interface
|
||||
*
|
||||
* Attempts to connect to a WiFi network. Requires ssid and passphrase to be set.
|
||||
* If passphrase is invalid, NSAPI_ERROR_AUTH_ERROR is returned.
|
||||
*
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t connect();
|
||||
|
||||
/** Stop the interface
|
||||
*
|
||||
* @return 0 on success, or error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t disconnect();
|
||||
|
||||
/** Scan for available networks
|
||||
*
|
||||
* This function will block. If the @a count is 0, function will only return count of available networks, so that
|
||||
* user can allocated necessary memory. If the \p count is grater than 0 and the a \p res is not NULL it'll be populated
|
||||
* with discovered networks up to value of \p count.
|
||||
*
|
||||
* @param res Pointer to allocated array to store discovered AP
|
||||
* @param count Size of allocated @a res array, or 0 to only count available AP
|
||||
* @return Number of entries in \p count, or if \p count was 0 number of available networks,
|
||||
* negative on error see @a nsapi_error
|
||||
*/
|
||||
virtual nsapi_size_or_error_t scan(WiFiAccessPoint *res, nsapi_size_t count);
|
||||
|
||||
virtual nsapi_size_or_error_t init();
|
||||
private:
|
||||
char _ssid[33];
|
||||
char _pass[65];
|
||||
uint8_t _channel;
|
||||
nsapi_security_t _security;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
/* Copyright (c) 2019 Unisoc Communications Inc.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* File Name : csl_mbed.h */
|
||||
/* */
|
||||
/* Description : This file contains all declarations and functions */
|
||||
/* related to the chip support library. */
|
||||
/* */
|
||||
/* MbedOS Usage : Call maclib_get_funcs_struct() to get MACLib funcs; */
|
||||
/* Define mbed_reg_func_t var, Register it by ml_init; */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef CSL_MBED_H
|
||||
#define CSL_MBED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Constants */
|
||||
/*****************************************************************************/
|
||||
#define RDA_EXT_INT_MAC_HW_INDEX 8
|
||||
#define RDA_EXT_INT_MAC_HW_PRI 0x80
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Enums */
|
||||
/*****************************************************************************/
|
||||
typedef enum {
|
||||
MACLIB_EVENT_PEND = 0,
|
||||
MACLIB_EVENT_PROCESS = 1,
|
||||
MACLIB_EVENT_CLEANUP = 2
|
||||
} MACLIB_EVENT_HANDLE_T;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data Types */
|
||||
/*****************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int ml_id; /* Buffer identification */
|
||||
unsigned char* ml_data; /* Pkt start address */
|
||||
unsigned short ml_len; /* Pkt length */
|
||||
} maclib_buf_t;
|
||||
|
||||
/* Structure that contains functions provided by MACLib */
|
||||
typedef struct {
|
||||
/* Initialize MAC Library, input param: mbed_reg_func_t *reg_funcs */
|
||||
int (*ml_init)(void *reg_funcs);
|
||||
|
||||
/* As a peroid task to process MAC Library background event */
|
||||
void (*ml_tasklet)(void);
|
||||
|
||||
/* Get a new packet buffer, output param: maclib_buf_t *buf */
|
||||
void (*ml_get_pkt_buf)(void *buf);
|
||||
|
||||
/* Mbed stack send packet to MAC Library, input param: maclib_buf_t *buf*/
|
||||
int (*ml_xmit_pkt)(void *buf);
|
||||
|
||||
/* Mbed receive and processing packet done, input param: unsigned int buf_id */
|
||||
void (*ml_recv_pkt_comp)(unsigned int buf_id);
|
||||
} maclib_func_t;
|
||||
|
||||
/* Structure that contains functions provided by MbedOS */
|
||||
typedef struct {
|
||||
/* MAC Library send packet to mbed stack, input param: maclib_buf_t *buf */
|
||||
void (*mbed_recv_pkt)(void *buf);
|
||||
|
||||
/* Critical section start realized in mbed */
|
||||
void (*mbed_critical_sec_start)(void);
|
||||
|
||||
/* Critical section end realized in mbed */
|
||||
void (*mbed_critical_sec_end)(void);
|
||||
|
||||
/* Create interrupt in mbed, input param: vector/priority/isr(function), */
|
||||
/* return: interrupt handle, non-zero is valid */
|
||||
void * (*mbed_create_interrupt)(unsigned int vec, unsigned int pri, void *isr);
|
||||
|
||||
/* Delete interrupt in mbed, input param: vector */
|
||||
void (*mbed_delete_interrupt)(unsigned int vec);
|
||||
|
||||
/* Enable interrupt in mbed, input param: vector */
|
||||
void (*mbed_enable_interrupt)(unsigned int vec);
|
||||
|
||||
/* Disable interrupt in mbed, input param: vector */
|
||||
void (*mbed_disable_interrupt)(unsigned int vec);
|
||||
|
||||
/* Get current time realized in mbed, return time in units of micro second */
|
||||
unsigned long (*mbed_get_cur_time_ms)(void);
|
||||
|
||||
/* Create alarm in mbed, input param: func(callback)/data(pass to func), */
|
||||
/* return: alarm handle, non-zero is valid */
|
||||
void * (*mbed_create_alarm)(void *func, unsigned int data);
|
||||
|
||||
/* Delete alarm in mbed, input param: alarm handle */
|
||||
void (*mbed_delete_alarm)(void **handle);
|
||||
|
||||
/* Start alarm in mbed, input param: alarm handle/timeout(micro second) */
|
||||
void (*mbed_start_alarm)(void *handle, unsigned int timeout_ms);
|
||||
|
||||
/* Stop alarm in mbed, input param: alarm handle */
|
||||
void (*mbed_stop_alarm)(void *handle);
|
||||
|
||||
#if defined(MBED_MUTEX_INTERFACE)
|
||||
/* Create mutex */
|
||||
void (*mbed_mutex_create)(void);
|
||||
|
||||
/* Delete mutex */
|
||||
unsigned int (*mbed_mutex_delete)(void *rdamutex);
|
||||
|
||||
/* Wait mutex, timer unit : millisec */
|
||||
unsigned int (*mbed_mutex_wait)(void *rdamutex, unsigned int millisec);
|
||||
|
||||
/* Release mutex */
|
||||
unsigned int (*mbed_mutex_release)(void *rdamutex);
|
||||
#endif /* MBED_MUTEX_INTERFACE */
|
||||
|
||||
/* Event post/get callback function, input param: event_type */
|
||||
void (*mbed_event_hdl_cb)(unsigned int event);
|
||||
|
||||
/* maclib task sleep callback function */
|
||||
void (*mbed_task_sleep_cb)(void);
|
||||
|
||||
/* maclib task wakeup callback function */
|
||||
void (*mbed_task_wakeup_cb)(void);
|
||||
} maclib_import_func_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Extern Function Declarations */
|
||||
/*****************************************************************************/
|
||||
extern void maclib_get_funcs_struct(maclib_func_t *func_str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSL_MBED_H */
|
|
@ -0,0 +1,69 @@
|
|||
/* Copyright (c) 2019 Unisoc Communications Inc.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* @file : maclib_task.h
|
||||
* @brief : WiFi MACLib task header file
|
||||
* @version: V1.0
|
||||
* @date : 6. May 2017
|
||||
*
|
||||
* @note :
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _MACLIB_TASK_H_
|
||||
#define _MACLIB_TASK_H_
|
||||
|
||||
#define MAC_LIB_MAX_FLEN 1536
|
||||
|
||||
/**
|
||||
* Enums
|
||||
*/
|
||||
typedef enum {
|
||||
MACLIB_MSG_EVNT_HNDL,
|
||||
MACLIB_MSG_WLAND_XMIT_PKT,
|
||||
MACLIB_MSG_LWIP_XMIT_PKT
|
||||
} MACLIB_MSG_TYPE_T;
|
||||
|
||||
/**
|
||||
* Structures
|
||||
*/
|
||||
typedef struct {
|
||||
MACLIB_MSG_TYPE_T type;
|
||||
void *msg;
|
||||
int is_free;
|
||||
} maclib_msg_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief : MACLib main task [MACLib api]
|
||||
* @param[in] : pvParameters(pointer to enet data)
|
||||
* @param[out]:
|
||||
* @return :
|
||||
*/
|
||||
extern void maclib_task(void *pvParameters);
|
||||
extern void mbed_event_handle_cb(unsigned int event);
|
||||
extern void mbed_mltask_sleep_cb(void);
|
||||
extern void mbed_mltask_wakeup_cb(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MACLIB_TASK_H_ */
|
|
@ -0,0 +1,105 @@
|
|||
/* Copyright (c) 2019 Unisoc Communications Inc.
|
||||
* 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 _RDA5981_FLASH_H_
|
||||
#define _RDA5981_FLASH_H_
|
||||
|
||||
#include "wland_types.h"
|
||||
|
||||
/** This struct contains tx power parameter. */
|
||||
typedef struct
|
||||
{
|
||||
u8 b[14];
|
||||
u8 g[14];
|
||||
u8 n[14];
|
||||
u8 sum;
|
||||
u8 padding1;//alignment
|
||||
} wland_tx_power_t;
|
||||
|
||||
/*
|
||||
*function: store reg and corresponding value related to test mode
|
||||
*@valid: 1 means data is valid
|
||||
*@flag: if biti(i=0~7) == 1, it means reg_val[i] is in use
|
||||
*@reg_val: store reg and value, reg_val[i][0] is reg, reg_val[i][1] ~ reg_val[i][14] is value
|
||||
*/
|
||||
typedef struct {
|
||||
u32 valid;
|
||||
u32 flag;
|
||||
u16 reg_val[8][2];
|
||||
} wland_rf_t;
|
||||
|
||||
typedef struct {
|
||||
u32 valid;
|
||||
u32 flag;
|
||||
u16 reg_val[8][15];
|
||||
} wland_rf_channels_t;
|
||||
|
||||
typedef struct {
|
||||
u32 valid;
|
||||
u32 flag;
|
||||
u32 reg_val[8][2];
|
||||
} wland_phy_t;
|
||||
|
||||
typedef struct {
|
||||
u32 valid;
|
||||
u32 flag;
|
||||
u32 reg_val[8][15];
|
||||
} wland_phy_channels_t;
|
||||
|
||||
/* if you add or delete any macros below, modify RDA5991H_USER_DATA_FLAG_UNINITIALIZED at the same time */
|
||||
#define RDA5991H_USER_DATA_FLAG_MAC BIT0
|
||||
#define RDA5991H_USER_DATA_FLAG_STA BIT1
|
||||
#define RDA5991H_USER_DATA_FLAG_PMK BIT2
|
||||
#define RDA5991H_USER_DATA_FLAG_IP BIT3
|
||||
#define RDA5991H_USER_DATA_FLAG_PARTER_DATA_LEN BIT4
|
||||
#define RDA5991H_USER_DATA_FLAG_TX_POWER BIT5
|
||||
#define RDA5991H_USER_DATA_FLAG_XTAL_CAL BIT6
|
||||
#define RDA5991H_USER_DATA_FLAG_TX_POWER_RF BIT7
|
||||
#define RDA5991H_USER_DATA_FLAG_TX_POWER_PHY_GN BIT8
|
||||
#define RDA5991H_USER_DATA_FLAG_TX_POWER_PHY_B BIT9
|
||||
#define RDA5991H_USER_DATA_FLAG_AP BIT10
|
||||
#define RDA5991H_USER_DATA_FLAG_APNET BIT11
|
||||
#define RDA5991H_USER_DATA_FLAG_DHCP BIT12
|
||||
#define RDA5991H_USER_DATA_FLAG_UART BIT13
|
||||
#define RDA5991H_USER_DATA_FLAG_RF BIT14
|
||||
#define RDA5991H_USER_DATA_FLAG_RF_CHANNELS BIT15
|
||||
#define RDA5991H_USER_DATA_FLAG_PHY BIT16
|
||||
#define RDA5991H_USER_DATA_FLAG_PHY_CHANNELS BIT17
|
||||
#define RDA5991H_USER_DATA_FLAG_TX_POWER_OFFSET BIT18
|
||||
|
||||
#define RDA5981_VBAT_CAL BIT0
|
||||
#define RDA5981_GPADC0_CAL BIT1
|
||||
#define RDA5981_GPADC1_CAL BIT2
|
||||
#define RDA5981_PRODUCT_ID BIT3
|
||||
#define RDA5981_POWER_CLASS BIT4
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* function: read VBAT Calibration value
|
||||
* y = k * x + b
|
||||
* @k: slope
|
||||
* @b: offset
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_flash_read_vbat_cal(float *k, float *b);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,57 @@
|
|||
/* Copyright (c) 2019 Unisoc Communications Inc.
|
||||
* 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 _RDA5981_OTA_H_
|
||||
#define _RDA5981_OTA_H_
|
||||
#include <stdint.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const unsigned int RDA_FW_INFO_ADDR;
|
||||
extern const unsigned int RDA_UPGRADE_ADDR;
|
||||
|
||||
/*
|
||||
* function: start to wirte a partition. this func will erase given flash region
|
||||
* @addr: partition start address, must be 4k alignment
|
||||
* @img_len: length of image getted from OTA server, must be 4k alignment
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_write_partition_start(unsigned int addr, unsigned int img_len);
|
||||
|
||||
/*
|
||||
* function: write image to flash, without erase.
|
||||
* the write region must be inside of the area given by func rda5981_write_partition_start
|
||||
* the write region must be in order, otherwise the end function will return crc error.
|
||||
* the maximum length could be write once time is 0x1000
|
||||
* @offset: offset from image inital position, must be 1k alignment
|
||||
* @buf: data to be written
|
||||
* @len: buffer len, max #0x1000, must be 1k alignment
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_write_partition(unsigned int offset, const unsigned char *buf, unsigned int len);
|
||||
|
||||
/*
|
||||
* function: end of writing partition
|
||||
* return: 0:crc32 check success, else:fail
|
||||
*/
|
||||
int rda5981_write_partition_end(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_RDA5981_OTA_H_*/
|
|
@ -0,0 +1,99 @@
|
|||
/* Copyright (c) 2019 Unisoc Communications Inc.
|
||||
* 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 _RDA5981_SNIFFER_H_
|
||||
#define _RDA5981_SNIFFER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "wland_types.h"
|
||||
|
||||
/* Enable filtering ACK frames (no support)*/
|
||||
//#define RDA_RX_FILTER_DROP_ACK BIT0
|
||||
|
||||
/* Enable filtering CTS frames (no support)*/
|
||||
//#define RDA_RX_FILTER_DROP_CTS BIT1
|
||||
|
||||
/* Enable filtering RTS frames (no support)*/
|
||||
//#define RDA_RX_FILTER_DROP_RTS BIT2
|
||||
|
||||
/* Enable filtering beacon frames */
|
||||
#define RDA_RX_FILTER_DROP_BEACON BIT3
|
||||
|
||||
/* Enable filtering ATIM frames (no support)*/
|
||||
//#define RDA_RX_FILTER_DROP_ATIM BIT4
|
||||
|
||||
/* Enable filtering CF_END frames (no support)*/
|
||||
//#define RDA_RX_FILTER_DROP_CF_END BIT5
|
||||
|
||||
/* Enable filtering QCF_POLL frames (no support)*/
|
||||
//#define RDA_RX_FILTER_DROP_QCF_POLL BIT6
|
||||
|
||||
/* Filter Management frames which are not directed to current STA */
|
||||
#define RDA_RX_FILTER_DROP_ND_MGMT BIT7
|
||||
|
||||
/* Filter BC/MC MGMT frames belonging to other BSS */
|
||||
#define RDA_RX_FILTER_DROP_BC_MC_MGMT_OTHER_BSS BIT8
|
||||
|
||||
/* Enable filtering of duplicate frames */
|
||||
#define RDA_RX_FILTER_DROP_DUPLICATE BIT9
|
||||
|
||||
/* Enable filtering of frames whose FCS has failed */
|
||||
#define RDA_RX_FILTER_DROP_FCS_FAILED BIT10
|
||||
|
||||
/* Enable filtering of De-authentication frame */
|
||||
#define RDA_RX_FILTER_DROP_DEAUTH BIT11
|
||||
|
||||
/* Filter BA frames which are not received as SIFS response (no support)*/
|
||||
//#define RDA_RX_FILTER_DROP_NSIFS_RESP_BA BIT12
|
||||
|
||||
/* Filter BA frames which are received as SIFS response (no support)*/
|
||||
//#define RDA_RX_FILTER_DROP_SIFS_RESP_BA BIT13
|
||||
|
||||
/* Filter frames which are received in secondary channel (20 MHz PPDU from Secondary channel) */
|
||||
#define RDA_RX_FILTER_DROP_SEC_CHANNEL BIT14
|
||||
|
||||
/* Filter BC/MC DATA frames belonging to other BSS */
|
||||
#define RDA_RX_FILTER_DROP_BC_MC_DATA_OTHER_BSS BIT15
|
||||
|
||||
/* Filter DATA frames not directed to this station */
|
||||
#define RDA_RX_FILTER_DROP_ND_DATA BIT16
|
||||
|
||||
/* Filter Control frames which are not directed to current STA (no support)*/
|
||||
//#define RDA_RX_FILTER_DROP_ND_CONTROL BIT17
|
||||
|
||||
/* Filter Beacon frames (in IBSS mode) which are not used for adoption because the timestamp field is lower than TSF timer */
|
||||
#define RDA_RX_FILTER_DROP_IBSS_BEACON BIT18
|
||||
|
||||
typedef int (*sniffer_handler_t)(unsigned short data_len, void *data);
|
||||
|
||||
int rda5981_enable_sniffer(sniffer_handler_t handler);
|
||||
int rda5981_disable_sniffer(void);
|
||||
//don't use this in sniffer callback handler
|
||||
int rda5981_disable_sniffer_nocallback(void);
|
||||
///TODO: time is no use anymore
|
||||
int rda5981_start_sniffer(unsigned char channel, unsigned char to_ds,
|
||||
unsigned char from_ds, unsigned char mgm_frame, unsigned short time);
|
||||
int rda5981_stop_sniffer(void);
|
||||
int wland_sniffer_set_channel(unsigned char channel);
|
||||
int rda5981_set_filter(unsigned char to_ds, unsigned char from_ds, unsigned int mgm_filter);
|
||||
int rda5981_sniffer_enable_fcs(void);//for hiflying
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_RDA5981_SNIFFER_H_*/
|
|
@ -0,0 +1,658 @@
|
|||
/* Copyright (c) 2019 Unisoc Communications Inc.
|
||||
* 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 _RDA5991H_WLAND_H_
|
||||
#define _RDA5991H_WLAND_H_
|
||||
|
||||
#include "sys_arch.h"
|
||||
#include "wland_types.h"
|
||||
|
||||
/* Mbed interface mac address
|
||||
* if MBED_MAC_ADD_x are zero, interface uid sets mac address,
|
||||
* otherwise MAC_ADD_x are used.
|
||||
*/
|
||||
|
||||
extern unsigned char user_mac[6];//not save in flash, need fill before wifi init every time
|
||||
extern unsigned char gssid[32+1];
|
||||
extern unsigned char gpass[64+1];
|
||||
extern unsigned char gchannel;
|
||||
extern unsigned char gbssid[6];
|
||||
|
||||
extern unsigned char gssid_ap[32+1];
|
||||
extern unsigned char gpass_ap[64+1];
|
||||
extern unsigned char gchannel_ap;
|
||||
extern void *wland_msgQ;
|
||||
extern void *wifi_auth_sem;
|
||||
|
||||
extern u8 sta_state;
|
||||
|
||||
typedef enum {
|
||||
WLAND_CONNECT,
|
||||
WLAND_RECONNECT,
|
||||
WLAND_DISCONNECT,
|
||||
WLAND_DISCONNECT_ERROR,
|
||||
WLAND_STARTAP,
|
||||
WLAND_STOPAP,
|
||||
WLAND_ADD_AP_GTK,
|
||||
WLAND_AP_EAPOL_3_OF_4,
|
||||
WLAND_ADD_AP_PTK,
|
||||
WLAND_STAJOINED,
|
||||
WLAND_STAEXITED,
|
||||
WLAND_STADEAUTH,
|
||||
WLAND_MAC_CONNECTED,
|
||||
WLAND_MAC_AP_CONNECTED,
|
||||
WLAND_ADD_GTK,
|
||||
WLAND_ADD_PTK,
|
||||
WLAND_CON_FINISH,
|
||||
WLAND_AUTO_RATE,
|
||||
WLAND_ARP_OFFLOAD,
|
||||
WLAND_SM_START,
|
||||
WLAND_SM_STOP,
|
||||
WLAND_WPS_CONNECT,
|
||||
WLAND_WPS_START,
|
||||
WLAND_WPS_DISCONNECT,
|
||||
}WLAND_MSG;
|
||||
|
||||
typedef enum {
|
||||
MAIN_CONNECT,
|
||||
MAIN_RECONNECT,
|
||||
MAIN_DISCONNECT,
|
||||
MAIN_STOP_AP,
|
||||
}MAIN_MSG;
|
||||
|
||||
typedef struct {
|
||||
unsigned int type;
|
||||
unsigned int arg1;
|
||||
unsigned int arg2;
|
||||
unsigned int arg3;
|
||||
}rda_msg;
|
||||
|
||||
|
||||
enum {
|
||||
D_NONE_LEVEL = 0,
|
||||
D_ERROR_LEVEL = 1,
|
||||
D_INFO_LEVEL = 2,
|
||||
D_DEBUG_LEVEL = 3,
|
||||
};
|
||||
|
||||
#define WLAND_DBG_DUMP 0
|
||||
#define WPA_DBG_DUMP 0
|
||||
#define HUT_DBG_DUMP 0
|
||||
#define WLAND_DBG_LEVEL D_NONE_LEVEL
|
||||
#define WPA_DBG_LEBEL D_NONE_LEVEL
|
||||
#define WLANDLIB_DBG_LEVEL D_NONE_LEVEL
|
||||
|
||||
#define ETH_ALEN 6
|
||||
|
||||
//encrypt type
|
||||
#define ENCRYPT_NONE (0)
|
||||
#define ENCRYPT_WPA_TKIP BIT0
|
||||
#define ENCRYPT_WPA_CCMP BIT1
|
||||
#define ENCRYPT_WPA2_TKIP BIT2
|
||||
#define ENCRYPT_WPA2_CCMP BIT3
|
||||
#define ENCRYPT_WEP BIT4
|
||||
|
||||
/* r91h driver data structure */
|
||||
typedef struct {
|
||||
struct netif *netif_sta;
|
||||
struct netif *netif_ap;
|
||||
sys_thread_t wland_thread;
|
||||
sys_thread_t maclib_thread;
|
||||
sys_mbox_t maclib_mbox;
|
||||
sys_mbox_t wland_mbox;
|
||||
} rda_enetdata_t;
|
||||
|
||||
__STATIC_INLINE int mac_is_valid(char* mac)
|
||||
{
|
||||
return (mac[0] | mac[1] | mac[2] | mac[3] | mac[4] | mac[5]);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void wland_txip_data(void *data, unsigned int len, int mode);
|
||||
extern void *wland_get_databuf(void);
|
||||
extern void wland_sta_init(void);
|
||||
extern void wland_reg_func(void);
|
||||
extern void r91h_phy_task(void *data);
|
||||
extern void wland_task(void *arg);
|
||||
extern void rda_get_macaddr(u8_t *macaddr, int mode);
|
||||
extern void rda5981_send_rawdata(char* data, unsigned int len);
|
||||
extern int rda5981_send_nulldata(int power_save);
|
||||
extern void rda5981_set_country_code(unsigned char country_code);// 0~china(1-14) 1~NA(1-11) 2~EU(1-13)
|
||||
extern int rda5981_set_retrans_policy(unsigned char count);
|
||||
extern int rda5981_set_channel(unsigned char channel);
|
||||
/* default is 0, receive multicast packet, disable please set 1*/
|
||||
extern int rda5981_filter_multicast(unsigned char enable);
|
||||
/* default is 0, 0 ~ no hidden, 1 ~ hidden zero len, 2 ~ hidden zero contents */
|
||||
extern void rda5981_set_AP_hidden_type(unsigned char mode);
|
||||
extern void rda5981_set_AP_link_num(unsigned char num);
|
||||
extern char* rda5981_get_ver(void);
|
||||
extern int rda5981_enter_CE_MODE(unsigned char enable);
|
||||
/*
|
||||
* mode 0 - not 11n 1 - 11n
|
||||
*
|
||||
* -----------------11n(mode 1)(Mbps)-----------------
|
||||
* rate HT20 HT40
|
||||
* GI(800ns) GI(400ns) GI(800ns) GI(400ns)
|
||||
* 0 6.5 7.2 13.5 15
|
||||
* 1 13 14.2 27 30
|
||||
* 2 19.5 21.7 40.5 45
|
||||
* 3 26 28.9 54 60
|
||||
* 4 39 43.3 81 90
|
||||
* 5 52 57.8 108 120
|
||||
* 6 58.5 65 121.5 135
|
||||
* 7 65 72 135 150
|
||||
*
|
||||
* --------------not 11n(mode 0)(Mbps)-----------------
|
||||
* rate data rate rate data rate
|
||||
* 0 autorate 9 9
|
||||
* 1 1 12 12
|
||||
* 2 2 18 18
|
||||
* 5 5.5 24 24
|
||||
* 11 11 36 36
|
||||
* 6 6 48 48
|
||||
*
|
||||
*/
|
||||
extern int rda5981_set_data_rate(unsigned char mode, unsigned char rate);
|
||||
extern void rda5981_set_mode(unsigned char bgn_enable);
|
||||
extern void rda5981_set_auth_timeout(unsigned char timeout_enable);
|
||||
typedef struct {
|
||||
char BSSID[ETH_ALEN];
|
||||
char SSID[32+1];
|
||||
signed char RSSI;
|
||||
unsigned char SSID_len;
|
||||
unsigned char channel;
|
||||
unsigned char secure_type;//refer #define ENCRYPT_XXX
|
||||
unsigned char wmm;
|
||||
unsigned char *ie;//user program couldn't free(ie);
|
||||
unsigned short capability;
|
||||
unsigned int ie_length;
|
||||
} rda5981_scan_result;
|
||||
|
||||
typedef struct {
|
||||
unsigned char mac[ETH_ALEN];
|
||||
unsigned int ip;
|
||||
} rda5981_apsta_info;
|
||||
|
||||
//scan one or all channel(if channel is 0) once
|
||||
int rda5981_scan(const char *SSID, const unsigned char SSID_len, const unsigned char channel);
|
||||
//0 passive mode, 1 active mode, scan time(unit is second)
|
||||
int rda5981_scan_v2(const char *SSID, const unsigned char SSID_len, const unsigned char channel, const unsigned char mode, \
|
||||
const unsigned char scan_time);
|
||||
int rda5981_get_scan_num();
|
||||
int rda5981_get_scan_result(rda5981_scan_result *buf, const unsigned char len);
|
||||
int rda5981_get_scan_result_index(rda5981_scan_result *buf, const unsigned char index);
|
||||
int rda5981_get_scan_result_name(rda5981_scan_result *buf, const char *name);
|
||||
int rda5981_get_scan_result_bssid(rda5981_scan_result *buf, const unsigned char *bssid);
|
||||
int rda5981_check_scan_result_name(const char *name);
|
||||
int rda5981_check_scan_result(const char *ssid, const char *bssid, const unsigned channel);
|
||||
int rda5981_check_scan_result_name_bssid(const unsigned char *name, const unsigned char *bssid);
|
||||
int rda5981_del_scan_all_result(void);
|
||||
void rda5981_set_expired_time(unsigned int expired_time);
|
||||
int rda5981_get_joined_AP(rda5981_scan_result *bss);
|
||||
s8 rda5981_get_rssi();
|
||||
void rda5981_set_main_queue(void* queue);
|
||||
|
||||
void rda5981_set_sta_listen_interval(unsigned char interval);
|
||||
void rda5981_set_sta_link_loss_time(unsigned char time);
|
||||
unsigned int rda5981_get_ap_join_info(rda5981_apsta_info *buf, const unsigned char len);
|
||||
void rda5981_set_AP_white_list(unsigned char flag, unsigned char *mac);
|
||||
int wland_set_joined_sta_ip(char *mac, unsigned int ip);
|
||||
|
||||
/*
|
||||
* return 0:ok, else:error.
|
||||
*/
|
||||
int rda5981_flash_read_mac_addr(unsigned char *mac_addr);
|
||||
int rda5981_flash_write_mac_addr(unsigned char *mac_addr);
|
||||
|
||||
/*
|
||||
* return 0:ok, else:error.
|
||||
*/
|
||||
int rda5981_flash_erase_uart(void);
|
||||
int rda5981_flash_read_uart(unsigned int *uart);
|
||||
int rda5981_flash_write_uart(unsigned int *uart);
|
||||
|
||||
/*
|
||||
* return 0:ok, else:error.
|
||||
*/
|
||||
int rda5981_flash_read_ip_addr(unsigned char *ip_addr, unsigned char *server_addr);
|
||||
int rda5981_flash_write_ip_addr(unsigned char *ip_add, unsigned char *server_addr);
|
||||
|
||||
/*
|
||||
* return 0:ok, else:error.
|
||||
*/
|
||||
int rda5981_flash_erase_dhcp_data(void);
|
||||
int rda5981_flash_read_dhcp_data(unsigned int *enable, unsigned int *ip, unsigned int *msk, unsigned int *gw);
|
||||
int rda5981_flash_write_dhcp_data(unsigned int enable, unsigned int ip, unsigned int msk, unsigned int gw);
|
||||
|
||||
/*
|
||||
* return 0:ok, else:error.
|
||||
*/
|
||||
int rda5981_flash_read_ap_data(char *ssid, char *passwd, unsigned char *channel);
|
||||
int rda5981_flash_write_ap_data(const char *ssid, const char *passwd, unsigned char channel);
|
||||
int rda5981_flash_erase_ap_data(void);
|
||||
|
||||
/*
|
||||
* return 0:ok, else:error.
|
||||
*/
|
||||
int rda5981_flash_read_ap_net_data(unsigned int *ip, unsigned int *msk, unsigned int *gw,
|
||||
unsigned int *dhcps, unsigned int *dhcpe);
|
||||
int rda5981_flash_write_ap_net_data(unsigned int ip, unsigned int msk, unsigned int gw,
|
||||
unsigned int dhcps, unsigned int dhcpe);
|
||||
int rda5981_flash_erase_ap_net_data(void);
|
||||
|
||||
/*
|
||||
* return 0:ok, else:error.
|
||||
*/
|
||||
int rda5981_flash_read_sta_data(char *ssid, char *passwd);
|
||||
int rda5981_flash_write_sta_data(const char *ssid, const char *passwd);
|
||||
int rda5981_flash_erase_sta_data(void);
|
||||
|
||||
|
||||
/*
|
||||
* read 3rd parter data length from flash
|
||||
* return user data length
|
||||
*/
|
||||
int rda5981_flash_read_3rdparter_data_length(void);
|
||||
|
||||
/*
|
||||
* read 3rd parter data from flash
|
||||
* @buf, buf to store user data
|
||||
* @buf_len, length of buf
|
||||
* return user data length
|
||||
*/
|
||||
int rda5981_flash_read_3rdparter_data(unsigned char *buf, unsigned int buf_len);
|
||||
|
||||
/*
|
||||
* write 3rd parter data from flash
|
||||
* @buf, data to write
|
||||
* @buf_len, length of buf.
|
||||
* return 0:ok, else:fail
|
||||
*/
|
||||
int rda5981_flash_write_3rdparter_data(const unsigned char *buf, unsigned int buf_len);
|
||||
|
||||
/*
|
||||
* erase 3rd parter data from flash
|
||||
* return 0:ok, else:fail
|
||||
*/
|
||||
int rda5981_flash_erase_3rdparter_data(void);
|
||||
|
||||
/*
|
||||
* set flash size
|
||||
* @size, 1MB:0x100000, 2MB:0x200000, 4MB:0x400000. default size: 1MB
|
||||
* return 0:ok, else:fail
|
||||
*/
|
||||
int rda5981_set_flash_size(const unsigned int size);
|
||||
|
||||
/*
|
||||
* set userdata location on flash
|
||||
* @sys_data_addr, data to save system parameter, user can not operate this area directly.
|
||||
* size:4KB. default location:0x180fb000
|
||||
* @user_data_addr, data to save user data. user can save own data in this area
|
||||
* by @rda5981_flash_read_3rdparter_data
|
||||
* and @rda5981_flash_write_3rdparter_data
|
||||
* default location:0x180fc000
|
||||
* @user_data_len, user data length, default:4KB
|
||||
* return 0:ok, else:fail
|
||||
*/
|
||||
int rda5981_set_user_data_addr(const unsigned int sys_data_addr,
|
||||
const unsigned int user_data_addr, const unsigned int user_data_len);
|
||||
|
||||
/*
|
||||
* function: erase flash
|
||||
* @addr: mast be 4k alignment
|
||||
* @len: must be 4k alignment. (package 64KB erase and 4KB erase for different condition automatically)
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_erase_flash(unsigned int addr, unsigned int len);
|
||||
|
||||
/*
|
||||
* function: write flash
|
||||
* @addr: mast be 256 alignment
|
||||
* @buf: data to be written, best be 4 alignment
|
||||
* @len: buffer len, mast be 4 alignment
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_write_flash(unsigned int addr, char *buf, unsigned int len);
|
||||
|
||||
/*
|
||||
* function: read flash to @buf
|
||||
* @addr: best be 4 alignment
|
||||
* @buf: best be 4 alignment
|
||||
* @len: buffer len
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_read_flash(unsigned int addr, char *buf, unsigned int len);
|
||||
|
||||
/*
|
||||
* function: read user data
|
||||
* @data: data to read
|
||||
* @len: length of data in byte
|
||||
* @flag: user data flag
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_read_user_data(unsigned char *data, unsigned short len, unsigned int flag);
|
||||
|
||||
/*
|
||||
* function: write user data
|
||||
* @data: data to write
|
||||
* @len: length of data in byte
|
||||
* @flag: user data flag
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_write_user_data(unsigned char *data, unsigned short len, unsigned int flag);
|
||||
|
||||
/*
|
||||
* function: erase user data
|
||||
* @flag: user data flag
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_erase_user_data(unsigned int flag);
|
||||
|
||||
/*
|
||||
* function: update tx power from efuse data, for reg 11F and 120
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int update_tx_power_from_efuse(void);
|
||||
|
||||
/*
|
||||
* function: update xtal calibration from efuse data, for reg DA
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int update_xtal_cal_from_efuse(void);
|
||||
|
||||
/*
|
||||
* function: update mac addr from flash data
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int update_mac_addr_from_efuse(void);
|
||||
|
||||
/*
|
||||
* function: update tx power from flash data, Deprecated version
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int update_tx_power_from_flash(void);
|
||||
|
||||
/*
|
||||
* function: update tx power from flash data, for reg 8A
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int update_tx_power_rf_from_flash(void);
|
||||
|
||||
/*
|
||||
* function: update tx power from flash data, for reg 11F and 120
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int update_tx_power_phy_from_flash(void);
|
||||
|
||||
/*
|
||||
* function: update xtal calibration from flash data
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int update_xtal_cal_from_flash(void);
|
||||
|
||||
/*
|
||||
* function: update mac addr from flash data
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int update_mac_addr_from_flash(void);
|
||||
|
||||
/*
|
||||
* function: write rf reg
|
||||
* @reg: rf reg data
|
||||
* @value: rf reg value
|
||||
* return: 0:success, else:fail
|
||||
* eg: 0x00DA:xtal calibration
|
||||
*/
|
||||
int wland_rf_write(unsigned short reg, unsigned short value);
|
||||
|
||||
/*
|
||||
* function: write rf reg
|
||||
* @reg: rf reg data
|
||||
* @value: rf reg value
|
||||
* @len : value length
|
||||
* return: 0:success, else:fail
|
||||
* eg: 0x008A:tx power rf
|
||||
*/
|
||||
int wland_rf_write_all_channels(unsigned short reg, unsigned short *value, unsigned short len);
|
||||
|
||||
/*
|
||||
* function: read rf reg
|
||||
* @reg: rf reg data
|
||||
* @value: rf reg value
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_rf_read(unsigned short reg, unsigned short *value);
|
||||
|
||||
/*
|
||||
* function: read rf reg
|
||||
* @reg: rf reg data
|
||||
* @value: rf reg value
|
||||
* return: 0:success, else:fail
|
||||
* eg: 0x008A:tx power rf
|
||||
*/
|
||||
int wland_rf_read_all_channels(unsigned short reg, unsigned short *value);
|
||||
|
||||
/*
|
||||
* function: write phy reg
|
||||
* @reg: phy reg data
|
||||
* @value: phy reg value
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_phy_write(unsigned int reg, unsigned int value);
|
||||
|
||||
/*
|
||||
* function: write phy reg
|
||||
* @reg: phy reg data
|
||||
* @value: phy reg value
|
||||
* @len : value length
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_phy_write_all_channels(unsigned int reg, unsigned int *value, unsigned short len);
|
||||
|
||||
/*
|
||||
* function: read phy reg
|
||||
* @reg: phy reg data
|
||||
* @value: phy reg value
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_phy_read(unsigned int reg, unsigned int *value);
|
||||
|
||||
/*
|
||||
* function: read phy reg
|
||||
* @reg: phy reg data
|
||||
* @value: phy reg value
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_phy_read_all_channels(unsigned int reg, unsigned int *value);
|
||||
|
||||
/* efuse API start */
|
||||
/* Efuse CAN ONLY WRITE ONCE! DO NOT CALL THESE API IF YOU DO KNOW WHAT THEY MEANS!!! */
|
||||
|
||||
/*
|
||||
* function: read all efuse
|
||||
* @value: buffer to store efuse data, 28 bytes
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_read_efuse(unsigned char *value);
|
||||
|
||||
/*
|
||||
* function: read tx power from efuse
|
||||
* @tx_power: 2 bytes, first is mode g/n(range 0x25~0x54), second is mode b(range 0x15~0x54).
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_read_tx_power_from_efuse(unsigned char *tx_power);
|
||||
|
||||
/*
|
||||
* function: read tx power from efuse
|
||||
* @tx_power: 2 bytes, first is mode g/n(range 0x25~0x54), second is mode b(range 0x15~0x54)
|
||||
* @len: must be 2
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_write_tx_power_to_efuse(unsigned char *tx_power, unsigned char len);
|
||||
|
||||
/*
|
||||
* function: read xtal cal from efuse
|
||||
* @xtal_cal: 1 byte, maximum 0x7F
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_read_xtal_cal_from_efuse(unsigned char *cal_val);
|
||||
|
||||
/*
|
||||
* function: write xtal cal to efuse
|
||||
* @xtal_cal: 1 byte, maximum 0x7F
|
||||
* @len : must be 1
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_write_xtal_cal_to_efuse(unsigned char *xtal_cal, unsigned char len);
|
||||
|
||||
/*
|
||||
* function: write mac to efuse
|
||||
* @xtal_cal: 6 bytes
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_read_mac_addr_from_efuse(unsigned char *mac_addr);
|
||||
|
||||
/*
|
||||
* function: write mac to efuse
|
||||
* @xtal_cal: 6 bytes
|
||||
* @len : must be 6
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_write_mac_addr_to_efuse(unsigned char*mac_addr, unsigned char len);
|
||||
/* efuse API end */
|
||||
|
||||
/*
|
||||
* function: start rf test
|
||||
* @argc: number of argv
|
||||
* @argv: args for test, 6 elements for tx test, 4 elements for rx test
|
||||
* @is_tx: 1 for tx test, 0 for rx test
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_start_rf_test(unsigned int argc, unsigned int *argv, unsigned int is_tx);
|
||||
|
||||
/*
|
||||
* function: stop rx test
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_stop_rx_test(void);
|
||||
|
||||
/*
|
||||
* function: get rf test result
|
||||
* @result buffer to store rx result
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_get_rx_result(char *result);
|
||||
|
||||
/*
|
||||
* function: restart rx test, use last rx test args
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_restart_rx_test(void);
|
||||
|
||||
/*
|
||||
* function: stop tx test
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_stop_tx_test(void);
|
||||
|
||||
/*
|
||||
* function: restart tx test, use last tx test args
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_restart_tx_test(void);
|
||||
|
||||
#define RDA5981_FIRMWARE_INFO_ADDR 0x18003000
|
||||
/*
|
||||
* function: reboot to assigned addr (onece).
|
||||
* reboot to rf test mode, not for OTA
|
||||
* @firmware_info_addr: firmware info addr, depend on your flash layout
|
||||
* @reboot_addr: reboot addr, 0x18001000-0x1840000
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_reboot_to_addr(unsigned int firmware_info_addr, unsigned int reboot_addr);
|
||||
|
||||
/*
|
||||
* function: read reg and corresponding value related to test mode stored in flash
|
||||
* @reg: reg to read
|
||||
* @value: buffer to store value
|
||||
* @flag: user data flag
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_read_user_data_regs(unsigned char *reg, unsigned char *value, unsigned int flag);
|
||||
|
||||
/*
|
||||
* function: write reg and corresponding value related to test mode stored in flash
|
||||
* @reg: reg to write
|
||||
* @value: buffer that stores value
|
||||
* @flag: user data flag
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_write_user_data_regs(unsigned char *reg, unsigned char *value, unsigned int flag);
|
||||
|
||||
/*
|
||||
* function: erase reg and corresponding value related to test mode stored in flash
|
||||
* @reg: reg to erase
|
||||
* @flag: user data flag
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_erase_user_data_regs(unsigned char *reg, unsigned int flag);
|
||||
|
||||
/*
|
||||
* function: get flash Manufacturer ID
|
||||
* @mid:
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_flash_get_mid(unsigned char *mid);
|
||||
|
||||
/*
|
||||
* function: get flash Device ID
|
||||
* @did:
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_flash_get_did(unsigned char *did);
|
||||
|
||||
/*
|
||||
* function: get flash ID
|
||||
* @mid:
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int rda5981_flash_get_jdid(unsigned short *jdid);
|
||||
|
||||
/*
|
||||
* function: read mac reg
|
||||
* @reg: mac reg data
|
||||
* @value: mac reg value
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_mac_reg_read(unsigned short reg, unsigned int *value);
|
||||
|
||||
/*
|
||||
* function: write mac reg
|
||||
* @reg: mac reg data
|
||||
* @value: mac reg value
|
||||
* return: 0:success, else:fail
|
||||
*/
|
||||
int wland_mac_reg_write(unsigned short reg, unsigned int value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,216 @@
|
|||
/* Copyright (c) 2019 Unisoc Communications Inc.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if 1
|
||||
#ifndef _RDA_SYS_WRAPPER_H_
|
||||
#define _RDA_SYS_WRAPPER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Alarm */
|
||||
/**
|
||||
* @brief : get current time in units of micro second
|
||||
* @param[in] :
|
||||
* @param[out]:
|
||||
* @return : return time value with uint32 type
|
||||
*/
|
||||
extern unsigned long rda_get_cur_time_ms(void);
|
||||
|
||||
/**
|
||||
* @brief : create an alarm with given function, return timer handle
|
||||
* @param[in] : func(callback)/data(pass to func)/mode(once or periodic)
|
||||
* @param[out]:
|
||||
* @return : return timer handle, a pointer to the timer structure, non-zero is valid
|
||||
*/
|
||||
extern void * rda_alarm_create_v2(void *func, unsigned int data, unsigned int mode);
|
||||
extern void * rda_alarm_create(void *func, unsigned int data);
|
||||
|
||||
/**
|
||||
* @brief : delete an alarm with given handle, then reset the handle
|
||||
* @param[in] : *handle(pointer to the timer structure)
|
||||
* @param[out]: **handle(address of the handle variable)
|
||||
* @return :
|
||||
*/
|
||||
extern int rda_alarm_delete(void **handle);
|
||||
|
||||
/**
|
||||
* @brief : start an alarm, raise a function call after given timeout delay
|
||||
* @param[in] : handle(pointer to the timer structure)/timeout(micro second)
|
||||
* @param[out]:
|
||||
* @return :
|
||||
*/
|
||||
extern int rda_alarm_start(void *handle, unsigned int timeout_ms);
|
||||
|
||||
/**
|
||||
* @brief : stop an alarm, will not raise a function call any more
|
||||
* @param[in] : handle(pointer to the timer structure)
|
||||
* @param[out]:
|
||||
* @return :
|
||||
*/
|
||||
extern int rda_alarm_stop(void *handle);
|
||||
|
||||
|
||||
/* Semaphore */
|
||||
/**
|
||||
* @brief : create a semaphore
|
||||
* @param[in] : name and initial valve of semaphore
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
extern void* rda_sem_create(unsigned int count);
|
||||
|
||||
/**
|
||||
* @brief : wait a semaphore
|
||||
* @param[in] : name of semaphore
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
extern int rda_sem_wait(void *sem, unsigned int millisec);
|
||||
|
||||
/**
|
||||
* @brief : release a semaphore
|
||||
* @param[in] : name of semaphore
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
extern int rda_sem_release(void *sem);
|
||||
|
||||
/**
|
||||
* @brief : delete a semaphore
|
||||
* @param[in] : name of semaphore
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
extern int rda_sem_delete(void *sem);
|
||||
|
||||
|
||||
/* Queue */
|
||||
/**
|
||||
* @brief : create a message queue
|
||||
* @param[in] : size of message queue
|
||||
* @param[out]:
|
||||
* @return : return message queue id or NULL if error
|
||||
*/
|
||||
extern void* rda_msgQ_create(unsigned int queuesz);
|
||||
|
||||
/**
|
||||
* @brief : put a message to queue
|
||||
* @param[in] : message queue id, message value and wait time
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
extern int rda_msg_put(void *msgQId, unsigned int msg, unsigned int millisec);
|
||||
|
||||
/**
|
||||
* @brief : get a message from queue
|
||||
* @param[in] : message queue id, message value and wait time
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
extern int rda_msg_get(void *msgQId, unsigned int *value, unsigned int millisec);
|
||||
|
||||
/* Mail */
|
||||
/**
|
||||
* @brief : create a mail
|
||||
* @param[in] : mail count/size
|
||||
* @param[out]:
|
||||
* @return : return mail handle
|
||||
*/
|
||||
void* rda_mail_create(unsigned int msgcnt, unsigned int msgsize);
|
||||
|
||||
/**
|
||||
* @brief : get a msg from mail
|
||||
* @param[in] : handler name of mail/mail/wait time
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
int rda_mail_get(void *rdahandle, void *evt, unsigned int wait);
|
||||
|
||||
/**
|
||||
* @brief : put a msg to mail
|
||||
* @param[in] : handler of mail/mail/wait time
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
|
||||
int rda_mail_put(void *rdahandle, void *evt, unsigned int wait);
|
||||
|
||||
/* Mutex */
|
||||
/**
|
||||
* @brief : create a mutex
|
||||
* @param[in] :
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
extern void* rda_mutex_create(void);
|
||||
|
||||
/**
|
||||
* @brief : wait a mutex
|
||||
* @param[in] : id of mutex and wait time
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
extern int rda_mutex_wait(void *rdamutex, unsigned int millisec);
|
||||
|
||||
/**
|
||||
* @brief : release a mutex
|
||||
* @param[in] : id of mutex
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
extern int rda_mutex_realease(void *rdamutex);
|
||||
|
||||
/**
|
||||
* @brief : delete a mutex
|
||||
* @param[in] : id of mutex
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
extern int rda_mutex_delete(void *rdamutex);
|
||||
|
||||
/* Thread */
|
||||
/**
|
||||
* @brief : creat a thread
|
||||
* @param[in] : thread name/thread function/thread fuction argument/stacksize/thread priority
|
||||
* @param[out]:
|
||||
* @return : return thread id
|
||||
*/
|
||||
void* rda_thread_new(const char *pcName, void (*thread)(void *arg), void *arg, int stacksize, int priority);
|
||||
|
||||
/**
|
||||
* @brief : delete a thread
|
||||
* @param[in] : thread id
|
||||
* @param[out]:
|
||||
* @return : return ERR or NO_ERR
|
||||
*/
|
||||
int rda_thread_delete(void* id);
|
||||
|
||||
/**
|
||||
* @brief : get current thread id
|
||||
* @param[in] :
|
||||
* @param[out]:
|
||||
* @return : return thread id
|
||||
*/
|
||||
void* rda_thread_get_id(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _RDA_SYS_WRAPPER_H_ */
|
||||
#endif
|
|
@ -0,0 +1,60 @@
|
|||
/* Copyright (c) 2019 Unisoc Communications Inc.
|
||||
* 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 _WLAND_DBG_H_
|
||||
#define _WLAND_DBG_H_
|
||||
#include <stdio.h>
|
||||
#include "rda5991h_wland.h"
|
||||
#include "wland_types.h"
|
||||
|
||||
extern int wland_dbg_dump;
|
||||
extern int wland_dbg_level;
|
||||
|
||||
#define RDA_WLAND_DBG
|
||||
|
||||
#ifdef RDA_WLAND_DBG
|
||||
#define WLAND_DBG(level, fmt, ...) do {\
|
||||
int dbg_level = D_##level##_LEVEL;\
|
||||
if((dbg_level <= wland_dbg_level)){\
|
||||
printf("%s,"fmt, __func__, ##__VA_ARGS__);\
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
//if frmae_len is zero, get len from frame header
|
||||
static inline void wland_dump_frame(const char* msg, u8 *data, u32 frame_len)
|
||||
{
|
||||
|
||||
u32 len,i;
|
||||
|
||||
if(wland_dbg_dump == 1) {
|
||||
if(frame_len != 0) {
|
||||
len = frame_len;
|
||||
} else {
|
||||
len = data[0] | ((data[1]&0x0f) << 8);
|
||||
}
|
||||
printf("%s : ",msg);
|
||||
for(i=0; i<len; i++)
|
||||
printf("%02x ", *(data+i));
|
||||
printf("\r\nframe_len=%d\r\n", len);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#else
|
||||
#define WLAND_DBG(level, fmt, ...)
|
||||
static inline void wland_dump_frame(const char* msg, u8 *data, u32 frame_len)
|
||||
{}
|
||||
#endif
|
||||
#endif /*_WLAND_DBG_H_*/
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue