1 |
|
1 |
|
2 |
|
2 |
|
3 |
#define TDC_CLKHS 5000000 // frequency of highspeed oscillator |
3 |
#define TDC_CLKHS 5000000 // frequency of highspeed oscillator |
4 |
|
4 |
|
5 |
//register 0 |
5 |
//register 0 |
6 |
#define TDC_NEG_START_INV 1 |
6 |
#define TDC_NEG_START_INV 1 |
7 |
#define TDC_NEG_START 0 |
7 |
#define TDC_NEG_START 0 |
8 |
#define TDC_NEG_STOP1_INV 1 |
8 |
#define TDC_NEG_STOP1_INV 1 |
9 |
#define TDC_NEG_STOP1 0 |
9 |
#define TDC_NEG_STOP1 0 |
10 |
#define TDC_NEG_STOP2_INV 1 |
10 |
#define TDC_NEG_STOP2_INV 1 |
11 |
#define TDC_NEG_STOP2 0 |
11 |
#define TDC_NEG_STOP2 0 |
12 |
#define TDC_MRANGE1 0 |
12 |
#define TDC_MRANGE1 0 |
13 |
#define TDC_MRANGE2 1 |
13 |
#define TDC_MRANGE2 1 |
14 |
#define TDC_AUTOCAL_EN 0 |
14 |
#define TDC_AUTOCAL_EN 0 |
15 |
#define TDC_AUTOCAL_DIS 1 |
15 |
#define TDC_AUTOCAL_DIS 1 |
16 |
#define TDC_CALIBRATE_EN 1 |
16 |
#define TDC_CALIBRATE_EN 1 |
17 |
#define TDC_CALIBRATE_DIS 0 |
17 |
#define TDC_CALIBRATE_DIS 0 |
18 |
#define TDC_TSELCLK_32KHZ 0 |
18 |
#define TDC_TSELCLK_32KHZ 0 |
19 |
#define TDC_TSELCLK_128HS 1 |
19 |
#define TDC_TSELCLK_128HS 1 |
20 |
#define TDC_TFAKENUM_2 0 |
20 |
#define TDC_TFAKENUM_2 0 |
21 |
#define TDC_TFAKENUM_8 1 |
21 |
#define TDC_TFAKENUM_8 1 |
22 |
#define TDC_TCYCLE_SHORT 0 |
22 |
#define TDC_TCYCLE_SHORT 0 |
23 |
#define TDC_TCYSLE_LONG 1 |
23 |
#define TDC_TCYCLE_LONG 1 |
24 |
#define TDC_TPORTNUM_2 0 |
24 |
#define TDC_TPORTNUM_2 0 |
25 |
#define TDC_TPORTNUM_4 1 |
25 |
#define TDC_TPORTNUM_4 1 |
26 |
#define TDC_CLKHS_OFF 0 |
26 |
#define TDC_CLKHS_OFF 0 |
27 |
#define TDC_CLKHS_ON 1 |
27 |
#define TDC_CLKHS_ON 1 |
28 |
#define TDC_CLKHS_640US 2 |
28 |
#define TDC_CLKHS_640US 2 |
29 |
#define TDC_CLKHS_1280US 4 |
29 |
#define TDC_CLKHS_1280US 4 |
30 |
#define TDC_CLKHSDIV_1 0 |
30 |
#define TDC_CLKHSDIV_1 0 |
31 |
#define TDC_CLKHSDIV_2 1 |
31 |
#define TDC_CLKHSDIV_2 1 |
32 |
#define TDC_CLKHSDIV_4 2 |
32 |
#define TDC_CLKHSDIV_4 2 |
33 |
#define TDC_CLKHSDIV_8 3 |
33 |
#define TDC_CLKHSDIV_8 3 |
34 |
#define TDC_CALPERIODS_2 0 |
34 |
#define TDC_CALPERIODS_2 0 |
35 |
#define TDC_CALPERIODS_4 1 |
35 |
#define TDC_CALPERIODS_4 1 |
36 |
#define TDC_CALPERIODS_8 2 |
36 |
#define TDC_CALPERIODS_8 2 |
37 |
#define TDC_CALPERIODS_16 3 |
37 |
#define TDC_CALPERIODS_16 3 |
38 |
|
38 |
|
39 |
#define TDC_DIV_FIRE_2 1 |
39 |
#define TDC_DIV_FIRE_2 1 |
40 |
#define TDC_DIV_FIRE_3 2 |
40 |
#define TDC_DIV_FIRE_3 2 |
41 |
#define TDC_DIV_FIRE_4 3 |
41 |
#define TDC_DIV_FIRE_4 3 |
42 |
#define TDC_DIV_FIRE_5 4 |
42 |
#define TDC_DIV_FIRE_5 4 |
43 |
#define TDC_DIV_FIRE_6 5 |
43 |
#define TDC_DIV_FIRE_6 5 |
44 |
#define TDC_DIV_FIRE_7 6 |
44 |
#define TDC_DIV_FIRE_7 6 |
45 |
#define TDC_DIV_FIRE_8 7 |
45 |
#define TDC_DIV_FIRE_8 7 |
46 |
#define TDC_DIV_FIRE_9 8 |
46 |
#define TDC_DIV_FIRE_9 8 |
47 |
#define TDC_DIV_FIRE_10 9 |
47 |
#define TDC_DIV_FIRE_10 9 |
48 |
#define TDC_DIV_FIRE_11 10 |
48 |
#define TDC_DIV_FIRE_11 10 |
49 |
#define TDC_DIV_FIRE_12 11 |
49 |
#define TDC_DIV_FIRE_12 11 |
50 |
#define TDC_DIV_FIRE_13 12 |
50 |
#define TDC_DIV_FIRE_13 12 |
51 |
#define TDC_DIV_FIRE_14 13 |
51 |
#define TDC_DIV_FIRE_14 13 |
52 |
#define TDC_DIV_FIRE_15 14 |
52 |
#define TDC_DIV_FIRE_15 14 |
53 |
#define TDC_DIV_FIRE_16 15 |
53 |
#define TDC_DIV_FIRE_16 15 |
54 |
|
54 |
|
55 |
#define TDC_FIRENUM_0 0 |
55 |
#define TDC_FIRENUM_0 0 |
56 |
#define TDC_FIRENUM_1 1 |
56 |
#define TDC_FIRENUM_1 1 |
57 |
#define TDC_FIRENUM_2 2 |
57 |
#define TDC_FIRENUM_2 2 |
58 |
#define TDC_FIRENUM_3 3 |
58 |
#define TDC_FIRENUM_3 3 |
59 |
#define TDC_FIRENUM_4 4 |
59 |
#define TDC_FIRENUM_4 4 |
60 |
#define TDC_FIRENUM_5 5 |
60 |
#define TDC_FIRENUM_5 5 |
61 |
#define TDC_FIRENUM_6 6 |
61 |
#define TDC_FIRENUM_6 6 |
62 |
#define TDC_FIRENUM_7 7 |
62 |
#define TDC_FIRENUM_7 7 |
63 |
#define TDC_FIRENUM_8 8 |
63 |
#define TDC_FIRENUM_8 8 |
64 |
#define TDC_FIRENUM_9 9 |
64 |
#define TDC_FIRENUM_9 9 |
65 |
#define TDC_FIRENUM_10 10 |
65 |
#define TDC_FIRENUM_10 10 |
66 |
#define TDC_FIRENUM_11 11 |
66 |
#define TDC_FIRENUM_11 11 |
67 |
#define TDC_FIRENUM_12 12 |
67 |
#define TDC_FIRENUM_12 12 |
68 |
#define TDC_FIRENUM_13 13 |
68 |
#define TDC_FIRENUM_13 13 |
69 |
#define TDC_FIRENUM_14 14 |
69 |
#define TDC_FIRENUM_14 14 |
70 |
#define TDC_FIRENUM_15 15 |
70 |
#define TDC_FIRENUM_15 15 |
71 |
|
71 |
|
72 |
//register 1 |
72 |
//register 1 |
73 |
#define TDC_HITIN1_0 0 |
73 |
#define TDC_HITIN1_0 0 |
74 |
#define TDC_HITIN1_1 1 |
74 |
#define TDC_HITIN1_1 1 |
75 |
#define TDC_HITIN1_2 2 |
75 |
#define TDC_HITIN1_2 2 |
76 |
#define TDC_HITIN1_3 3 |
76 |
#define TDC_HITIN1_3 3 |
77 |
#define TDC_HITIN1_4 4 |
77 |
#define TDC_HITIN1_4 4 |
78 |
|
78 |
|
79 |
#define TDC_HITIN2_0 0 |
79 |
#define TDC_HITIN2_0 0 |
80 |
#define TDC_HITIN2_1 1 |
80 |
#define TDC_HITIN2_1 1 |
81 |
#define TDC_HITIN2_2 2 |
81 |
#define TDC_HITIN2_2 2 |
82 |
#define TDC_HITIN2_3 3 |
82 |
#define TDC_HITIN2_3 3 |
83 |
#define TDC_HITIN2_4 4 |
83 |
#define TDC_HITIN2_4 4 |
84 |
|
84 |
|
85 |
#define TDC_FAST_INIT_EN 1 |
85 |
#define TDC_FAST_INIT_EN 1 |
86 |
#define TDC_FAST_INIT_DIS 0 |
86 |
#define TDC_FAST_INIT_DIS 0 |
87 |
|
87 |
|
88 |
#define TDC_MRANGE1_HIT1_START 0 |
88 |
#define TDC_MRANGE1_HIT1_START 0 |
89 |
#define TDC_MRANGE1_HIT1_1CH1 1 |
89 |
#define TDC_MRANGE1_HIT1_1CH1 1 |
90 |
#define TDC_MRANGE1_HIT1_2CH1 2 |
90 |
#define TDC_MRANGE1_HIT1_2CH1 2 |
91 |
#define TDC_MRANGE1_HIT1_3CH1 3 |
91 |
#define TDC_MRANGE1_HIT1_3CH1 3 |
92 |
#define TDC_MRANGE1_HIT1_4CH1 4 |
92 |
#define TDC_MRANGE1_HIT1_4CH1 4 |
93 |
#define TDC_MRANGE1_HIT1_NOAC 5 |
93 |
#define TDC_MRANGE1_HIT1_NOAC 5 |
94 |
#define TDC_MRANGE1_HIT1_CAL1CH1 6 |
94 |
#define TDC_MRANGE1_HIT1_CAL1CH1 6 |
95 |
#define TDC_MRANGE1_HIT1_CAL2CH1 7 |
95 |
#define TDC_MRANGE1_HIT1_CAL2CH1 7 |
96 |
#define TDC_MRANGE1_HIT1_1CH2 9 |
96 |
#define TDC_MRANGE1_HIT1_1CH2 9 |
97 |
#define TDC_MRANGE1_HIT1_2CH2 0xA |
97 |
#define TDC_MRANGE1_HIT1_2CH2 0xA |
98 |
#define TDC_MRANGE1_HIT1_3CH2 0xB |
98 |
#define TDC_MRANGE1_HIT1_3CH2 0xB |
99 |
#define TDC_MRANGE1_HIT1_4CH2 0xC |
99 |
#define TDC_MRANGE1_HIT1_4CH2 0xC |
100 |
|
100 |
|
101 |
#define TDC_MRANGE2_HIT1_START 1 |
101 |
#define TDC_MRANGE2_HIT1_START 1 |
102 |
|
102 |
|
103 |
#define TDC_MRANGE1_HIT2_START 0 |
103 |
#define TDC_MRANGE1_HIT2_START 0 |
104 |
#define TDC_MRANGE1_HIT2_1CH1 1 |
104 |
#define TDC_MRANGE1_HIT2_1CH1 1 |
105 |
#define TDC_MRANGE1_HIT2_2CH1 2 |
105 |
#define TDC_MRANGE1_HIT2_2CH1 2 |
106 |
#define TDC_MRANGE1_HIT2_3CH1 3 |
106 |
#define TDC_MRANGE1_HIT2_3CH1 3 |
107 |
#define TDC_MRANGE1_HIT2_4CH1 4 |
107 |
#define TDC_MRANGE1_HIT2_4CH1 4 |
108 |
#define TDC_MRANGE1_HIT2_NOAC 5 |
108 |
#define TDC_MRANGE1_HIT2_NOAC 5 |
109 |
#define TDC_MRANGE1_HIT2_CAL1CH1 6 |
109 |
#define TDC_MRANGE1_HIT2_CAL1CH1 6 |
110 |
#define TDC_MRANGE1_HIT2_CAL2CH1 7 |
110 |
#define TDC_MRANGE1_HIT2_CAL2CH1 7 |
111 |
#define TDC_MRANGE1_HIT2_1CH2 9 |
111 |
#define TDC_MRANGE1_HIT2_1CH2 9 |
112 |
#define TDC_MRANGE1_HIT2_2CH2 0xA |
112 |
#define TDC_MRANGE1_HIT2_2CH2 0xA |
113 |
#define TDC_MRANGE1_HIT2_3CH2 0xB |
113 |
#define TDC_MRANGE1_HIT2_3CH2 0xB |
114 |
#define TDC_MRANGE1_HIT2_4CH2 0xC |
114 |
#define TDC_MRANGE1_HIT2_4CH2 0xC |
115 |
|
115 |
|
116 |
#define TDC_MRANGE2_HIT2_1CH1 2 |
116 |
#define TDC_MRANGE2_HIT2_1CH1 2 |
117 |
#define TDC_MRANGE2_HIT2_2CH1 3 |
117 |
#define TDC_MRANGE2_HIT2_2CH1 3 |
118 |
#define TDC_MRANGE2_HIT2_3CH1 4 |
118 |
#define TDC_MRANGE2_HIT2_3CH1 4 |
119 |
|
119 |
|
120 |
//register 2 |
120 |
//register 2 |
121 |
#define TDC_INT_TIMEOUT 4 |
121 |
#define TDC_INT_TIMEOUT 4 |
122 |
#define TDC_INT_ENDHIT 2 |
122 |
#define TDC_INT_ENDHIT 2 |
123 |
#define TDC_INT_ALU 1 |
123 |
#define TDC_INT_ALU 1 |
124 |
#define TDC_CH1EDGE_RIS 0 |
124 |
#define TDC_CH1EDGE_RIS 0 |
125 |
#define TDC_CH1EDGE_FAL 1 |
125 |
#define TDC_CH1EDGE_FAL 1 |
126 |
#define TDC_CH2EDGE_RIS 0 |
126 |
#define TDC_CH2EDGE_RIS 0 |
127 |
#define TDC_CH2EDGE_FAL 1 |
127 |
#define TDC_CH2EDGE_FAL 1 |
128 |
|
128 |
|
129 |
//register 3 |
129 |
//register 3 |
130 |
#define TDC_TIM0MR2_256CLKHS 0 |
130 |
#define TDC_TIM0MR2_256CLKHS 0 |
131 |
#define TDC_TIM0MR2_1024CLKHS 1 |
131 |
#define TDC_TIM0MR2_1024CLKHS 1 |
132 |
#define TDC_TIM0MR2_4096CLKHS 2 |
132 |
#define TDC_TIM0MR2_4096CLKHS 2 |
133 |
#define TDC_TIM0MR2_16384CLKHS 3 |
133 |
#define TDC_TIM0MR2_16384CLKHS 3 |
134 |
|
134 |
|
135 |
#define TDC_ERRVAL_EN 1 |
135 |
#define TDC_ERRVAL_EN 1 |
136 |
#define TDC_ERRVAL_DIS 0 |
136 |
#define TDC_ERRVAL_DIS 0 |
137 |
|
137 |
|
138 |
//register 5 |
138 |
//register 5 |
139 |
#define TDC_REPEAT_FIRE_0 0 |
139 |
#define TDC_REPEAT_FIRE_0 0 |
140 |
#define TDC_REPEAT_FIRE_1 1 |
140 |
#define TDC_REPEAT_FIRE_1 1 |
141 |
#define TDC_REPEAT_FIRE_2 2 |
141 |
#define TDC_REPEAT_FIRE_2 2 |
142 |
#define TDC_REPEAT_FIRE_3 3 |
142 |
#define TDC_REPEAT_FIRE_3 3 |
143 |
#define TDC_REPEAT_FIRE_4 4 |
143 |
#define TDC_REPEAT_FIRE_4 4 |
144 |
#define TDC_REPEAT_FIRE_5 5 |
144 |
#define TDC_REPEAT_FIRE_5 5 |
145 |
#define TDC_REPEAT_FIRE_6 6 |
145 |
#define TDC_REPEAT_FIRE_6 6 |
146 |
#define TDC_REPEAT_FIRE_7 7 |
146 |
#define TDC_REPEAT_FIRE_7 7 |
147 |
|
147 |
|
148 |
#define TDC_PHASENOISE_EN 0 |
148 |
#define TDC_PHASENOISE_EN 0 |
149 |
#define TDC_PHASENOISE_DIS 1 |
149 |
#define TDC_PHASENOISE_DIS 1 |
150 |
|
150 |
|
151 |
#define TDC_STARTNOISE_EN 1 |
151 |
#define TDC_STARTNOISE_EN 1 |
152 |
#define TDC_STARTNOISE_DIS 0 |
152 |
#define TDC_STARTNOISE_DIS 0 |
153 |
|
153 |
|
154 |
#include "GP2.c" |
154 |
#include "GP2.c" |