summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2010-04-26 20:45:59 +0200
committerSylvain Munaut <tnt@246tNt.com>2010-04-28 10:16:51 +0200
commitafc0ee79c466f74194c19770489d01ce1370f9da (patch)
tree3da3b5f4d973a62c98613f633ba93d7b09e56142 /src
parentce51a07fef40f73f6cf6e500ec0fa4dccebe448c (diff)
fw/layer1: Change the tdma_schedule_set return value to # frames spanned
Previously, it returned the number of item + number of frames spanned by the set. But that value isn't that useful and wasn't used by anyone. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src')
-rw-r--r--src/target/firmware/layer1/tdma_sched.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/target/firmware/layer1/tdma_sched.c b/src/target/firmware/layer1/tdma_sched.c
index 9469369c..82892103 100644
--- a/src/target/firmware/layer1/tdma_sched.c
+++ b/src/target/firmware/layer1/tdma_sched.c
@@ -78,9 +78,9 @@ int tdma_schedule_set(uint8_t frame_offset, const struct tdma_sched_item *item_s
{
struct tdma_scheduler *sched = &l1s.tdma_sched;
uint8_t bucket_nr = wrap_bucket(frame_offset);
- int i;
+ int i, j;
- for (i = 0; 1; i++) {
+ for (i = 0, j = 0; 1; i++) {
const struct tdma_sched_item *sched_item = &item_set[i];
struct tdma_sched_bucket *bucket = &sched->bucket[bucket_nr];
@@ -92,6 +92,7 @@ int tdma_schedule_set(uint8_t frame_offset, const struct tdma_sched_item *item_s
if (sched_item->cb == NULL) {
/* advance to next bucket (== TDMA frame) */
bucket_nr = wrap_bucket(++frame_offset);
+ j++;
continue;
}
/* check for bucket overflow */
@@ -105,7 +106,7 @@ int tdma_schedule_set(uint8_t frame_offset, const struct tdma_sched_item *item_s
bucket->num_items++;
}
- return i;
+ return j;
}
/* Advance TDMA scheduler to the next bucket */