1 /* -------------------------------- Arctic Core ------------------------------
\r
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
\r
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
\r
6 * This source code is free software; you can redistribute it and/or modify it
\r
7 * under the terms of the GNU General Public License version 2 as published by the
\r
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
\r
10 * This program is distributed in the hope that it will be useful, but
\r
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
\r
14 * -------------------------------- Arctic Core ------------------------------*/
\r
16 /** @req CANSM008 */
\r
21 #include "ComStack_Types.h" /**< @req CANSM238 */
\r
23 #include "CanSM_ConfigTypes.h"
\r
24 #include "Modules.h"
\r
26 #define CANSM_VENDOR_ID 1
\r
27 #define CANSM_MODULE_ID MODULE_ID_CANSM
\r
29 #define CANSM_AR_MAJOR_VERSION 1
\r
30 #define CANSM_AR_MINOR_VERSION 0
\r
31 #define CANSM_AR_PATCH_VERSION 1
\r
33 #define CANSM_SW_MAJOR_VERSION 1
\r
34 #define CANSM_SW_MINOR_VERSION 0
\r
35 #define CANSM_SW_PATCH_VERSION 0
\r
37 #include "CanSM_Cfg.h" /**< @req CANSM239 @req CANSM025.configuration */
\r
40 #define CANSM_E_UNINIT 0x01 /**< API service used without module initialization */
\r
41 #define CANSM_E_PARAM_POINTER 0x02 /**< API service called with wrong pointer */
\r
42 #define CANSM_E_INVALID_NETWORK_HANDLE 0x03 /**< API service called with wrong parameter */
\r
43 #define CANSM_E_INVALID_NETWORK_MODE 0x04 /**< API service called with wrong parameter */
\r
46 #define CANSM_SERVICEID_INIT 0x00
\r
47 #define CANSM_SERVICEID_GETVERSIONINFO 0x01
\r
48 #define CANSM_SERVICEID_REQUESTCOMMODE 0x02
\r
49 #define CANSM_SERVICEID_GETCURRENTCOMMODE 0x03
\r
50 #define CANSM_SERVICEID_CONTROLLERBUSOFF 0x04
\r
51 #define CANSM_SERVICEID_MAINFUNCTION 0x05
\r
54 /** This type shall define the states of the network mode state machine. */
\r
57 CANSM_NO_COMMUNICATION,
\r
58 CANSM_SILENT_COMMUNICATION,
\r
59 CANSM_FULL_COMMUNICATION
\r
60 } CanSM_NetworkModeStateType;
\r
62 /** This type shall define the states of the bus-off recovery state machine. */
\r
64 CANSM_BOR_IDLE, /**< Idle state */
\r
65 CANSM_BOR_CHECK, /**< Initial bus-off check at beginning of full-communication */
\r
66 CANSM_BOR_NO_BUS_OFF, /**< Regular state during full-communication without detected bus-off events */
\r
67 CANSM_BOR_TXOFF_L1, /**< Bus-off recovery level 1 state, TX disabled */
\r
68 CANSM_BOR_CHECK_L1, /**< Bus-off recovery level 1 state, TX enabled again */
\r
69 CANSM_BOR_TXOFF_L2, /**< Bus-off recovery level 2 state, TX disabled */
\r
70 CANSM_BOR_CHECK_L2 /**< Bus-off recovery level 2 state, TX enabled again */
\r
71 } CanSM_BusOffRecoveryStateType; /** @req CANSM169 */
\r
73 /** @req CANSM037 */
\r
75 /** This service initializes the CanSM module */
\r
76 /** @req CANSM023 */
\r
77 void CanSM_Init( const CanSM_ConfigType* ConfigPtr );
\r
79 /** This service puts out the version information of this module */
\r
80 /** @req CANSM024 @req CANSM180 */
\r
81 #if (CANSM_VERSION_INFO_API == STD_ON)
\r
82 #define CanSM_GetVersionInfo(_vi) STD_GET_VERSION_INFO(_vi,CANSM)
\r
85 /** This service shall change the communication mode of a CAN network to the requested one. */
\r
86 /** @req CANSM062 */
\r
87 Std_ReturnType CanSM_RequestComMode( NetworkHandleType NetworkHandle, ComM_ModeType ComM_Mode );
\r
89 /** This service shall put out the current communication mode of a CAN network. */
\r
90 /** @req CANSM063 */
\r
91 Std_ReturnType CanSM_GetCurrentComMode( NetworkHandleType NetworkHandle, ComM_ModeType* ComM_ModePtr );
\r
94 /** Scheduled function of the CanSM */
\r
95 /** @req CANSM065 */
\r
96 void CanSM_MainFunction(void);
\r
102 #endif /* CANSM_H_ */
\r