FreeCalypso > hg > freecalypso-tools
view uptools/atcmd/smsend_concat.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 | 076d533f840d |
children |
line wrap: on
line source
/* * This module contains the messy code for automatic generation and * increment of concat SMS reference numbers. */ #include <sys/types.h> #include <sys/param.h> #include <sys/file.h> #include <sys/time.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "../../rvinterf/include/exitcodes.h" static int initial_seed() { struct timeval tv; u_char refno, *cp, *endp; gettimeofday(&tv, 0); cp = (u_char *) &tv; endp = cp + sizeof(struct timeval); refno = 0; while (cp < endp) refno ^= *cp++; return refno; } get_concsms_refno_from_host_fs() { char *homedir, statefile[MAXPATHLEN]; int fd, cc; char buf[6]; u_char refno; homedir = getenv("HOME"); if (!homedir) { fprintf(stderr, "error: no HOME= defined, needed for concat SMS refno\n"); exit(ERROR_UNIX); } sprintf(statefile, "%s/.concat_sms_refno", homedir); fd = open(statefile, O_RDWR|O_CREAT, 0666); if (fd < 0) { perror(statefile); exit(ERROR_UNIX); } cc = read(fd, buf, 5); if (cc == 5 && buf[0] == '0' && buf[1] == 'x' && isxdigit(buf[2]) && isxdigit(buf[3]) && buf[4] == '\n') refno = strtoul(buf, 0, 16) + 1; else refno = initial_seed(); sprintf(buf, "0x%02X\n", refno); lseek(fd, 0, SEEK_SET); write(fd, buf, 5); close(fd); return refno; }