annotate ffstools/tiaud/mkvol.c @ 926:6a0aa8d36d06

rvinterf backslash escape: introduce libprint The new helper function library named libprint is meant to replace the badly misnamed libg23, and will soon contain functions for printing all of the same kinds of GPF TST packets that are now handled in libg23. However, we are also moving safe_print_trace() from libasync to this new library, and changing it to emit our new backslash escape format.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 23 May 2023 03:47:46 +0000
parents 1f3b28d66d53
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
241
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This program generates an audio volume file for uploading into Calypso
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * device FFS; TI's Audio Service requires every *.cfg file to be accompanied
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * by a corresponding *.vol file.
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <sys/types.h>
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <sys/file.h>
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdio.h>
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdlib.h>
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <unistd.h>
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 u_char bin[4];
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 write_bin_output(filename)
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 char *filename;
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 {
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 int fd;
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666);
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 if (fd < 0) {
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 perror(filename);
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 exit(1);
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 }
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 write(fd, &bin, sizeof bin);
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 close(fd);
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 }
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 main(argc, argv)
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 char **argv;
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 {
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 if (argc != 3) {
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 fprintf(stderr, "usage: %s volume outfile\n", argv[0]);
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 exit(1);
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 }
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 bin[0] = atoi(argv[1]);
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 write_bin_output(argv[2]);
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 exit(0);
1f3b28d66d53 tiaud-mkvol program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 }