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
20 /** @req NM117.partially */
\r
21 #include "Std_Types.h"
\r
22 #include "ComStack_Types.h"
\r
23 #include "NmStack_Types.h"
\r
24 #include "Nm_ConfigTypes.h"
\r
25 #include "ComM_Nm.h"
\r
27 #define NM_AR_MAJOR_VERSION 1
\r
28 #define NM_AR_MINOR_VERSION 0
\r
29 #define NM_AR_PATCH_VERSION 1
\r
31 #define NM_SW_MAJOR_VERSION 1
\r
32 #define NM_SW_MINOR_VERSION 0
\r
33 #define NM_SW_PATCH_VERSION 0
\r
37 /** Initializes the NM Interface. */
\r
39 void Nm_Init( const Nm_ConfigType * const nmConfigPtr );
\r
41 /** This service returns the version information of this module */
\r
43 void Nm_GetVersionInfo( Std_VersionInfoType* nmVerInfoPtr );
\r
45 /** This function calls the <BusNm>_PassiveStartUp function
\r
46 * (e.g. CanNm_PassiveStartUp function is called if channel is configured as CAN). */
\r
48 Nm_ReturnType Nm_PassiveStartUp( const NetworkHandleType NetworkHandle );
\r
50 /** This function calls the <BusNm>_NetworkRequest
\r
51 * (e.g. CanNm_NetworkRequest function is called if channel is configured as CAN). */
\r
53 Nm_ReturnType Nm_NetworkRequest( const NetworkHandleType NetworkHandle );
\r
55 /** This function calls the <BusNm>_NetworkRelease bus specific function
\r
56 * (e.g. CanNm_NetworkRelease function is called if channel is configured as CAN). */
\r
58 Nm_ReturnType Nm_NetworkRelease( const NetworkHandleType NetworkHandle );
\r
60 /** This function calls the CanNm_NetworkRelease bus specific function, to disable
\r
61 * the NM PDU transmission ability due to a ISO14229 Communication Control (28hex) service */
\r
63 Nm_ReturnType Nm_DisableCommunication( const NetworkHandleType NetworkHandle );
\r
65 /** This function calls the CanNm_NetworkRequest bus specific function, to enable
\r
66 * the NM PDU transmission ability due to a ISO14229 Communication Control (28hex) service */
\r
68 Nm_ReturnType Nm_EnableCommunication( const NetworkHandleType NetworkHandle );
\r
70 /** Set user data for NM messages transmitted next on the bus.
\r
71 * For that purpose <BusNm>_SetUserData shall be called
\r
72 * (e.g. CanNm_SetUserData function is called if channel is configured as CAN). */
\r
74 Nm_ReturnType Nm_SetUserData( const NetworkHandleType NetworkHandle, const uint8 * const nmUserDataPtr );
\r
76 /** Get user data out of the last successfully received NM message.
\r
77 * For that purpose <BusNm>_GetUserData shall be called
\r
78 * (e.g. CanNm_GetUserData function is called if channel is configured as CAN). */
\r
80 Nm_ReturnType Nm_GetUserData( const NetworkHandleType NetworkHandle, uint8 * const nmUserDataPtr, uint8 * const nmNodeIdPtr );
\r
82 /** Get the whole PDU data out of the most recently received NM message.
\r
83 * For that purpose CanNm_GetPduData shall be called. */
\r
85 Nm_ReturnType Nm_GetPduData( const NetworkHandleType NetworkHandle, uint8 * const nmPduData );
\r
87 /** Set Repeat Message Request Bit for NM messages transmitted next on the bus.
\r
88 * For that purpose <BusNm>_RepeatMessageRequest shall be called
\r
89 * (e.g. CanNm_RepeatMessageRequest function is called if channel is configured as CAN) */
\r
91 Nm_ReturnType Nm_RepeatMessageRequest( const NetworkHandleType NetworkHandle );
\r
93 /** Get node identifier out of the last successfully received NM-message.
\r
94 * The function <BusNm>_GetNodeIdentifier shall be called. */
\r
96 Nm_ReturnType Nm_GetNodeIdentifier( const NetworkHandleType NetworkHandle, uint8 * const nmNodeIdPtr );
\r
98 /** Get node identifier configured for the local node.
\r
99 * For that purpose <BusNm>_GetLocalNodeIdentifier shall be called
\r
100 * (e.g. CanNm_GetLocalNodeIdentifier function is called if channel is configured as CAN). */
\r
102 Nm_ReturnType Nm_GetLocalNodeIdentifier( const NetworkHandleType NetworkHandle, uint8 * const nmNodeIdPtr );
\r
104 /** Check if remote sleep indication takes place or not. This in turn calls the
\r
105 * <BusNm>_CheckRemoteSleepIndication for the bus specific NM layer
\r
106 * (e.g. CanNm_CheckRemoteSleepIndication function is called if channel is configured as CAN). */
\r
108 Nm_ReturnType Nm_CheckRemoteSleepIndication( const NetworkHandleType nmNetworkHandle, boolean * const nmRemoteSleepIndPtr );
\r
110 /** Returns the state of the network management. This function in turn calls the
\r
111 * <BusNm>_GetState function (e.g. CanNm_GetState function is called if channel is configured as CAN). */
\r
113 Nm_ReturnType Nm_GetState( const NetworkHandleType nmNetworkHandle, Nm_StateType* const nmStatePtr, Nm_ModeType* const nmModePtr );
\r
115 /** Notification that a NM-message has been received in the Bus-Sleep Mode, what
\r
116 * indicates that some nodes in the network have already entered the Network Mode.
\r
117 * The callback function shall start the network management state machine. */
\r
119 void Nm_NetworkStartIndication( const NetworkHandleType nmNetworkHandle );
\r
121 /** Notification that the network management has entered Network Mode. The
\r
122 * callback function shall enable transmission of application messages. */
\r
124 void Nm_NetworkMode( const NetworkHandleType nmNetworkHandle );
\r
126 /** Notification that the network management has entered Prepare Bus-Sleep Mode.
\r
127 * The callback function shall disable transmission of application messages. */
\r
129 void Nm_PrepareBusSleepMode( const NetworkHandleType nmNetworkHandle );
\r
131 /** Notification that the network management has entered Bus-Sleep Mode. */
\r
133 void Nm_BusSleepMode( const NetworkHandleType nmNetworkHandle );
\r
135 /** Notification that a NM message has been received. */
\r
137 void Nm_PduRxIndication( const NetworkHandleType nmNetworkHandle );
\r
139 /** Notification that the CAN Generic NM state has changed. */
\r
141 void Nm_StateChangeNotification(
\r
142 const NetworkHandleType nmNetworkHandle,
\r
143 const Nm_StateType nmPreviousState,
\r
144 const Nm_StateType nmCurrentState );
\r
146 /** This function implements the processes of the NM Interface, which need a fix
\r
147 * cyclic scheduling. This function is supplied for the NM coordinator functionality
\r
148 * (Nm020). However, specific implementation may not need it (Nm093) */
\r
150 void Nm_MainFunction(void);
\r