Skip to content

Commit fc465e7

Browse files
author
Arto Kinnunen
committed
Merge commit '93c77e83625be3989aecb9b3c2b7e930b34eb529'
* commit '93c77e83625be3989aecb9b3c2b7e930b34eb529': Squashed 'features/nanostack/sal-stack-nanostack/' changes from cc03296..b3fe574
2 parents 1159fa3 + 93c77e8 commit fc465e7

File tree

98 files changed

+5558
-1355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+5558
-1355
lines changed

features/nanostack/sal-stack-nanostack/README.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,29 @@ ARM Mesh networking stack
33

44
This repository contains the ARM mesh networking stack that provides support for the following mesh protocols:
55

6-
* 6LoWPAN with Neighbor Discovery (ND) and Mesh Link Establishment (MLE)
7-
* Thread
8-
* Wi-SUN
6+
* 6LoWPAN with Neighbor Discovery (ND) and Mesh Link Establishment (MLE)
7+
* Wi-SUN
98

10-
All networking stacks are using IEEE 802.15.4 based radios.
9+
All networking stacks are using IEEE 802.15.4 based radios.
1110

1211
The full documentation is hosted in [Mbed OS documentation](https://os.mbed.com/docs/mbed-os/latest/reference/mesh-tech.html).
1312

14-
On mbed OS, mesh networking stacks can be used through [Mbed Mesh API](https://os.mbed.com/docs/mbed-os/latest/apis/mesh-api.html) and [Network Socket API](https://os.mbed.com/docs/mbed-os/v5.11/apis/network-socket.html).
13+
On mbed OS, mesh networking stacks can be used through [Mbed Mesh API](https://os.mbed.com/docs/mbed-os/latest/apis/mesh-api.html) and [Network Socket API](https://os.mbed.com/docs/mbed-os/latest/apis/network-socket.html).
1514

1615
To see, how the mesh networking stack works, check the example application [mbed-os-example-mesh-minimal](https://github.com/ARMmbed/mbed-os-example-mesh-minimal).
1716

18-
19-
##6LoWPAN with ND and MLE
17+
18+
## 6LoWPAN with ND and MLE
2019

2120
This networking stack is using standard 6LoWPAN and uses:
2221

2322
* Neighbor Discovery Protocol ([RFC4861](https://tools.ietf.org/html/rfc4861)) to locate other devices in the mesh network.
2423
* Mesh-Link-Establishment ([draft-kelsey-intarea-mesh-link-establishment-06](https://tools.ietf.org/html/draft-kelsey-intarea-mesh-link-establishment-06)) is used for establishing and configuring secure radio links.
25-
26-
##Thread
27-
Thread is standardized by [Thread group](https://www.threadgroup.org/).
28-
29-
![](docs/img/thread_certified.png)
3024

31-
mbed OS is now a Thread Certified Component. Using IPv6 with 6LoWPAN as the foundation, Thread technology provides a low-power, self-healing mesh network designed for the home.
3225

33-
##Wi-SUN
26+
## Wi-SUN
3427
Wi-SUN (Smart Utility Networks) specification is standardized by [Wi-SUN Alliance](https://www.wi-sun.org/).
3528

36-
Mbed OS release 5.12 contains the initial Mbed Wi-SUN FAN implementation. Functionality of the Mbed Wi-SUN network stack will be updated when the Wi-SUN protocol is specified further.
3729

3830
## License
3931

Binary file not shown.

features/nanostack/sal-stack-nanostack/nanostack/fhss_config.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ typedef struct fhss_configuration {
8888
*/
8989
typedef int32_t fhss_vendor_defined_cf(const fhss_api_t *api, uint16_t slot, uint8_t eui64[8], uint16_t bsi, uint16_t number_of_channels);
9090

91+
/**
92+
* \brief Struct fhss_config_parameters defines FHSS configuration parameters.
93+
*
94+
*/
95+
typedef struct fhss_config_parameters {
96+
/** Number of channel retries defines how many consecutive channels are used when retransmitting a frame after initial transmission channel. */
97+
uint8_t number_of_channel_retries;
98+
} fhss_config_parameters_t;
99+
100+
91101
/**
92102
* \brief Struct fhss_ws_configuration defines configuration of WS FHSS.
93103
*/
@@ -125,6 +135,9 @@ typedef struct fhss_ws_configuration {
125135
/** Vendor defined channel function. */
126136
fhss_vendor_defined_cf *vendor_defined_cf;
127137

138+
/** Configuration parameters. */
139+
fhss_config_parameters_t config_parameters;
140+
128141
} fhss_ws_configuration_t;
129142

130143
/**

features/nanostack/sal-stack-nanostack/nanostack/fhss_test_api.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ extern "C" {
3939
*/
4040
int8_t fhss_set_optimal_packet_length(const fhss_api_t *fhss_api, uint16_t packet_length);
4141

42+
/**
43+
* \brief Set number of channel retries
44+
*
45+
* \param fhss_api FHSS instance.
46+
* \param number_of_channel_retries Number of channel retries
47+
*
48+
* \return 0 Success
49+
* \return -1 Failure
50+
*/
51+
int8_t fhss_set_number_of_channel_retries(const fhss_api_t *fhss_api, uint8_t number_of_channel_retries);
52+
4253
#ifdef __cplusplus
4354
}
4455
#endif

features/nanostack/sal-stack-nanostack/nanostack/mlme.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ typedef enum {
264264
macAutoRequestKeyIndex = 0x7b, /*<The index of the key used for automatic data*/
265265
macDefaultKeySource = 0x7c, /*<Default key source*/
266266
//NON standard extension
267+
macCCAThresholdStart = 0xf4, /*< Start automatic CCA threshold */
268+
macDevicePendingAckTrig = 0xf5, /*< Trig Pending ACK for Accepted Data packet for temporary neighbour */
267269
mac802_15_4Mode = 0xf6, /*<IEEE 802.15.4 mode*/
268270
macDeviceDescriptionPanIDUpdate = 0xf7, /*<Thread pending link update case this will update device descrioton list pan-id to new one*/
269271
macTXPower = 0xf8, /*<TX output power*/

features/nanostack/sal-stack-nanostack/nanostack/ns_file_system.h

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,109 @@ int ns_file_system_set_root_path(const char *root_path);
5050
*/
5151
char *ns_file_system_get_root_path(void);
5252

53+
/**
54+
* \brief NS file handle
55+
*
56+
*/
57+
typedef void *NS_FILE;
58+
59+
/**
60+
* File open callback
61+
*
62+
* Depending on underlying file system file open for read for non-existing
63+
* files can return success. In that case file read will fail.
64+
*
65+
* \param filename filename
66+
* \param mode can be either "r" or "w"
67+
*
68+
* \return file handle
69+
* \return NULL on error
70+
*
71+
*/
72+
typedef NS_FILE(*ns_file_open)(const char *filename, const char *mode);
73+
74+
/**
75+
* File close callback
76+
*
77+
* \param handle file handle
78+
*
79+
* \return 0 on success
80+
* \return < 0 in case of errors
81+
*
82+
*/
83+
typedef int (*ns_file_close)(NS_FILE *handle);
84+
85+
/**
86+
* File remove callback
87+
*
88+
* \param filename filename
89+
*
90+
* \return 0 on success
91+
* \return < 0 in case of errors
92+
*
93+
*/
94+
typedef int (*ns_file_remove)(const char *filename);
95+
96+
/**
97+
* File write callback
98+
*
99+
* Write is not stream write. The whole file is written from start to end
100+
* and if function is called again, previous file content is replaced with
101+
* new content.
102+
*
103+
* \param handle file handle
104+
* \param buffer buffer
105+
* \param buffer buffer size
106+
*
107+
* \return bytes written
108+
*
109+
*/
110+
typedef size_t (*ns_file_write)(NS_FILE *handle, const void *buffer, size_t size);
111+
112+
/**
113+
* File read callback
114+
*
115+
* Read is not stream read. The whole file is read from start to end
116+
* and if function is called again, read is started from start again.
117+
*
118+
* \param handle file handle
119+
* \param buffer buffer
120+
* \param size buffer size
121+
*
122+
* \return bytes written
123+
*
124+
*/
125+
typedef size_t (*ns_file_read)(NS_FILE *handle, void *buffer, size_t size);
126+
127+
/**
128+
* File size callback
129+
*
130+
* Reads file size.
131+
*
132+
* \param handle file handle
133+
* \param size file size
134+
*
135+
* \return 0 on success
136+
* \return < 0 in case of reading file size is not supported
137+
*
138+
*/
139+
typedef int (*ns_file_size)(NS_FILE *handle, size_t *size);
140+
141+
/**
142+
* File callbacks set
143+
*
144+
* Sets file handling callbacks to nanostack.
145+
*
146+
* \param open file open callback
147+
* \param close file close callback
148+
* \param remove file remove callback
149+
* \param write file write callback
150+
* \param read file read callback
151+
* \param size file size callback
152+
*
153+
*/
154+
void ns_file_system_callbacks_set(ns_file_open open, ns_file_close close, ns_file_remove remove, ns_file_write write, ns_file_read read, ns_file_size size);
155+
53156
#ifdef __cplusplus
54157
}
55158
#endif
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2020, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/**
19+
* \file ns_time_api.h
20+
* \brief Nanostack time API
21+
*
22+
* This is Nanostack time API.
23+
*
24+
*/
25+
26+
#ifndef NS_TIME_API_H_
27+
#define NS_TIME_API_H_
28+
29+
#include "ns_types.h"
30+
31+
/**
32+
* System time callback.
33+
*
34+
* Callback shall return the system time in seconds after 1970.
35+
*
36+
* \param seconds system time in seconds
37+
*
38+
*/
39+
typedef uint64_t ns_time_api_system_time_callback(void);
40+
41+
/**
42+
* System time callback set.
43+
*
44+
* Sets callback for the system time.
45+
*
46+
* \param callback system time callback
47+
*
48+
*/
49+
void ns_time_api_system_time_callback_set(ns_time_api_system_time_callback callback);
50+
51+
#endif /* NS_TIME_API_H_ */

features/nanostack/sal-stack-nanostack/nanostack/platform/arm_hal_phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ typedef enum {
8080
PHY_EXTENSION_FILTERING_SUPPORT, /**< Return filtering modes that can be supported by the PHY driver. See phy_link_filters_e */
8181
PHY_EXTENSION_SET_TX_POWER, /**< Set TX output power which is given as percentage of maximum. 0 is the lowest possible TX power and 100 is the highest possible TX power */
8282
PHY_EXTENSION_SET_CCA_THRESHOLD, /**< Set CCA threshold which is given as percentage of maximum threshold. 0 is the lowest(strictest) possible threshold and 100 is the highest possible threshold */
83+
PHY_EXTENSION_SET_CHANNEL_CCA_THRESHOLD, /**< Set CCA threshold which is given as dBm. This value is set in PHY_LINK_CCA_PREPARE callback and PHY driver should update the CCA threshold configuration */
8384
PHY_EXTENSION_SET_802_15_4_MODE /**< Set IEEE 802.15.4 mode as defined by phy_802_15_4_mode_t*/
8485
} phy_extension_type_e;
8586

features/nanostack/sal-stack-nanostack/nanostack/ws_bbr_api.h

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,36 @@
3030

3131
#include "ns_types.h"
3232

33+
/**
34+
* \brief Struct ws_statistics Border router dynamic information.
35+
*/
36+
typedef struct bbr_information {
37+
/** Timestamp of the the device. Can be used as version number*/
38+
uint64_t timestamp;
39+
/** Border router dodag id */
40+
uint8_t dodag_id[16];
41+
/** Address prefix given to devices in network set to 0 if not available*/
42+
uint8_t prefix[8];
43+
/** Address IID of the border router set to 0 if not available*/
44+
uint8_t IID[8];
45+
/** Amount of devices in the network. */
46+
uint16_t devices_in_network;
47+
/** Border router instance identifier defined in RPL */
48+
uint8_t instance_id;
49+
/** RPL version number */
50+
uint8_t version;
51+
} bbr_information_t;
52+
53+
/**
54+
* \brief Struct route_info is parent child relation structure.
55+
*/
56+
typedef struct bbr_route_info {
57+
/** IID of target device public IPv6 address can be formed by combining prefix + IID*/
58+
uint8_t target[8];
59+
/** IID of parent*/
60+
uint8_t parent[8];
61+
} bbr_route_info_t;
62+
3363
/**
3464
* Start backbone border router service.
3565
*
@@ -83,6 +113,49 @@ int ws_bbr_configure(int8_t interface_id, uint16_t options);
83113
*/
84114
void ws_bbr_stop(int8_t interface_id);
85115

116+
/**
117+
* Get border router information
118+
*
119+
* \param interface_id interface ID of the Wi-SUN network
120+
* \param info_ptr Structure given to stack where information is stored
121+
*
122+
* \return 0 on success
123+
* \return <0 in case of errors
124+
*
125+
*/
126+
int ws_bbr_info_get(int8_t interface_id, bbr_information_t *info_ptr);
127+
128+
/**
129+
* Routing table get
130+
*
131+
* Table is Parent child relation using the Global address IID of the devices
132+
* To get the full IPv6 address of the device.
133+
* IPv6 = Global Prefix + IID.
134+
*
135+
* Routing table is in the format: 18 bytes per entry
136+
* | Node IID 8 bytes | parent IID 8 bytes |
137+
* | 1122112211221122 | 1111111111111111 |
138+
* | 1133113311331133 | 1111111111111111 |
139+
* | 1144114411441144 | 1111111111111111 |
140+
* | 1155115511551155 | 1122112211221122 |
141+
* | 1166116611661166 | 1122112211221122 |
142+
* | 1177117711771177 | 1155115511551155 |
143+
* | 1188118811881188 | 1177117711771177 |
144+
*
145+
* Order is not assured only parent child link is given in random order
146+
*
147+
* Return value is device amount in network divided by 16 bytes per route entry
148+
*
149+
* \param interface_id interface ID of the Wi-SUN network
150+
* \param table_ptr Application allocated memory block where routing table is written.
151+
* \param table_len Length of the table allocated by application given as amount of entries.
152+
*
153+
* \return 0 - x on success indicates amount of bytes written to the table_ptr
154+
* \return <0 in case of errors
155+
*
156+
*/
157+
int ws_bbr_routing_table_get(int8_t interface_id, bbr_route_info_t *table_ptr, uint16_t table_len);
158+
86159
/**
87160
* Remove node's keys from border router
88161
*
@@ -243,4 +316,40 @@ int ws_bbr_pan_configuration_get(int8_t interface_id, uint16_t *pan_id);
243316
*/
244317
int ws_bbr_pan_configuration_validate(int8_t interface_id, uint16_t pan_id);
245318

319+
/**
320+
* ws_bbr_key_storage_memory_set sets memory used for key storages
321+
*
322+
* This functions can be used to set memory used by EAPOL key storage. When memory
323+
* areas are set, module does not allocate memory internally from heap.
324+
*
325+
* \param interface_id Network interface ID.
326+
* \param key_storages_number number of memory areas.
327+
* \param key_storage_size array of memory area sizes.
328+
* \param key_storages array of memory area start pointers.
329+
*
330+
* \return < 0 failure
331+
* \return >= 0 success
332+
*
333+
*/
334+
int ws_bbr_key_storage_memory_set(int8_t interface_id, uint8_t key_storages_number, const uint16_t *key_storage_size, void **key_storages);
335+
336+
/**
337+
* ws_bbr_key_storage_settings_set sets key storage settings
338+
*
339+
* This functions can be used to set the settings of EAPOL key storage.
340+
* Allocation max number and allocation size sets the settings that are used when key storage
341+
* memory is allocated dynamically from heap. These settings must be set before (first) interface
342+
* up and shall not be set if key storage memory is set by ws_pae_key_storage_memory_set() call.
343+
*
344+
* \param interface_id Network interface ID.
345+
* \param alloc_max_number maximum number of allocation made to dynamic memory.
346+
* \param alloc_size size of each allocation.
347+
* \param storing_interval interval in which the check to store to NVM is made.
348+
*
349+
* \return < 0 failure
350+
* \return >= 0 success
351+
*
352+
*/
353+
int ws_bbr_key_storage_settings_set(int8_t interface_id, uint8_t alloc_max_number, uint16_t alloc_size, uint16_t storing_interval);
354+
246355
#endif /* WS_BBR_API_H_ */

0 commit comments

Comments
 (0)