FreeCalypso > hg > freecalypso-tools
annotate uptools/libcoding/gsmtime.c @ 995:74024eb17e04
fc-loadtool help: improve language regarding 16 MiB flash chips
In FC project history, 16 MiB flash originally meant Pirelli DP-L10.
Then we got FCDEV3B with the same flash (our own design), but now we are
discovering more Calypso devices that used such large flash, both late
Calypso era (Sony Ericsson K2x0) as well as much earlier ones (FIC FLUID
devices.txt file with 2004 dates, Leonardo+ rev 5). Hence we need to
migrate to more generic or neutral language in associated documentation,
without giving elevated status to specific examples that drove our
early project history.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 03 Dec 2023 21:11:12 +0000 |
parents | f40530e2d48d |
children |
rev | line source |
---|---|
334
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This library module implements decoding of GSM timestamps. |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 gsm_timestamp_decode(inbuf, outbuf) |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 u_char *inbuf; |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 char *outbuf; |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 { |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 u_char rev[7]; |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 int i, d1, d2, tzsign; |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 for (i = 0; i < 7; i++) { |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 d1 = inbuf[i] & 0xF; |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 d2 = inbuf[i] >> 4; |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 rev[i] = (d1 << 4) | d2; |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 } |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 if (rev[6] & 0x80) { |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 rev[6] &= 0x7F; |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 tzsign = '-'; |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 } else |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 tzsign = '+'; |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 sprintf(outbuf, "%02X/%02X/%02X,%02X:%02X:%02X%c%02X", rev[0], rev[1], |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 rev[2], rev[3], rev[4], rev[5], tzsign, rev[6]); |
f40530e2d48d
uptools/libcoding: GSM timestamp decoding implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 } |