CROSS Technical Documentation User Manual and Technical Doc.
INFN Milano Bicocca
Loading...
Searching...
No Matches

◆ ERROR_codifica_errore()

void ERROR_codifica_errore ( uint8_t  scheda_su_scheda_giu,
unsigned char  error_addres,
unsigned char  code_to_shift,
uint8_t  reset_count_se_0 
)

If an error is found its flag is codified here.

The errors are 32 bit flag regsiters. The bits that are 1 indicates that the corresponding error was verified.

Parameters
[in]scheda_su_scheda_giu: 0 if down board, 1 if up board
[in]error_addres: is the address of the register where the flag is found. The address to be passed is that of the down board. The actual address is dependent on the scheda_su_scheda_giu value;
[in]code_to_shift: is the posistion of the error flag within the register;
[in]reset_count_se_0: if 0 a rest of all errors is done and the registration of errors starts from now
Returns
No params
void ERROR_codifica_errore(uint8_t scheda_su_scheda_giu, unsigned char error_addres, unsigned char code_to_shift, uint8_t reset_count_se_0 ){
//if error_addres is >= error_number_of_errors_registers nothing is done, but the reset, if reset_count_se_0 is =0
uint8_t iii, buffer_instruction[8],actual_error_address=error_addres;
if(scheda_su_scheda_giu) actual_error_address=error_addres + error_offset_for_board_up;
// if (scheda_su_scheda_giu) scheda_su_scheda_giu=1;
// error_addres += scheda_su_scheda_giu;
if( reset_count_se_0 ==0){ // Verifichiamo solo gli errori che capitano da ora.
Error_good_operation=0;
flag_error_verified=0;
Post_frontend_errors[actual_error_address]=0;
}
if (( code_to_shift ==0) && ( (error_address_I2C0 == error_addres) | (error_addres == error_address_I2C1) | (error_addres == error_address_SPI) )){
__NOP();
}else {
if( reset_count_se_0 > 0 ){ //if error_addres is >= error_number_of_errors_registers nothing is
//done, but the reset, if reset_count_se_0 is =0
if (~( Post_frontend_errors[actual_error_address] & (1 << code_to_shift))) //Error is set only if it happens for the first time
{
Post_frontend_errors[actual_error_address] |= (1 << code_to_shift);
flag_error_verified++;
last_error_address= actual_error_address ;
last_code_to_shift=code_to_shift;
}
for( iii=0;iii<8;iii++){
buffer_instruction[iii]=tx_data[iii];
}
tx_data[5]= actual_error_address; //The register where the error is confined
tx_data[6]= 1; //This must be "1" and says that the node voltage read must be returned here
tx_data[7]= instr_ERROR_echo_on_off ; //instr code
tx_msg_info.id = ARM_CAN_EXTENDED_ID(indirizzo_CAN_della_scheda);
CANdrv->MessageSend(tx_obj_idx, &tx_msg_info, tx_data, 8U);//msg to CAN back to the control room
Aspetta_tanti_ms(100); //From here we wait the answer or generate an error
for( iii=0;iii<8;iii++){
tx_data[iii]=buffer_instruction[iii];
}
}
}
}
}
@ instr_ERROR_echo_on_off
if enabled, echo of the error via CAN as soon as the error is verified
uint8_t tx_data[8]
Transmission data vector.
Definition: Can.c:321
uint32_t tx_obj_idx
This is the variable which resembles the flags from the communication.
Definition: Can.c:323
unsigned int indirizzo_CAN_della_scheda
Per ora lo assegnamo cos\i l'indirizzo della scheda.
Definition: Can.c:335
ARM_DRIVER_CAN * CANdrv
Definition: Can.c:333
void store_errors(void)
Copy all errors in a buffer.
unsigned int Post_frontend_errors[error_number_of_errors_registers+error_offset_for_board_up]
Error are notified via can if =1; not notified if =0.
volatile unsigned char can_send_error
The shift bit of the last error.
volatile uint32_t Error_bad_operation
exploited to mark the errors
volatile unsigned char last_code_to_shift
The address of the last verified error.
void ERROR_codifica_errore(uint8_t scheda_su_scheda_giu, unsigned char error_addres, unsigned char code_to_shift, uint8_t reset_count_se_0)
If an error is found its flag is codified here.
volatile unsigned char last_error_address
Il flag di errore veirifcato e tutti gli errori vengono resettati perch\'e acquisiti.
@ error_address_I2C0
Error register A for I2C0.
@ error_offset_for_board_up
=15, First addresss for board up errors
@ error_address_I2C1
Error register A for I2C1
@ error_address_SPI
Error register for SPI.
void Aspetta_tanti_ms(int millisecondi)
The timing function.
Definition: Timer.c:52

Definition at line 664 of file Error_handling.c.