
#ifndef _Spi_FICOSEKCOM_H
#define _Spi_FICOSEKCOM_H

/*-------------------------------- includes ------------------------------*/
#include "Global.h"
#include "SpiFrameWrapper.h"

/*-------------------------------- defines -------------------------------*/
/* Return type of the calls OSEK COM */
#ifndef STD_TYPES_H
    #define E_OK         ((UI_8)0x00) /* Service call has succeeded        */
#endif    
#define E_COM_ID         ((UI_8)0x01) /* Given message or mode identifier  */
                             /* is out of range or invalid        */
#define E_COM_LENGTH     ((UI_8)0x02) /* Given data length is out of range */
#define E_COM_LIMIT      ((UI_8)0x03) /* Overflow of message queue         */
#define E_COM_NOMSG      ((UI_8)0x04) /* Message queue is empty            */
#define E_COM_SYS_NOINIT ((UI_8)0x05) /* User defined E_COM_SYS_??         */


/* Valors admisibles pel senyal sig_DIE1_M0_DIAG */
#define SIG_DIE1_M0_DIAG_F_DIAG_SEQUENCE_NOT_FINISHED ((t_sig_die1_m0_diag) 0)
#define SIG_DIE1_M0_DIAG_DIAG_FAIL ((t_sig_die1_m0_diag) 1)
#define SIG_DIE1_M0_DIAG_DIAGC_PASS_(PREVIOUS_CYCLE) ((t_sig_die1_m0_diag) 2)
#define SIG_DIE1_M0_DIAG_DIAG_PASS_NEW_CYCLE_COMPLETED ((t_sig_die1_m0_diag) 3)

/* Valors admisibles pel senyal sig_DIE1_M1_DIAG */
#define SIG_DIE1_M1_DIAG_F_DIAG_SEQUENCE_NOT_FINISHED ((t_sig_die1_m1_diag) 0)
#define SIG_DIE1_M1_DIAG_DIAG_FAIL ((t_sig_die1_m1_diag) 1)
#define SIG_DIE1_M1_DIAG_DIAGC_PASS_(PREVIOUS_CYCLE) ((t_sig_die1_m1_diag) 2)
#define SIG_DIE1_M1_DIAG_DIAG_PASS_NEW_CYCLE_COMPLETED ((t_sig_die1_m1_diag) 3)

/* Valors admisibles pel senyal sig_DIE2_M0_DIAG */
#define SIG_DIE2_M0_DIAG_F_DIAG_SEQUENCE_NOT_FINISHED ((t_sig_die2_m0_diag) 0)
#define SIG_DIE2_M0_DIAG_DIAG_FAIL ((t_sig_die2_m0_diag) 1)
#define SIG_DIE2_M0_DIAG_DIAGC_PASS_(PREVIOUS_CYCLE) ((t_sig_die2_m0_diag) 2)
#define SIG_DIE2_M0_DIAG_DIAG_PASS_NEW_CYCLE_COMPLETED ((t_sig_die2_m0_diag) 3)

/* Valors admisibles pel senyal sig_DIE2_M1_DIAG */
#define SIG_DIE2_M1_DIAG_F_DIAG_SEQUENCE_NOT_FINISHED ((t_sig_die2_m1_diag) 0)
#define SIG_DIE2_M1_DIAG_DIAG_FAIL ((t_sig_die2_m1_diag) 1)
#define SIG_DIE2_M1_DIAG_DIAGC_PASS_(PREVIOUS_CYCLE) ((t_sig_die2_m1_diag) 2)
#define SIG_DIE2_M1_DIAG_DIAG_PASS_NEW_CYCLE_COMPLETED ((t_sig_die2_m1_diag) 3)
/* Node id */ 
#define NODE_ID_MASK ((UI_16) 0xF000) /* Mask to get nodes id */
#define NODE_ID_ECU_LITE (((UI_16) 0x1000) & NODE_ID_MASK) /* Symbolic name of the node ECU_Lite */

/* Symbolic names for Tx signals with static length */ 
/* First tx signal */
#define SPIFIRST_TX_STA_LEN_SIGNAL_SYMBOLIC_NAME ((~NODE_ID_MASK) & SIG_MASTER_M0_RST_DIE1)
#define SIG_MASTER_M0_RST_DIE1 (((UI_16) 1) | NODE_ID_ECU_LITE) /* Symbolic name of the signal MASTER_M0_RST_DIE1 */
#define SIG_MASTER_M0_RST_DIE2 (((UI_16) 2) | NODE_ID_ECU_LITE) /* Symbolic name of the signal MASTER_M0_RST_DIE2 */
#define SIG_MASTER_M0_TIMEOUT_VALUE_DIE1 (((UI_16) 3) | NODE_ID_ECU_LITE) /* Symbolic name of the signal MASTER_M0_TIMEOUT_VALUE_DIE1 */
#define SIG_MASTER_M0_TIMEOUT_VALUE_DIE2 (((UI_16) 4) | NODE_ID_ECU_LITE) /* Symbolic name of the signal MASTER_M0_TIMEOUT_VALUE_DIE2 */
#define SIG_MASTER_M3_ADD0_DIE1 (((UI_16) 5) | NODE_ID_ECU_LITE) /* Symbolic name of the signal MASTER_M3_ADD0_DIE1 */
#define SIG_MASTER_M3_ADD0_DIE2 (((UI_16) 6) | NODE_ID_ECU_LITE) /* Symbolic name of the signal MASTER_M3_ADD0_DIE2 */
#define SIG_MASTER_M3_ADD1_DIE1 (((UI_16) 7) | NODE_ID_ECU_LITE) /* Symbolic name of the signal MASTER_M3_ADD1_DIE1 */
#define SIG_MASTER_M3_ADD1_DIE2 (((UI_16) 8) | NODE_ID_ECU_LITE) /* Symbolic name of the signal MASTER_M3_ADD1_DIE2 */
#define SIG_MASTER_M7_KEY_DIE1 (((UI_16) 9) | NODE_ID_ECU_LITE) /* Symbolic name of the signal MASTER_M7_KEY_DIE1 */
#define SIG_MASTER_M7_KEY_DIE2 (((UI_16) 10) | NODE_ID_ECU_LITE) /* Symbolic name of the signal MASTER_M7_KEY_DIE2 */
/* Last tx signal */
#define SPILAST_TX_STA_LEN_SIGNAL_SYMBOLIC_NAME ((~NODE_ID_MASK) & SIG_MASTER_M7_KEY_DIE2)


/* Symbolic names for Rx signals */ 
#define SIG_DIE1_M0_ALPHA (((UI_16) 11) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE1_M0_ALPHA */
#define SIG_DIE1_M0_DIAG (((UI_16) 12) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE1_M0_DIAG */
#define SIG_DIE1_M0_VG (((UI_16) 13) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE1_M0_VG */
#define SIG_DIE1_M1_ALPHA (((UI_16) 14) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE1_M1_ALPHA */
#define SIG_DIE1_M1_BETA (((UI_16) 15) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE1_M1_BETA */
#define SIG_DIE1_M1_DIAG (((UI_16) 16) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE1_M1_DIAG */
#define SIG_DIE1_M1_VG (((UI_16) 17) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE1_M1_VG */
#define SIG_DIE1_M4_DATA_AT_ADD0 (((UI_16) 18) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE1_M4_DATA_AT_ADD0 */
#define SIG_DIE1_M4_DATA_AT_ADD1 (((UI_16) 19) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE1_M4_DATA_AT_ADD1 */
#define SIG_DIE1_M8_INVERTED_KEY_ECHO (((UI_16) 20) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE1_M8_INVERTED_KEY_ECHO */
#define SIG_DIE1_M8_KEY_ECHO (((UI_16) 21) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE1_M8_KEY_ECHO */
#define SIG_DIE2_M0_ALPHA (((UI_16) 22) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE2_M0_ALPHA */
#define SIG_DIE2_M0_DIAG (((UI_16) 23) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE2_M0_DIAG */
#define SIG_DIE2_M0_VG (((UI_16) 24) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE2_M0_VG */
#define SIG_DIE2_M1_ALPHA (((UI_16) 25) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE2_M1_ALPHA */
#define SIG_DIE2_M1_BETA (((UI_16) 26) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE2_M1_BETA */
#define SIG_DIE2_M1_DIAG (((UI_16) 27) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE2_M1_DIAG */
#define SIG_DIE2_M1_VG (((UI_16) 28) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE2_M1_VG */
#define SIG_DIE2_M4_DATA_AT_ADD0 (((UI_16) 29) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE2_M4_DATA_AT_ADD0 */
#define SIG_DIE2_M4_DATA_AT_ADD1 (((UI_16) 30) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE2_M4_DATA_AT_ADD1 */
#define SIG_DIE2_M8_INVERTED_KEY_ECHO (((UI_16) 31) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE2_M8_INVERTED_KEY_ECHO */
#define SIG_DIE2_M8_KEY_ECHO (((UI_16) 32) | NODE_ID_ECU_LITE) /* Symbolic name of the signal DIE2_M8_KEY_ECHO */
/* Last Rx signal */
#define SPILAST_RX_STA_LEN_SIGNAL_SYMBOLIC_NAME ((~NODE_ID_MASK) & SIG_DIE2_M8_KEY_ECHO)


/* Symbolic names for Dummy signal */ 
#define SPISIGDUMMY ((UI_16)0x0FFF) /* Symbolic name of the signal SIGDUMMY */


/*----------------------------- data types -------------------------------*/
/* Type definition of internal signals */
typedef UI_16 t_sig_die1_m0_alpha;
typedef UI_8 t_sig_die1_m0_vg;
typedef UI_8 t_sig_die1_m0_diag;
typedef UI_16 t_sig_die1_m1_alpha;
typedef UI_16 t_sig_die1_m1_beta;
typedef UI_8 t_sig_die1_m1_diag;
typedef UI_8 t_sig_die1_m1_vg;
typedef UI_16 t_sig_die1_m4_data_at_add0;
typedef UI_16 t_sig_die1_m4_data_at_add1;
typedef UI_16 t_sig_die1_m8_key_echo;
typedef UI_16 t_sig_die1_m8_inverted_key_echo;
typedef UI_16 t_sig_die2_m0_alpha;
typedef UI_8 t_sig_die2_m0_diag;
typedef UI_8 t_sig_die2_m0_vg;
typedef UI_16 t_sig_die2_m1_alpha;
typedef UI_16 t_sig_die2_m1_beta;
typedef UI_8 t_sig_die2_m1_diag;
typedef UI_8 t_sig_die2_m1_vg;
typedef UI_16 t_sig_die2_m4_data_at_add0;
typedef UI_16 t_sig_die2_m4_data_at_add1;
typedef UI_16 t_sig_die2_m8_key_echo;
typedef UI_16 t_sig_die2_m8_inverted_key_echo;
typedef UI_8 t_sig_master_m0_rst_die1;
typedef UI_16 t_sig_master_m0_timeout_value_die1;
typedef UI_16 t_sig_master_m7_key_die1;
typedef UI_16 t_sig_master_m3_add0_die1;
typedef UI_16 t_sig_master_m3_add1_die1;
typedef UI_8 t_sig_master_m0_rst_die2;
typedef UI_16 t_sig_master_m0_timeout_value_die2;
typedef UI_16 t_sig_master_m3_add0_die2;
typedef UI_16 t_sig_master_m3_add1_die2;
typedef UI_16 t_sig_master_m7_key_die2;


#ifndef _FICOSEKCOM_H
#define _FICOSEKCOM_H

/* Type definition of the symbolic names for signals */
typedef UI_16 t_symbolic_name;
typedef UI_16 t_symbolic_frm_name;

/* Return type of the calls OSEK COM */
typedef UI_8 t_status_type;

/* Structure of data type passed by reference in */
/* the calls of OSEK COM                         */
typedef void *t_application_data_ref;
typedef void *t_length_ref; 

/* Flag types of OSEK COM */
typedef enum {
    COM_FALSE = 0x00, /* Flag down  */
    COM_TRUE  = 0x01  /* Flag up */
} t_flag_value;

/* Stop mode of OSEK COM */
typedef enum {
    COM_SHUTDOWN_IMMEDIATE = 0 /* Apagat immediat */
} t_com_shutdown_mode_type;

/* Initialize mode of OSEK COM */
typedef enum {
    COM_NORMAL_MODE = 0 /* No es processen trames de COM de Debug */
} t_com_application_mode_type;

#endif

/*--------------------------- global variables ---------------------------*/


/*------------------------- prototips de funcions ------------------------*/

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * Reception callback Routine of COM frames
|---------------------------------------------------------------------------
| Parameters description:
|---------------------------------------------------------------------------
| CPU requirements data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
void SpiOsekComRxNotifCallbackECU_Lite(t_com_buf_hdl bhdl);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * Transmission callback Routine of COM frames
|---------------------------------------------------------------------------
| Parameters description:
|---------------------------------------------------------------------------
| CPU requirements data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
BOOL SpiOsekComTxReqCallbackECU_Lite(void);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * Notifying transmission callback Routine of COM frames
|---------------------------------------------------------------------------
| Parameters description:
|---------------------------------------------------------------------------
| CPU requirements data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
void SpiOsekComTxNotifCallbackECU_Lite(t_com_buf_hdl bhdl);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * Initialize service of OSEK COM in the selected mode
|
| ------------------------------------------------- --------------------------
| Explanation of arguments:
| App_mode: activation model of communications.
| Result: if all goes well E_OK
| Another code (see t_status_type) if an error occurs.
|---------------------------------------------------------------------------
| Temporitzacio:
| Tmax: ?? cicles cpu | O(n): CTE 
/---------------------------------------------------------------------------*/
t_status_type SpiStartCom(t_com_application_mode_type app_mode);

/*****************************************************************************
| Portability: Generic
| ----------------------------------------------------------------------------
| Contract transactions:
| * Service inquiry mode in which communications are initialized
| COM.
| * If this service is called before initializing the communications
| Random mode will be returned.
| ---------------------------------------------------------------------------
| Explanation of arguments:
| Result: how they have been enabled communications
| (See t_com_application_mode_type)
| ---------------------------------------------------------------------------
| Timing:
| Tmax: 15 cpu cycles | O (n): CTE
/ --------------------------------------------------------------------------- */
t_com_application_mode_type SpiGetComApplicationMode(void);

/*****************************************************************************
| Portability: Generic
| ----------------------------------------------------------------------------
| Contract transactions:
| * Service stopped the activity of OSEK COM communications.
| * This service stops the transmission of messages periodically.
| * After calling this service communications can be reestablished
| Calling service StartCom. (At no time this service modifies the state
| COM driver).
| ---------------------------------------------------------------------------
| Explanation of arguments:
| App_mode: Stop mode communications.
| Result: if all goes well E_OK
| Another code (see t_status_type) if an error occurs.
| ---------------------------------------------------------------------------
| Timing:
| Tmax:? cpu cycles | O (n): CTE
/ --------------------------------------------------------------------------- */
t_status_type SpiStopCom(t_com_shutdown_mode_type shtdwn_mode);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * Initialize service transmission of periodic or mix frames.
|  * If the transmission of periodic or mix frames is initialized, this service
|    reboot the communication.
|---------------------------------------------------------------------------
| Parameters description:
|   return: 
|     E_OK in case of no errors
|     Other (see t_status_type).
|---------------------------------------------------------------------------
| CPU requirements data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
t_status_type SpiStartPeriodic(void);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * Stop service transmission of periodic or mix frames.
|  * If the transmission of periodic or mix frames is stopped, you can restart
|    it calling the StartPeriodic service.
|---------------------------------------------------------------------------
| Parameters description:
|   return: 
|     E_OK in case of no errors
|     Other (see t_status_type).
|---------------------------------------------------------------------------
| CPU requirements data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
t_status_type SpiStopPeriodic(void);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * This service updates the application signal referenced by >data_ref< with
|    the data in the internal object identified by >message<.
|  * This service will reset the class 1 and 3 flags associated to >message<
|  * If >message< is an unqueued signal the service will return the last value
|    received.
|    If >message< is a queued signal the service will return the first value
|    available in the queue or error if the queue is empty. (Mode not suported)
|  * The software engineer is resposible of granting that the parameter >data_ref< 
|    points to an address correctly allocated and compatible in size with the 
|    received signal type
|  * Usage example: 
|    t_vehicle_speed vehicle_speed;
|    (void)ReceiveMessage(SIG_VEHICLE_SPEED,&vehicle_speed); 
|---------------------------------------------------------------------------
| Parameters description:
|   message: Identification of the received signal.
|   data_ref: Pointer to the application area where to store the received signal. 
|   return: 
|     E_OK in case of no errors
|     E_COM_ID in case the parameter >message< is out of range or if it refers
|              to signal that is sent or to a dynamiclength or zero-length signal
|     E_COM_NOMSG in case the queued signal identified by >message< is empty.
|     E_COM_LIMIT in case an overflow of the signal queue identified by >message<
|                 occurred since the last call to ReceiveMessage for >message<.
|                 E_COM_LIMIT indicates that at least one message has been discarded
|                 since the message queue filled. Nevertheless the service is 
|                 performed and a message is returned. The service ReceiveMessage
|                 clears the overflow condition for >message<.
|     other (see t_status_type).
|---------------------------------------------------------------------------
| CPU resources data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
t_status_type SpiReceiveMessage(t_symbolic_name message,
                             t_application_data_ref data_ref);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * This service updates the internal signal object identified by >message<
|    with the application signal referenced by the >data_ref< parameter.
|  * This service will reset the class 2 and 4 flags associated to >message<
|  * If >message< has the Triggered Transfer Property, the update is followed
|    by immediate transmission of the I-PDU associated with the signal except
|    when the signal is packed into an I-PDU with Periodic Transmission Mode;
|    in this case, no transmission is initiated by the call to this service.
|  * If >message< has the Pending Transfer Property, no transmission is
|    caused by the update.
|  * The software engineer is resposible of granting that the parameter >data_ref< 
|    points to an address correctly allocated and compatible in size with the 
|    transmited signal type
|  * Usage example: 
|    t_vehicle_speed vehicle_speed = 20;
|    (void)SendMessage(SIG_VEHICLE_SPEED,&vehicle_speed); 
|---------------------------------------------------------------------------
| Parameters description:
|   message: Identification of the transmited signal.
|   data_ref: Pointer to the application signal where is the value to be transmited. 
|   return: 
|     E_OK in case of no errors
|     E_COM_ID is case the parameter >message< is out of range or if it refers
|              to a message that is received or to a dynamic-length or 
|              zero-length message.
|     other (see t_status_type).
|---------------------------------------------------------------------------
| CPU requirements data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
#define OSEK_SPISENDMESSAGE
t_status_type SpiSendMessage(t_symbolic_name message,
                          t_application_data_ref data_ref);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * Initialize service message with a different value than configuration.
|  * The software engineer is responsible of garanting that the parameter 'data_ref' 
|    points to an address correctly allocated and compatible in size with the 
|    transmitted signal type.
|---------------------------------------------------------------------------
| Parameters description:
|   message: Identification of the received signal.
|   data_ref: Pointer to the application area where to store the received signal. 
|   return: 
|     E_OK in case of no errors
|     E_COM_ID if the message or signal to initialize don't exist
|     Other (see t_status_type).
|---------------------------------------------------------------------------
| CPU requirements data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
t_status_type SpiInitMessage(t_symbolic_name message,
                          t_application_data_ref data_ref);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * Consult service for the flag of COM traffic.
|---------------------------------------------------------------------------
| Parameters description:
|   return: 
|     COM_FALSE if the flag is down
|     COM_TRUE  if the flag is up
|---------------------------------------------------------------------------
| CPU requirements data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
t_flag_value SpiReadFlagComTrafficECU_Lite(void);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * Reset service for the flag of COM traffic.
|---------------------------------------------------------------------------
| Parameters description:
|---------------------------------------------------------------------------
| CPU requirements data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
void SpiResetFlagComTrafficECU_Lite(void);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * Consult service for the notify Rx Rx_Error Tx Tx_Error
|---------------------------------------------------------------------------
| Parameters description:
|   message: Identification of the signal flag.
|   return: 
|     COM_FALSE if the flag is down
|     COM_TRUE  if the flag is up
|---------------------------------------------------------------------------
| CPU requirements data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
t_flag_value SpiReadFlagRxSig(t_symbolic_name message);
t_flag_value SpiReadFlagRxSigDIE1_M0_ALPHA(void);
t_flag_value SpiReadFlagRxSigDIE1_M0_VG(void);
t_flag_value SpiReadFlagRxSigDIE1_M0_DIAG(void);
t_flag_value SpiReadFlagRxSigDIE1_M1_ALPHA(void);
t_flag_value SpiReadFlagRxSigDIE1_M1_BETA(void);
t_flag_value SpiReadFlagRxSigDIE1_M1_DIAG(void);
t_flag_value SpiReadFlagRxSigDIE1_M1_VG(void);
t_flag_value SpiReadFlagRxSigDIE1_M4_DATA_AT_ADD0(void);
t_flag_value SpiReadFlagRxSigDIE1_M4_DATA_AT_ADD1(void);
t_flag_value SpiReadFlagRxSigDIE1_M8_KEY_ECHO(void);
t_flag_value SpiReadFlagRxSigDIE1_M8_INVERTED_KEY_ECHO(void);
t_flag_value SpiReadFlagRxSigDIE2_M0_ALPHA(void);
t_flag_value SpiReadFlagRxSigDIE2_M0_DIAG(void);
t_flag_value SpiReadFlagRxSigDIE2_M0_VG(void);
t_flag_value SpiReadFlagRxSigDIE2_M1_ALPHA(void);
t_flag_value SpiReadFlagRxSigDIE2_M1_BETA(void);
t_flag_value SpiReadFlagRxSigDIE2_M1_DIAG(void);
t_flag_value SpiReadFlagRxSigDIE2_M1_VG(void);
t_flag_value SpiReadFlagRxSigDIE2_M4_DATA_AT_ADD0(void);
t_flag_value SpiReadFlagRxSigDIE2_M4_DATA_AT_ADD1(void);
t_flag_value SpiReadFlagRxSigDIE2_M8_KEY_ECHO(void);
t_flag_value SpiReadFlagRxSigDIE2_M8_INVERTED_KEY_ECHO(void);
t_flag_value SpiReadFlagRxErrorSig(t_symbolic_name message);
t_flag_value SpiReadFlagRxErrorSigDIE1_M0_ALPHA(void);
t_flag_value SpiReadFlagRxErrorSigDIE1_M4_DATA_AT_ADD0(void);
t_flag_value SpiReadFlagRxErrorSigDIE2_M0_ALPHA(void);
t_flag_value SpiReadFlagTxSig(t_symbolic_name message);
t_flag_value SpiReadFlagTxSigMASTER_M0_RST_DIE1(void);
t_flag_value SpiReadFlagTxSigMASTER_M0_TIMEOUT_VALUE_DIE1(void);
t_flag_value SpiReadFlagTxSigMASTER_M7_KEY_DIE1(void);
t_flag_value SpiReadFlagTxSigMASTER_M3_ADD0_DIE1(void);
t_flag_value SpiReadFlagTxSigMASTER_M3_ADD1_DIE1(void);
t_flag_value SpiReadFlagTxSigMASTER_M0_RST_DIE2(void);
t_flag_value SpiReadFlagTxSigMASTER_M0_TIMEOUT_VALUE_DIE2(void);
t_flag_value SpiReadFlagTxSigMASTER_M3_ADD0_DIE2(void);
t_flag_value SpiReadFlagTxSigMASTER_M3_ADD1_DIE2(void);
t_flag_value SpiReadFlagTxSigMASTER_M7_KEY_DIE2(void);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * Reset service for the notify Rx Rx_Error Tx Tx_Error
|---------------------------------------------------------------------------
| Parameters description:
|   message: Identification of the signal flag.
|---------------------------------------------------------------------------
| CPU requirements data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
void SpiResetFlagRxSig(t_symbolic_name message);
void SpiResetFlagRxSigDIE1_M0_ALPHA(void);
void SpiResetFlagRxSigDIE1_M0_VG(void);
void SpiResetFlagRxSigDIE1_M0_DIAG(void);
void SpiResetFlagRxSigDIE1_M1_ALPHA(void);
void SpiResetFlagRxSigDIE1_M1_BETA(void);
void SpiResetFlagRxSigDIE1_M1_DIAG(void);
void SpiResetFlagRxSigDIE1_M1_VG(void);
void SpiResetFlagRxSigDIE1_M4_DATA_AT_ADD0(void);
void SpiResetFlagRxSigDIE1_M4_DATA_AT_ADD1(void);
void SpiResetFlagRxSigDIE1_M8_KEY_ECHO(void);
void SpiResetFlagRxSigDIE1_M8_INVERTED_KEY_ECHO(void);
void SpiResetFlagRxSigDIE2_M0_ALPHA(void);
void SpiResetFlagRxSigDIE2_M0_DIAG(void);
void SpiResetFlagRxSigDIE2_M0_VG(void);
void SpiResetFlagRxSigDIE2_M1_ALPHA(void);
void SpiResetFlagRxSigDIE2_M1_BETA(void);
void SpiResetFlagRxSigDIE2_M1_DIAG(void);
void SpiResetFlagRxSigDIE2_M1_VG(void);
void SpiResetFlagRxSigDIE2_M4_DATA_AT_ADD0(void);
void SpiResetFlagRxSigDIE2_M4_DATA_AT_ADD1(void);
void SpiResetFlagRxSigDIE2_M8_KEY_ECHO(void);
void SpiResetFlagRxSigDIE2_M8_INVERTED_KEY_ECHO(void);
void SpiResetFlagRxErrorSig(t_symbolic_name message);
void SpiResetFlagRxErrorSigDIE1_M0_ALPHA(void);
void SpiResetFlagRxErrorSigDIE1_M4_DATA_AT_ADD0(void);
void SpiResetFlagRxErrorSigDIE2_M0_ALPHA(void);
void SpiResetFlagTxSig(t_symbolic_name message);
void SpiResetFlagTxSigMASTER_M0_RST_DIE1(void);
void SpiResetFlagTxSigMASTER_M0_TIMEOUT_VALUE_DIE1(void);
void SpiResetFlagTxSigMASTER_M7_KEY_DIE1(void);
void SpiResetFlagTxSigMASTER_M3_ADD0_DIE1(void);
void SpiResetFlagTxSigMASTER_M3_ADD1_DIE1(void);
void SpiResetFlagTxSigMASTER_M0_RST_DIE2(void);
void SpiResetFlagTxSigMASTER_M0_TIMEOUT_VALUE_DIE2(void);
void SpiResetFlagTxSigMASTER_M3_ADD0_DIE2(void);
void SpiResetFlagTxSigMASTER_M3_ADD1_DIE2(void);
void SpiResetFlagTxSigMASTER_M7_KEY_DIE2(void);

/*****************************************************************************
| Portability:  Target platform independent
|----------------------------------------------------------------------------
| Routine specification:
|  * Main task of OSEK/COM that must be called periodically in
|    the main loop of the program.
|---------------------------------------------------------------------------
| Parameters description:
|---------------------------------------------------------------------------
| CPU requirements data:
| Tmax: ?? cpu cycles | O(n): CTE 
/---------------------------------------------------------------------------*/
void SpiOsekComTask(void);

#endif

