summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/calypso/dsp.c
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/target/firmware/calypso/dsp.c
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/target/firmware/calypso/dsp.c')
-rw-r--r--src/target/firmware/calypso/dsp.c16
1 files changed, 16 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)
{