annotate simtool/smsp_common.c @ 173:e70964adcbba

fc-simtool readef extended to fully dump all files
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 02 Mar 2021 03:33:41 +0000
parents f5a26c1d0b93
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module implements some common functions for working with EF_SMSP.
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <stdio.h>
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include "curfile.h"
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include "file_id.h"
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 select_ef_smsp()
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 {
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 int rc;
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 rc = select_op(DF_TELECOM);
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 if (rc < 0)
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 return(rc);
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 rc = select_op(EF_SMSP);
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 if (rc < 0)
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 return(rc);
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 rc = parse_ef_select_response();
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 if (rc < 0)
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 return(rc);
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 if (curfile_structure != 0x01) {
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 fprintf(stderr, "error: EF_SMSP is not linear fixed\n");
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 return(-1);
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 }
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 if (curfile_record_len < 28) {
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 fprintf(stderr,
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 "error: EF_SMSP has record length of %u bytes, less than minimum 28\n",
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 curfile_record_len);
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 return(-1);
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 }
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 return(0);
f5a26c1d0b93 fc-simtool smsp-dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 }