Project

General

Profile

Feature #981 » SPI.h

tin, 03/10/2014 06:20 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		0x02
15
#define SPI_SEL		0x08
16
#define SPI_MISO	0x04
17
#define SPI_MOSI	0x01
18

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

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

    
25

    
26
/*********************************************************
27
		TLA Types
28
*********************************************************/
29

    
30

    
31
enum TLA_INFO {
32
        TLA_INFO_FIRST_SEQUENCE,
33
        TLA_INFO_LAST_SEQUENCE,
34
        TLA_INFO_DISPLAY_ATTRIBUTE,
35
        TLA_INFO_3,
36
        TLA_INFO_MNEMONICS_WIDTH=5
37
};
38

    
39
struct lactx;
40
struct businfo {
41
	int val0;
42
	int val4;
43
	int val8;
44
	int valc;
45
	int val10;
46
	int val14;
47
	void *val18;
48
	int val1c;
49
};
50

    
51
struct modeinfo {
52
	const char *name;
53
	const char **options;
54
	int val1;
55
	int val2;
56
};
57

    
58
struct sequence {
59
	struct sequence *next;
60
	char *textp;
61
	uint8_t flags;		//The flags determine the background
62
										//bit 0= white (blank),  bit 1=grey,  bit 2=red, bit3=yellow
63
        char field_9;
64
        char field_A;
65
        char field_B;
66
	char *text2;
67
	int field_10;
68
	int field_14;
69
	int field_18;
70
	int field_1C;
71
	char text[128];
72
	char text2_buf[8];
73
};
74

    
75
struct pctx_functable {
76
	int (*LAGroupValue)(struct lactx *lactx, int seqno, int group);
77
	void (*rda_free)(void *p);
78
        void *(*rda_calloc)(int memb, int size);
79
        int (*LAInfo)(struct lactx *, enum TLA_INFO, int16_t bus);
80
};
81
struct pctx {
82
	struct lactx *lactx;
83
	struct pctx_functable func;
84
};
85

    
86
struct groupinfo {
87
	char *name;
88
	char field_4;
89
	char field_5;
90
	char field_6;
91
	char field_7;
92
	uint16_t members;
93
	uint16_t len;
94
};
95

    
96
enum MODEINFO {
97
	MODEINFO_MAX_BUS=0,
98
	MODEINFO_MAX_GROUP=1,
99
	MODEINFO_MAX_MODE=2,
100
	MODEINFO_3=3,
101
	MODEINFO_GETNAME=4,
102
	MODEINFO_MAX,
103
};
104

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

    
163

    
164
/*********************************************************
165
		SPI Types
166
*********************************************************/
167

    
168
typedef struct TSPIData
169
{
170
	int sequence;	//where this data was found
171
	int last_sequence;	//where the data ends
172
	int bit_count;	//where are we?
173
	uint32_t	mosi_data;		//SPI data
174
	uint32_t	miso_data;		//SPI data
175

    
176
} TSPIData;
177

    
178

    
179
typedef struct TSeqData
180
{
181
	int seq_number;
182
	struct sequence seq_data;
183
} TSignalGenerator;
184

    
185

    
186
typedef vector <TSeqData> TVSeqData;
187

    
188

    
189

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

    
210
#endif
(4-4/7)