summaryrefslogtreecommitdiffstats
path: root/src/target/firmware
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-10-12 06:34:49 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-10-16 12:21:40 +0700
commit79baca14d41663b1282655620328452944a13f4d (patch)
tree03b82b6e72848ea327f68a3410831a476bcb0ed4 /src/target/firmware
parentde630abfc83a88091072fb3c93e958041c3d99f0 (diff)
firmware/layer1: mute UL/DL vocodec if it's not needed
The upper layers usually request either of the two configurations: * (AUDIO_TX_MICROPHONE | AUDIO_RX_SPEAKER) - in this configuration the phone (PHY) is both the origin and the destination of the TCH frames. DL frames are played via the built-in speaker; UL frames recorded using the built-in microphone. * (AUDIO_TX_TRAFFIC_REQ | AUDIO_RX_TRAFFIC_IND) - in this case the upper layers (host side) become the origin and the destination of the TCH frames. The built-in speaker and microphone are expected to be disabled. However, when using the second configuration, one can still hear DL TCH frames being played by the built-in speaker. The built-in microphone does not seem to be causing any issues, but still we definitely don't want the vocoder to interfere with the host. Change-Id: I390db1889f079dea8112794c3e039a9136b897df Related: OS#4396
Diffstat (limited to 'src/target/firmware')
-rw-r--r--src/target/firmware/include/calypso/l1_environment.h2
-rw-r--r--src/target/firmware/layer1/prim_tch.c12
2 files changed, 14 insertions, 0 deletions
diff --git a/src/target/firmware/include/calypso/l1_environment.h b/src/target/firmware/include/calypso/l1_environment.h
index d49866e2..476a8a86 100644
--- a/src/target/firmware/include/calypso/l1_environment.h
+++ b/src/target/firmware/include/calypso/l1_environment.h
@@ -104,6 +104,8 @@ typedef signed short API_SIGNED;
#define B_PLAY_UL (1 << 3) // Play UL
#define B_DCO_ON (1 << 4) // DCO ON/OFF
#define B_AUDIO_ASYNC (1 << 1) // WCP reserved
+#define B_MUTE_VOCODEC_DL (1 << 14) // DL voice decoder
+#define B_MUTE_VOCODEC_UL (1 << 15) // UL voice encoder
// ****************************************************************
// PARAMETER AREA (PARAM) MCU<->DSP COMMUNICATION DEFINITIONS
diff --git a/src/target/firmware/layer1/prim_tch.c b/src/target/firmware/layer1/prim_tch.c
index e3cffd1b..1e3ca752 100644
--- a/src/target/firmware/layer1/prim_tch.c
+++ b/src/target/firmware/layer1/prim_tch.c
@@ -85,6 +85,18 @@ static void tch_get_params(struct gsm_time *time, uint8_t chan_nr,
*tch_mode = SIG_ONLY_MODE;
}
}
+
+ /* enable/disable the voice decoder (Downlink) */
+ if (l1s.audio_mode & AUDIO_RX_SPEAKER)
+ dsp_api.ndb->d_tch_mode &= ~B_MUTE_VOCODEC_DL; /* unmute */
+ else
+ dsp_api.ndb->d_tch_mode |= B_MUTE_VOCODEC_DL; /* mute */
+
+ /* enable/disable the voice encoder (Uplink) */
+ if (l1s.audio_mode & AUDIO_TX_MICROPHONE)
+ dsp_api.ndb->d_tch_mode &= ~B_MUTE_VOCODEC_UL; /* unmute */
+ else
+ dsp_api.ndb->d_tch_mode |= B_MUTE_VOCODEC_UL; /* mute */
}