summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/layer1/mframe_sched.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-03-01 11:08:38 +0100
committerHarald Welte <laforge@gnumonks.org>2010-03-01 23:48:45 +0100
commit43dd25c49355212a589be9784dd43fa11f626103 (patch)
tree4197455107e977f79d657452e943fc021b4a5e11 /src/target/firmware/layer1/mframe_sched.c
parent2f60aee6d93c509926fc017a80352fff62149992 (diff)
Include channel number and link identifier in L1 DL info
This enables the layer2 to identify on which channel (BCCH/CCCH/SDCCH/TCH/...) the respective message was received. * Encode MFrame Task Number + SACCH info in 'p3' parameter * Generate channel number and link identifier * Decode channel number in layer2 program
Diffstat (limited to 'src/target/firmware/layer1/mframe_sched.c')
-rw-r--r--src/target/firmware/layer1/mframe_sched.c67
1 files changed, 59 insertions, 8 deletions
diff --git a/src/target/firmware/layer1/mframe_sched.c b/src/target/firmware/layer1/mframe_sched.c
index 502d102f..61fbe48b 100644
--- a/src/target/firmware/layer1/mframe_sched.c
+++ b/src/target/firmware/layer1/mframe_sched.c
@@ -31,11 +31,6 @@
#include <layer1/tdma_sched.h>
#include <layer1/mframe_sched.h>
-enum mf_sched_item_flag {
- MF_F_SACCH,
- //MF_F_UL_OFFS_15, /* uplink 15 frames after downlink */
-};
-
/* A multiframe operation which can be scheduled for a multiframe */
struct mframe_sched_item {
/* The TDMA scheduler item that shall be scheduled */
@@ -230,6 +225,61 @@ static const struct mframe_sched_item *sched_set_for_task[32] = {
[MF_TASK_UL_ALL_NB] = mf_tx_all_nb,
};
+/* encodes a channel number according to 08.58 Chapter 9.3.1 */
+uint8_t mframe_task2chan_nr(enum mframe_task mft, uint8_t ts)
+{
+ uint8_t cbits;
+
+ switch (mft) {
+ case MF_TASK_BCCH_NORM:
+ case MF_TASK_BCCH_EXT:
+ cbits = 0x10;
+ break;
+ case MF_TASK_CCCH:
+ case MF_TASK_CCCH_COMB:
+ cbits = 0x12;
+ break;
+ case MF_TASK_SDCCH4_0:
+ cbits = 0x04 + 0;
+ break;
+ case MF_TASK_SDCCH4_1:
+ cbits = 0x04 + 1;
+ break;
+ case MF_TASK_SDCCH4_2:
+ cbits = 0x04 + 2;
+ break;
+ case MF_TASK_SDCCH4_3:
+ cbits = 0x04 + 3;
+ break;
+ case MF_TASK_SDCCH8_0:
+ cbits = 0x08 + 0;
+ break;
+ case MF_TASK_SDCCH8_1:
+ cbits = 0x08 + 1;
+ break;
+ case MF_TASK_SDCCH8_2:
+ cbits = 0x08 + 2;
+ break;
+ case MF_TASK_SDCCH8_3:
+ cbits = 0x08 + 3;
+ break;
+ case MF_TASK_SDCCH8_4:
+ cbits = 0x08 + 4;
+ break;
+ case MF_TASK_SDCCH8_5:
+ cbits = 0x08 + 5;
+ break;
+ case MF_TASK_SDCCH8_6:
+ cbits = 0x08 + 6;
+ break;
+ case MF_TASK_SDCCH8_7:
+ cbits = 0x08 + 7;
+ break;
+ }
+
+ return (cbits << 3) | (ts & 0x7);
+}
+
/* how many TDMA frame ticks should we schedule events ahead? */
#define SCHEDULE_AHEAD 2
@@ -237,8 +287,9 @@ static const struct mframe_sched_item *sched_set_for_task[32] = {
#define SCHEDULE_LATENCY 1
/* (test and) schedule one particular sched_item_set by means of the TDMA scheduler */
-static void mframe_schedule_set(const struct mframe_sched_item *set)
+static void mframe_schedule_set(enum mframe_task task_id)
{
+ const struct mframe_sched_item *set = sched_set_for_task[task_id];
const struct mframe_sched_item *si;
for (si = set; si->sched_set != NULL; si++) {
@@ -247,7 +298,7 @@ static void mframe_schedule_set(const struct mframe_sched_item *set)
if (current == trigger) {
/* FIXME: what to do with SACCH Flag etc? */
tdma_schedule_set(SCHEDULE_AHEAD-SCHEDULE_LATENCY,
- si->sched_set, si->flags);
+ si->sched_set, task_id | (si->flags<<8));
}
}
}
@@ -259,6 +310,6 @@ void mframe_schedule(uint32_t tasks_enabled)
for (i = 0; i < 32; i++) {
if (tasks_enabled & (1 << i))
- mframe_schedule_set(sched_set_for_task[i]);
+ mframe_schedule_set(i);
}
}