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

Commit 59fe586

Browse files
author
Jarkko Paso
committed
FHSS: removed allocation of scramble table
- This table should always exist with FHSS
1 parent 1ca1d0b commit 59fe586

File tree

4 files changed

+0
-22
lines changed

4 files changed

+0
-22
lines changed

source/Service_Libs/fhss/fhss.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#define TRACE_GROUP "fhss"
3737

3838
static int fhss_reset(fhss_structure_t *fhss_structure);
39-
static void fhss_destroy_scramble_table(fhss_structure_t *fhss_structure);
4039
static bool fhss_is_bc_sending_superframe(fhss_structure_t *fhss_structure);
4140
static bool fhss_check_remaining_tx_time(fhss_structure_t *fhss_structure, uint16_t tx_length, uint8_t phy_header_length, uint8_t phy_tail_length);
4241
static bool fhss_is_there_common_divisor(uint16_t i, uint8_t j);
@@ -529,10 +528,6 @@ static bool fhss_is_there_common_divisor(uint16_t i, uint8_t j)
529528
static int fhss_generate_scramble_table(fhss_structure_t *fhss_structure)
530529
{
531530
uint8_t j = 2;
532-
fhss_structure->bs->fhss_scramble_table = ns_dyn_mem_alloc(MAX_SCRAMBLE_TABLE_INDEXES);
533-
if (fhss_structure->bs->fhss_scramble_table == NULL) {
534-
return -1;
535-
}
536531
// Generate indexes to extend the channel sequence. Generated indexes cannot have common divisors with value number_of_channels.
537532
for(int i=0; i<MAX_SCRAMBLE_TABLE_INDEXES;)
538533
{
@@ -641,7 +636,6 @@ static int fhss_reset(fhss_structure_t *fhss_structure)
641636
if (!fhss_structure) {
642637
return -1;
643638
}
644-
fhss_destroy_scramble_table(fhss_structure);
645639
fhss_structure->platform_functions.fhss_timer_stop(fhss_superframe_handler, fhss_structure->fhss_api);
646640
fhss_structure->bs->synch_panid = 0xffff;
647641
fhss_beacon_periodic_stop(fhss_structure);
@@ -800,14 +794,6 @@ static void fhss_handle_state_set(const fhss_api_t *api, fhss_states fhss_state,
800794
return;
801795
}
802796

803-
static void fhss_destroy_scramble_table(fhss_structure_t *fhss_structure)
804-
{
805-
if (fhss_structure->bs->fhss_scramble_table) {
806-
ns_dyn_mem_free(fhss_structure->bs->fhss_scramble_table);
807-
fhss_structure->bs->fhss_scramble_table = NULL;
808-
}
809-
}
810-
811797
static void fhss_beacon_received(fhss_structure_t *fhss_structure, const uint8_t *synch_info, const uint32_t elapsed_time)
812798
{
813799

test/nanostack/unittest/service_libs/fhss_beacon_tasklet/test_fhss_beacon_tasklet.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@
2828

2929
static fhss_structure_t fhss_structure;
3030
static fhss_bs_t bs;
31-
static fhss_scramble[MAX_SCRAMBLE_TABLE_INDEXES];
3231

3332
static init_fhss_struct(void)
3433
{
35-
bs.fhss_scramble_table = fhss_scramble;
3634
fhss_structure.bs = &bs;
3735
}
3836

test/nanostack/unittest/service_libs/fhss_channel/test_fhss_channel.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ static uint16_t rand_value = 0;
3030
static int rand_call_cnt = 0;
3131
static fhss_structure_t fhss_struct;
3232
static fhss_bs_t bs;
33-
static fhss_scramble[MAX_SCRAMBLE_TABLE_INDEXES];
3433

3534
static init_fhss_struct(void)
3635
{
37-
bs.fhss_scramble_table = fhss_scramble;
3836
fhss_struct.bs = &bs;
3937
}
4038

@@ -398,7 +396,6 @@ bool test_fhss_change_to_tx_channel()
398396
uint8_t destination_address[8] = {0, 0, 0, 0, 0, 0, 0 , 1};
399397
init_fhss_struct();
400398
// Must allocate scramble stable
401-
fhss_struct.bs->fhss_scramble_table = malloc(20);
402399
fhss_struct.number_of_channels = 50;
403400
fhss_struct.bs->synch_configuration.fhss_number_of_bc_channels = 10;
404401
fhss_struct.rx_channel = 10;
@@ -424,7 +421,6 @@ bool test_fhss_change_to_tx_channel()
424421
if (fhss_callbacks_stub.uint8_value != 20) {
425422
return false;
426423
}
427-
free(fhss_struct.bs->fhss_scramble_table);
428424
return true;
429425
}
430426

test/nanostack/unittest/service_libs/fhss_statistics/test_fhss_statistics.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@
2626
static fhss_structure_t fhss_struct;
2727
static fhss_bs_t bs;
2828
static fhss_statistics_t fhss_stats_ptr;
29-
static fhss_scramble[MAX_SCRAMBLE_TABLE_INDEXES];
3029

3130
static init_fhss_struct(void)
3231
{
3332
memset(&fhss_stats_ptr, 0, sizeof(fhss_statistics_t));
3433
bs.fhss_stats_ptr = &fhss_stats_ptr;
35-
bs.fhss_scramble_table = fhss_scramble;
3634
fhss_struct.bs = &bs;
3735
}
3836

0 commit comments

Comments
 (0)