summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSylvain Munaut2010-09-15 09:39:22 +0200
committerSylvain Munaut2010-09-17 20:52:41 +0200
commit664fa9ae0b4519b2026ed6b22fb0eed8720f56c6 (patch)
tree7ee68abb18798ea59b9aaac7704cf3d47e1715dc /src
parentfw/layer1: Properly load the tch dsp param (including various fn) in RX (diff)
downloadosmocom-664fa9ae0b4519b2026ed6b22fb0eed8720f56c6.tar.gz
osmocom-664fa9ae0b4519b2026ed6b22fb0eed8720f56c6.tar.xz
osmocom-664fa9ae0b4519b2026ed6b22fb0eed8720f56c6.zip
fw/dsp: Add function to load dsp ciphering parameters
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src')
-rw-r--r--src/target/firmware/calypso/dsp.c16
-rw-r--r--src/target/firmware/include/calypso/dsp.h1
-rw-r--r--src/target/firmware/layer1/sync.c3
3 files changed, 20 insertions, 0 deletions
diff --git a/src/target/firmware/calypso/dsp.c b/src/target/firmware/calypso/dsp.c
index 317abb5..c4b6bac 100644
--- a/src/target/firmware/calypso/dsp.c
+++ b/src/target/firmware/calypso/dsp.c
@@ -370,6 +370,22 @@ void dsp_load_tch_param(struct gsm_time *next_time,
dsp_api.db_w->d_ctrl_tch = d_ctrl_tch; /* Channel config. */
}
+void dsp_load_ciph_param(int mode, uint8_t *key)
+{
+ dsp_api.ndb->d_a5mode = mode;
+
+ if (!mode || !key)
+ return;
+
+ /* key is expected in the same format as in RSL
+ * Encryption information IE. So we need to load the
+ * bytes backward in A5 unit */
+ dsp_api.ndb->a_kc[0] = (uint16_t)key[7] | ((uint16_t)key[6] << 8);
+ dsp_api.ndb->a_kc[1] = (uint16_t)key[5] | ((uint16_t)key[4] << 8);
+ dsp_api.ndb->a_kc[2] = (uint16_t)key[3] | ((uint16_t)key[2] << 8);
+ dsp_api.ndb->a_kc[3] = (uint16_t)key[1] | ((uint16_t)key[0] << 8);
+}
+
#define SC_CHKSUM_VER (BASE_API_W_PAGE_0 + (2 * (0x08DB - 0x800)))
static void dsp_dump_csum(void)
{
diff --git a/src/target/firmware/include/calypso/dsp.h b/src/target/firmware/include/calypso/dsp.h
index 30dfad1..e232c32 100644
--- a/src/target/firmware/include/calypso/dsp.h
+++ b/src/target/firmware/include/calypso/dsp.h
@@ -30,6 +30,7 @@ void dsp_load_apc_dac(uint16_t apc);
void dsp_load_tch_param(struct gsm_time *next_time,
uint8_t chan_mode, uint8_t chan_type, uint8_t chan_sub,
uint8_t tch_loop, uint8_t sync_tch, uint8_t tn);
+void dsp_load_ciph_param(int mode, uint8_t *key);
void dsp_end_scenario(void);
void dsp_load_rx_task(uint16_t task, uint8_t burst_id, uint8_t tsc);
diff --git a/src/target/firmware/layer1/sync.c b/src/target/firmware/layer1/sync.c
index c8840de..f756c98 100644
--- a/src/target/firmware/layer1/sync.c
+++ b/src/target/firmware/layer1/sync.c
@@ -361,6 +361,9 @@ void l1s_reset(void)
mframe_reset();
tdma_sched_reset();
l1s_dsp_abort();
+
+ /* Cipher off */
+ dsp_load_ciph_param(0, NULL);
}
void l1s_init(void)