@@ -106,7 +106,7 static void CCR_faultTolerantScheme() | |||||
106 |
|
106 | |||
107 | if( (vendorId == VENDORID_GAISLER) & (deviceId ==DEVICEID_LEON3FT) ) |
|
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 | cacheControlRegister = CCR_getValue(); |
|
110 | cacheControlRegister = CCR_getValue(); | |
111 | cacheControlRegister = (cacheControlRegister | 0xc); |
|
111 | cacheControlRegister = (cacheControlRegister | 0xc); | |
112 | CCR_setValue(cacheControlRegister); |
|
112 | CCR_setValue(cacheControlRegister); | |
@@ -163,7 +163,7 static void CCR_getInstructionAndDataErr | |||||
163 | //******************************************* |
|
163 | //******************************************* | |
164 | // ASR16 Register protection control register |
|
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 | /** This function is used to retrieve the integer unit register file error counter and the floating point unit |
|
168 | /** This function is used to retrieve the integer unit register file error counter and the floating point unit | |
169 | * register file error counter |
|
169 | * register file error counter | |
@@ -182,7 +182,7 static unsigned int ASR16_get_FPRF_IURF_ | |||||
182 | *iurfErrorCounter = ( asr16 & COUNTER_FIELD_IURF ) >> POS_IURF; |
|
182 | *iurfErrorCounter = ( asr16 & COUNTER_FIELD_IURF ) >> POS_IURF; | |
183 |
|
183 | |||
184 | // reset the counter to 0 |
|
184 | // reset the counter to 0 | |
185 |
asr16 = asr16 |
|
185 | asr16 = asr16 | |
186 | & COUNTER_MASK_FPRF |
|
186 | & COUNTER_MASK_FPRF | |
187 | & COUNTER_FIELD_IURF; |
|
187 | & COUNTER_FIELD_IURF; | |
188 |
|
188 |
@@ -28,7 +28,7 int spacewire_open_link( void ); | |||||
28 | int spacewire_start_link( int fd ); |
|
28 | int spacewire_start_link( int fd ); | |
29 | int spacewire_stop_and_start_link( int fd ); |
|
29 | int spacewire_stop_and_start_link( int fd ); | |
30 | int spacewire_configure_link(int fd ); |
|
30 | int spacewire_configure_link(int fd ); | |
31 |
int spacewire_ |
|
31 | int spacewire_several_connect_attemps( void ); | |
32 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force |
|
32 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force | |
33 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ); // RMAP Enable |
|
33 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ); // RMAP Enable | |
34 | void spacewire_compute_stats_offsets( void ); |
|
34 | void spacewire_compute_stats_offsets( void ); |
@@ -8,7 +8,7 dsu3plugin0.loadFile() | |||||
8 | dsu3plugin0.run() |
|
8 | dsu3plugin0.run() | |
9 |
|
9 | |||
10 | # START SENDING TIMECODES AT 1 Hz |
|
10 | # START SENDING TIMECODES AT 1 Hz | |
11 | SpwPlugin0.StarDundeeStartTimecodes( 1 ) |
|
11 | #SpwPlugin0.StarDundeeStartTimecodes( 1 ) | |
12 |
|
12 | |||
13 | # it is possible to change the time code frequency |
|
13 | # it is possible to change the time code frequency | |
14 | #RMAPPlugin0.changeTimecodeFrequency(2) |
|
14 | #RMAPPlugin0.changeTimecodeFrequency(2) |
@@ -95,7 +95,7 void initCache() | |||||
95 |
|
95 | |||
96 | CCR_faultTolerantScheme(); |
|
96 | CCR_faultTolerantScheme(); | |
97 |
|
97 | |||
98 | // FT activation |
|
98 | PRINTF("\n"); | |
99 | } |
|
99 | } | |
100 |
|
100 | |||
101 | rtems_task Init( rtems_task_argument ignored ) |
|
101 | rtems_task Init( rtems_task_argument ignored ) | |
@@ -124,9 +124,8 rtems_task Init( rtems_task_argument ign | |||||
124 | rtems_isr_entry old_isr_handler; |
|
124 | rtems_isr_entry old_isr_handler; | |
125 |
|
125 | |||
126 | // UART settings |
|
126 | // UART settings | |
127 | send_console_outputs_on_apbuart_port(); |
|
127 | enable_apbuart_transmitter(); | |
128 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
128 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); | |
129 | enable_apbuart_transmitter(); |
|
|||
130 |
|
129 | |||
131 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
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 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
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 | return 0; |
|
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 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
158 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) | |
168 | { |
|
159 | { | |
169 | /** This function sets the scaler reload register of the apbuart module |
|
160 | /** This function sets the scaler reload register of the apbuart module | |
@@ -178,6 +169,7 void set_apbuart_scaler_reload_register( | |||||
178 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
169 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; | |
179 |
|
170 | |||
180 | apbuart_regs->scaler = value; |
|
171 | apbuart_regs->scaler = value; | |
|
172 | ||||
181 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
173 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) | |
182 | } |
|
174 | } | |
183 |
|
175 |
@@ -67,7 +67,7 rtems_task spiq_task(rtems_task_argument | |||||
67 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link |
|
67 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link | |
68 | { |
|
68 | { | |
69 | spacewire_compute_stats_offsets(); |
|
69 | spacewire_compute_stats_offsets(); | |
70 |
status = spacewire_ |
|
70 | status = spacewire_several_connect_attemps( ); | |
71 | } |
|
71 | } | |
72 | else // [2.b] in run state, start the link |
|
72 | else // [2.b] in run state, start the link | |
73 | { |
|
73 | { | |
@@ -93,7 +93,8 rtems_task spiq_task(rtems_task_argument | |||||
93 | else // [3.b] the link is not in run state, go in STANDBY mode |
|
93 | else // [3.b] the link is not in run state, go in STANDBY mode | |
94 | { |
|
94 | { | |
95 | status = enter_mode_standby(); |
|
95 | status = enter_mode_standby(); | |
96 |
if ( status != RTEMS_SUCCESSFUL ) |
|
96 | if ( status != RTEMS_SUCCESSFUL ) | |
|
97 | { | |||
97 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) |
|
98 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) | |
98 | } |
|
99 | } | |
99 | // wake the WTDG task up to wait for the link recovery |
|
100 | // wake the WTDG task up to wait for the link recovery | |
@@ -477,7 +478,7 int spacewire_configure_link( int fd ) | |||||
477 | return status; |
|
478 | return status; | |
478 | } |
|
479 | } | |
479 |
|
480 | |||
480 |
int spacewire_ |
|
481 | int spacewire_several_connect_attemps( void ) | |
481 | { |
|
482 | { | |
482 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. |
|
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 | void update_last_valid_transition_date( unsigned int transitionCoarseTime ) |
|
447 | void update_last_valid_transition_date( unsigned int transitionCoarseTime ) | |
448 | { |
|
448 | { | |
449 | lastValidEnterModeTime = transitionCoarseTime; |
|
449 | lastValidEnterModeTime = transitionCoarseTime; | |
|
450 | PRINTF1("lastValidEnterModeTime = %x\n", transitionCoarseTime); | |||
450 | } |
|
451 | } | |
451 |
|
452 | |||
452 | int check_transition_date( unsigned int transitionCoarseTime ) |
|
453 | int check_transition_date( unsigned int transitionCoarseTime ) | |
@@ -465,12 +466,12 int check_transition_date( unsigned int | |||||
465 | { |
|
466 | { | |
466 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
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 | status = LFR_DEFAULT; |
|
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 | if (status == LFR_SUCCESSFUL) |
|
477 | if (status == LFR_SUCCESSFUL) |
@@ -869,10 +869,15 void snapshot_resynchronization( unsigne | |||||
869 | unsigned long long int nextTick; |
|
869 | unsigned long long int nextTick; | |
870 | unsigned long long int deltaPreviousTick; |
|
870 | unsigned long long int deltaPreviousTick; | |
871 | unsigned long long int deltaNextTick; |
|
871 | unsigned long long int deltaNextTick; | |
872 |
|
|
872 | int deltaTickInF2; | |
873 | double deltaPrevious_ms; |
|
873 | double deltaPrevious_ms; | |
874 | double deltaNext_ms; |
|
874 | double deltaNext_ms; | |
|
875 | double correctionInF2; | |||
|
876 | static unsigned char resynchroEngaged = 0; | |||
875 |
|
877 | |||
|
878 | if (resynchroEngaged == 0) | |||
|
879 | { | |||
|
880 | resynchroEngaged = 1; | |||
876 | // get acquisition time in fine time ticks |
|
881 | // get acquisition time in fine time ticks | |
877 | acquisitionTime = get_acquisition_time( timePtr ); |
|
882 | acquisitionTime = get_acquisition_time( timePtr ); | |
878 |
|
883 | |||
@@ -890,20 +895,33 void snapshot_resynchronization( unsigne | |||||
890 | PRINTF2("delta previous = %f ms, delta next = %f ms\n", deltaPrevious_ms, deltaNext_ms); |
|
895 | 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); |
|
896 | PRINTF2("delta previous = %llu fine time ticks, delta next = %llu fine time ticks\n", deltaPreviousTick, deltaNextTick); | |
892 |
|
897 | |||
893 | // which tick is the closest |
|
898 | // which tick is the closest? | |
894 | if (deltaPreviousTick > deltaNextTick) |
|
899 | if (deltaPreviousTick > deltaNextTick) | |
895 | { |
|
900 | { | |
896 | // the snapshot center is just before the second => increase delta_snapshot |
|
901 | // the snapshot center is just before the second => increase delta_snapshot | |
897 |
|
|
902 | correctionInF2 = + (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); |
|
|||
900 | } |
|
903 | } | |
901 | else |
|
904 | else | |
902 | { |
|
905 | { | |
903 |
// the snapshot center is just after the second => decrease del |
|
906 | // the snapshot center is just after the second => decrease delta_snapshot | |
904 |
|
|
907 | correctionInF2 = - (deltaPrevious_ms * 256. / 1000. ); | |
905 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - 1 * deltaTickInF2; |
|
908 | } | |
906 | PRINTF2("correction of = - %u, delta_snapshot = %d\n", deltaTickInF2, waveform_picker_regs->delta_snapshot); |
|
909 | ||
|
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); | |||
|
920 | } | |||
|
921 | else | |||
|
922 | { | |||
|
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