##// END OF EJS Templates
waveform initialization modified due to a problem of compatibility...
paul@pc-solar1.lab-lpp.local -
r19:beef07605c12 default
parent child
Show More
@@ -18,6 +18,7 extern rtems_id Task_id[]; /* ar
18 extern int fdSPW;
18 extern int fdSPW;
19 extern volatile int wf_snap_f0[ ];
19 extern volatile int wf_snap_f0[ ];
20 extern volatile int wf_snap_f1[ ];
20 extern volatile int wf_snap_f1[ ];
21 extern volatile int wf_snap_f1_bis[ ];
21 extern volatile int wf_snap_f2[ ];
22 extern volatile int wf_snap_f2[ ];
22 extern volatile int wf_cont_f3[ ];
23 extern volatile int wf_cont_f3[ ];
23 extern waveform_picker_regs_t *waveform_picker_regs;
24 extern waveform_picker_regs_t *waveform_picker_regs;
@@ -17,11 +17,12 time_management_regs_t *time_management_
17 waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
17 waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
18 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
18 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
19
19
20 // WAVEFORMS GLOBAL VARIABLES
20 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
21 volatile int wf_snap_f0[ 2 * NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + 2]; // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
21 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
22 volatile int wf_snap_f1[ 2 * NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + 2]; // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
22 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
23 volatile int wf_snap_f2[ 2 * NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + 2]; // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
23 volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
24 volatile int wf_cont_f3[ 2 * NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + 2]; // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
24 volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
25 volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
25
26
26 // SPECTRAL MATRICES GLOBAL VARIABLES
27 // SPECTRAL MATRICES GLOBAL VARIABLES
27 volatile int spec_mat_f0_a[ TOTAL_SIZE_SPEC_MAT ];
28 volatile int spec_mat_f0_a[ TOTAL_SIZE_SPEC_MAT ];
@@ -122,9 +122,9 rtems_task Init( rtems_task_argument ign
122 LEON_Unmask_interrupt( IRQ_TIME2 );
122 LEON_Unmask_interrupt( IRQ_TIME2 );
123
123
124 #ifdef GSA
124 #ifdef GSA
125 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
125 //if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
126 printf("in INIT *** Error sending event to WFRM\n");
126 // printf("in INIT *** Error sending event to WFRM\n");
127 }
127 //}
128 #endif
128 #endif
129
129
130 status = rtems_task_delete(RTEMS_SELF);
130 status = rtems_task_delete(RTEMS_SELF);
@@ -611,14 +611,18 int action_enter(ccsdsTelecommandPacket_
611 printf("enter mode %d\n", lfr_mode);
611 printf("enter mode %d\n", lfr_mode);
612 switch(lfr_mode)
612 switch(lfr_mode)
613 {
613 {
614 //********
615 // STANDBY
614 case(LFR_MODE_STANDBY):
616 case(LFR_MODE_STANDBY):
615 LEON_Mask_interrupt( IRQ_WF );
617 LEON_Mask_interrupt( IRQ_WF );
616 LEON_Mask_interrupt( IRQ_SM );
618 LEON_Mask_interrupt( IRQ_SM );
617 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER );
619 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER );
618 waveform_picker_regs->burst_enable = 0x00;
620 waveform_picker_regs->burst_enable = 0x00;
619 break;
621 break;
622
623 //******
624 // NORMAL
620 case(LFR_MODE_NORMAL):
625 case(LFR_MODE_NORMAL):
621
622 #ifdef GSA
626 #ifdef GSA
623 LEON_Unmask_interrupt( IRQ_WF );
627 LEON_Unmask_interrupt( IRQ_WF );
624 #else
628 #else
@@ -627,14 +631,35 int action_enter(ccsdsTelecommandPacket_
627 waveform_picker_regs->burst_enable = 0x07;
631 waveform_picker_regs->burst_enable = 0x07;
628 waveform_picker_regs->status = 0x00;
632 waveform_picker_regs->status = 0x00;
629 #endif
633 #endif
634 LEON_Unmask_interrupt( IRQ_SM );
635 break;
630
636
631 break;
637 //******
638 // BURST
632 case(LFR_MODE_BURST):
639 case(LFR_MODE_BURST):
633 break;
640 break;
641
642 //*****
643 // SBM1
634 case(LFR_MODE_SBM1):
644 case(LFR_MODE_SBM1):
645 #ifdef GSA
646 #else
647 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
648 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
649 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] burst f2, f1, f0 enable f3 f2 f1 f0
650 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x02;
651 waveform_picker_regs->status = 0x00;
652 #endif
653 //LEON_Unmask_interrupt( IRQ_SM );
635 break;
654 break;
655
656 //*****
657 // SBM2
636 case(LFR_MODE_SBM2):
658 case(LFR_MODE_SBM2):
637 break;
659 break;
660
661 //********
662 // DEFAULT
638 default:
663 default:
639 break;
664 break;
640 }
665 }
@@ -2,7 +2,22
2
2
3 rtems_isr waveforms_isr( rtems_vector_number vector )
3 rtems_isr waveforms_isr( rtems_vector_number vector )
4 {
4 {
5 if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){// if no channel is enable
5 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
6 printf("In waveforms_isr *** Error sending event to WFRM\n");
7 }
8 if (waveform_picker_regs->burst_enable == 0x22) {
9 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
10 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
11 }
12 else {
13 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
14 }
15 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
16 printf("In waveforms_isr *** Error sending event to WFRM\n");
17 }
18 }
19 waveform_picker_regs->status = 0x00;
20 /*else if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){// if no channel is enable
6 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
21 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
7 printf("In timecode_irq_handler *** Error sending event to DUMB\n");
22 printf("In timecode_irq_handler *** Error sending event to DUMB\n");
8 }
23 }
@@ -14,7 +29,7 rtems_isr waveforms_isr( rtems_vector_nu
14 printf("In waveforms_isr *** Error sending event to WFRM\n");
29 printf("In waveforms_isr *** Error sending event to WFRM\n");
15 }
30 }
16 }
31 }
17 }
32 }*/
18 }
33 }
19
34
20 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
35 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
@@ -74,19 +89,24 rtems_task wfrm_task(rtems_task_argument
74 //***************
89 //***************
75 // send snapshots
90 // send snapshots
76 // F0
91 // F0
77 send_waveform( &header, wf_snap_f0, SID_NORM_SWF_F0, &spw_ioctl_send);
92 //send_waveform( &header, wf_snap_f0, SID_NORM_SWF_F0, &spw_ioctl_send);
78 // F1
93 // F1
79 send_waveform( &header, wf_snap_f1, SID_NORM_SWF_F1, &spw_ioctl_send);
94 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
95 send_waveform( &header, wf_snap_f1_bis, SID_NORM_SWF_F1, &spw_ioctl_send);
96 }
97 else {
98 send_waveform( &header, wf_snap_f1, SID_NORM_SWF_F1, &spw_ioctl_send);
99 }
80 // F2
100 // F2
81 send_waveform( &header, wf_snap_f2, SID_NORM_SWF_F2, &spw_ioctl_send);
101 //send_waveform( &header, wf_snap_f2, SID_NORM_SWF_F2, &spw_ioctl_send);
82
102
83 #ifdef GSA
103 #ifdef GSA
84 // irq processed, reset the related register of the timer unit
104 // irq processed, reset the related register of the timer unit
85 gptimer_regs->timer[2].ctrl = gptimer_regs->timer[2].ctrl | 0x00000010;
105 gptimer_regs->timer[2].ctrl = gptimer_regs->timer[2].ctrl | 0x00000010;
86 #else
106 #else
87 // irq processed, reset the related register of the waveform picker
107 // irq processed, reset the related register of the waveform picker
88 waveform_picker_regs->status = 0x00;
108 //waveform_picker_regs->status = 0x00;
89 waveform_picker_regs->burst_enable = 0x07;
109 //waveform_picker_regs->burst_enable = 0x07;
90 #endif
110 #endif
91
111
92 }
112 }
@@ -97,23 +117,9 rtems_task wfrm_task(rtems_task_argument
97 void init_waveforms( void )
117 void init_waveforms( void )
98 {
118 {
99 int i = 0;
119 int i = 0;
100 int aux1 = 0;
101 int aux2 = 0;
102 int val1 = 0;
103 int val2 = 0;
104 int val3 = 0;
105 int val4 = 0;
106 int amplitude1 = pow(2, 10);
107 static int delta_phi = 0;
108
120
109 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
121 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
110 {
122 {
111 aux1 = (int) (amplitude1 * cos((2*pi*i)/2048 + (delta_phi*pi)/180));
112 aux2 = (int) (amplitude1 * sin((2*pi*i)/2048 + (delta_phi*pi)/180));
113 val1 = build_value(aux1, aux2);
114 val2 = build_value(i, 2*i);
115 val3 = build_value(-aux1, -aux2);
116 val4 = build_value(-i, -2*i);
117 //***
123 //***
118 // F0
124 // F0
119 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
125 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
@@ -122,14 +128,14 void init_waveforms( void )
122
128
123 //***
129 //***
124 // F1
130 // F1
125 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = val1;
131 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
126 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = val2;
132 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
127 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
133 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
128
134
129 //***
135 //***
130 // F2
136 // F2
131 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = val1;
137 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
132 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = val2;
138 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
133 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
139 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
134
140
135 //***
141 //***
@@ -138,9 +144,6 void init_waveforms( void )
138 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
144 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
139 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
145 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
140 }
146 }
141
142 delta_phi = delta_phi + 10;
143
144 }
147 }
145
148
146 void init_waveform_header( ExtendedTMHeader_t * header, unsigned int sid )
149 void init_waveform_header( ExtendedTMHeader_t * header, unsigned int sid )
@@ -229,7 +232,7 void send_waveform( ExtendedTMHeader_t *
229 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + (1 * TIME_OFFSET) ];
232 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + (1 * TIME_OFFSET) ];
230 }
233 }
231 else if (sid == SID_NORM_SWF_F2) {
234 else if (sid == SID_NORM_SWF_F2) {
232 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + (0 * TIME_OFFSET) ];
235 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + (1 * TIME_OFFSET) ];
233 }
236 }
234 else {
237 else {
235 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
238 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
General Comments 0
You need to be logged in to leave comments. Login now