fw/dsp: Add function to load dsp ciphering parameters

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2010-09-15 09:39:22 +02:00
parent 3d5274ed61
commit 664fa9ae0b
3 changed files with 20 additions and 0 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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)