@@ -1,11 +1,32 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the LFR Offset analysis firmware | |||
|
3 | -- Copyright (C) 2016, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
1 | #include <LFR.h> |
|
22 | #include <LFR.h> | |
2 |
|
23 | |||
3 | volatile lfr_regs_t* LFR = (lfr_regs_t*)0x80000f00; |
|
24 | volatile lfr_regs_t* LFR = (lfr_regs_t*)0x80000f00; | |
4 | volatile lfr_managment_regs_t* LFR_MANAGMENT = (lfr_managment_regs_t*)0x80000600; |
|
25 | volatile lfr_managment_regs_t* LFR_MANAGMENT = (lfr_managment_regs_t*)0x80000600; | |
5 |
|
26 | |||
6 | void resetLFR() |
|
27 | void resetLFR() | |
7 | { |
|
28 | { | |
8 | LFR_MANAGMENT->Control.Value=7; |
|
29 | LFR_MANAGMENT->Control.Value=7; | |
9 | asm("nop;nop;"); |
|
30 | asm("nop;nop;"); | |
10 | LFR_MANAGMENT->Control.Value=0; |
|
31 | LFR_MANAGMENT->Control.Value=0; | |
11 | } |
|
32 | } |
@@ -1,12 +1,33 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the LFR Offset analysis firmware | |||
|
3 | -- Copyright (C) 2016, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
1 | #ifndef LFR_H_INCLUDED |
|
22 | #ifndef LFR_H_INCLUDED | |
2 | #define LFR_H_INCLUDED |
|
23 | #define LFR_H_INCLUDED | |
3 |
|
24 | |||
4 | #include <stdint.h> |
|
25 | #include <stdint.h> | |
5 | #include <grlib_regs.h> |
|
26 | #include <grlib_regs.h> | |
6 |
|
27 | |||
7 | extern volatile lfr_regs_t* LFR; |
|
28 | extern volatile lfr_regs_t* LFR; | |
8 | extern volatile lfr_managment_regs_t* LFR_MANAGMENT; |
|
29 | extern volatile lfr_managment_regs_t* LFR_MANAGMENT; | |
9 |
|
30 | |||
10 | extern void resetLFR(); |
|
31 | extern void resetLFR(); | |
11 |
|
32 | |||
12 | #endif // LFR_H_INCLUDED |
|
33 | #endif // LFR_H_INCLUDED |
@@ -1,242 +1,263 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the LFR Offset analysis firmware | |||
|
3 | -- Copyright (C) 2016, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
1 | #ifndef GRLIB_REGS_H_INCLUDED |
|
22 | #ifndef GRLIB_REGS_H_INCLUDED | |
2 | #define GRLIB_REGS_H_INCLUDED |
|
23 | #define GRLIB_REGS_H_INCLUDED | |
3 |
|
24 | |||
4 | #define NB_GPTIMER 3 |
|
25 | #define NB_GPTIMER 3 | |
5 | #include <stdint.h> |
|
26 | #include <stdint.h> | |
6 |
|
27 | |||
7 | struct apbuart_regs_str{ |
|
28 | struct apbuart_regs_str{ | |
8 | volatile unsigned int data; |
|
29 | volatile unsigned int data; | |
9 | volatile unsigned int status; |
|
30 | volatile unsigned int status; | |
10 | volatile unsigned int ctrl; |
|
31 | volatile unsigned int ctrl; | |
11 | volatile unsigned int scaler; |
|
32 | volatile unsigned int scaler; | |
12 | volatile unsigned int fifoDebug; |
|
33 | volatile unsigned int fifoDebug; | |
13 | }; |
|
34 | }; | |
14 |
|
35 | |||
15 | struct grgpio_regs_str{ |
|
36 | struct grgpio_regs_str{ | |
16 | volatile int io_port_data_register; |
|
37 | volatile int io_port_data_register; | |
17 | int io_port_output_register; |
|
38 | int io_port_output_register; | |
18 | int io_port_direction_register; |
|
39 | int io_port_direction_register; | |
19 | int interrupt_mak_register; |
|
40 | int interrupt_mak_register; | |
20 | int interrupt_polarity_register; |
|
41 | int interrupt_polarity_register; | |
21 | int interrupt_edge_register; |
|
42 | int interrupt_edge_register; | |
22 | int bypass_register; |
|
43 | int bypass_register; | |
23 | int reserved; |
|
44 | int reserved; | |
24 | // 0x20-0x3c interrupt map register(s) |
|
45 | // 0x20-0x3c interrupt map register(s) | |
25 | }; |
|
46 | }; | |
26 |
|
47 | |||
27 | typedef volatile struct { |
|
48 | typedef volatile struct { | |
28 | int counter; |
|
49 | int counter; | |
29 | volatile unsigned int reload; |
|
50 | volatile unsigned int reload; | |
30 | volatile unsigned int ctrl; |
|
51 | volatile unsigned int ctrl; | |
31 | volatile unsigned int unused; |
|
52 | volatile unsigned int unused; | |
32 | } timer_regs_t; |
|
53 | } timer_regs_t; | |
33 |
|
54 | |||
34 | typedef volatile struct { |
|
55 | typedef volatile struct { | |
35 | volatile unsigned int scaler_value; |
|
56 | volatile unsigned int scaler_value; | |
36 | volatile unsigned int scaler_reload; |
|
57 | volatile unsigned int scaler_reload; | |
37 | volatile unsigned int conf; |
|
58 | volatile unsigned int conf; | |
38 | volatile unsigned int unused0; |
|
59 | volatile unsigned int unused0; | |
39 | timer_regs_t timer[NB_GPTIMER]; |
|
60 | timer_regs_t timer[NB_GPTIMER]; | |
40 | } gptimer_regs_t; |
|
61 | } gptimer_regs_t; | |
41 |
|
62 | |||
42 |
|
63 | |||
43 | typedef struct |
|
64 | typedef struct | |
44 | { |
|
65 | { | |
45 | uint32_t unused:16; |
|
66 | uint32_t unused:16; | |
46 | uint32_t Fine:16; |
|
67 | uint32_t Fine:16; | |
47 | uint32_t Coarse; |
|
68 | uint32_t Coarse; | |
48 | }CUCtime_t; |
|
69 | }CUCtime_t; | |
49 |
|
70 | |||
50 | struct DualBuffAddr_t |
|
71 | struct DualBuffAddr_t | |
51 | { |
|
72 | { | |
52 | volatile uint32_t ADDR0; |
|
73 | volatile uint32_t ADDR0; | |
53 | volatile uint32_t ADDR1; |
|
74 | volatile uint32_t ADDR1; | |
54 | }; |
|
75 | }; | |
55 |
|
76 | |||
56 | struct Potential_t |
|
77 | struct Potential_t | |
57 | { |
|
78 | { | |
58 | uint32_t UNUSED:16; |
|
79 | uint32_t UNUSED:16; | |
59 | uint32_t Value:16; |
|
80 | uint32_t Value:16; | |
60 | }; |
|
81 | }; | |
61 |
|
82 | |||
62 |
|
83 | |||
63 | typedef volatile struct { |
|
84 | typedef volatile struct { | |
64 | volatile union CONFIG{ |
|
85 | volatile union CONFIG{ | |
65 | volatile struct { |
|
86 | volatile struct { | |
66 | uint32_t UNUSED:29; // 0x00 |
|
87 | uint32_t UNUSED:29; // 0x00 | |
67 | uint32_t run:1; |
|
88 | uint32_t run:1; | |
68 | uint32_t interuptOnDoneEnable:1; |
|
89 | uint32_t interuptOnDoneEnable:1; | |
69 | uint32_t interuptOnErrorEnable:1; |
|
90 | uint32_t interuptOnErrorEnable:1; | |
70 | }FIELDS; |
|
91 | }FIELDS; | |
71 | uint32_t Value; |
|
92 | uint32_t Value; | |
72 | }CONFIG; |
|
93 | }CONFIG; | |
73 |
|
94 | |||
74 | volatile union STATUS{ |
|
95 | volatile union STATUS{ | |
75 | volatile struct { |
|
96 | volatile struct { | |
76 | uint32_t UNUSED:21; |
|
97 | uint32_t UNUSED:21; | |
77 | uint32_t FIFO_2_Full_err:1; |
|
98 | uint32_t FIFO_2_Full_err:1; | |
78 | uint32_t FIFO_1_Full_err:1; |
|
99 | uint32_t FIFO_1_Full_err:1; | |
79 | uint32_t FIFO_0_Full_err:1; |
|
100 | uint32_t FIFO_0_Full_err:1; | |
80 | uint32_t Buffer_Full_err:1; |
|
101 | uint32_t Buffer_Full_err:1; | |
81 | uint32_t Ready_F2_Buffer1:1; |
|
102 | uint32_t Ready_F2_Buffer1:1; | |
82 | uint32_t Ready_F2_Buffer0:1; |
|
103 | uint32_t Ready_F2_Buffer0:1; | |
83 | uint32_t Ready_F1_Buffer1:1; |
|
104 | uint32_t Ready_F1_Buffer1:1; | |
84 | uint32_t Ready_F1_Buffer0:1; |
|
105 | uint32_t Ready_F1_Buffer0:1; | |
85 | uint32_t Ready_F0_Buffer1:1; |
|
106 | uint32_t Ready_F0_Buffer1:1; | |
86 | uint32_t Ready_F0_Buffer0:1; |
|
107 | uint32_t Ready_F0_Buffer0:1; | |
87 | }FIELDS; |
|
108 | }FIELDS; | |
88 | uint32_t Value; |
|
109 | uint32_t Value; | |
89 | }STATUS; |
|
110 | }STATUS; | |
90 |
|
111 | |||
91 | struct DualBuffAddr_t ADDRESS_F0; |
|
112 | struct DualBuffAddr_t ADDRESS_F0; | |
92 | struct DualBuffAddr_t ADDRESS_F1; |
|
113 | struct DualBuffAddr_t ADDRESS_F1; | |
93 | struct DualBuffAddr_t ADDRESS_F2; |
|
114 | struct DualBuffAddr_t ADDRESS_F2; | |
94 |
|
115 | |||
95 | CUCtime_t TIME_F0_0; |
|
116 | CUCtime_t TIME_F0_0; | |
96 | CUCtime_t TIME_F0_1; |
|
117 | CUCtime_t TIME_F0_1; | |
97 | CUCtime_t TIME_F1_0; |
|
118 | CUCtime_t TIME_F1_0; | |
98 | CUCtime_t TIME_F1_1; |
|
119 | CUCtime_t TIME_F1_1; | |
99 | CUCtime_t TIME_F2_0; |
|
120 | CUCtime_t TIME_F2_0; | |
100 | CUCtime_t TIME_F2_1; |
|
121 | CUCtime_t TIME_F2_1; | |
101 | volatile struct { |
|
122 | volatile struct { | |
102 | uint32_t Unused:6; |
|
123 | uint32_t Unused:6; | |
103 | uint32_t length:26; // 0x50, length of a spectral matrix in burst (25*128) / 16 = 200 = 0xc8 |
|
124 | uint32_t length:26; // 0x50, length of a spectral matrix in burst (25*128) / 16 = 200 = 0xc8 | |
104 | }length; |
|
125 | }length; | |
105 | } lfr_sm_regs_t; |
|
126 | } lfr_sm_regs_t; | |
106 |
|
127 | |||
107 |
|
128 | |||
108 | typedef volatile struct { |
|
129 | typedef volatile struct { | |
109 | volatile union DATASHAPING { |
|
130 | volatile union DATASHAPING { | |
110 | volatile struct { |
|
131 | volatile struct { | |
111 | uint32_t UNUSED:26; // 0x00 |
|
132 | uint32_t UNUSED:26; // 0x00 | |
112 | uint32_t R2:1; |
|
133 | uint32_t R2:1; | |
113 | uint32_t R1:1; |
|
134 | uint32_t R1:1; | |
114 | uint32_t R0:1; |
|
135 | uint32_t R0:1; | |
115 | uint32_t SP1:1; |
|
136 | uint32_t SP1:1; | |
116 | uint32_t SP0:1; |
|
137 | uint32_t SP0:1; | |
117 | uint32_t BW:1; |
|
138 | uint32_t BW:1; | |
118 | }FIELDS; |
|
139 | }FIELDS; | |
119 | uint32_t Value; |
|
140 | uint32_t Value; | |
120 | }DATASHAPING; |
|
141 | }DATASHAPING; | |
121 |
|
142 | |||
122 | volatile union { |
|
143 | volatile union { | |
123 | volatile struct { |
|
144 | volatile struct { | |
124 | uint32_t UNUSED:25; |
|
145 | uint32_t UNUSED:25; | |
125 | uint32_t BURST_EN_F2:1; |
|
146 | uint32_t BURST_EN_F2:1; | |
126 | uint32_t BURST_EN_F1:1; |
|
147 | uint32_t BURST_EN_F1:1; | |
127 | uint32_t BURST_EN_F0:1; |
|
148 | uint32_t BURST_EN_F0:1; | |
128 | uint32_t ACQ_EN_F3:1; |
|
149 | uint32_t ACQ_EN_F3:1; | |
129 | uint32_t ACQ_EN_F2:1; |
|
150 | uint32_t ACQ_EN_F2:1; | |
130 | uint32_t ACQ_EN_F1:1; |
|
151 | uint32_t ACQ_EN_F1:1; | |
131 | uint32_t ACQ_EN_F0:1; |
|
152 | uint32_t ACQ_EN_F0:1; | |
132 | }FIELDS; |
|
153 | }FIELDS; | |
133 | uint32_t Value; |
|
154 | uint32_t Value; | |
134 | }Control; |
|
155 | }Control; | |
135 |
|
156 | |||
136 | volatile struct DualBuffAddr_t ADDRESS_F0; |
|
157 | volatile struct DualBuffAddr_t ADDRESS_F0; | |
137 | volatile struct DualBuffAddr_t ADDRESS_F1; |
|
158 | volatile struct DualBuffAddr_t ADDRESS_F1; | |
138 | volatile struct DualBuffAddr_t ADDRESS_F2; |
|
159 | volatile struct DualBuffAddr_t ADDRESS_F2; | |
139 | volatile struct DualBuffAddr_t ADDRESS_F3; |
|
160 | volatile struct DualBuffAddr_t ADDRESS_F3; | |
140 |
|
161 | |||
141 | uint32_t STATUS; |
|
162 | uint32_t STATUS; | |
142 | uint32_t DeltaSnapshot; |
|
163 | uint32_t DeltaSnapshot; | |
143 | uint32_t Delta_F0; |
|
164 | uint32_t Delta_F0; | |
144 |
|
165 | |||
145 | uint32_t UNUSED_Delta_F0_2:25; |
|
166 | uint32_t UNUSED_Delta_F0_2:25; | |
146 | uint32_t Delta_F0_2:7; |
|
167 | uint32_t Delta_F0_2:7; | |
147 | uint32_t Delta_F1; |
|
168 | uint32_t Delta_F1; | |
148 | uint32_t Delta_F2; |
|
169 | uint32_t Delta_F2; | |
149 |
|
170 | |||
150 | uint32_t Nb_Data_per_buff; |
|
171 | uint32_t Nb_Data_per_buff; | |
151 | uint32_t Nb_snapshot; |
|
172 | uint32_t Nb_snapshot; | |
152 |
|
173 | |||
153 | uint32_t StartDate; |
|
174 | uint32_t StartDate; | |
154 |
|
175 | |||
155 | CUCtime_t TIME_F0_0; |
|
176 | CUCtime_t TIME_F0_0; | |
156 | CUCtime_t TIME_F0_1; |
|
177 | CUCtime_t TIME_F0_1; | |
157 | CUCtime_t TIME_F1_0; |
|
178 | CUCtime_t TIME_F1_0; | |
158 | CUCtime_t TIME_F1_1; |
|
179 | CUCtime_t TIME_F1_1; | |
159 | CUCtime_t TIME_F2_0; |
|
180 | CUCtime_t TIME_F2_0; | |
160 | CUCtime_t TIME_F2_1; |
|
181 | CUCtime_t TIME_F2_1; | |
161 | CUCtime_t TIME_F3_0; |
|
182 | CUCtime_t TIME_F3_0; | |
162 | CUCtime_t TIME_F3_1; |
|
183 | CUCtime_t TIME_F3_1; | |
163 |
|
184 | |||
164 | union{ |
|
185 | union{ | |
165 | struct { |
|
186 | struct { | |
166 | uint32_t Unused_length:6; |
|
187 | uint32_t Unused_length:6; | |
167 | uint32_t length:26; |
|
188 | uint32_t length:26; | |
168 | }FIELDS; // 0x50, length of a spectral matrix in burst (25*128) / 16 = 200 = 0xc8 |
|
189 | }FIELDS; // 0x50, length of a spectral matrix in burst (25*128) / 16 = 200 = 0xc8 | |
169 | uint32_t Value; |
|
190 | uint32_t Value; | |
170 | }length; |
|
191 | }length; | |
171 | struct Potential_t V; |
|
192 | struct Potential_t V; | |
172 | struct Potential_t E1; |
|
193 | struct Potential_t E1; | |
173 | struct Potential_t E2; |
|
194 | struct Potential_t E2; | |
174 | } lfr_wfp_regs_t; |
|
195 | } lfr_wfp_regs_t; | |
175 |
|
196 | |||
176 | typedef struct { |
|
197 | typedef struct { | |
177 | uint32_t UNUSED:16; |
|
198 | uint32_t UNUSED:16; | |
178 | uint32_t Value:16; |
|
199 | uint32_t Value:16; | |
179 | }lfr_hk_temp_t; |
|
200 | }lfr_hk_temp_t; | |
180 |
|
201 | |||
181 | typedef struct { |
|
202 | typedef struct { | |
182 | struct { |
|
203 | struct { | |
183 | uint32_t UNUSED:25; |
|
204 | uint32_t UNUSED:25; | |
184 | uint32_t CAL_EN:1; |
|
205 | uint32_t CAL_EN:1; | |
185 | uint32_t Interleaved_EN:1; |
|
206 | uint32_t Interleaved_EN:1; | |
186 | uint32_t Reload_EN:1; |
|
207 | uint32_t Reload_EN:1; | |
187 | uint32_t DAC_CFG:4; |
|
208 | uint32_t DAC_CFG:4; | |
188 | }Control; |
|
209 | }Control; | |
189 |
|
210 | |||
190 | uint32_t UNUSED_PRE:24; |
|
211 | uint32_t UNUSED_PRE:24; | |
191 | uint32_t PRE:8; |
|
212 | uint32_t PRE:8; | |
192 |
|
213 | |||
193 | uint32_t UNUSED_N:16; |
|
214 | uint32_t UNUSED_N:16; | |
194 | uint32_t N:16; |
|
215 | uint32_t N:16; | |
195 |
|
216 | |||
196 | uint32_t UNUSED_ADDR:24; |
|
217 | uint32_t UNUSED_ADDR:24; | |
197 | uint32_t ADDRESS:8; |
|
218 | uint32_t ADDRESS:8; | |
198 |
|
219 | |||
199 | uint32_t UNUSED_DATA_IN:14; |
|
220 | uint32_t UNUSED_DATA_IN:14; | |
200 | uint32_t DATA_IN:18; |
|
221 | uint32_t DATA_IN:18; | |
201 |
|
222 | |||
202 | }lfr_dac_regs_t; |
|
223 | }lfr_dac_regs_t; | |
203 |
|
224 | |||
204 | typedef volatile struct { |
|
225 | typedef volatile struct { | |
205 | union { |
|
226 | union { | |
206 | struct { |
|
227 | struct { | |
207 | uint32_t UNUSED:29; |
|
228 | uint32_t UNUSED:29; | |
208 | uint32_t SOFT_RESET:1; |
|
229 | uint32_t SOFT_RESET:1; | |
209 | uint32_t TIME_MANAGMENT_RESET:1; |
|
230 | uint32_t TIME_MANAGMENT_RESET:1; | |
210 | uint32_t SWTick:1;}FIELDS; |
|
231 | uint32_t SWTick:1;}FIELDS; | |
211 | uint32_t Value; |
|
232 | uint32_t Value; | |
212 | }Control; |
|
233 | }Control; | |
213 |
|
234 | |||
214 | uint32_t UNUSED_TIME_LOAD:1; |
|
235 | uint32_t UNUSED_TIME_LOAD:1; | |
215 | uint32_t TIME_LOAD:31; |
|
236 | uint32_t TIME_LOAD:31; | |
216 |
|
237 | |||
217 | uint32_t Unsynchronized:1; |
|
238 | uint32_t Unsynchronized:1; | |
218 | uint32_t COARSE_TIME:31; |
|
239 | uint32_t COARSE_TIME:31; | |
219 |
|
240 | |||
220 | uint32_t UNUSED_FINE_TIME:16; |
|
241 | uint32_t UNUSED_FINE_TIME:16; | |
221 | uint32_t FINE_TIME:16; |
|
242 | uint32_t FINE_TIME:16; | |
222 |
|
243 | |||
223 | lfr_hk_temp_t TEMP_0; |
|
244 | lfr_hk_temp_t TEMP_0; | |
224 | lfr_hk_temp_t TEMP_1; |
|
245 | lfr_hk_temp_t TEMP_1; | |
225 | lfr_hk_temp_t TEMP_2; |
|
246 | lfr_hk_temp_t TEMP_2; | |
226 |
|
247 | |||
227 | lfr_dac_regs_t DAC; |
|
248 | lfr_dac_regs_t DAC; | |
228 |
|
249 | |||
229 | }lfr_managment_regs_t; |
|
250 | }lfr_managment_regs_t; | |
230 |
|
251 | |||
231 | typedef volatile struct { |
|
252 | typedef volatile struct { | |
232 | lfr_sm_regs_t SM; |
|
253 | lfr_sm_regs_t SM; | |
233 | lfr_wfp_regs_t WFP; |
|
254 | lfr_wfp_regs_t WFP; | |
234 | struct { |
|
255 | struct { | |
235 | uint32_t UNUSED:8; |
|
256 | uint32_t UNUSED:8; | |
236 | uint32_t Board:8; |
|
257 | uint32_t Board:8; | |
237 | uint32_t Major:8; |
|
258 | uint32_t Major:8; | |
238 | uint32_t Minor:8; |
|
259 | uint32_t Minor:8; | |
239 | }VERSION; |
|
260 | }VERSION; | |
240 | }lfr_regs_t; |
|
261 | }lfr_regs_t; | |
241 |
|
262 | |||
242 | #endif // GRLIB_REGS_H_INCLUDED |
|
263 | #endif // GRLIB_REGS_H_INCLUDED |
@@ -1,48 +1,69 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the LFR Offset analysis firmware | |||
|
3 | -- Copyright (C) 2016, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
1 | #include <stdio.h> |
|
22 | #include <stdio.h> | |
2 | #include <grlib_regs.h> |
|
23 | #include <grlib_regs.h> | |
3 | #include <stdint.h> |
|
24 | #include <stdint.h> | |
4 | #include <LFR.h> |
|
25 | #include <LFR.h> | |
5 | #include <wfp.h> |
|
26 | #include <wfp.h> | |
6 |
|
27 | |||
7 | #define MS_Size_Int (128 * 25 * 4 / sizeof(int)) |
|
28 | #define MS_Size_Int (128 * 25 * 4 / sizeof(int)) | |
8 |
|
29 | |||
9 | #define BUF_SZ 2688 |
|
30 | #define BUF_SZ 2688 | |
10 |
|
31 | |||
11 | uint16_t WF1[6 * BUF_SZ] __attribute__((aligned(0x100))); |
|
32 | uint16_t WF1[6 * BUF_SZ] __attribute__((aligned(0x100))); | |
12 | uint16_t WF2[6 * BUF_SZ] __attribute__((aligned(0x100))); |
|
33 | uint16_t WF2[6 * BUF_SZ] __attribute__((aligned(0x100))); | |
13 |
|
34 | |||
14 | volatile int todo = 0; |
|
35 | volatile int todo = 0; | |
15 | volatile int Freq = 0; |
|
36 | volatile int Freq = 0; | |
16 | volatile int PerformReset = 1; |
|
37 | volatile int PerformReset = 1; | |
17 | volatile int Major; |
|
38 | volatile int Major; | |
18 | volatile int Minor; |
|
39 | volatile int Minor; | |
19 | volatile int Board; |
|
40 | volatile int Board; | |
20 |
|
41 | |||
21 | int main(void) { |
|
42 | int main(void) { | |
22 | Major = LFR->VERSION.Major; |
|
43 | Major = LFR->VERSION.Major; | |
23 | Minor = LFR->VERSION.Minor; |
|
44 | Minor = LFR->VERSION.Minor; | |
24 | Board = LFR->VERSION.Board; |
|
45 | Board = LFR->VERSION.Board; | |
25 | while (1) |
|
46 | while (1) | |
26 | { |
|
47 | { | |
27 | do{ |
|
48 | do{ | |
28 | if(PerformReset) |
|
49 | if(PerformReset) | |
29 | resetLFR(); |
|
50 | resetLFR(); | |
30 | switch (Freq) |
|
51 | switch (Freq) | |
31 | { |
|
52 | { | |
32 | case 0: |
|
53 | case 0: | |
33 | getSnapShotsF0((uint32_t)WF1,(uint32_t)WF2,BUF_SZ,0); |
|
54 | getSnapShotsF0((uint32_t)WF1,(uint32_t)WF2,BUF_SZ,0); | |
34 | break; |
|
55 | break; | |
35 | case 1: |
|
56 | case 1: | |
36 | getSnapShotsF1((uint32_t)WF1,(uint32_t)WF2,BUF_SZ,0); |
|
57 | getSnapShotsF1((uint32_t)WF1,(uint32_t)WF2,BUF_SZ,0); | |
37 | break; |
|
58 | break; | |
38 | case 2: |
|
59 | case 2: | |
39 | getSnapShotsF2((uint32_t)WF1,(uint32_t)WF2,BUF_SZ,0); |
|
60 | getSnapShotsF2((uint32_t)WF1,(uint32_t)WF2,BUF_SZ,0); | |
40 | break; |
|
61 | break; | |
41 | default: |
|
62 | default: | |
42 | break; |
|
63 | break; | |
43 | } |
|
64 | } | |
44 | todo--; |
|
65 | todo--; | |
45 | }while (todo!=0); |
|
66 | }while (todo!=0); | |
46 | } |
|
67 | } | |
47 | return 0; |
|
68 | return 0; | |
48 | } |
|
69 | } |
@@ -1,44 +1,65 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the LFR Offset analysis firmware | |||
|
3 | -- Copyright (C) 2016, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
1 | #include <wfp.h> |
|
22 | #include <wfp.h> | |
2 |
|
23 | |||
3 |
|
24 | |||
4 | void getSnapShotsF0(uint32_t buffer0, uint32_t buffer1,unsigned int NB_Samples, int freq) |
|
25 | void getSnapShotsF0(uint32_t buffer0, uint32_t buffer1,unsigned int NB_Samples, int freq) | |
5 | { |
|
26 | { | |
6 | LFR->WFP.Control.Value=0; |
|
27 | LFR->WFP.Control.Value=0; | |
7 | volatile int test = LFR->WFP.STATUS; |
|
28 | volatile int test = LFR->WFP.STATUS; | |
8 | LFR->WFP.ADDRESS_F0.ADDR0 = buffer0; |
|
29 | LFR->WFP.ADDRESS_F0.ADDR0 = buffer0; | |
9 | LFR->WFP.ADDRESS_F0.ADDR1 = buffer1; |
|
30 | LFR->WFP.ADDRESS_F0.ADDR1 = buffer1; | |
10 | LFR->WFP.length.FIELDS.length=(NB_Samples*3)/16; |
|
31 | LFR->WFP.length.FIELDS.length=(NB_Samples*3)/16; | |
11 | LFR->WFP.Nb_Data_per_buff= NB_Samples-1; |
|
32 | LFR->WFP.Nb_Data_per_buff= NB_Samples-1; | |
12 | LFR->WFP.Nb_snapshot=NB_Samples; |
|
33 | LFR->WFP.Nb_snapshot=NB_Samples; | |
13 | LFR->WFP.StartDate=(uint32_t)LFR_MANAGMENT->COARSE_TIME + 1; |
|
34 | LFR->WFP.StartDate=(uint32_t)LFR_MANAGMENT->COARSE_TIME + 1; | |
14 | LFR->WFP.Control.Value = 0x11; |
|
35 | LFR->WFP.Control.Value = 0x11; | |
15 | while ((LFR->WFP.STATUS&7)==0) ; |
|
36 | while ((LFR->WFP.STATUS&7)==0) ; | |
16 | } |
|
37 | } | |
17 |
|
38 | |||
18 | void getSnapShotsF1(uint32_t buffer0, uint32_t buffer1, unsigned int NB_Samples, int freq) |
|
39 | void getSnapShotsF1(uint32_t buffer0, uint32_t buffer1, unsigned int NB_Samples, int freq) | |
19 | { |
|
40 | { | |
20 | LFR->WFP.Control.Value=0; |
|
41 | LFR->WFP.Control.Value=0; | |
21 | volatile int test = LFR->WFP.STATUS; |
|
42 | volatile int test = LFR->WFP.STATUS; | |
22 | LFR->WFP.ADDRESS_F1.ADDR0 = buffer0; |
|
43 | LFR->WFP.ADDRESS_F1.ADDR0 = buffer0; | |
23 | LFR->WFP.ADDRESS_F1.ADDR1 = buffer1; |
|
44 | LFR->WFP.ADDRESS_F1.ADDR1 = buffer1; | |
24 | LFR->WFP.length.FIELDS.length=(NB_Samples*3)/16; |
|
45 | LFR->WFP.length.FIELDS.length=(NB_Samples*3)/16; | |
25 | LFR->WFP.Nb_Data_per_buff= NB_Samples-1; |
|
46 | LFR->WFP.Nb_Data_per_buff= NB_Samples-1; | |
26 | LFR->WFP.Nb_snapshot=NB_Samples; |
|
47 | LFR->WFP.Nb_snapshot=NB_Samples; | |
27 | LFR->WFP.StartDate=(uint32_t)LFR_MANAGMENT->COARSE_TIME + 1; |
|
48 | LFR->WFP.StartDate=(uint32_t)LFR_MANAGMENT->COARSE_TIME + 1; | |
28 | LFR->WFP.Control.Value = 0x22; |
|
49 | LFR->WFP.Control.Value = 0x22; | |
29 | while ((LFR->WFP.STATUS&7)==0) ; |
|
50 | while ((LFR->WFP.STATUS&7)==0) ; | |
30 | } |
|
51 | } | |
31 |
|
52 | |||
32 | void getSnapShotsF2(uint32_t buffer0, uint32_t buffer1, unsigned int NB_Samples, int freq) |
|
53 | void getSnapShotsF2(uint32_t buffer0, uint32_t buffer1, unsigned int NB_Samples, int freq) | |
33 | { |
|
54 | { | |
34 | LFR->WFP.Control.Value=0; |
|
55 | LFR->WFP.Control.Value=0; | |
35 | volatile int test = LFR->WFP.STATUS; |
|
56 | volatile int test = LFR->WFP.STATUS; | |
36 | LFR->WFP.ADDRESS_F2.ADDR0 = buffer0; |
|
57 | LFR->WFP.ADDRESS_F2.ADDR0 = buffer0; | |
37 | LFR->WFP.ADDRESS_F2.ADDR1 = buffer1; |
|
58 | LFR->WFP.ADDRESS_F2.ADDR1 = buffer1; | |
38 | LFR->WFP.length.FIELDS.length=(NB_Samples*3)/16; |
|
59 | LFR->WFP.length.FIELDS.length=(NB_Samples*3)/16; | |
39 | LFR->WFP.Nb_Data_per_buff= NB_Samples-1; |
|
60 | LFR->WFP.Nb_Data_per_buff= NB_Samples-1; | |
40 | LFR->WFP.Nb_snapshot=NB_Samples; |
|
61 | LFR->WFP.Nb_snapshot=NB_Samples; | |
41 | LFR->WFP.StartDate=(uint32_t)LFR_MANAGMENT->COARSE_TIME + 1; |
|
62 | LFR->WFP.StartDate=(uint32_t)LFR_MANAGMENT->COARSE_TIME + 1; | |
42 | LFR->WFP.Control.Value = 0x44; |
|
63 | LFR->WFP.Control.Value = 0x44; | |
43 | while ((LFR->WFP.STATUS&7)==0) ; |
|
64 | while ((LFR->WFP.STATUS&7)==0) ; | |
44 | } |
|
65 | } |
@@ -1,12 +1,33 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the LFR Offset analysis firmware | |||
|
3 | -- Copyright (C) 2016, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
1 | #ifndef WFP_H_INCLUDED |
|
22 | #ifndef WFP_H_INCLUDED | |
2 | #define WFP_H_INCLUDED |
|
23 | #define WFP_H_INCLUDED | |
3 |
|
24 | |||
4 | #include <stdint.h> |
|
25 | #include <stdint.h> | |
5 | #include <grlib_regs.h> |
|
26 | #include <grlib_regs.h> | |
6 | #include <LFR.h> |
|
27 | #include <LFR.h> | |
7 |
|
28 | |||
8 | extern void getSnapShotsF0(uint32_t buffer0, uint32_t buffer1, unsigned int NB_Samples, int freq); |
|
29 | extern void getSnapShotsF0(uint32_t buffer0, uint32_t buffer1, unsigned int NB_Samples, int freq); | |
9 | extern void getSnapShotsF1(uint32_t buffer0, uint32_t buffer1, unsigned int NB_Samples, int freq); |
|
30 | extern void getSnapShotsF1(uint32_t buffer0, uint32_t buffer1, unsigned int NB_Samples, int freq); | |
10 | extern void getSnapShotsF2(uint32_t buffer0, uint32_t buffer1, unsigned int NB_Samples, int freq); |
|
31 | extern void getSnapShotsF2(uint32_t buffer0, uint32_t buffer1, unsigned int NB_Samples, int freq); | |
11 |
|
32 | |||
12 | #endif // WFP_H_INCLUDED |
|
33 | #endif // WFP_H_INCLUDED |
General Comments 0
You need to be logged in to leave comments.
Login now