etisserant@0: /* etisserant@0: This file is part of CanFestival, a library implementing CanOpen Stack. etisserant@0: etisserant@0: Copyright (C): Edouard TISSERANT and Francis DUPIN etisserant@0: etisserant@0: See COPYING file for copyrights details. etisserant@0: etisserant@0: This library is free software; you can redistribute it and/or etisserant@0: modify it under the terms of the GNU Lesser General Public etisserant@0: License as published by the Free Software Foundation; either etisserant@0: version 2.1 of the License, or (at your option) any later version. etisserant@0: etisserant@0: This library is distributed in the hope that it will be useful, etisserant@0: but WITHOUT ANY WARRANTY; without even the implied warranty of etisserant@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU etisserant@0: Lesser General Public License for more details. etisserant@0: etisserant@0: You should have received a copy of the GNU Lesser General Public etisserant@0: License along with this library; if not, write to the Free Software etisserant@0: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA etisserant@0: */ etisserant@0: greg@528: /** @defgroup networkmanagement Network Management greg@528: * @ingroup userapi greg@528: */ greg@528: /** @defgroup nmtmaster NMT Master greg@528: * @ingroup networkmanagement greg@528: */ greg@528: etisserant@0: #ifndef __nmtMaster_h__ etisserant@0: #define __nmtMaster_h__ etisserant@0: etisserant@0: #include "data.h" etisserant@0: greg@528: /** greg@528: * @ingroup nmtmaster greg@528: * @brief Transmit a NMT message on the bus number bus_id etisserant@0: * to the slave whose node_id is ID greg@528: * etisserant@0: * bus_id is hardware dependant etisserant@0: * cs represents the order of state changement: greg@528: * - cs = NMT_Start_Node // Put the node in operational mode greg@528: * - cs = NMT_Stop_Node // Put the node in stopped mode greg@528: * - cs = NMT_Enter_PreOperational // Put the node in pre_operational mode greg@528: * - cs = NMT_Reset_Node // Put the node in initialization mode greg@528: * - cs = NMT_Reset_Comunication // Put the node in initialization mode etisserant@0: * The mode is changed according to the slave state machine mode : greg@528: * - initialisation ---> pre-operational (Automatic transition) greg@528: * - pre-operational <--> operational greg@528: * - pre-operational <--> stopped greg@528: * - pre-operational, operational, stopped -> initialisation greg@528: * @param *d Pointer on a CAN object data structure greg@528: * @param Node_ID Id of the slave node greg@528: * @param cs State changement greg@528: * @return canSend(bus_id,&m) etisserant@0: */ etisserant@0: UNS8 masterSendNMTstateChange (CO_Data* d, UNS8 Node_ID, UNS8 cs); etisserant@0: greg@528: /** greg@528: * @ingroup nmtmaster greg@528: * @brief Transmit a Node_Guard message on the bus number bus_id etisserant@0: * to the slave whose node_id is nodeId greg@528: * etisserant@0: * bus_id is hardware dependant greg@528: * @param *d Pointer on a CAN object data structure greg@528: * @param nodeId Id of the slave node greg@528: * @return canSend(bus_id,&m) etisserant@0: */ etisserant@0: UNS8 masterSendNMTnodeguard (CO_Data* d, UNS8 nodeId); etisserant@0: greg@528: /** greg@528: * @ingroup nmtmaster greg@528: * @brief Prepare a Node_Guard message transmission on the bus number bus_id etisserant@0: * to the slave whose node_id is nodeId greg@528: * etisserant@0: * Put nodeId = 0 to send an NMT broadcast. etisserant@0: * This message will ask for the slave, whose node_id is nodeId, its state etisserant@0: * bus_id is hardware dependant greg@528: * @param *d Pointer on a CAN object data structure greg@528: * @param nodeId Id of the slave node etisserant@0: */ etisserant@0: void masterRequestNodeState (CO_Data* d, UNS8 nodeId); etisserant@0: etisserant@0: frdupin@71: #endif /* __nmtMaster_h__ */