Line -... |
Line 1... |
- |
|
1 |
|
- |
|
2 |
//struct { |
- |
|
3 |
unsigned int8 firenum; |
- |
|
4 |
unsigned int8 div_fire; |
- |
|
5 |
unsigned int8 calresnum :2; |
- |
|
6 |
unsigned int8 clkhsdiv ; |
- |
|
7 |
unsigned int8 start_clkhs:1; |
- |
|
8 |
unsigned int8 portnum :1; |
- |
|
9 |
unsigned int8 Tcycle :1; |
- |
|
10 |
unsigned int8 fakenum :1; |
- |
|
11 |
unsigned int8 selclkT :1; |
- |
|
12 |
unsigned int8 calibrate :1; |
- |
|
13 |
unsigned int8 disautocal :1; |
- |
|
14 |
unsigned int8 MRange :1; |
- |
|
15 |
unsigned int8 neg_stop2 :1; |
- |
|
16 |
unsigned int8 neg_stop1 :1; |
- |
|
17 |
unsigned int8 neg_start :1; |
- |
|
18 |
//}reg0; |
- |
|
19 |
|
- |
|
20 |
//struct { |
- |
|
21 |
unsigned int hit2 :4; |
- |
|
22 |
unsigned int hit1 :4; |
- |
|
23 |
unsigned int fast_init :1; |
- |
|
24 |
unsigned int sc :1; |
- |
|
25 |
unsigned int hitin2 :3; |
- |
|
26 |
unsigned int hitin1 :3; |
- |
|
27 |
//}reg1; |
- |
|
28 |
|
- |
|
29 |
//struct { |
- |
|
30 |
unsigned int en_int :3; |
- |
|
31 |
unsigned int rfedge2 :1; |
- |
|
32 |
unsigned int rfedge1 :1; |
- |
|
33 |
unsigned int delval1 :3; |
- |
|
34 |
//}reg2; |
- |
|
35 |
|
- |
|
36 |
//struct { |
- |
|
37 |
unsigned int en_err_val :1; |
- |
|
38 |
unsigned int tim0_mr2 :2; |
- |
|
39 |
unsigned int32 delval :7; |
- |
|
40 |
//}reg3; |
- |
|
41 |
|
- |
|
42 |
//}TDC_registers; |
- |
|
43 |
|
- |
|
44 |
|
1 |
void TDC_init() |
45 |
void TDC_init() |
2 |
{ |
46 |
{ |
3 |
output_low(TDC_ENABLE); |
47 |
output_low(TDC_ENABLE); |
4 |
spi_xfer(TDC_stream,0x70); |
48 |
spi_xfer(TDC_stream,0x70); |
5 |
output_high(TDC_ENABLE); |
49 |
output_high(TDC_ENABLE); |
Line 71... |
Line 115... |
71 |
ret=spi_xfer(TDC_stream,0,8); |
115 |
ret=spi_xfer(TDC_stream,0,8); |
72 |
output_high(TDC_ENABLE); |
116 |
output_high(TDC_ENABLE); |
73 |
return ret; |
117 |
return ret; |
74 |
} |
118 |
} |
75 |
|
119 |
|
76 |
void TDC_setup_reg1() |
120 |
void TDC_update_registers() |
77 |
{ |
121 |
{ |
78 |
output_low(TDC_ENABLE); |
122 |
output_low(TDC_ENABLE); |
79 |
spi_xfer(TDC_stream,0x81,8); |
123 |
spi_xfer(TDC_stream,0x81,8); |
80 |
spi_xfer(TDC_stream,0x224000,24); |
124 |
spi_xfer(TDC_stream,reg1.*,24); |
81 |
output_high(TDC_ENABLE); |
125 |
output_high(TDC_ENABLE); |
82 |
|
126 |
|
83 |
output_low(TDC_ENABLE); |
127 |
/* output_low(TDC_ENABLE); |
84 |
spi_xfer(TDC_stream,0xB1); |
128 |
spi_xfer(TDC_stream,0xB1); |
85 |
output_high(TDC_ENABLE); |
129 |
output_high(TDC_ENABLE); |
86 |
|
130 |
|
87 |
output_low(TDC_ENABLE); |
131 |
output_low(TDC_ENABLE); |
88 |
spi_xfer(TDC_stream,0xB2); |
132 |
spi_xfer(TDC_stream,0xB2); |
Line 92... |
Line 136... |
92 |
spi_xfer(TDC_stream,0xB3); |
136 |
spi_xfer(TDC_stream,0xB3); |
93 |
output_high(TDC_ENABLE); |
137 |
output_high(TDC_ENABLE); |
94 |
|
138 |
|
95 |
output_low(TDC_ENABLE); |
139 |
output_low(TDC_ENABLE); |
96 |
spi_xfer(TDC_stream,0xB4); |
140 |
spi_xfer(TDC_stream,0xB4); |
97 |
output_high(TDC_ENABLE); |
141 |
output_high(TDC_ENABLE); */ |
- |
|
142 |
} |
- |
|
143 |
|
- |
|
144 |
void TDC_set_firenum() |
- |
|
145 |
{ |
- |
|
146 |
reg0.Tcycle=TDC_TCYCLE_SHORT; |
98 |
} |
147 |
} |