forked from haiwil/pa2000
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spi_d.h
187 lines (147 loc) · 5.83 KB
/
spi_d.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*345678901234567890123456789012345678901234567890123456789012345678901234567890
* 10 20 30 40 50 60 70 80
*/
#ifndef __SPI_D_H_
#define __SPI_D_H_
#define FOCAL_DATA_ADD 0x10000000
#define GROUP_DATA_ADD 0x20000000
#define TGC_DATA_ADD 0x40000000
#define FIR_DATA_ADD 0x80000000
typedef struct _DWORD_OBJ
{
unsigned int RX_TX_SEL_H;
unsigned int RX_TX_SEL_L;
} DWORD;
typedef struct _Group_data
{
/* s_group_reg (-1) 地址 */
unsigned int offset:16; /* bit:0-15 地址的偏移 */
unsigned int TT:12; /* bit:16-27 保留*/
unsigned int addr:4; /* bit:28-31 片选 Group取值0010 */
/* s_group_reg (0) */
unsigned int freq_band:4; /* bit:0-3 频带选择 */
unsigned int video_filter:1; /* bit:4 视频滤波 */
unsigned int rectifier:2; /* bit:5-6 检波 */
unsigned int compress_rato:12; /* bit:7-18 压缩比 */
unsigned int TT9:3; /* */
unsigned int gain:10; /* bit:22-31 Gain */
/* s_group_reg (1) */
unsigned int tcg_point_qty:8; /* bit:0-7 TCG点个数 */
unsigned int tcg_en:1; /* bit:8 TCG使能 */
unsigned int UT1:1; /* bit:9 UT1 */
unsigned int UT2:1; /* bit:10 UT2 */
unsigned int PA:1; /* bit:11 PA */
unsigned int _sample_start:20; /* bit:12-31 采样起点*/
/* s_group_reg (2) */
unsigned int sum_gain:12; /* bit:0-11 Sum gain */
unsigned int _sample_range:20; /* bit:12-31 capture end 采样范围 */
/* s_group_reg (3) */
unsigned int point_qty:16 ; /* bit:0-15 聚焦法则数量 */
unsigned int sample_offset:16; /* bit:16-31 采样延时 */
//unsigned int beam_qty:16 ; // modify 20110816
/* s_group_reg (4) */
unsigned int rx_time:20; /* bit:0-19 rx_time */
unsigned int TT1:2;
unsigned int gain1:10; /* bit:22-31 gain1 */
/* s_group_reg (5) */
unsigned int idel_time:27; /* bit:0-26 idel time */
unsigned int TT2:5;
/* s_group_reg (6) */
unsigned int gate_a_height:12; /* bit:0-11 闸门A 高度 */
unsigned int gate_a_start:20; /* bit:12-31 闸门A 开始 */
/* s_group_reg (7) */
unsigned int gate_a_logic:8; /* bit:0-7 闸门A 逻辑 */
unsigned int TT4:4;
unsigned int gate_a_end:20; /* bit:12-31 闸门A 结束 */
/* s_group_reg (8) */
unsigned int gate_b_height:12; /* bit:0-11 闸门B 高度 */
unsigned int gate_b_start:20; /* bit:12-31 闸门B 开始 */
/* s_group_reg (9) */
unsigned int gate_b_logic:8; /* bit:0-7 闸门B 逻辑 */
unsigned int TT5:4;
unsigned int gate_b_end:20; /* bit:12-31 闸门B 结束 */
/* s_group_reg (10) */
unsigned int gate_i_height:12; /* bit:0-11 闸门C 高度 */
unsigned int gate_i_start:20; /* bit:12-31 闸门C 开始 */
/* s_group_reg (11) */
unsigned int gate_i_logic:8; /* bit:0-7 闸门C 逻辑 */
unsigned int TT6:4;
unsigned int gate_i_end:20; /* bit:12-31 闸门C 结束 */
/* s_group_reg (12) */
unsigned int voltage:8; /* bit:0-7 发射电压 */
unsigned int damping:2; /* bit:8-9 阻尼 */
unsigned int twin_on_off:1; /* bit:10 双晶 */
unsigned int twin_ut:1; /* bit:11 0:UT1 1:UT2 */
unsigned int TT8:8; /**/
unsigned int reject:12; /* bit:20-31 闸门C 结束 */
/* s_group_ref (13) */
unsigned int sample_start:21;
unsigned int TT_S:11;
/* s_group_ref (14)*/
unsigned int sample_range:21;
unsigned int TT_V:11;
/* s_group_ref (15)*/
unsigned int tx_end:14;
unsigned int TT15:2;
unsigned int tx_start:14;
unsigned int TT16:2;
} group_data_spi;
typedef struct _Focal_data
{
/* s_group_reg (-1) 地址 */
unsigned int offset:16; /* bit:0-15 地址的偏移 */
unsigned int TT:12; /* bit:16-27 保留*/
unsigned int addr:4; /* bit:28-31 片选 Group取值0010 */
/* s_group_reg (0) 地址 */
unsigned int TT1:2; /* bit:0-1 保留 */
unsigned int gain_offset:10; /* bit:2-11 增益补偿单位0.1dB */
unsigned int TT2:3; /* bit:12-14 保留 */
unsigned int group:4; /* bit:15-18 groupId */
unsigned int all_beam_info:13; /* bit:19-31 beam_qty */
/* s_group_reg (1) 地址 */
unsigned int beam_delay:16; /* bit:0-15 16 单位10ns */
unsigned int TT3:16; /* bit 16-31 保留*/
/* s_group_reg (2) 地址 */
unsigned int gate_a_start:20;/* bit:0-19 单位10ns */
unsigned int TT4:12; /* bit 20-31 保留*/
/* s_group_reg (3) 地址 */
unsigned int gate_a_end:20; /* bit:0-19 单位10ns */
unsigned int TT5:12; /* bit 20-31 保留*/
/* s_group_reg (4) 地址 */
unsigned int gate_b_start:20;/* bit:0-19 单位10ns */
unsigned int TT6:12; /* bit 20-31 保留*/
/* s_group_reg (5) 地址 */
unsigned int gate_b_end:20; /* bit:0-19 单位10ns */
unsigned int TT7:12; /* bit 20-31 保留*/
/* s_group_reg (6) 地址 */
unsigned int gate_i_start:20;/* bit:0-19 单位10ns */
unsigned int TT8:12; /* bit 20-31 保留*/
/* s_group_reg (7) 地址 */
unsigned int gate_i_end:20; /* bit:0-19 单位10ns */
unsigned int TT9:12; /* bit 20-31 保留*/
/* s_group_reg (8-9) 地址 */
unsigned int TT10[2]; /* 保留 */
unsigned int tx_enable;
unsigned int rx_enable;
/* s_group_reg (12-13) 地址 接收使能 */
DWORD rx_sel;
/* s_group_reg (14-15) 地址 发射使能 */
DWORD tx_sel;
/* s_group_reg (16-47) 地址 阵元发射信息 */
unsigned int tx_info[32]; /* bit0-13 发射开始 bit:16-29 发射结束*/
/* s_group_reg (48-63) 地址 阵元接收信息 */
unsigned int rx_info[16]; /* bit0-31 控制 1-32 路 */
/*
unsigned int tx_start:14;
unsigned int TT5:2;
unsigned int tx_end:14;
unsigned int TT6:2;
*/
} focal_data_spi;
extern void init_spi ();
extern DWORD channel_select(unsigned int n);
extern int write_group_data (group_data_spi *p, unsigned int group);
extern int write_focal_data (focal_data_spi *p, unsigned int beam_num);
extern void little_to_big(unsigned int *p, int n) ;
extern int write_focal_data_without_reset (focal_data_spi *p, unsigned int beam_num) ;
#endif