From be594e911338d9a6e843bcd2aac77267dc095204 Mon Sep 17 00:00:00 2001 From: NĂ©lio Laranjeiro Date: Thu, 5 May 2011 17:19:00 +0200 Subject: cesar/bsu: replace BSU_BEACON_SCHEDULES_MAX by BSU_BEACON_SCHEDULES_NB --- cesar/bsu/beacon/beacon.h | 2 +- cesar/bsu/inc/context.h | 2 +- cesar/bsu/src/bsu.c | 16 ++++++++-------- cesar/bsu/test/utest/src/schedules.c | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cesar/bsu/beacon/beacon.h b/cesar/bsu/beacon/beacon.h index 3abe0477d0..f408689bc9 100644 --- a/cesar/bsu/beacon/beacon.h +++ b/cesar/bsu/beacon/beacon.h @@ -23,7 +23,7 @@ #include "mac/pbproc/pbproc.h" /** Number of schedules information kept from the beacon. */ -#define BSU_BEACON_SCHEDULES_MAX 3 +#define BSU_BEACON_SCHEDULES_NB 3 enum bsu_beacon_direction_t { diff --git a/cesar/bsu/inc/context.h b/cesar/bsu/inc/context.h index cbfbf3b236..0139c156a8 100644 --- a/cesar/bsu/inc/context.h +++ b/cesar/bsu/inc/context.h @@ -101,7 +101,7 @@ struct bsu_t /** Track a new AVLN. */ bool track_new; /** Channel access schedules in use. */ - uint ca_schedules_in_use[BSU_BEACON_SCHEDULES_MAX]; + uint ca_schedules_in_use[BSU_BEACON_SCHEDULES_NB]; /** Is station */ bsu_update_sta_type_t is_sta; /** HAL timer context. */ diff --git a/cesar/bsu/src/bsu.c b/cesar/bsu/src/bsu.c index 8982a423cc..6cc35920d4 100644 --- a/cesar/bsu/src/bsu.c +++ b/cesar/bsu/src/bsu.c @@ -538,7 +538,7 @@ bsu_ca_schedules_available (bsu_t *ctx, uint *indexes) uint i, j; uint nb = 0; bool in_use; - for (i = 0; i < CA_SCHEDULE_NB && nb < BSU_BEACON_SCHEDULES_MAX; i++) + for (i = 0; i < CA_SCHEDULE_NB && nb < BSU_BEACON_SCHEDULES_NB; i++) { in_use = false; for (j = 0; j < COUNT (ctx->ca_schedules_in_use) && !in_use; j++) @@ -574,10 +574,10 @@ bsu_ca_schedule_prepare_missing ( { ca_schedule_t *schedule; uint i, j; - uint ca_index[BSU_BEACON_SCHEDULES_MAX]; + uint ca_index[BSU_BEACON_SCHEDULES_NB]; bsu_ca_schedules_available (ctx, ca_index); /* Get non used schedules from the CA. */ - for (i = start_index, j = 0; i < BSU_BEACON_SCHEDULES_MAX; i++, j++) + for (i = start_index, j = 0; i < BSU_BEACON_SCHEDULES_NB; i++, j++) { /* Get the next channel access index not in use. */ schedule = ca_alloc_get_schedule (ctx->ca, ca_index[j]); @@ -587,7 +587,7 @@ bsu_ca_schedule_prepare_missing ( bp[i].schedule_index = ca_index[j]; } /* Store the current schedules in use. */ - for (i = 0; i < BSU_BEACON_SCHEDULES_MAX; i++) + for (i = 0; i < BSU_BEACON_SCHEDULES_NB; i++) ctx->ca_schedules_in_use[i] = bp[i].schedule_index; } @@ -602,8 +602,8 @@ void bsu_ca_schedules (bsu_t *ctx, bsu_avln_t *avln, uint copy_nb) { uint start_nb; - u32 bpsd[BSU_BEACON_SCHEDULES_MAX]; - ca_beacon_period_t beacon_period[BSU_BEACON_SCHEDULES_MAX]; + u32 bpsd[BSU_BEACON_SCHEDULES_NB]; + ca_beacon_period_t beacon_period[BSU_BEACON_SCHEDULES_NB]; bsu_aclf_beacon_period_start_date (ctx->aclf, bpsd, COUNT (bpsd)); for (start_nb = 0; start_nb < copy_nb; start_nb++) { @@ -616,7 +616,7 @@ bsu_ca_schedules (bsu_t *ctx, bsu_avln_t *avln, uint copy_nb) /* Provide the schedules to the CA. */ BSU_TRACE (SCHEDULES, bpsd[0], bpsd[1], bpsd[2]); ca_alloc_update_beacon_periods ( - ctx->ca, beacon_period, BSU_BEACON_SCHEDULES_MAX); + ctx->ca, beacon_period, BSU_BEACON_SCHEDULES_NB); } /** @@ -762,7 +762,7 @@ bsu_timer_event_process (void *ud) { if (ctx->track_new) { - u32 bpsd[BSU_BEACON_SCHEDULES_MAX]; + u32 bpsd[BSU_BEACON_SCHEDULES_NB]; uint bp = bsu_aclf_beacon_period_tck (ctx->aclf); /* Reset STA clock correction. */ bsu_ntb_clock_configure ( diff --git a/cesar/bsu/test/utest/src/schedules.c b/cesar/bsu/test/utest/src/schedules.c index 1230a55eb3..2bb8d28fa3 100644 --- a/cesar/bsu/test/utest/src/schedules.c +++ b/cesar/bsu/test/utest/src/schedules.c @@ -325,7 +325,7 @@ test_case_track_new (test_t t) test_fail_unless (ctx.bsu->sta_avln->sync.ntb_offset_tck == 0); test_fail_unless (ctx.bsu->sta_avln->sync.fe == 0.0); test_fail_unless (ctx.mac_config.ntb_offset_tck == 0); - for (i = 0; i < BSU_BEACON_SCHEDULES_MAX - 1; i++) + for (i = 0; i < BSU_BEACON_SCHEDULES_NB- 1; i++) { test_fail_unless ( lesseq_mod2p32 ( @@ -371,7 +371,7 @@ test_case_track_new (test_t t) test_fail_unless (ctx.bsu->sta_avln->sync.ntb_offset_tck == 0); test_fail_unless (ctx.bsu->sta_avln->sync.fe == 0.0); test_fail_unless (ctx.mac_config.ntb_offset_tck == 0); - for (i = 0; i < BSU_BEACON_SCHEDULES_MAX - 1; i++) + for (i = 0; i < BSU_BEACON_SCHEDULES_NB - 1; i++) { test_fail_unless ( lesseq_mod2p32 ( @@ -407,7 +407,7 @@ test_case_track_new (test_t t) test_fail_unless (ctx.bsu->track_new); bsu_timer_event_process (ctx.bsu); test_fail_unless (ctx.bsu->track_new == false); - for (i = 0; i < BSU_BEACON_SCHEDULES_MAX - 1; i++) + for (i = 0; i < BSU_BEACON_SCHEDULES_NB - 1; i++) { test_fail_unless ( lesseq_mod2p32 ( -- cgit v1.2.3