FreeCalypso > hg > freecalypso-tools
view ringtools/fc-ringlist-comp.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 | f442156d31ad |
children |
line wrap: on
line source
/* * This program compiles a list of ringing tone or message alert tone * melodies from ASCII source into the binary format (.mls) that will * be uploaded into FreeCalypso device FFS and read by the UI layer * of FC phone firmwares. */ #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <strings.h> #define MAX_FFS_PATHNAME 19 #define MAX_FFS_PREFIX 5 #define MAX_NAME_FIELD 59 struct bin_record { char ffs_pathname[MAX_FFS_PATHNAME+1]; char ui_name[MAX_NAME_FIELD+1]; }; char *infname, *outfname; FILE *inf, *outf; char ffs_prefix[MAX_FFS_PREFIX+2]; unsigned ffs_prefix_len; char linebuf[256]; int lineno; set_ffs_prefix(prefix_arg) char *prefix_arg; { char *cp; if (prefix_arg[0] != '/') { fprintf(stderr, "error: given FFS prefix does not begin with \'/\'\n"); exit(1); } ffs_prefix_len = strlen(prefix_arg); if (ffs_prefix_len > MAX_FFS_PREFIX) { fprintf(stderr, "error: given FFS prefix is too long\n"); exit(1); } strcpy(ffs_prefix, prefix_arg); cp = ffs_prefix + ffs_prefix_len; if (cp[-1] != '/') { cp[0] = '/'; cp[1] = '\0'; ffs_prefix_len++; } } enforce_and_strip_newline() { char *cp; cp = index(linebuf, '\n'); if (!cp) { fprintf(stderr, "%s line %d: too long or missing newline\n", infname, lineno); exit(1); } *cp = '\0'; } emit_record(fname, uname) char *fname, *uname; { struct bin_record rec; strcpy(rec.ffs_pathname, ffs_prefix); strncpy(rec.ffs_pathname + ffs_prefix_len, fname, MAX_FFS_PATHNAME + 1 - ffs_prefix_len); strncpy(rec.ui_name, uname, MAX_NAME_FIELD + 1); fwrite(&rec, sizeof rec, 1, outf); } process_line() { char *cp, *fname, *uname; cp = linebuf; while (isspace(*cp)) cp++; if (*cp == '\0' || *cp == '#') return; fname = cp; while (*cp && !isspace(*cp)) cp++; if (!*cp) { inv: fprintf(stderr, "%s line %d: invalid syntax\n", infname, lineno); exit(1); } *cp++ = '\0'; while (isspace(*cp)) cp++; if (*cp == '\0' || *cp == '#') goto inv; uname = cp; if (strlen(fname) + ffs_prefix_len > MAX_FFS_PATHNAME) { fprintf(stderr, "%s line %d: melody filename exceeds limit\n", infname, lineno); exit(1); } if (strlen(uname) > MAX_NAME_FIELD) { fprintf(stderr, "%s line %d: melody UI name exceeds limit\n", infname, lineno); exit(1); } emit_record(fname, uname); } main(argc, argv) char **argv; { if (argc != 4) { fprintf(stderr, "usage: %s src-file bin-file ffs-prefix\n", argv[0]); exit(1); } if (strcmp(argv[1], "-")) { infname = argv[1]; inf = fopen(infname, "r"); if (!inf) { perror(infname); exit(1); } } else { infname = "stdin"; inf = stdin; } set_ffs_prefix(argv[3]); outfname = argv[2]; outf = fopen(outfname, "w"); if (!outf) { perror(outfname); exit(1); } for (lineno = 1; fgets(linebuf, sizeof linebuf, inf); lineno++) { enforce_and_strip_newline(); process_line(); } exit(0); }