summaryrefslogtreecommitdiff
path: root/cesar/bsu/src/bsu.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/bsu/src/bsu.c')
-rw-r--r--cesar/bsu/src/bsu.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/cesar/bsu/src/bsu.c b/cesar/bsu/src/bsu.c
index 333d3b2d6b..da12e6d185 100644
--- a/cesar/bsu/src/bsu.c
+++ b/cesar/bsu/src/bsu.c
@@ -285,24 +285,33 @@ bsu_schedules_merge (bsu_t *ctx, bsu_beacon_t *beacon,
bsu_schedules_merge_process_init (ctx, beacon, &process, bp_index);
while ((sai = bsu_schedules_merge_get_lesser (ctx, beacon, &process)))
{
+ /* A hole is present for the first allocation. It is a beacon region,
+ * BSU should inform the CA with the correct glid (a reserved one).
+ * - When acting as CCo glid is MAC_LID_SPC_CENTRAL.
+ * - When acting as STA glid is MAC_LID_SPC_BEACON_LISTEN. */
+ if (alloc == 0 && sai->stpf && sai->start_time_atu != 0)
+ {
+ u8 glid;
+ if (ctx->is_sta == BSU_UPDATE_STA_TYPE_CCO)
+ glid = MAC_LID_SPC_CENTRAL;
+ else
+ glid = MAC_LID_SPC_BEACON_LISTEN;
+ bsu_schedules_merge__allocation_add (
+ ctx, schedule, alloc, sai->start_time_atu, glid);
+ alloc++;
+ }
/* Add a hole between the previous allocation end this one. */
- if ((alloc
- && sai->stpf
- && MAC_ATU_TO_TCK(sai->start_time_atu) !=
- schedule->allocations[alloc-1].end_offset_tck)
- || (alloc == 0 && sai->stpf && sai->start_time_atu != 0))
+ else if (sai->stpf
+ && MAC_ATU_TO_TCK(sai->start_time_atu)
+ != schedule->allocations[alloc-1].end_offset_tck)
{
- bsu_schedules_merge__allocation_add (ctx, schedule, alloc,
- sai->start_time_atu,
- alloc == 0 ?
- MAC_LID_SPC_BEACON_LISTEN :
- MAC_LID_SPC_HOLE);
+ bsu_schedules_merge__allocation_add (
+ ctx, schedule, alloc, sai->start_time_atu, MAC_LID_SPC_HOLE);
alloc++;
}
/* Add this allocation. */
- bsu_schedules_merge__allocation_add (ctx, schedule, alloc,
- sai->end_time_atu,
- sai->glid | 0x80);
+ bsu_schedules_merge__allocation_add (
+ ctx, schedule, alloc, sai->end_time_atu, sai->glid | 0x80);
alloc++;
}
/* store the number of allocations. */