comparison sw/mcsi-rxtx/tx_func.c @ 12:23555b9a1c20

fc-mcsi-rxtx: implement pcm-fill command
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 28 Oct 2024 06:52:33 +0000
parents e93a11f44e6f
children f908a782cff9
comparison
equal deleted inserted replaced
11:e93a11f44e6f 12:23555b9a1c20
2 * Here we implement basic Tx functions: emitting an uplink sample stream 2 * Here we implement basic Tx functions: emitting an uplink sample stream
3 * to Calypso MCSI via the FPGA. 3 * to Calypso MCSI via the FPGA.
4 */ 4 */
5 5
6 #include <sys/types.h> 6 #include <sys/types.h>
7 #include <ctype.h>
7 #include <stdio.h> 8 #include <stdio.h>
8 #include <stdlib.h> 9 #include <stdlib.h>
9 #include <unistd.h> 10 #include <unistd.h>
10 11
11 extern int target_fd; 12 extern int target_fd;
44 u_short tx_samples[160]; 45 u_short tx_samples[160];
45 46
46 do_idle_fill(tx_samples); 47 do_idle_fill(tx_samples);
47 emit_uart_output(tx_samples); 48 emit_uart_output(tx_samples);
48 } 49 }
50
51 void
52 cmd_pcm_fill(argc, argv)
53 char **argv;
54 {
55 u_long val;
56 char *endp;
57
58 if (argc < 2) {
59 printf("%04x\n", pcm_fill_word);
60 return;
61 }
62 if (!isxdigit(argv[1][0])) {
63 inv: printf("error: pcm-fill argument is not a valid hex word\n");
64 return;
65 }
66 val = strtoul(argv[1], &endp, 16);
67 if (*endp)
68 goto inv;
69 if (val > 0xFFFF)
70 goto inv;
71 pcm_fill_word = val;
72 }