FreeCalypso > hg > freecalypso-sw
view gsm-fw/L1/cfile/tch_feature.c @ 1015:9ced8e13cf91
fc-shell tch-dl command implementation: brown paper bag
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sun, 20 Mar 2016 23:07:46 +0000 |
parents | 3bfeee466b0a |
children | a6ca9ee289f7 |
line wrap: on
line source
/* * This module is a FreeCalypso addition; it contains code implementing * our custom voice TCH rerouting feature. */ #include "config.h" #include "l1_confg.h" #include "l1_types.h" #include "sys_types.h" #include "l1_trace.h" #include "tch_feature.h" T_RVT_USER_ID tch_reroute_rvt_id; BOOL tch_reroute_downlink; void tch_send_downlink_bits(API *dsp_buffer) { T_RVT_BUFFER buf; T_RVT_RET rc; UINT8 *dp; API apiword; int i; rc = rvt_mem_alloc(tch_reroute_rvt_id, 41, &buf); if (rc != RVT_OK) return; dp = buf; *dp++ = TCH_DLBITS_IND; for (i = 0; i < 20; i++) { apiword = dsp_buffer[i]; *dp++ = apiword; *dp++ = apiword >> 8; } rvt_send_trace_no_cpy(buf, tch_reroute_rvt_id, 41, RVT_BINARY_FORMAT); } static void handle_tch_config_reg(T_RVT_BUFFER pkt) { UWORD8 config; T_RVT_BUFFER buf; T_RVT_RET rc; config = pkt[1] & 0x01; tch_reroute_downlink = config; /* send TCH_CONFIG_CONF response */ rc = rvt_mem_alloc(tch_reroute_rvt_id, 2, &buf); if (rc == RVT_OK) { buf[0] = TCH_CONFIG_CONF; buf[1] = config; rvt_send_trace_no_cpy(buf, tch_reroute_rvt_id, 2, RVT_BINARY_FORMAT); } } /* * The following function is the callback registered with RVT; it gets * called in RVT HISR context. */ static void tch_rvt_input_callback(T_RVT_BUFFER pkt, UINT16 pktlen) { if (pktlen < 1) return; switch (pkt[0]) { case TCH_CONFIG_REQ: if (pktlen != 2) return; handle_tch_config_reg(pkt); break; case TCH_ULBITS_REQ: /* to be filled */ break; } } void feature_tch_reroute_init() { rvt_register_id("TCH", &tch_reroute_rvt_id, tch_rvt_input_callback); tch_reroute_downlink = FALSE; }