annotate ffstools/tiffs-mkfs/ffsparam.c @ 1014:961efadd530a default tip

fc-shell TCH DL handler: add support for CSD modes TCH DL capture mechanism in FC Tourmaline firmware has been extended to support CSD modes in addition to speech - add the necessary support on the host tools side. It needs to be noted that this mechanism in its present state does NOT provide the debug utility value that was sought: as we learned only after the code was implemented, TI's DSP has a misfeature in that the buffer we are reading (a_dd_0[]) is zeroed out when the IDS block is enabled, i.e., we are reading all zeros and not the real DL bits we were after. But since the code has already been written, we are keeping it - perhaps we can do some tests with IDS disabled.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 26 Nov 2024 06:27:43 +0000
parents 178ed445021d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
705
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include <sys/types.h>
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include <sys/param.h>
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #include <ctype.h>
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 #include <stdio.h>
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <stdint.h>
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdlib.h>
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <string.h>
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <strings.h>
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include "struct.h"
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "globals.h"
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 void
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 parse_org_arg(arg)
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 char *arg;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 {
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 char *cp;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 cp = index(arg, 'x');
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 if (!cp || !isdigit(cp[1]) || !isdigit(arg[0])) {
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 fprintf(stderr,
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 "error: TIFFS organization argument \"%s\" is invalid\n", arg);
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 exit(1);
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 }
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 *cp++ = '\0';
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 if (!strcmp(arg, "8"))
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 ffs_sector_size = 0x2000;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 else if (!strcmp(arg, "16"))
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 ffs_sector_size = 0x4000;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 else if (!strcmp(arg, "32"))
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 ffs_sector_size = 0x8000;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 else if (!strcmp(arg, "64"))
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 ffs_sector_size = 0x10000;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 else if (!strcmp(arg, "128"))
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 ffs_sector_size = 0x20000;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 else if (!strcmp(arg, "256"))
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 ffs_sector_size = 0x40000;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 else {
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 fprintf(stderr,
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 "error: \"%s\" is not a recognized flash sector size\n",
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 arg);
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 exit(1);
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 }
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 ffs_nsectors = atoi(cp);
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 if (ffs_nsectors < 3 || ffs_nsectors > 128) {
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 fprintf(stderr,
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 "error: \"%s\" is not a reasonable number of FFS sectors\n",
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 cp);
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 exit(1);
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 }
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 }
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 void
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 preen_chunk_size_max()
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 {
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 if (chunk_size_max) {
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 if (chunk_size_max > ffs_sector_size / 2) {
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 fprintf(stderr,
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 "error: max chunk size specified with -c is too large\n");
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 exit(1);
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 }
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 return;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 }
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 /* default matching TI's code */
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 if (ffs_sector_size * ffs_nsectors > 1024*1024)
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 chunk_size_max = 8192;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 else if (ffs_sector_size / 8 < 2048)
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 chunk_size_max = ffs_sector_size / 8;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 else
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 chunk_size_max = 2048;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 }
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 void
717
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
73 preen_journal_size()
705
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 {
717
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
75 if (journal_size)
705
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 return;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 /* default matching TI's code */
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 journal_size = ffs_sector_size >> 4;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 if (journal_size < 1024)
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 journal_size = 1024;
12ae93940467 tiffs-mkfs program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 }
717
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
82
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
83 void
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
84 preen_block_files_max()
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
85 {
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
86 unsigned local_journal_size;
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
87
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
88 if (block_files_max)
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
89 return;
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
90 /* default matching TI's code */
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
91 local_journal_size = ffs_sector_size >> 4;
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
92 if (local_journal_size < 1024)
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
93 local_journal_size = 1024;
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
94 block_files_max = (local_journal_size >> 4) - 6;
178ed445021d tiffs-mkfs: journal creation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 705
diff changeset
95 }