comparison gpf/inc/tstheader.h @ 0:75a11d740a02

initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 00:02:41 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:75a11d740a02
1 /*
2 +------------------------------------------------------------------------------
3 | File: tstheader.h
4 +------------------------------------------------------------------------------
5 | Copyright 2002 Texas Instruments Berlin, AG
6 | All rights reserved.
7 |
8 | This file is confidential and a trade secret of Texas
9 | Instruments Berlin, AG
10 | The receipt of or possession of this file does not convey
11 | any rights to reproduce or disclose its contents or to
12 | manufacture, use, or sell anything it may describe, in
13 | whole, or in part, without the specific written consent of
14 | Texas Instruments Berlin, AG.
15 +-----------------------------------------------------------------------------
16 | Purpose : Definitions for the TST internal header
17 +-----------------------------------------------------------------------------
18 */
19
20 #ifndef TSTHEADER_H
21 #define TSTHEADER_H
22
23 /*==== INCLUDES =============================================================*/
24
25 #include "gpfconf.h"
26 #include "tools.h"
27
28 /*==== CONSTS ===============================================================*/
29
30 #ifdef CONNECT_2_PS
31 #define TOOLSIDE
32 #else
33 #define STACKSIDE
34 #endif
35
36 #if defined STACKSIDE && defined _TARGET_
37 #define TARGET_STACK
38 #endif
39
40 #if defined STACKSIDE && !defined _TARGET_
41 #define EMULATED_STACK
42 #endif
43
44
45 #define ID_OFFSET 0
46 #define TIMESTAMP_OFFSET 1
47 #define LENGTH_OFFSET 5
48 #define SENDER_OFFSET 9
49 #define RECEIVER_OFFSET 13
50 #define DATA_OFFSET 17
51
52 #define ID_SUBTRACT 17
53 #define TIMESTAMP_SUBTRACT 16
54 #define LENGTH_SUBTRACT 12
55 #define SENDER_SUBTRACT 8
56 #define RECEIVER_SUBTRACT 4
57 #define OPC_SUBTRACT 4
58 #define DATA_SUBTRACT 0
59
60 #define PROT_PRIM_ID 'P'
61 #define PROT_PRIM_ID_32BIT 'Q'
62 #define SYS_PRIM_ID 'S'
63 #define TRACE_ID 'T'
64
65 #define IDENT_PS_PRIM 0x10 /* former 'P' */
66 #define IDENT_SYS_PRIM 0x30 /* former 'S' */
67 #define IDENT_ABORT 0x00 /* former 'A' */
68 #define IDENT_TRACE 0x20 /* former 'T' */
69
70
71 #define HDR_VALID_VERSION_0 0x40 /* 01 OLD TST Header */
72 #define HDR_VALID_VERSION_1 0x80 /* 10 NEW TST Header */
73 #define HDR_VALID_VERSION_2 0x00 /* 00 reserved */
74 #define HDR_VALID_VERSION_3 0xC0 /* 11 reserved */
75
76 #define HDR_TIME_MS 0x04 /* 01 ms Time Frame */
77 #define HDR_TIME_TDMA 0x08 /* 10 TDMA Time Frame */
78
79 #define HDR_VERSION_MASK 0xc0
80 #define HDR_IDENT_MASK 0x30
81 #define HDR_TIME_MASK 0x0c
82 #define HDR_RESERVED_MASK 0x03
83
84 #define LOW_MASK 0xFF
85
86 #define EMPTY_BYTE 0
87 #define INFO_BYTE 1
88 #define FIRST_BYTE 2
89 #define SECOND_BYTE 3
90
91 #define TST_HEADER_LEADING_FIELDS 3 /* .info + .size */
92 #define TST_HEADER_TRAILING_FIELDS 12 /* .time + .sender + .receiver */
93 /* the .orgreceiver field will be added dynamically, if used */
94
95 /*==== TYPES =================================================================*/
96 typedef struct
97 {
98 UBYTE combined [4];
99 unsigned long time;
100 char sender[4];
101 char receiver[4];
102 } TST_SMALL_HEADER;
103
104 typedef struct
105 {
106 UBYTE combined [4];
107 unsigned long time;
108 char sender[4];
109 char receiver[4];
110 UCHAR trace_opc;
111 } TST_MED_HEADER;
112
113 typedef struct
114 {
115 UBYTE combined [4];
116 unsigned long time;
117 char sender[4];
118 char receiver[4];
119 char orgreceiver[4];
120 int opc;
121 } TST_BIG_HEADER;
122
123 #define TST_SMALL_HEADER_SIZE (sizeof(TST_SMALL_HEADER) -1)
124 #define TST_BIG_HEADER_SIZE (sizeof(TST_BIG_HEADER) -1)
125
126 #if defined (_LINUX_) || defined (_SOLARIS_)
127 #define PRIM_HEADER_FLAG 0x00000000
128 #define PRIM_DATA_FLAG 0x00000000
129 #define PRIM_FLAG_MASK 0x00000000
130
131 #define EXCHANGE_4BYTES_ENDIANESS(val_ptr) {\
132 char c;\
133 char *p = (char*) val_ptr;\
134 c = p[0];\
135 p[0] = p[3];\
136 p[3] = c;\
137 c = p[1];\
138 p[1] = p[2];\
139 p[2] = c;\
140 }
141 #else
142 #define PRIM_HEADER_FLAG 0x40000000
143 #define PRIM_DATA_FLAG 0x80000000
144 #define PRIM_FLAG_MASK 0xc0000000
145
146 #define EXCHANGE_4BYTES_ENDIANESS(val_ptr)
147 #endif
148
149 /*==== EXPORTS ===============================================================*/
150
151 #endif /* !TSTHEADER.H */