Project

General

Profile

Feature #980 » I2C.h

tin, 03/10/2014 06:18 PM

 
1

    
2
#ifndef I2C_H
3
#define I2C_H
4

    
5
#include <stdint.h>
6

    
7
/*********************************************************
8
		Defines
9
*********************************************************/
10

    
11
#define ARRAY_SIZE(_x) (sizeof(_x)/sizeof(_x[0]))
12

    
13

    
14
#define SPI_CLK		0x01
15
#define SPI_SEL		0x02
16
#define SPI_MISO	0x04
17
#define SPI_MOSI	0x08
18

    
19
#define SPI_MASK	(SPI_CLK | SPI_SEL | SPI_MISO | SPI_MOSI)
20

    
21
#define I2C_SDA		0x02
22
#define I2C_SCL		0x01
23
#define I2C_MASK (I2C_SDA|I2C_SCL)
24

    
25
typedef enum EI2CState
26
{
27
	I2C_IDLE=0,
28
	I2C_START,
29
	I2C_DATA,
30
	I2C_ACK,
31
	I2C_STOP,
32
} EI2CState;
33

    
34
/*********************************************************
35
		TLA Types
36
*********************************************************/
37

    
38

    
39
enum TLA_INFO {
40
        TLA_INFO_FIRST_SEQUENCE,
41
        TLA_INFO_LAST_SEQUENCE,
42
        TLA_INFO_DISPLAY_ATTRIBUTE,
43
        TLA_INFO_3,
44
        TLA_INFO_MNEMONICS_WIDTH=5
45
};
46

    
47
struct lactx;
48
struct businfo {
49
	int val0;
50
	int val4;
51
	int val8;
52
	int valc;
53
	int val10;
54
	int val14;
55
	void *val18;
56
	int val1c;
57
};
58

    
59
struct modeinfo {
60
	const char *name;
61
	const char **options;
62
	int val1;
63
	int val2;
64
};
65

    
66
struct sequence {
67
	struct sequence *next;
68
	char *textp;
69
	uint8_t flags;		//The flags determine the background
70
										//bit 0= white (blank),  bit 1=grey,  bit 2=red, bit3=yellow
71
        char field_9;
72
        char field_A;
73
        char field_B;
74
	char *text2;
75
	int field_10;
76
	int field_14;
77
	int field_18;
78
	int field_1C;
79
	char text[128];
80
	char text2_buf[8];
81
};
82

    
83
struct pctx_functable {
84
	int (*LAGroupValue)(struct lactx *lactx, int seqno, int group);
85
	void (*rda_free)(void *p);
86
        void *(*rda_calloc)(int memb, int size);
87
        int (*LAInfo)(struct lactx *, enum TLA_INFO, int16_t bus);
88
};
89
struct pctx {
90
	struct lactx *lactx;
91
	struct pctx_functable func;
92
};
93

    
94
struct groupinfo {
95
	char *name;
96
	char field_4;
97
	char field_5;
98
	char field_6;
99
	char field_7;
100
	uint16_t members;
101
	uint16_t len;
102
};
103

    
104
enum MODEINFO {
105
	MODEINFO_MAX_BUS=0,
106
	MODEINFO_MAX_GROUP=1,
107
	MODEINFO_MAX_MODE=2,
108
	MODEINFO_3=3,
109
	MODEINFO_GETNAME=4,
110
	MODEINFO_MAX,
111
};
112

    
113
struct lafunc {
114
	int unknown;	/* field_0 */
115
	char *support_path;		/* field_4 */
116
	char *support_sep;  /* field_8 */
117
	char *support_name;	/* field_C */
118
	char *support_name2;	/* field_10 */
119
	char *support_ext; /* field_14 */
120
	void *(*rda_malloc)(int size); /* field_18 */
121
	void *(*rda_calloc)(int members, int size); /* field_1C */
122
	void *(*rda_realloc)(void *p, int size); /* field_20 */
123
	void (*rda_free)(void *p); /* field_24 */
124
	void (*LABus)(void);				/* 28 */
125
	int  (*LAInfo)(struct lactx *, enum TLA_INFO, int16_t bus);			/* 2C */
126
	void (*LAError)(struct lactx *, int, char *, ...);				/* 30 */
127
	void (*LAFindSeq)(void);			/* 34 */
128
	void (*LAFormatValue)(void);		/* 38 */
129
	void (*LAGap)(void);				/* 3c */
130
	int (*LAGroupValue)(struct lactx *lactx, int seqno, int group);			/* 40 */
131
	void (*LAInvalidate)(void);			/* 44 */
132
	void (*LASeqToText)(void);			/* 48 */
133
	void (*LAGroupWidth_)(void);		/* 4c */
134
	void (*LATimeStamp_ps_)(void);		/* 50 */
135
	void (*LASysTrigTime_ps_)(void);	/* 54 */
136
	void (*LABusModTrigTime_ps_)(void);	/* 58 */
137
	void (*LABusModTimeOffset_ps_)(void);	/* 5c */
138
	void (*LAGroupInvalidBitMask_)(void);	/* 60 */
139
	void (*LAContigLongToSeq_)(void);		/* 64 */
140
	void (*LALongToSeq_)(void);				/* 68 */
141
	void (*LALongToValidSeq_)(void);		/* 6c */
142
	void (*LASeqToContigLong_)(void);		/* 70 */
143
	void (*LASeqToLong_)(void);				/* 74 */
144
	void (*LASubDisasmLoad)(void);			/* 78 */
145
	void (*LASubDisasmUnload)(void);		/* 7c */
146
	void (*LASubDisasmFuncTablePtr_)(void);	/* 80 */
147
	void (*LAWhichBusMod_)(void);			/* 84 */
148
	void (*LASeqDisplayFormat_)(void);		/* 88 */
149
	void (*LAInteractiveUI2_)(void);		/* 8c */
150
	void (*LAProgAbort_)(void);				/* 90 */
151
	void (*LATimestamp_ps_ToText)(void);	/* 94 */
152
	void (*LATimeStampDisplayFormat)(void);	/* 98 */
153
	void (*LAReferenceTime_ps_)(void);		/* 9c */
154
	void (*LABusModSysTrigTime_ps_)(void);	/* a0 */
155
	void (*LABusModFrameOffset_ps_)(void);	/* a4 */
156
	void (*LABusModTimeToUserAlignedTime_ps_)(void); /* a8 */
157
	void (*LABusModTrigSample)(void);		/* ac */
158
	void (*LABusModWallClockStart_)(void);	/* b0 */
159
	void *field_B4;							/* b4 */
160
	void (*LAReferenceTime_ps_2)(void);		/* b8 */
161
	void (*LASampleStatusBits)(void);		/* bc */
162
	void (*LASampleStatusBitsType_)(void);
163
	void (*LAGroupViolationBitMask_)(void);
164
	void (*LAGroupViolationBitMaskType_)(void);
165
	void (*LABusModVariantName_)(void);
166
	void (*LASystemName_)(void);
167
	void (*LASystemPath_)(void);
168
	void *field_DC;
169
};
170

    
171

    
172
/*********************************************************
173
		SPI Types
174
*********************************************************/
175

    
176
typedef struct TI2CData
177
{
178
	int sequence;	//where this data was found
179
	int last_sequence;	//where the data ends
180
	int bit_count;	//where are we?
181
	uint32_t	i2c_data;		//I2C data
182

    
183
} TI2CData;
184

    
185

    
186
typedef struct TSeqData
187
{
188
	int seq_number;
189
	struct sequence seq_data;
190
} TSignalGenerator;
191

    
192

    
193
typedef vector <TSeqData> TVSeqData;
194

    
195

    
196

    
197
/*********************************************************
198
		DLL prototypes
199
*********************************************************/
200
extern "C"
201
	{
202
__declspec(dllexport) struct pctx *ParseReinit(struct pctx *pctx, struct lactx *lactx, struct lafunc *func);
203
__declspec(dllexport) int ParseFinish(struct pctx *pctx);
204
__declspec(dllexport) int ParseInfo(struct pctx *pctx, unsigned int request);
205
__declspec(dllexport) int ParseMarkMenu(struct pctx *, int, int, int, int);
206
__declspec(dllexport) int ParseMarkGet(struct pctx *pctx, int seq);
207
__declspec(dllexport) int ParseMarkSet(struct pctx *pctx, int seq, int);
208
__declspec(dllexport) int ParseMarkNext(struct pctx *pctx, int seq, int);
209
__declspec(dllexport) int ParseModeGetPut(struct pctx *pctx, int mode, int, int request);
210
__declspec(dllexport) struct sequence *ParseSeq(struct pctx *, int seq);
211
__declspec(dllexport) struct businfo *ParseBusInfo(struct pctx *, uint16_t bus);
212
__declspec(dllexport) struct modeinfo *ParseModeInfo(struct pctx *pctx, uint16_t mode);
213
__declspec(dllexport) struct groupinfo *ParseGroupInfo(struct pctx *pctx, uint16_t group);
214
__declspec(dllexport) int ParseDisasmReinit(struct pctx *, int request);
215
	}
216

    
217
#endif
(3-3/5)