summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2010-09-26 21:50:00 +0200
committerSylvain Munaut <tnt@246tNt.com>2010-09-28 08:04:18 +0200
commit1b6c2593ebd3066f144a085dd0495c89928106a8 (patch)
tree5ea63fbb24c2aab1f784aae2516004ea3170abb9
parentaef1e05d9aa862ddf3816e8d04a523aae35b7845 (diff)
fw/layer1: Introduce prim_utils.c for shared helper betwee primitives
Currently only share the idle frame pattern. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r--src/target/firmware/include/layer1/prim.h3
-rw-r--r--src/target/firmware/layer1/Makefile2
-rw-r--r--src/target/firmware/layer1/prim_tx_nb.c4
-rw-r--r--src/target/firmware/layer1/prim_utils.c42
4 files changed, 47 insertions, 4 deletions
diff --git a/src/target/firmware/include/layer1/prim.h b/src/target/firmware/include/layer1/prim.h
index bbb8e9cd..3d368ff6 100644
--- a/src/target/firmware/include/layer1/prim.h
+++ b/src/target/firmware/include/layer1/prim.h
@@ -7,6 +7,9 @@
struct l1ctl_fbsb_req;
+/* Utils */
+const uint8_t *pu_get_idle_frame(void);
+
/* Primitives tests/requests */
void l1s_fb_test(uint8_t base_fn, uint8_t fb_mode);
void l1s_sb_test(uint8_t base_fn);
diff --git a/src/target/firmware/layer1/Makefile b/src/target/firmware/layer1/Makefile
index ed61c16d..d6bcbff3 100644
--- a/src/target/firmware/layer1/Makefile
+++ b/src/target/firmware/layer1/Makefile
@@ -5,5 +5,5 @@ layer1_SRCS=avg.c agc.c afc.c sync.c tdma_sched.c tpu_window.c init.c l23_api.c
mframe_sched.c sched_gsmtime.c async.c rfch.c apc.c
layer1_SRCS += prim_pm.c prim_rach.c prim_tx_nb.c prim_rx_nb.c prim_fbsb.c \
- prim_freq.c
+ prim_freq.c prim_utils.c
diff --git a/src/target/firmware/layer1/prim_tx_nb.c b/src/target/firmware/layer1/prim_tx_nb.c
index bff104c7..cea0b9cb 100644
--- a/src/target/firmware/layer1/prim_tx_nb.c
+++ b/src/target/firmware/layer1/prim_tx_nb.c
@@ -53,8 +53,6 @@
static uint32_t last_txnb_fn;
-static const uint8_t ubUui[23] = { 0x01, 0x03, 0x01, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b };
-
/* p1: type of operation (0: one NB, 1: one RACH burst, 2: four NB */
static int l1s_tx_resp(__unused uint8_t p1, __unused uint8_t burst_id,
__unused uint16_t p3)
@@ -103,7 +101,7 @@ static int l1s_tx_cmd(uint8_t p1, uint8_t burst_id, uint16_t p3)
/* If the TX queue is empty, send idle pattern */
if (!msg) {
puts("TX idle pattern\n");
- data = ubUui;
+ data = pu_get_idle_frame();
} else {
puts("TX uplink msg\n");
data = msg->l3h;
diff --git a/src/target/firmware/layer1/prim_utils.c b/src/target/firmware/layer1/prim_utils.c
new file mode 100644
index 00000000..4f77eba8
--- /dev/null
+++ b/src/target/firmware/layer1/prim_utils.c
@@ -0,0 +1,42 @@
+/* Layer 1 Various primitive utilities */
+
+/* (C) 2010 by Sylvain Munaut <tnt@246tNt.com>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <stdint.h>
+
+#include <layer1/sync.h>
+
+
+static const uint8_t ubUui[23] = {
+ /* dummy lapdm header */
+ 0x01, 0x03, 0x01,
+
+ /* fill bytes */
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b
+};
+
+
+const uint8_t *pu_get_idle_frame(void)
+{
+ return ubUui;
+}