Skip to content

Commit 3f66f6a

Browse files
Juha Heiskanenjuhhei01
authored andcommitted
LLC delete added for test purpose
1 parent b48cda0 commit 3f66f6a

File tree

3 files changed

+49
-13
lines changed

3 files changed

+49
-13
lines changed

source/6LoWPAN/ws/ws_llc.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ int8_t ws_llc_create(struct protocol_interface_info_entry *interface, ws_asynch_
9494
*/
9595
void ws_llc_reset(struct protocol_interface_info_entry *interface);
9696

97+
/**
98+
* @brief ws_llc_delete Delete LLC interface. ONLY for Test purpose.
99+
* @param interface Interface pointer
100+
*
101+
*/
102+
int8_t ws_llc_delete(struct protocol_interface_info_entry *interface);
103+
97104
/**
98105
* @brief ws_llc_asynch_request ws asynch message request to all giving channels
99106
* @param interface Interface pointer
@@ -144,13 +151,13 @@ void ws_llc_set_network_name(struct protocol_interface_info_entry *interface, ui
144151
void ws_llc_set_broadcast_schecudule_info(struct protocol_interface_info_entry *interface, uint16_t length, uint8_t *schedule_info);
145152

146153
/**
147-
* @brief @brief ws_llc_set_unitcast_secudule_info data for braodcast schedule WP_PAYLOAD_IE_US_TYPE
154+
* @brief @brief ws_llc_set_unicast_secudule_info data for braodcast schedule WP_PAYLOAD_IE_US_TYPE
148155
* @param interface Interface pointer
149156
* @param schedule_info pointer to Configured shedule data
150157
* @param length configured unicast schedule length
151158
*
152159
*/
153-
void ws_llc_set_unitcast_schecudule_info(struct protocol_interface_info_entry *interface, uint8_t *schedule_info, uint16_t length);
160+
void ws_llc_set_unicast_schecudule_info(struct protocol_interface_info_entry *interface, uint8_t *schedule_info, uint16_t length);
154161

155162
/**
156163
* @brief ws_llc_set_gtkhash Configure WS GTK hash information (Data of WP_PAYLOAD_IE_GTKHASH_TYPE IE element)

source/6LoWPAN/ws/ws_llc_data_service.c

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,19 @@ static int8_t ws_llc_mpx_init(mpx_class_t *mpx_class, int8_t interface_id)
638638
return lowpan_adaptation_interface_mpx_register(interface_id, &mpx_class->mpx_api, MPX_LOWPAN_ENC_USER_ID);
639639
}
640640

641+
static void ws_llc_clean(llc_data_base_t *base)
642+
{
643+
//Clean Message queue's
644+
mcps_purge_t purge_req;
645+
ns_list_foreach_safe(llc_message_t, message, &base->llc_message_list) {
646+
purge_req.msduHandle = message->msg_handle;
647+
llc_message_free(message, base);
648+
base->interface_ptr->mac_api->mcps_purge_req(base->interface_ptr->mac_api, &purge_req);
649+
650+
}
651+
memset(&base->ie_params, 0, sizeof(llc_ie_params_t));
652+
}
653+
641654

642655
int8_t ws_llc_create(struct protocol_interface_info_entry *interface, ws_asynch_ind *asynch_ind_cb, ws_asynch_confirm *asynch_cnf_cb)
643656
{
@@ -667,21 +680,33 @@ int8_t ws_llc_create(struct protocol_interface_info_entry *interface, ws_asynch_
667680
return 0;
668681
}
669682

670-
void ws_llc_reset(struct protocol_interface_info_entry *interface)
683+
int8_t ws_llc_delete(struct protocol_interface_info_entry *interface)
671684
{
672685
llc_data_base_t *base = ws_llc_discover_by_interface(interface);
673686
if (!base) {
674-
return;
687+
return -1;
675688
}
676-
//Clean Message queue's
677-
mcps_purge_t purge_req;
678-
ns_list_foreach_safe(llc_message_t, message, &base->llc_message_list) {
679-
purge_req.msduHandle = message->msg_handle;
680-
llc_message_free(message, base);
681-
base->interface_ptr->mac_api->mcps_purge_req(base->interface_ptr->mac_api, &purge_req);
682689

690+
ws_llc_clean(base);
691+
692+
ns_list_remove(&llc_data_base_list, base);
693+
//Disable Mac extension
694+
base->interface_ptr->mac_api->mac_mcps_extension_enable(base->interface_ptr->mac_api, NULL, NULL);
695+
//Disable Adaptation MPX
696+
lowpan_adaptation_interface_mpx_register(base->interface_ptr->id, NULL, 0);
697+
ns_dyn_mem_free(base);
698+
return 0;
699+
}
700+
701+
702+
703+
void ws_llc_reset(struct protocol_interface_info_entry *interface)
704+
{
705+
llc_data_base_t *base = ws_llc_discover_by_interface(interface);
706+
if (!base) {
707+
return;
683708
}
684-
memset(&base->ie_params, 0, sizeof(llc_ie_params_t));
709+
ws_llc_clean(base);
685710
}
686711

687712
int8_t ws_llc_asynch_request(struct protocol_interface_info_entry *interface, asynch_request_t *request)
@@ -834,7 +859,7 @@ void ws_llc_set_broadcast_schecudule_info(struct protocol_interface_info_entry *
834859
}
835860

836861

837-
void ws_llc_set_unitcast_schecudule_info(struct protocol_interface_info_entry *interface, uint8_t *schedule_info, uint16_t length)
862+
void ws_llc_set_unicast_schecudule_info(struct protocol_interface_info_entry *interface, uint8_t *schedule_info, uint16_t length)
838863
{
839864
llc_data_base_t *base = ws_llc_discover_by_interface(interface);
840865
if (!base) {

source/MAC/IEEE802_15_4/sw_mac.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,11 @@ static int8_t ns_sw_mac_api_enable_mcps_ext(mac_api_t *api, mcps_data_indication
227227

228228
cur->data_conf_ext_cb = data_cnf_cb;
229229
cur->data_ind_ext_cb = data_ind_cb;
230-
mac_store.setup->mac_extension_enabled = true;
230+
if (data_cnf_cb && data_ind_cb) {
231+
mac_store.setup->mac_extension_enabled = true;
232+
} else {
233+
mac_store.setup->mac_extension_enabled = false;
234+
}
231235
return 0;
232236
}
233237

0 commit comments

Comments
 (0)