Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 9ac47a8

Browse files
author
Arto Kinnunen
authored
Adjust WS build configurations (ARMmbed#1744)
-Add ws_empty_functions to contain empty WS API functions -Add fhss_ws_empty_functions to contain empty FHSS WS API functions -Fix unused parameter warning
1 parent c593e2b commit 9ac47a8

File tree

7 files changed

+200
-46
lines changed

7 files changed

+200
-46
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/*
2+
* Copyright (c) 2018, 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+
#include <string.h>
19+
#include "nsconfig.h"
20+
#include "ns_types.h"
21+
#include "ns_trace.h"
22+
#include <ns_list.h>
23+
#include <nsdynmemLIB.h>
24+
#include "NWK_INTERFACE/Include/protocol.h"
25+
#include "6LoWPAN/ws/ws_common.h"
26+
27+
#include "ws_management_api.h"
28+
29+
#ifndef HAVE_WS
30+
int ws_management_node_init(
31+
int8_t interface_id,
32+
char *network_name_ptr,
33+
fhss_timer_t *fhss_timer_ptr)
34+
{
35+
(void)interface_id;
36+
(void)network_name_ptr;
37+
(void)fhss_timer_ptr;
38+
return -1;
39+
}
40+
41+
int ws_management_regulatory_domain_set(
42+
int8_t interface_id,
43+
uint8_t regulatory_domain,
44+
uint8_t operating_class,
45+
uint8_t operating_mode)
46+
{
47+
(void)interface_id;
48+
(void)regulatory_domain;
49+
(void)operating_class;
50+
(void)operating_mode;
51+
return -1;
52+
}
53+
54+
int ws_management_channel_mask_set(
55+
int8_t interface_id,
56+
uint32_t channel_mask[8])
57+
{
58+
(void)interface_id;
59+
(void)channel_mask;
60+
return -1;
61+
}
62+
63+
int ws_management_channel_plan_set(
64+
int8_t interface_id,
65+
uint8_t channel_plan,
66+
uint8_t channel_function,
67+
uint32_t ch0_freq, // Stack can not modify this
68+
uint8_t channel_spacing,// Stack can not modify this
69+
uint8_t number_of_channels)
70+
{
71+
(void)interface_id;
72+
(void)channel_plan;
73+
(void)channel_function;
74+
(void)ch0_freq;
75+
(void)channel_spacing;
76+
(void)number_of_channels;
77+
return -1;
78+
}
79+
80+
int ws_management_fhss_timing_configure(
81+
int8_t interface_id,
82+
uint8_t fhss_uc_dwell_interval,
83+
uint32_t fhss_broadcast_interval,
84+
uint8_t fhss_bc_dwell_interval)
85+
{
86+
(void)interface_id;
87+
(void)fhss_uc_dwell_interval;
88+
(void)fhss_broadcast_interval;
89+
(void)fhss_bc_dwell_interval;
90+
return -1;
91+
}
92+
/* ### test api ### */
93+
int ws_test_pan_size_set(int8_t interface_id, uint16_t pan_size)
94+
{
95+
(void) interface_id;
96+
(void) pan_size;
97+
return -1;
98+
}
99+
100+
#endif // no HAVE_WS
101+

source/6LoWPAN/ws/ws_management_api.c

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@
2828

2929
#define TRACE_GROUP "wsmg"
3030

31+
#ifdef HAVE_WS
32+
3133
int ws_management_node_init(
3234
int8_t interface_id,
3335
char *network_name_ptr,
3436
fhss_timer_t *fhss_timer_ptr)
3537
{
36-
#ifdef HAVE_WS
3738
protocol_interface_info_entry_t *cur;
3839

3940
cur = protocol_stack_interface_info_get_by_id(interface_id);
@@ -46,12 +47,6 @@ int ws_management_node_init(
4647
strncpy(cur->ws_info->network_name,network_name_ptr,32);
4748
cur->ws_info->fhss_timer_ptr = fhss_timer_ptr;
4849
return 0;
49-
#else
50-
(void)interface_id;
51-
(void)network_name_ptr;
52-
(void)fhss_timer_ptr;
53-
return -1;
54-
#endif
5550
}
5651

5752
int ws_management_regulatory_domain_set(
@@ -60,7 +55,6 @@ int ws_management_regulatory_domain_set(
6055
uint8_t operating_class,
6156
uint8_t operating_mode)
6257
{
63-
#ifdef HAVE_WS
6458
uint8_t regulatory_domain_saved;
6559
uint8_t operating_class_saved;
6660
uint8_t operating_mode_saved;
@@ -87,20 +81,12 @@ int ws_management_regulatory_domain_set(
8781
// TODO update fields to llc
8882

8983
return 0;
90-
#else
91-
(void)interface_id;
92-
(void)regulatory_domain;
93-
(void)operating_class;
94-
(void)operating_mode;
95-
return -1;
96-
#endif
9784
}
9885

9986
int ws_management_channel_mask_set(
10087
int8_t interface_id,
10188
uint32_t channel_mask[8])
10289
{
103-
#ifdef HAVE_WS
10490
protocol_interface_info_entry_t *cur;
10591

10692
cur = protocol_stack_interface_info_get_by_id(interface_id);
@@ -109,12 +95,6 @@ int ws_management_channel_mask_set(
10995
}
11096
memcpy(cur->ws_info->hopping_schdule.channel_mask, channel_mask, sizeof(uint32_t)*8);
11197
return 0;
112-
113-
#else
114-
(void)interface_id;
115-
(void)channel_mask;
116-
return -1;
117-
#endif
11898
}
11999

120100
int ws_management_channel_plan_set(
@@ -125,7 +105,6 @@ int ws_management_channel_plan_set(
125105
uint8_t channel_spacing,// Stack can not modify this
126106
uint8_t number_of_channels)
127107
{
128-
#ifdef HAVE_WS
129108
protocol_interface_info_entry_t *cur;
130109

131110
cur = protocol_stack_interface_info_get_by_id(interface_id);
@@ -140,15 +119,6 @@ int ws_management_channel_plan_set(
140119

141120
// TODO update fields to llc
142121
return 0;
143-
#else
144-
(void)interface_id;
145-
(void)channel_plan;
146-
(void)channel_function;
147-
(void)ch0_freq;
148-
(void)channel_spacing;
149-
(void)number_of_channels;
150-
return -1;
151-
#endif
152122
}
153123

154124
int ws_management_fhss_timing_configure(
@@ -157,7 +127,6 @@ int ws_management_fhss_timing_configure(
157127
uint32_t fhss_broadcast_interval,
158128
uint8_t fhss_bc_dwell_interval)
159129
{
160-
#ifdef HAVE_WS
161130
protocol_interface_info_entry_t *cur;
162131

163132
cur = protocol_stack_interface_info_get_by_id(interface_id);
@@ -168,11 +137,6 @@ int ws_management_fhss_timing_configure(
168137
cur->ws_info->hopping_schdule.fhss_broadcast_interval = fhss_broadcast_interval;
169138
cur->ws_info->hopping_schdule.fhss_bc_dwell_interval = fhss_bc_dwell_interval;
170139
return 0;
171-
#else
172-
(void)interface_id;
173-
(void)fhss_uc_dwell_interval;
174-
(void)fhss_broadcast_interval;
175-
(void)fhss_bc_dwell_interval;
176-
return -1;
177-
#endif
178140
}
141+
142+
#endif // HAVE_WS

source/6LoWPAN/ws/ws_test_api.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,14 @@
4242

4343
#define TRACE_GROUP "wste"
4444

45+
#ifdef HAVE_WS
4546

4647
int ws_test_pan_size_set(int8_t interface_id, uint16_t pan_size)
4748
{
48-
#ifdef HAVE_WS
49+
4950
(void) interface_id;
5051
test_pan_size_override = pan_size;
5152
return 0;
52-
#else
53-
(void) interface_id;
54-
(void) pan_size;
55-
return -1;
56-
#endif
5753
}
54+
55+
#endif // HAVE_WS

source/NWK_INTERFACE/protocol_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,8 @@ protocol_interface_info_entry_t *protocol_stack_interface_info_get_by_fhss_api(c
777777
return cur;
778778
}
779779
}
780+
#else
781+
(void)fhss_api;
780782
#endif //HAVE_WS
781783
return NULL;
782784
}

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#define WH_SUB_ID_UTT 1
4343
#define WH_SUB_ID_BT 2
4444

45+
#ifdef HAVE_WS
46+
4547
struct ws_ie_t {
4648
uint8_t *content_ptr;
4749
unsigned length:7;
@@ -629,3 +631,5 @@ int fhss_ws_set_hop_count(fhss_structure_t *fhss_structure, const uint8_t hop_co
629631
fhss_structure->own_hop = hop_count;
630632
return 0;
631633
}
634+
635+
#endif // HAVE_WS
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright (c) 2015-2017, 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+
#include "nsconfig.h"
18+
#include "ns_types.h"
19+
#include "fhss_api.h"
20+
#include "fhss_config.h"
21+
#include "fhss.h"
22+
#include "fhss_common.h"
23+
#include "channel_list.h"
24+
#include "channel_functions.h"
25+
#include "fhss_ws.h"
26+
#include "nsdynmemLIB.h"
27+
#include "common_functions.h"
28+
#include "eventOS_callback_timer.h"
29+
#include "randLIB.h"
30+
#include <string.h>
31+
32+
#ifndef HAVE_WS
33+
34+
fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer)
35+
{
36+
(void) fhss_api;
37+
(void) fhss_configuration;
38+
(void) fhss_timer;
39+
40+
return NULL;
41+
}
42+
43+
int fhss_ws_set_callbacks(fhss_structure_t *fhss_structure)
44+
{
45+
(void) fhss_structure;
46+
return -1;
47+
}
48+
49+
int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8], const broadcast_timing_info_t *bc_timing_info)
50+
{
51+
(void) fhss_structure;
52+
(void) eui64;
53+
(void) bc_timing_info;
54+
55+
return -1;
56+
}
57+
58+
int fhss_ws_remove_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8])
59+
{
60+
(void) fhss_structure;
61+
(void) eui64;
62+
63+
return -1;
64+
}
65+
66+
int fhss_ws_configuration_set(fhss_structure_t *fhss_structure, const fhss_ws_configuration_t *fhss_configuration)
67+
{
68+
(void) fhss_structure;
69+
(void) fhss_configuration;
70+
71+
return -1;
72+
}
73+
74+
int fhss_ws_set_hop_count(fhss_structure_t *fhss_structure, const uint8_t hop_count)
75+
{
76+
(void) fhss_structure;
77+
(void) hop_count;
78+
79+
return -1;
80+
}
81+
82+
#endif // HAVE_WS
83+

sources.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ SRCS += \
2727
source/6LoWPAN/ws/ws_management_api.c \
2828
source/6LoWPAN/ws/ws_bbr_api.c \
2929
source/6LoWPAN/ws/ws_test_api.c \
30+
source/6LoWPAN/ws/ws_empty_functions.c \
3031
source/BorderRouter/border_router.c \
3132
source/Common_Protocols/icmpv6.c \
3233
source/Common_Protocols/icmpv6_prefix.c \
@@ -99,6 +100,7 @@ SRCS += \
99100
source/Service_Libs/fhss/fhss_statistics.c \
100101
source/Service_Libs/fhss/fhss.c \
101102
source/Service_Libs/fhss/fhss_ws.c \
103+
source/Service_Libs/fhss/fhss_ws_empty_functions.c \
102104
source/Service_Libs/fhss/fhss_common.c \
103105
source/Service_Libs/fhss/channel_functions.c \
104106
source/Service_Libs/fhss/channel_list.c \

0 commit comments

Comments
 (0)