annotate src/gpf/inc/tdc_msg.h @ 122:7c68000b87cf

targets: c155 added
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 07 Nov 2018 06:55:49 +0000
parents 1ea54a97e831
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 +-----------------------------------------------------------------------------
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 | Project :
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 | Modul : TDC
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 +-----------------------------------------------------------------------------
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 | Copyright 2002 Texas Instruments Berlin, AG
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 | All rights reserved.
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 |
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 | This file is confidential and a trade secret of Texas
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 | Instruments Berlin, AG
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 | The receipt of or possession of this file does not convey
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 | any rights to reproduce or disclose its contents or to
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 | manufacture, use, or sell anything it may describe, in
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 | whole, or in part, without the specific written consent of
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 | Texas Instruments Berlin, AG.
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 +-----------------------------------------------------------------------------
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 | Purpose :
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 +-----------------------------------------------------------------------------
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 */
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #ifdef TDC_H
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #error "TDC.H already included, TDC.H must come after all primitives and messages"
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #endif
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 #ifndef TDC_MSG_H
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 #define TDC_MSG_H
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #if DOT_COMPLETE_DEFINES
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 //----------------------------------------------------------------------------
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 // macros to repeat stuff that is similar in many interface classes
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 //----------------------------------------------------------------------------
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #define M_TDC_INTERFACE_PRIM_ADDITIONAL(SHORT_NAME)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #define M_TDC_INTERFACE_PSTRUCT_ADDITIONAL(SHORT_NAME)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #define M_TDC_INTERFACE_PUNION_ADDITIONAL(SHORT_NAME)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 #define M_TDC_INTERFACE_SDU_ADDITIONAL(SHORT_NAME)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 #define M_TDC_INTERFACE_PENUM_ADDITIONAL(SHORT_NAME)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 #define M_TDC_INTERFACE_PINT_ADDITIONAL(INT_NAME, SHORT_NAME)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 //-----
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 #define M_TDC_INTERFACE_MSG_ADDITIONAL(SHORT_NAME)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 #define M_TDC_INTERFACE_MSTRUCT_ADDITIONAL(SHORT_NAME)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 #define M_TDC_INTERFACE_MUNION_ADDITIONAL(SHORT_NAME)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 #define M_TDC_INTERFACE_MENUM_ADDITIONAL(SHORT_NAME)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 #define M_TDC_INTERFACE_MINT_ADDITIONAL(INT_NAME, SHORT_NAME)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 //-----
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 #define M_TDC_INTERFACE_INT_ADDITIONAL(SHORT_NAME)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 #define M_TDC_INTERFACE_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 #define M_TDC_INTERFACE_XXX_MESSAGE_UNION_ADDITIONAL(MSG)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 #define M_TDC_CREATE_DEFAULT_PRIMITIVE_INTERFACE_CLASS(SAP)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 #define M_TDC_INTERFACE_PRIMITIVE_ADDITIONAL()
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 #define M_TDC_INTERFACE_PRIMITIVE_ELEMENT_ADDITIONAL(SAP)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 #define M_TDC_CREATE_DEFAULT_MESSAGE_INTERFACE_CLASS(MSG)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 #define M_TDC_INTERFACE_MESSAGE_ADDITIONAL()
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 #define M_TDC_INTERFACE_MESSAGE_ELEMENT_ADDITIONAL(MSG)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 #else
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 #endif
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 #include "tdc_base.h"
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 #ifndef TDC_DESCRIPTOR
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 #include "message.h"
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 #include "primitive.h"
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 #else
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 #include "message_dsc.h"
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 #include "primitive_dsc.h"
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 #endif
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 struct T_TDC_INTERFACE_U8;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 //TODO: eliminate need for these types used by M_RR (this is a bug work around)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 typedef T_TDC_HANDLE_U8 T_TDC_HANDLE_AVG_W;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 typedef T_TDC_HANDLE_U8 T_TDC_HANDLE_AVG_T;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 typedef T_TDC_INTERFACE_U8 T_TDC_INTERFACE_AVG_W;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 typedef T_TDC_INTERFACE_U8 T_TDC_INTERFACE_AVG_T;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 //TODO: eliminate need for these types used by M_GRR (this is a bug work around)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 typedef T_TDC_HANDLE_U8 T_TDC_HANDLE_RESEL;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 typedef T_TDC_INTERFACE_U8 T_TDC_INTERFACE_RESEL;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 typedef struct T_TDC_HANDLE_TEST_var4 T_TDC_HANDLE_TEST_var4T;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 typedef struct T_TDC_HANDLE_TEST_enum4 T_TDC_HANDLE_TEST_enum4T;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 M_TDC_FORWARD_SDU (sdu)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 struct T_TDC_DESCRIPTOR_sdu;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 struct T_TDC_HANDLE_sdu;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 struct T_TDC_INTERFACE_sdu;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 struct T_sdu;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 typedef T_TDC_HANDLE_sdu T_TDC_HANDLE_SDU;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 typedef T_TDC_DESCRIPTOR_sdu T_TDC_DESCRIPTOR_SDU;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 typedef T_TDC_INTERFACE_sdu T_TDC_INTERFACE_SDU;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 typedef T_sdu T_TDC_INSTANCE_SDU;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 ///\todo make some sencible stuff here
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 struct T_TDC_HANDLE_desc_list
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 int dummy_to_keep_doxygen_happy;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 };
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 ///\todo make some sencible stuff here
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 struct T_TDC_HANDLE_desc
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 int dummy_to_keep_doxygen_happy;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 };
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 ///\todo make some sencible stuff here
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 struct T_TDC_INTERFACE_desc_list
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 int dummy_to_keep_doxygen_happy;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 };
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 ///\todo make some sencible stuff here
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 struct T_TDC_INTERFACE_desc
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 int dummy_to_keep_doxygen_happy;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 };
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 #ifdef TDC_DESCRIPTOR
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 /*M_TDC_FORWARD_PSTRUCT(raw)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 M_TDC_FORWARD_PSTRUCT(aim)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 M_TDC_FORWARD_PSTRUCT(sdu)*/
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 struct T_TDC_DESCRIPTOR_aim:T_TDC_DESCRIPTOR_PSTRUCT_BASE
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 M_TDC_DESCRIPTOR_PSTRUCT_ADDITIONAL (aim)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 T_TDC_HANDLE_U8 ti;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 T_TDC_HANDLE_U8 tie;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 T_TDC_HANDLE_U8 nsd;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 T_TDC_HANDLE_MESSAGE_UNION entity;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 };
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 struct T_TDC_DESCRIPTOR_sdu:T_TDC_DESCRIPTOR_SDU_BASE
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 M_TDC_DESCRIPTOR_SDU_ADDITIONAL (sdu)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 T_TDC_HANDLE_raw raw; //manual sdu
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 T_TDC_HANDLE_aim aim; //coded sdu
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 };
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 #endif
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 #if !defined TDC_DESCRIPTOR || defined TDC_PRECOMPILE
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 struct T_aim:T_TDC_INSTANCE_PSTRUCT_BASE
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 M_TDC_INSTANCE_PSTRUCT_ADDITIONAL (aim,aim)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 T_TDC_INTERFACE_aim* operator-> ();
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 };
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 struct T_TDC_INTERFACE_aim:T_TDC_INTERFACE_PSTRUCT_BASE
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 M_TDC_INTERFACE_PSTRUCT_ADDITIONAL (aim,aim)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 T_TDC_INTERFACE_U8 ti;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 T_TDC_INTERFACE_U8 tie;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 T_TDC_INTERFACE_U8 nsd;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 T_TDC_INTERFACE_MESSAGE_UNION entity;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 #ifdef TDC_TYPE_NAME_COMPLETE
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 struct { char T_aim, ___ti___tie___nsd___entiy; } _type_name ();
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 #endif
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 };
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 struct T_sdu:T_TDC_INSTANCE_SDU_BASE
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 M_TDC_INSTANCE_SDU_ADDITIONAL (sdu)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 T_sdu(const T_MESSAGE_UNION& msg);
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 T_sdu(const T_TDC_INSTANCE_MSG_BASE& msg);
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 T_TDC_INTERFACE_sdu* operator-> ();
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 };
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193 struct T_TDC_INTERFACE_sdu:T_TDC_INTERFACE_SDU_BASE
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 M_TDC_INTERFACE_PSTRUCT_ADDITIONAL (sdu,sdu)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 T_TDC_INTERFACE_raw raw; //manual sdu
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 T_TDC_INTERFACE_aim aim; //coded sdu
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 #ifdef TDC_TYPE_NAME_COMPLETE
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199 struct { char T_sdu, ___raw___aim; } _type_name ();
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 #endif
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 };
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202 inline T_sdu::T_sdu(const T_MESSAGE_UNION& msg)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204 construct();
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205 (*this)->aim.entity=msg;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 inline T_sdu::T_sdu(const T_TDC_INSTANCE_MSG_BASE& msg)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 construct();
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 (*this)->aim.entity=msg;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 #endif //!defined TDC_DESCRIPTOR || defined TDC_PRECOMPILE
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 //============================================================================
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 template <class T>
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 T_sdu tds_array_to_sdu(const T& U8array)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219 //This function is a temporary solution to help the convertion from TDS U8 arrays to TDC SDU's.
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221 T_sdu sdu;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222 sdu->raw.l_buf = U8array[0] + U8array[1] * 256;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 sdu->raw.o_buf = U8array[2] + U8array[3] * 256;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224 if (sizeof(U8array)>4)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226 for (int i = 4; i < sizeof(U8array);i++)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 sdu->raw.buf[i-4] = U8array[i];
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 else
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 sdu->raw.buf = T_ARRAY<U8>();
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 return sdu;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237 //============================================================================
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238 template <class T>
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 T_sdu BIN(const T& U8array)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241 T_sdu sdu;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 int i=0,bit=0,l_buf=0;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243 U8 temp=0;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245 while(U8array[i] != '\0')
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247 if(U8array[i] == 0x20) //(0x20 is space)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249 if(bit != 0)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 tdc_user_error("BIN(): There is not 8 bits between spaces!");
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 else
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 switch(U8array[i])
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 case 0x31: //(0x31 ascii code for 1)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 temp += 1<<(7-bit);
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 break;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 case 0x30: //(0x30 ascii code for 0)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 break;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 default:
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 tdc_user_error("BIN(): string character neither '0' or '1': %c",U8array[i]);
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 break;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 bit ++;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 if(bit == 8)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 sdu->raw.buf[l_buf/8] = temp;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 temp = 0;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 bit=0;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 l_buf++;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 i++;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 if(bit != 0) //if the number of bits is not a multiplum of 8 the last few bits will be assigned here
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280 sdu->raw.buf[l_buf/8] = temp;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 sdu->raw.l_buf=l_buf;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284 sdu->raw.o_buf=0;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 return sdu;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 template <class T>
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 T_sdu HEX(const T& U8array)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 T_sdu sdu;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 int i = 0, nibble = 0, l_buf = 0;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 U8 temp = 0;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295 while(U8array[i] != '\0')
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297 if(U8array[i] == 0x20) //(0x20 is space)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299 if(nibble != 0)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 tdc_user_error("HEX(): There is not 2 nibbles between spaces!");
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 else
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304 if(('0' <= U8array[i]) && (U8array[i] <= '9'))
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 temp += (U8array[i] - 0x30) << (4*(1-nibble));
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
308 else if(('A' <= U8array[i]) && (U8array[i] <= 'F'))
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310 temp += (U8array[i] - 0x37) << (4*(1-nibble));
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312 else if(('a' <= U8array[i]) && (U8array[i] <= 'f'))
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 temp += (U8array[i] - 0x57) << (4*(1-nibble));
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316 else
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 tdc_user_error("HEX(): String character not a HEX number: %c",U8array[i]);
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
319 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320 nibble ++;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
321 if(nibble == 2)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323 sdu->raw.buf[l_buf/8] = temp;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324 temp = 0;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 nibble = 0;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
327 l_buf += 4;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329 i++;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
330 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
331
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
332 if(nibble != 0) //checks whether the number of nibbles are odd. IF THIS SHOULD BE MADE LEGAL
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
333 { //remove the '//' in front of the line above and comment out the error function call!
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
334 tdc_user_error("HEX(): Odd number of nibbles (hex numbers)");
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
335 //sdu->raw.buf[l_buf/8]=temp;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
336 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
337 sdu->raw.l_buf = l_buf;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
338 sdu->raw.o_buf = 0;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
339 return sdu;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
340 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
341
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
342 template <class T>
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
343 T_sdu CHR(const T& U8array)
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
344 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
345 T_sdu sdu;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
346 int i=0;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
347 while(U8array[i] != '\0')
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
348 {
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
349 sdu->raw.buf[i]= (U8)U8array[i];
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
350 i++;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
351 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
352 sdu->raw.l_buf=8*i;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
353 sdu->raw.o_buf=0;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
354 return sdu;
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
355 }
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
356
1ea54a97e831 src/gpf: import of Magnetite src/gpf3
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
357 #endif //TDC_MSG_H