@@ -0,0 +1,145 | |||||
|
1 | /* | |||
|
2 | * CPU Usage Reporter | |||
|
3 | * | |||
|
4 | * COPYRIGHT (c) 1989-2009 | |||
|
5 | * On-Line Applications Research Corporation (OAR). | |||
|
6 | * | |||
|
7 | * The license and distribution terms for this file may be | |||
|
8 | * found in the file LICENSE in this distribution or at | |||
|
9 | * http://www.rtems.com/license/LICENSE. | |||
|
10 | * | |||
|
11 | * $Id$ | |||
|
12 | */ | |||
|
13 | ||||
|
14 | #ifdef HAVE_CONFIG_H | |||
|
15 | #include "config.h" | |||
|
16 | #endif | |||
|
17 | ||||
|
18 | #include <rtems.h> | |||
|
19 | ||||
|
20 | #include <assert.h> | |||
|
21 | #include <string.h> | |||
|
22 | #include <stdlib.h> | |||
|
23 | #include <stdio.h> | |||
|
24 | #include <ctype.h> | |||
|
25 | #include <inttypes.h> | |||
|
26 | ||||
|
27 | #include <rtems/cpuuse.h> | |||
|
28 | #include <rtems/bspIo.h> | |||
|
29 | ||||
|
30 | #include "lfr_cpu_usage_report.h" | |||
|
31 | ||||
|
32 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ | |||
|
33 | #include <rtems/score/timestamp.h> | |||
|
34 | #endif | |||
|
35 | ||||
|
36 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ | |||
|
37 | extern Timestamp_Control CPU_usage_Uptime_at_last_reset; | |||
|
38 | #else | |||
|
39 | extern uint32_t CPU_usage_Ticks_at_last_reset; | |||
|
40 | #endif | |||
|
41 | ||||
|
42 | /*PAGE | |||
|
43 | * | |||
|
44 | * rtems_cpu_usage_report | |||
|
45 | */ | |||
|
46 | ||||
|
47 | unsigned char lfr_rtems_cpu_usage_report( void ) | |||
|
48 | { | |||
|
49 | uint32_t api_index; | |||
|
50 | Thread_Control *the_thread; | |||
|
51 | Objects_Information *information; | |||
|
52 | uint32_t ival, fval; | |||
|
53 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ | |||
|
54 | Timestamp_Control uptime, total, ran; | |||
|
55 | #else | |||
|
56 | uint32_t total_units = 0; | |||
|
57 | #endif | |||
|
58 | ||||
|
59 | unsigned char cpu_load; | |||
|
60 | cpu_load = 0; | |||
|
61 | ||||
|
62 | /* | |||
|
63 | * When not using nanosecond CPU usage resolution, we have to count | |||
|
64 | * the number of "ticks" we gave credit for to give the user a rough | |||
|
65 | * guideline as to what each number means proportionally. | |||
|
66 | */ | |||
|
67 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ | |||
|
68 | _TOD_Get_uptime( &uptime ); | |||
|
69 | _Timestamp_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &total ); | |||
|
70 | #else | |||
|
71 | for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) { | |||
|
72 | if ( !_Objects_Information_table[ api_index ] ) | |||
|
73 | { | |||
|
74 | continue; | |||
|
75 | } | |||
|
76 | information = _Objects_Information_table[ api_index ][ 1 ]; | |||
|
77 | if ( information ) | |||
|
78 | { | |||
|
79 | for ( i=1 ; i <= information->maximum ; i++ ) { | |||
|
80 | the_thread = (Thread_Control *)information->local_table[ i ]; | |||
|
81 | ||||
|
82 | if ( the_thread ) | |||
|
83 | total_units += the_thread->cpu_time_used; | |||
|
84 | } | |||
|
85 | } | |||
|
86 | } | |||
|
87 | #endif | |||
|
88 | ||||
|
89 | for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) | |||
|
90 | { | |||
|
91 | if ( !_Objects_Information_table[ api_index ] ) | |||
|
92 | { | |||
|
93 | continue; | |||
|
94 | } | |||
|
95 | information = _Objects_Information_table[ api_index ][ 1 ]; | |||
|
96 | if ( information ) | |||
|
97 | { | |||
|
98 | the_thread = (Thread_Control *)information->local_table[ 1 ]; | |||
|
99 | ||||
|
100 | if ( !the_thread ) | |||
|
101 | { | |||
|
102 | continue; | |||
|
103 | } | |||
|
104 | ||||
|
105 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ | |||
|
106 | /* | |||
|
107 | * If this is the currently executing thread, account for time | |||
|
108 | * since the last context switch. | |||
|
109 | */ | |||
|
110 | ran = the_thread->cpu_time_used; | |||
|
111 | if ( _Thread_Executing->Object.id == the_thread->Object.id ) | |||
|
112 | { | |||
|
113 | Timestamp_Control used; | |||
|
114 | _Timestamp_Subtract( | |||
|
115 | &_Thread_Time_of_last_context_switch, &uptime, &used | |||
|
116 | ); | |||
|
117 | _Timestamp_Add_to( &ran, &used ); | |||
|
118 | } | |||
|
119 | _Timestamp_Divide( &ran, &total, &ival, &fval ); | |||
|
120 | ||||
|
121 | #else | |||
|
122 | if (total_units) | |||
|
123 | { | |||
|
124 | uint64_t ival_64; | |||
|
125 | ||||
|
126 | ival_64 = the_thread->cpu_time_used; | |||
|
127 | ival_64 *= 100000; | |||
|
128 | ival = ival_64 / total_units; | |||
|
129 | } | |||
|
130 | else | |||
|
131 | { | |||
|
132 | ival = 0; | |||
|
133 | } | |||
|
134 | ||||
|
135 | fval = ival % 1000; | |||
|
136 | ival /= 1000; | |||
|
137 | #endif | |||
|
138 | } | |||
|
139 | } | |||
|
140 | cpu_load = (unsigned char) (100 - ival); | |||
|
141 | ||||
|
142 | return cpu_load; | |||
|
143 | } | |||
|
144 | ||||
|
145 |
@@ -1,1 +1,1 | |||||
1 | b0a4fa20a3c7bd7e9ca1a1c4fda85d3269653bc8 src/basic_parameters |
|
1 | 163519b5356a8bcd9197f504c31ad34b6233de38 src/basic_parameters |
@@ -1,6 +1,6 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/fsw |
|
2 | # Makefile for building: bin/fsw | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.6) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Mon May 26 14:45:46 2014 | |
4 | # Project: fsw-qt.pro |
|
4 | # Project: fsw-qt.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
@@ -245,7 +245,8 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_ex | |||||
245 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
245 | obj/tc_acceptance.o: ../src/tc_acceptance.c | |
246 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c |
|
246 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c | |
247 |
|
247 | |||
248 | obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h |
|
248 | obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h \ | |
|
249 | ../src/basic_parameters/basic_parameters_params.h | |||
249 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c |
|
250 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c | |
250 |
|
251 | |||
251 | obj/fsw_processing.o: ../src/processing/fsw_processing.c |
|
252 | obj/fsw_processing.o: ../src/processing/fsw_processing.c |
@@ -1,6 +1,6 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 3.0.1, 2014-05- |
|
3 | <!-- Written by QtCreator 3.0.1, 2014-05-26T06:56:48. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -73,6 +73,7 void reset_nb_sm( void ); | |||||
73 | // SM |
|
73 | // SM | |
74 | void SM_init_rings( void ); |
|
74 | void SM_init_rings( void ); | |
75 | void SM_reset_current_ring_nodes( void ); |
|
75 | void SM_reset_current_ring_nodes( void ); | |
|
76 | void SM_generic_init_ring(ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] ); | |||
76 | // ASM |
|
77 | // ASM | |
77 | void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes ); |
|
78 | void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes ); | |
78 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
79 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header); |
@@ -283,6 +283,10 rtems_task dumb_task( rtems_task_argumen | |||||
283 | coarse_time = time_management_regs->coarse_time; |
|
283 | coarse_time = time_management_regs->coarse_time; | |
284 | fine_time = time_management_regs->fine_time; |
|
284 | fine_time = time_management_regs->fine_time; | |
285 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
285 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); | |
|
286 | if (i==8) | |||
|
287 | { | |||
|
288 | PRINTF1("status = %x\n", spectral_matrix_regs->status) | |||
|
289 | } | |||
286 | } |
|
290 | } | |
287 | } |
|
291 | } | |
288 | } |
|
292 | } | |
@@ -436,7 +440,7 void send_dumb_hk( void ) | |||||
436 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
440 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
437 | } |
|
441 | } | |
438 |
|
442 | |||
439 | void get_v_e1_e2_f3( unsigned char *spacecraft_potential ) |
|
443 | void get_v_e1_e2_f3_old( unsigned char *spacecraft_potential ) | |
440 | { |
|
444 | { | |
441 | unsigned int coarseTime; |
|
445 | unsigned int coarseTime; | |
442 | unsigned int acquisitionTime; |
|
446 | unsigned int acquisitionTime; | |
@@ -495,6 +499,65 void get_v_e1_e2_f3( unsigned char *spac | |||||
495 | } |
|
499 | } | |
496 | } |
|
500 | } | |
497 |
|
501 | |||
|
502 | void get_v_e1_e2_f3( unsigned char *spacecraft_potential ) | |||
|
503 | { | |||
|
504 | unsigned int coarseTime; | |||
|
505 | unsigned int acquisitionTime; | |||
|
506 | unsigned int deltaT = 0; | |||
|
507 | unsigned char *bufferPtr; | |||
|
508 | ||||
|
509 | unsigned int offset_in_samples; | |||
|
510 | unsigned int offset_in_bytes; | |||
|
511 | unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz | |||
|
512 | ||||
|
513 | if (lfrCurrentMode == LFR_MODE_STANDBY) | |||
|
514 | { | |||
|
515 | spacecraft_potential[0] = 0x00; | |||
|
516 | spacecraft_potential[1] = 0x00; | |||
|
517 | spacecraft_potential[2] = 0x00; | |||
|
518 | spacecraft_potential[3] = 0x00; | |||
|
519 | spacecraft_potential[4] = 0x00; | |||
|
520 | spacecraft_potential[5] = 0x00; | |||
|
521 | } | |||
|
522 | else | |||
|
523 | { | |||
|
524 | coarseTime = time_management_regs->coarse_time & 0x7fffffff; | |||
|
525 | bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address; | |||
|
526 | acquisitionTime = (unsigned int) ( ( bufferPtr[0] & 0x7f ) << 24 ) | |||
|
527 | + (unsigned int) ( bufferPtr[1] << 16 ) | |||
|
528 | + (unsigned int) ( bufferPtr[2] << 8 ) | |||
|
529 | + (unsigned int) ( bufferPtr[3] ); | |||
|
530 | if ( coarseTime > acquisitionTime ) | |||
|
531 | { | |||
|
532 | deltaT = coarseTime - acquisitionTime; | |||
|
533 | offset_in_samples = (deltaT-1) * f3 ; | |||
|
534 | } | |||
|
535 | else if( coarseTime == acquisitionTime ) | |||
|
536 | { | |||
|
537 | bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer | |||
|
538 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1; | |||
|
539 | } | |||
|
540 | else | |||
|
541 | { | |||
|
542 | offset_in_samples = 0; | |||
|
543 | PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) | |||
|
544 | } | |||
|
545 | ||||
|
546 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) | |||
|
547 | { | |||
|
548 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) | |||
|
549 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; | |||
|
550 | } | |||
|
551 | offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; | |||
|
552 | spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0]; | |||
|
553 | spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1]; | |||
|
554 | spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2]; | |||
|
555 | spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3]; | |||
|
556 | spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4]; | |||
|
557 | spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5]; | |||
|
558 | } | |||
|
559 | } | |||
|
560 | ||||
498 | void get_cpu_load( unsigned char *resource_statistics ) |
|
561 | void get_cpu_load( unsigned char *resource_statistics ) | |
499 | { |
|
562 | { | |
500 | unsigned char cpu_load; |
|
563 | unsigned char cpu_load; |
@@ -248,6 +248,7 rtems_task prc0_task( rtems_task_argumen | |||||
248 | incomingMsg = (asm_msg*) incomingData; |
|
248 | incomingMsg = (asm_msg*) incomingData; | |
249 |
|
249 | |||
250 | localTime = getTimeAsUnsignedLongLongInt( ); |
|
250 | localTime = getTimeAsUnsignedLongLongInt( ); | |
|
251 | ||||
251 | //**************** |
|
252 | //**************** | |
252 | //**************** |
|
253 | //**************** | |
253 | // BURST SBM1 SBM2 |
|
254 | // BURST SBM1 SBM2 |
@@ -32,40 +32,65 ring_node_sm *ring_node_for_averaging_sm | |||||
32 |
|
32 | |||
33 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
33 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
34 | { |
|
34 | { | |
35 | // ring_node_sm *previous_ring_node_sm_f0; |
|
35 | //*** | |
36 |
|
36 | // F0 | ||
37 | //// rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
37 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) // check the status_ready_matrix_f0 bit | |
38 |
|
38 | { | ||
39 | // previous_ring_node_sm_f0 = current_ring_node_sm_f0; |
|
39 | nb_sm_f0 = nb_sm_f0 + 1; | |
|
40 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) | |||
|
41 | { | |||
|
42 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |||
|
43 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |||
|
44 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |||
|
45 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |||
|
46 | { | |||
|
47 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |||
|
48 | } | |||
|
49 | nb_sm_f0 = 0; | |||
|
50 | } | |||
|
51 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 | |||
|
52 | } | |||
40 |
|
53 | |||
41 | // if ( (spectral_matrix_regs->status & 0x2) == 0x02) // check ready matrix bit f0_1 |
|
54 | //*** | |
42 | // { |
|
55 | // F1 | |
43 | // current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
56 | if ( (spectral_matrix_regs->status & 0x4) == 0x04) // check the status_ready_matrix_f1 bit | |
44 | // spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
57 | { | |
45 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 |
|
58 | nb_sm_f1 = nb_sm_f1 + 1; | |
46 | // nb_sm_f0 = nb_sm_f0 + 1; |
|
59 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) | |
47 | // } |
|
60 | { | |
|
61 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; | |||
|
62 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |||
|
63 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; | |||
|
64 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |||
|
65 | { | |||
|
66 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |||
|
67 | } | |||
|
68 | nb_sm_f1 = 0; | |||
|
69 | } | |||
|
70 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb; // 1011 | |||
|
71 | } | |||
48 |
|
72 | |||
49 | // //************************ |
|
73 | //*** | |
50 | // // reset status error bits |
|
74 | // F2 | |
51 |
|
|
75 | if ( (spectral_matrix_regs->status & 0x8) == 0x08) // check the status_ready_matrix_f2 bit | |
|
76 | { | |||
|
77 | ||||
|
78 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; | |||
|
79 | current_ring_node_sm_f2 = current_ring_node_sm_f2->next; | |||
|
80 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; | |||
|
81 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |||
|
82 | { | |||
|
83 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |||
|
84 | } | |||
|
85 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7; // 0111 | |||
|
86 | } | |||
|
87 | ||||
|
88 | //************************ | |||
|
89 | // reset status error bits | |||
|
90 | // if ( (spectral_matrix_regs->status & 0x3e0) != 0x00) // [0011 1110 0000] check the status bits | |||
52 | // { |
|
91 | // { | |
53 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
92 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
54 |
// spectral_matrix_regs->status = spectral_matrix_regs->status |
|
93 | // spectral_matrix_regs->status = spectral_matrix_regs->status | 0xfffffc1f; // [1100 0001 1111] | |
55 | // } |
|
|||
56 |
|
||||
57 | // //************************************** |
|
|||
58 | // // reset ready matrix bits for f0_0, f1 and f2 |
|
|||
59 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010 |
|
|||
60 |
|
||||
61 | // if (nb_sm_f0 == NB_SM_BEFORE_AVF0) |
|
|||
62 | // { |
|
|||
63 | // ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0; |
|
|||
64 | // if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
|||
65 | // { |
|
|||
66 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
|||
67 | // } |
|
|||
68 | // nb_sm_f0 = 0; |
|
|||
69 | // } |
|
94 | // } | |
70 |
|
95 | |||
71 | } |
|
96 | } | |
@@ -198,6 +223,34 void SM_init_rings( void ) | |||||
198 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) |
|
223 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) | |
199 | } |
|
224 | } | |
200 |
|
225 | |||
|
226 | void SM_generic_init_ring( ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] ) | |||
|
227 | { | |||
|
228 | unsigned char i; | |||
|
229 | ||||
|
230 | //*************** | |||
|
231 | // BUFFER ADDRESS | |||
|
232 | for(i=0; i<nbNodes; i++) | |||
|
233 | { | |||
|
234 | ring[ i ].buffer_address = (int) &sm_f[ i * TOTAL_SIZE_SM ]; | |||
|
235 | } | |||
|
236 | ||||
|
237 | //***** | |||
|
238 | // NEXT | |||
|
239 | ring[ nbNodes - 1 ].next = (ring_node_sm*) &ring[ 0 ]; | |||
|
240 | for(i=0; i<nbNodes-1; i++) | |||
|
241 | { | |||
|
242 | ring[ i ].next = (ring_node_sm*) &ring[ i + 1 ]; | |||
|
243 | } | |||
|
244 | ||||
|
245 | //********* | |||
|
246 | // PREVIOUS | |||
|
247 | ring[ 0 ].previous = (ring_node_sm*) &ring[ nbNodes -1 ]; | |||
|
248 | for(i=1; i<nbNodes; i++) | |||
|
249 | { | |||
|
250 | ring[ i ].previous = (ring_node_sm*) &ring[ i - 1 ]; | |||
|
251 | } | |||
|
252 | } | |||
|
253 | ||||
201 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) |
|
254 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) | |
202 | { |
|
255 | { | |
203 | unsigned char i; |
|
256 | unsigned char i; |
@@ -532,7 +532,7 int enter_mode( unsigned char mode, unsi | |||||
532 | #endif |
|
532 | #endif | |
533 | status = restart_science_tasks( mode ); |
|
533 | status = restart_science_tasks( mode ); | |
534 | launch_waveform_picker( mode, transitionCoarseTime ); |
|
534 | launch_waveform_picker( mode, transitionCoarseTime ); | |
535 | launch_spectral_matrix( ); |
|
535 | //launch_spectral_matrix( ); | |
536 | launch_spectral_matrix_simu( ); |
|
536 | launch_spectral_matrix_simu( ); | |
537 | } |
|
537 | } | |
538 | else if ( mode == LFR_MODE_STANDBY ) |
|
538 | else if ( mode == LFR_MODE_STANDBY ) |
@@ -841,7 +841,7 int send_waveform_CWF3_light(volatile in | |||||
841 | return ret; |
|
841 | return ret; | |
842 | } |
|
842 | } | |
843 |
|
843 | |||
844 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, |
|
844 | void compute_acquisition_time_old( unsigned int coarseTime, unsigned int fineTime, | |
845 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) |
|
845 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) | |
846 | { |
|
846 | { | |
847 | unsigned long long int acquisitionTimeAsLong; |
|
847 | unsigned long long int acquisitionTimeAsLong; | |
@@ -915,6 +915,80 void compute_acquisition_time( unsigned | |||||
915 |
|
915 | |||
916 | } |
|
916 | } | |
917 |
|
917 | |||
|
918 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, | |||
|
919 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) | |||
|
920 | { | |||
|
921 | unsigned long long int acquisitionTimeAsLong; | |||
|
922 | unsigned char localAcquisitionTime[6]; | |||
|
923 | double deltaT; | |||
|
924 | ||||
|
925 | deltaT = 0.; | |||
|
926 | ||||
|
927 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 ); | |||
|
928 | localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 ); | |||
|
929 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 ); | |||
|
930 | localAcquisitionTime[3] = (unsigned char) ( coarseTime ); | |||
|
931 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 ); | |||
|
932 | localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 ); | |||
|
933 | ||||
|
934 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) | |||
|
935 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) | |||
|
936 | + ( localAcquisitionTime[2] << 24 ) | |||
|
937 | + ( localAcquisitionTime[3] << 16 ) | |||
|
938 | + ( localAcquisitionTime[4] << 8 ) | |||
|
939 | + ( localAcquisitionTime[5] ); | |||
|
940 | ||||
|
941 | switch( sid ) | |||
|
942 | { | |||
|
943 | case SID_NORM_SWF_F0: | |||
|
944 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; | |||
|
945 | break; | |||
|
946 | ||||
|
947 | case SID_NORM_SWF_F1: | |||
|
948 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; | |||
|
949 | break; | |||
|
950 | ||||
|
951 | case SID_NORM_SWF_F2: | |||
|
952 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; | |||
|
953 | break; | |||
|
954 | ||||
|
955 | case SID_SBM1_CWF_F1: | |||
|
956 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; | |||
|
957 | break; | |||
|
958 | ||||
|
959 | case SID_SBM2_CWF_F2: | |||
|
960 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |||
|
961 | break; | |||
|
962 | ||||
|
963 | case SID_BURST_CWF_F2: | |||
|
964 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |||
|
965 | break; | |||
|
966 | ||||
|
967 | case SID_NORM_CWF_F3: | |||
|
968 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; | |||
|
969 | break; | |||
|
970 | ||||
|
971 | case SID_NORM_CWF_LONG_F3: | |||
|
972 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; | |||
|
973 | break; | |||
|
974 | ||||
|
975 | default: | |||
|
976 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) | |||
|
977 | deltaT = 0.; | |||
|
978 | break; | |||
|
979 | } | |||
|
980 | ||||
|
981 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; | |||
|
982 | // | |||
|
983 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); | |||
|
984 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); | |||
|
985 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); | |||
|
986 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); | |||
|
987 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); | |||
|
988 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); | |||
|
989 | ||||
|
990 | } | |||
|
991 | ||||
918 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) |
|
992 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) | |
919 | { |
|
993 | { | |
920 | unsigned int i; |
|
994 | unsigned int i; | |
@@ -1018,7 +1092,7 void build_snapshot_from_ring( ring_node | |||||
1018 | } |
|
1092 | } | |
1019 | } |
|
1093 | } | |
1020 |
|
1094 | |||
1021 | void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) |
|
1095 | void build_acquisition_time_old( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) | |
1022 | { |
|
1096 | { | |
1023 | unsigned char *acquisitionTimeCharPtr; |
|
1097 | unsigned char *acquisitionTimeCharPtr; | |
1024 |
|
1098 | |||
@@ -1033,6 +1107,21 void build_acquisition_time( unsigned lo | |||||
1033 | + ( acquisitionTimeCharPtr[5] ); |
|
1107 | + ( acquisitionTimeCharPtr[5] ); | |
1034 | } |
|
1108 | } | |
1035 |
|
1109 | |||
|
1110 | void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) | |||
|
1111 | { | |||
|
1112 | unsigned char *acquisitionTimeCharPtr; | |||
|
1113 | ||||
|
1114 | acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; | |||
|
1115 | ||||
|
1116 | *acquisitionTimeAslong = 0x00; | |||
|
1117 | *acquisitionTimeAslong = ( (unsigned long long int) (acquisitionTimeCharPtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit | |||
|
1118 | + ( (unsigned long long int) acquisitionTimeCharPtr[1] << 32 ) | |||
|
1119 | + ( acquisitionTimeCharPtr[2] << 24 ) | |||
|
1120 | + ( acquisitionTimeCharPtr[3] << 16 ) | |||
|
1121 | + ( acquisitionTimeCharPtr[4] << 8 ) | |||
|
1122 | + ( acquisitionTimeCharPtr[5] ); | |||
|
1123 | } | |||
|
1124 | ||||
1036 | //************** |
|
1125 | //************** | |
1037 | // wfp registers |
|
1126 | // wfp registers | |
1038 | void reset_wfp_burst_enable(void) |
|
1127 | void reset_wfp_burst_enable(void) |
General Comments 0
You need to be logged in to leave comments.
Login now