comparison src/gpf/inc/tstheader.h @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
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 "tools.h"
26
27 /*==== CONSTS ===============================================================*/
28
29 #ifdef CONNECT_2_PS
30 #define TOOLSIDE
31 #else
32 #define STACKSIDE
33 #endif
34
35 #if defined STACKSIDE && defined _TARGET_
36 #define TARGET_STACK
37 #endif
38
39 #if defined STACKSIDE && !defined _TARGET_
40 #define EMULATED_STACK
41 #endif
42
43
44 #define ID_OFFSET 0
45 #define TIMESTAMP_OFFSET 1
46 #define LENGTH_OFFSET 5
47 #define SENDER_OFFSET 9
48 #define RECEIVER_OFFSET 13
49 #define DATA_OFFSET 17
50
51 #define ID_SUBTRACT 17
52 #define TIMESTAMP_SUBTRACT 16
53 #define LENGTH_SUBTRACT 12
54 #define SENDER_SUBTRACT 8
55 #define RECEIVER_SUBTRACT 4
56 #define OPC_SUBTRACT 4
57 #define DATA_SUBTRACT 0
58
59 #define PROT_PRIM_ID 'P'
60 #define PROT_PRIM_ID_32BIT 'Q'
61 #define SYS_PRIM_ID 'S'
62 #define TRACE_ID 'T'
63
64 #define IDENT_PS_PRIM 0x10 /* former 'P' */
65 #define IDENT_SYS_PRIM 0x30 /* former 'S' */
66 #define IDENT_ABORT 0x00 /* former 'A' */
67 #define IDENT_TRACE 0x20 /* former 'T' */
68
69
70 #define HDR_VALID_VERSION_0 0x40 /* 01 OLD TST Header */
71 #define HDR_VALID_VERSION_1 0x80 /* 10 NEW TST Header */
72 #define HDR_VALID_VERSION_2 0x00 /* 00 reserved */
73 #define HDR_VALID_VERSION_3 0xC0 /* 11 reserved */
74
75 #define HDR_TIME_MS 0x04 /* 01 ms Time Frame */
76 #define HDR_TIME_TDMA 0x08 /* 10 TDMA Time Frame */
77
78 #define HDR_VERSION_MASK 0xc0
79 #define HDR_IDENT_MASK 0x30
80 #define HDR_TIME_MASK 0x0c
81 #define HDR_RESERVED_MASK 0x03
82
83 #define LOW_MASK 0xFF
84
85 #define EMPTY_BYTE 0
86 #define INFO_BYTE 1
87 #define FIRST_BYTE 2
88 #define SECOND_BYTE 3
89
90 #define TST_HEADER_LEADING_FIELDS 3 /* .info + .size */
91 #define TST_HEADER_TRAILING_FIELDS 12 /* .time + .sender + .receiver */
92 /* the .orgreceiver field will be added dynamically, if used */
93
94 /*==== TYPES =================================================================*/
95 typedef struct
96 {
97 UBYTE combined [4];
98 unsigned long time;
99 char sender[4];
100 char receiver[4];
101 } TST_SMALL_HEADER;
102
103 typedef struct
104 {
105 UBYTE combined [4];
106 unsigned long time;
107 char sender[4];
108 char receiver[4];
109 UCHAR trace_opc;
110 } TST_MED_HEADER;
111
112 typedef struct
113 {
114 UBYTE combined [4];
115 unsigned long time;
116 char sender[4];
117 char receiver[4];
118 char orgreceiver[4];
119 int opc;
120 } TST_BIG_HEADER;
121
122 #define TST_SMALL_HEADER_SIZE (sizeof(TST_SMALL_HEADER) -1)
123 #define TST_BIG_HEADER_SIZE (sizeof(TST_BIG_HEADER) -1)
124
125 #if defined (_LINUX_) || defined (_SOLARIS_)
126 #define PRIM_HEADER_FLAG 0x00000000
127 #define PRIM_DATA_FLAG 0x00000000
128 #define PRIM_FLAG_MASK 0x00000000
129
130 #define EXCHANGE_4BYTES_ENDIANESS(val_ptr) {\
131 char c;\
132 char *p = (char*) val_ptr;\
133 c = p[0];\
134 p[0] = p[3];\
135 p[3] = c;\
136 c = p[1];\
137 p[1] = p[2];\
138 p[2] = c;\
139 }
140 #else
141 #define PRIM_HEADER_FLAG 0x40000000
142 #define PRIM_DATA_FLAG 0x80000000
143 #define PRIM_FLAG_MASK 0xc0000000
144
145 #define EXCHANGE_4BYTES_ENDIANESS(val_ptr)
146 #endif
147
148 /*==== EXPORTS ===============================================================*/
149
150 #endif /* !TSTHEADER.H */