@@ -106,7 +106,7 static void CCR_faultTolerantScheme() | |||
|
106 | 106 | |
|
107 | 107 | if( (vendorId == VENDORID_GAISLER) & (deviceId ==DEVICEID_LEON3FT) ) |
|
108 | 108 | { |
|
109 | PRINTF("in faultTolerantScheme *** Leon3FT detected, configure the CCR FT bits"); | |
|
109 | PRINTF("in faultTolerantScheme *** Leon3FT detected, configure the CCR FT bits\n"); | |
|
110 | 110 | cacheControlRegister = CCR_getValue(); |
|
111 | 111 | cacheControlRegister = (cacheControlRegister | 0xc); |
|
112 | 112 | CCR_setValue(cacheControlRegister); |
@@ -163,7 +163,7 static void CCR_getInstructionAndDataErr | |||
|
163 | 163 | //******************************************* |
|
164 | 164 | // ASR16 Register protection control register |
|
165 | 165 | |
|
166 |
static |
|
|
166 | static void ASR16_get_FPRF_IURF_ErrorCounters( unsigned int* fprfErrorCounter, unsigned int* iurfErrorCounter) | |
|
167 | 167 | { |
|
168 | 168 | /** This function is used to retrieve the integer unit register file error counter and the floating point unit |
|
169 | 169 | * register file error counter |
@@ -182,7 +182,7 static unsigned int ASR16_get_FPRF_IURF_ | |||
|
182 | 182 | *iurfErrorCounter = ( asr16 & COUNTER_FIELD_IURF ) >> POS_IURF; |
|
183 | 183 | |
|
184 | 184 | // reset the counter to 0 |
|
185 |
asr16 = asr16 |
|
|
185 | asr16 = asr16 | |
|
186 | 186 | & COUNTER_MASK_FPRF |
|
187 | 187 | & COUNTER_FIELD_IURF; |
|
188 | 188 |
@@ -28,7 +28,7 int spacewire_open_link( void ); | |||
|
28 | 28 | int spacewire_start_link( int fd ); |
|
29 | 29 | int spacewire_stop_and_start_link( int fd ); |
|
30 | 30 | int spacewire_configure_link(int fd ); |
|
31 |
int spacewire_ |
|
|
31 | int spacewire_several_connect_attemps( void ); | |
|
32 | 32 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force |
|
33 | 33 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ); // RMAP Enable |
|
34 | 34 | void spacewire_compute_stats_offsets( void ); |
@@ -8,7 +8,7 dsu3plugin0.loadFile() | |||
|
8 | 8 | dsu3plugin0.run() |
|
9 | 9 | |
|
10 | 10 | # START SENDING TIMECODES AT 1 Hz |
|
11 | SpwPlugin0.StarDundeeStartTimecodes( 1 ) | |
|
11 | #SpwPlugin0.StarDundeeStartTimecodes( 1 ) | |
|
12 | 12 | |
|
13 | 13 | # it is possible to change the time code frequency |
|
14 | 14 | #RMAPPlugin0.changeTimecodeFrequency(2) |
@@ -95,7 +95,7 void initCache() | |||
|
95 | 95 | |
|
96 | 96 | CCR_faultTolerantScheme(); |
|
97 | 97 | |
|
98 | // FT activation | |
|
98 | PRINTF("\n"); | |
|
99 | 99 | } |
|
100 | 100 | |
|
101 | 101 | rtems_task Init( rtems_task_argument ignored ) |
@@ -124,9 +124,8 rtems_task Init( rtems_task_argument ign | |||
|
124 | 124 | rtems_isr_entry old_isr_handler; |
|
125 | 125 | |
|
126 | 126 | // UART settings |
|
127 | send_console_outputs_on_apbuart_port(); | |
|
127 | enable_apbuart_transmitter(); | |
|
128 | 128 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
129 | enable_apbuart_transmitter(); | |
|
130 | 129 | |
|
131 | 130 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
132 | 131 |
@@ -146,7 +146,7 void watchdog_start(void) | |||
|
146 | 146 | |
|
147 | 147 | } |
|
148 | 148 | |
|
149 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port | |
|
149 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register | |
|
150 | 150 | { |
|
151 | 151 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
152 | 152 | |
@@ -155,15 +155,6 int send_console_outputs_on_apbuart_port | |||
|
155 | 155 | return 0; |
|
156 | 156 | } |
|
157 | 157 | |
|
158 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register | |
|
159 | { | |
|
160 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
|
161 | ||
|
162 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; | |
|
163 | ||
|
164 | return 0; | |
|
165 | } | |
|
166 | ||
|
167 | 158 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
168 | 159 | { |
|
169 | 160 | /** This function sets the scaler reload register of the apbuart module |
@@ -178,6 +169,7 void set_apbuart_scaler_reload_register( | |||
|
178 | 169 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
179 | 170 | |
|
180 | 171 | apbuart_regs->scaler = value; |
|
172 | ||
|
181 | 173 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
182 | 174 | } |
|
183 | 175 |
@@ -63,11 +63,11 rtems_task spiq_task(rtems_task_argument | |||
|
63 | 63 | } |
|
64 | 64 | |
|
65 | 65 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT |
|
66 |
status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); |
|
|
66 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) | |
|
67 | 67 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link |
|
68 | 68 | { |
|
69 | 69 | spacewire_compute_stats_offsets(); |
|
70 |
status = spacewire_ |
|
|
70 | status = spacewire_several_connect_attemps( ); | |
|
71 | 71 | } |
|
72 | 72 | else // [2.b] in run state, start the link |
|
73 | 73 | { |
@@ -93,7 +93,8 rtems_task spiq_task(rtems_task_argument | |||
|
93 | 93 | else // [3.b] the link is not in run state, go in STANDBY mode |
|
94 | 94 | { |
|
95 | 95 | status = enter_mode_standby(); |
|
96 |
if ( status != RTEMS_SUCCESSFUL ) |
|
|
96 | if ( status != RTEMS_SUCCESSFUL ) | |
|
97 | { | |
|
97 | 98 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) |
|
98 | 99 | } |
|
99 | 100 | // wake the WTDG task up to wait for the link recovery |
@@ -477,7 +478,7 int spacewire_configure_link( int fd ) | |||
|
477 | 478 | return status; |
|
478 | 479 | } |
|
479 | 480 | |
|
480 |
int spacewire_ |
|
|
481 | int spacewire_several_connect_attemps( void ) | |
|
481 | 482 | { |
|
482 | 483 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. |
|
483 | 484 | * |
@@ -447,6 +447,7 int check_mode_transition( unsigned char | |||
|
447 | 447 | void update_last_valid_transition_date( unsigned int transitionCoarseTime ) |
|
448 | 448 | { |
|
449 | 449 | lastValidEnterModeTime = transitionCoarseTime; |
|
450 | PRINTF1("lastValidEnterModeTime = %x\n", transitionCoarseTime); | |
|
450 | 451 | } |
|
451 | 452 | |
|
452 | 453 | int check_transition_date( unsigned int transitionCoarseTime ) |
@@ -465,12 +466,12 int check_transition_date( unsigned int | |||
|
465 | 466 | { |
|
466 | 467 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
467 | 468 | |
|
468 | PRINTF2("localTime = %x, transitionTime = %x\n", localCoarseTime, transitionCoarseTime) | |
|
469 | PRINTF2("localTime = %x, transitionTime = %x\n", localCoarseTime, transitionCoarseTime); | |
|
469 | 470 | |
|
470 |
|
|
|
471 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 | |
|
471 | 472 | { |
|
472 | 473 | status = LFR_DEFAULT; |
|
473 | PRINTF("ERR *** in check_transition_date *** transitionCoarseTime <= localCoarseTime\n") | |
|
474 | PRINTF("ERR *** in check_transition_date *** transitionCoarseTime <= localCoarseTime\n"); | |
|
474 | 475 | } |
|
475 | 476 | |
|
476 | 477 | if (status == LFR_SUCCESSFUL) |
@@ -869,41 +869,59 void snapshot_resynchronization( unsigne | |||
|
869 | 869 | unsigned long long int nextTick; |
|
870 | 870 | unsigned long long int deltaPreviousTick; |
|
871 | 871 | unsigned long long int deltaNextTick; |
|
872 |
|
|
|
872 | int deltaTickInF2; | |
|
873 | 873 | double deltaPrevious_ms; |
|
874 | 874 | double deltaNext_ms; |
|
875 | double correctionInF2; | |
|
876 | static unsigned char resynchroEngaged = 0; | |
|
875 | 877 | |
|
876 | // get acquisition time in fine time ticks | |
|
877 | acquisitionTime = get_acquisition_time( timePtr ); | |
|
878 | if (resynchroEngaged == 0) | |
|
879 | { | |
|
880 | resynchroEngaged = 1; | |
|
881 | // get acquisition time in fine time ticks | |
|
882 | acquisitionTime = get_acquisition_time( timePtr ); | |
|
878 | 883 | |
|
879 | // compute center time | |
|
880 | centerTime = acquisitionTime + 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |
|
881 | previousTick = centerTime - (centerTime & 0xffff); | |
|
882 | nextTick = previousTick + 65536; | |
|
884 | // compute center time | |
|
885 | centerTime = acquisitionTime + 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |
|
886 | previousTick = centerTime - (centerTime & 0xffff); | |
|
887 | nextTick = previousTick + 65536; | |
|
883 | 888 | |
|
884 | deltaPreviousTick = centerTime - previousTick; | |
|
885 | deltaNextTick = nextTick - centerTime; | |
|
889 | deltaPreviousTick = centerTime - previousTick; | |
|
890 | deltaNextTick = nextTick - centerTime; | |
|
891 | ||
|
892 | deltaPrevious_ms = ((double) deltaPreviousTick) / 65536. * 1000.; | |
|
893 | deltaNext_ms = ((double) deltaNextTick) / 65536. * 1000.; | |
|
894 | ||
|
895 | PRINTF2("delta previous = %f ms, delta next = %f ms\n", deltaPrevious_ms, deltaNext_ms); | |
|
896 | PRINTF2("delta previous = %llu fine time ticks, delta next = %llu fine time ticks\n", deltaPreviousTick, deltaNextTick); | |
|
886 | 897 | |
|
887 | deltaPrevious_ms = ((double) deltaPreviousTick) / 65536. * 1000.; | |
|
888 | deltaNext_ms = ((double) deltaNextTick) / 65536. * 1000.; | |
|
889 | ||
|
890 | PRINTF2("delta previous = %f ms, delta next = %f ms\n", deltaPrevious_ms, deltaNext_ms); | |
|
891 | PRINTF2("delta previous = %llu fine time ticks, delta next = %llu fine time ticks\n", deltaPreviousTick, deltaNextTick); | |
|
898 | // which tick is the closest? | |
|
899 | if (deltaPreviousTick > deltaNextTick) | |
|
900 | { | |
|
901 | // the snapshot center is just before the second => increase delta_snapshot | |
|
902 | correctionInF2 = + (deltaNext_ms * 256. / 1000. ); | |
|
903 | } | |
|
904 | else | |
|
905 | { | |
|
906 | // the snapshot center is just after the second => decrease delta_snapshot | |
|
907 | correctionInF2 = - (deltaPrevious_ms * 256. / 1000. ); | |
|
908 | } | |
|
892 | 909 | |
|
893 | // which tick is the closest | |
|
894 | if (deltaPreviousTick > deltaNextTick) | |
|
895 | { | |
|
896 | // the snapshot center is just before the second => increase delta_snapshot | |
|
897 | deltaTickInF2 = ceil( (deltaNext_ms * 256. / 1000.) ); | |
|
898 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + 1 * deltaTickInF2; | |
|
899 | PRINTF2("correction of = + %u, delta_snapshot = %d\n", deltaTickInF2, waveform_picker_regs->delta_snapshot); | |
|
910 | if (correctionInF2 >=0 ) | |
|
911 | { | |
|
912 | deltaTickInF2 = floor( correctionInF2 ); | |
|
913 | } | |
|
914 | else | |
|
915 | { | |
|
916 | deltaTickInF2 = ceil( correctionInF2 ); | |
|
917 | } | |
|
918 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2; | |
|
919 | PRINTF2("Correction of = %d, delta_snapshot = %d\n\n", deltaTickInF2, waveform_picker_regs->delta_snapshot); | |
|
900 | 920 | } |
|
901 | 921 | else |
|
902 | 922 | { |
|
903 | // the snapshot center is just after the second => decrease delat_snapshot | |
|
904 | deltaTickInF2 = ceil( (deltaPrevious_ms * 256. / 1000.) ); | |
|
905 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - 1 * deltaTickInF2; | |
|
906 | PRINTF2("correction of = - %u, delta_snapshot = %d\n", deltaTickInF2, waveform_picker_regs->delta_snapshot); | |
|
923 | PRINTF1("No resynchro, delta_snapshot = %d\n\n", waveform_picker_regs->delta_snapshot); | |
|
924 | resynchroEngaged = 0; | |
|
907 | 925 | } |
|
908 | 926 | } |
|
909 | 927 |
General Comments 0
You need to be logged in to leave comments.
Login now