FreeCalypso > hg > freecalypso-tools
annotate ffstools/tiaud/mkvol.c @ 660:b34384991094
loadagent: implemented binary flash programming
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 04 Mar 2020 06:51:52 +0000 |
parents | 1f3b28d66d53 |
children |
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 } |