FreeCalypso > hg > fc-pcm-if
view sw/mcsi-rxtx/tx_func.c @ 11:e93a11f44e6f
fc-mcsi-rxtx: implement basic Tx
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 28 Oct 2024 06:34:42 +0000 |
parents | |
children | 23555b9a1c20 |
line wrap: on
line source
/* * Here we implement basic Tx functions: emitting an uplink sample stream * to Calypso MCSI via the FPGA. */ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> extern int target_fd; u_short pcm_fill_word; static void do_idle_fill(buf) u_short *buf; { unsigned n; for (n = 0; n < 160; n++) buf[n] = pcm_fill_word; } static void emit_uart_output(samples) u_short *samples; { u_char bytes[320], *dp; unsigned n, samp; dp = bytes; for (n = 0; n < 160; n++) { samp = samples[n]; *dp++ = samp; *dp++ = samp >> 8; } write(target_fd, bytes, 320); } void transmit_20ms_block() { u_short tx_samples[160]; do_idle_fill(tx_samples); emit_uart_output(tx_samples); }