Sam Grove
/
canopen_slavenode
CANfestival - an open source CANopen framework
framework/include/nmtMaster.h@6:bc64031ac849, 2012-09-26 (annotated)
- Committer:
- sam_grove
- Date:
- Wed Sep 26 05:43:05 2012 +0000
- Revision:
- 6:bc64031ac849
- Parent:
- 0:6219434a0cb5
Change a typecast in can_mbed.cpp from unit8_t * to char * to fit the CANMessage constructor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove |
0:6219434a0cb5 | 1 | /* |
sam_grove |
0:6219434a0cb5 | 2 | This file is part of CanFestival, a library implementing CanOpen Stack. |
sam_grove |
0:6219434a0cb5 | 3 | |
sam_grove |
0:6219434a0cb5 | 4 | Copyright (C): Edouard TISSERANT and Francis DUPIN |
sam_grove |
0:6219434a0cb5 | 5 | |
sam_grove |
0:6219434a0cb5 | 6 | See COPYING file for copyrights details. |
sam_grove |
0:6219434a0cb5 | 7 | |
sam_grove |
0:6219434a0cb5 | 8 | This library is free software; you can redistribute it and/or |
sam_grove |
0:6219434a0cb5 | 9 | modify it under the terms of the GNU Lesser General Public |
sam_grove |
0:6219434a0cb5 | 10 | License as published by the Free Software Foundation; either |
sam_grove |
0:6219434a0cb5 | 11 | version 2.1 of the License, or (at your option) any later version. |
sam_grove |
0:6219434a0cb5 | 12 | |
sam_grove |
0:6219434a0cb5 | 13 | This library is distributed in the hope that it will be useful, |
sam_grove |
0:6219434a0cb5 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
sam_grove |
0:6219434a0cb5 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
sam_grove |
0:6219434a0cb5 | 16 | Lesser General Public License for more details. |
sam_grove |
0:6219434a0cb5 | 17 | |
sam_grove |
0:6219434a0cb5 | 18 | You should have received a copy of the GNU Lesser General Public |
sam_grove |
0:6219434a0cb5 | 19 | License along with this library; if not, write to the Free Software |
sam_grove |
0:6219434a0cb5 | 20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
sam_grove |
0:6219434a0cb5 | 21 | */ |
sam_grove |
0:6219434a0cb5 | 22 | |
sam_grove |
0:6219434a0cb5 | 23 | /** @defgroup networkmanagement Network Management |
sam_grove |
0:6219434a0cb5 | 24 | * @ingroup userapi |
sam_grove |
0:6219434a0cb5 | 25 | */ |
sam_grove |
0:6219434a0cb5 | 26 | /** @defgroup nmtmaster NMT Master |
sam_grove |
0:6219434a0cb5 | 27 | * @brief NMT master provides mechanisms that control and monitor the state of nodes and their behavior in the network. |
sam_grove |
0:6219434a0cb5 | 28 | * @ingroup networkmanagement |
sam_grove |
0:6219434a0cb5 | 29 | */ |
sam_grove |
0:6219434a0cb5 | 30 | |
sam_grove |
0:6219434a0cb5 | 31 | #ifndef __nmtMaster_h__ |
sam_grove |
0:6219434a0cb5 | 32 | #define __nmtMaster_h__ |
sam_grove |
0:6219434a0cb5 | 33 | |
sam_grove |
0:6219434a0cb5 | 34 | #include "data.h" |
sam_grove |
0:6219434a0cb5 | 35 | |
sam_grove |
0:6219434a0cb5 | 36 | #ifdef __cplusplus |
sam_grove |
0:6219434a0cb5 | 37 | extern "C"{ |
sam_grove |
0:6219434a0cb5 | 38 | #endif |
sam_grove |
0:6219434a0cb5 | 39 | |
sam_grove |
0:6219434a0cb5 | 40 | /** |
sam_grove |
0:6219434a0cb5 | 41 | * @ingroup nmtmaster |
sam_grove |
0:6219434a0cb5 | 42 | * @brief Transmit a NMT message on the network to the slave whose nodeId is node ID. |
sam_grove |
0:6219434a0cb5 | 43 | * |
sam_grove |
0:6219434a0cb5 | 44 | * @param *d Pointer to a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 45 | * @param nodeId Id of the slave node |
sam_grove |
0:6219434a0cb5 | 46 | * @param cs The order of state changement \n\n |
sam_grove |
0:6219434a0cb5 | 47 | * |
sam_grove |
0:6219434a0cb5 | 48 | * Allowed states : |
sam_grove |
0:6219434a0cb5 | 49 | * - cs = NMT_Start_Node // Put the node in operational mode |
sam_grove |
0:6219434a0cb5 | 50 | * - cs = NMT_Stop_Node // Put the node in stopped mode |
sam_grove |
0:6219434a0cb5 | 51 | * - cs = NMT_Enter_PreOperational // Put the node in pre_operational mode |
sam_grove |
0:6219434a0cb5 | 52 | * - cs = NMT_Reset_Node // Put the node in initialization mode |
sam_grove |
0:6219434a0cb5 | 53 | * - cs = NMT_Reset_Comunication // Put the node in initialization mode |
sam_grove |
0:6219434a0cb5 | 54 | * |
sam_grove |
0:6219434a0cb5 | 55 | * The mode is changed according to the slave state machine mode : |
sam_grove |
0:6219434a0cb5 | 56 | * - initialisation ---> pre-operational (Automatic transition) |
sam_grove |
0:6219434a0cb5 | 57 | * - pre-operational <--> operational |
sam_grove |
0:6219434a0cb5 | 58 | * - pre-operational <--> stopped |
sam_grove |
0:6219434a0cb5 | 59 | * - pre-operational, operational, stopped -> initialisation |
sam_grove |
0:6219434a0cb5 | 60 | * \n\n |
sam_grove |
0:6219434a0cb5 | 61 | * @return errorcode |
sam_grove |
0:6219434a0cb5 | 62 | * - 0 if the NMT message was send |
sam_grove |
0:6219434a0cb5 | 63 | * - 1 if an error occurs |
sam_grove |
0:6219434a0cb5 | 64 | */ |
sam_grove |
0:6219434a0cb5 | 65 | UNS8 masterSendNMTstateChange (CO_Data* d, UNS8 nodeId, UNS8 cs); |
sam_grove |
0:6219434a0cb5 | 66 | |
sam_grove |
0:6219434a0cb5 | 67 | /** |
sam_grove |
0:6219434a0cb5 | 68 | * @ingroup nmtmaster |
sam_grove |
0:6219434a0cb5 | 69 | * @brief Transmit a NodeGuard message on the network to the slave whose nodeId is node ID |
sam_grove |
0:6219434a0cb5 | 70 | * |
sam_grove |
0:6219434a0cb5 | 71 | * @param *d Pointer to a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 72 | * @param nodeId Id of the slave node |
sam_grove |
0:6219434a0cb5 | 73 | * @return |
sam_grove |
0:6219434a0cb5 | 74 | * - 0 is returned if the NodeGuard message was send. |
sam_grove |
0:6219434a0cb5 | 75 | * - 1 is returned if an error occurs. |
sam_grove |
0:6219434a0cb5 | 76 | */ |
sam_grove |
0:6219434a0cb5 | 77 | UNS8 masterSendNMTnodeguard (CO_Data* d, UNS8 nodeId); |
sam_grove |
0:6219434a0cb5 | 78 | |
sam_grove |
0:6219434a0cb5 | 79 | /** |
sam_grove |
0:6219434a0cb5 | 80 | * @ingroup nmtmaster |
sam_grove |
0:6219434a0cb5 | 81 | * @brief Ask the state of the slave node whose nodeId is node Id. |
sam_grove |
0:6219434a0cb5 | 82 | * |
sam_grove |
0:6219434a0cb5 | 83 | * To ask states of all nodes on the network (NMT broadcast), nodeId must be equal to 0 |
sam_grove |
0:6219434a0cb5 | 84 | * @param *d Pointer to a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 85 | * @param nodeId Id of the slave node |
sam_grove |
0:6219434a0cb5 | 86 | */ |
sam_grove |
0:6219434a0cb5 | 87 | UNS8 masterRequestNodeState (CO_Data* d, UNS8 nodeId); |
sam_grove |
0:6219434a0cb5 | 88 | |
sam_grove |
0:6219434a0cb5 | 89 | #ifdef __cplusplus |
sam_grove |
0:6219434a0cb5 | 90 | } |
sam_grove |
0:6219434a0cb5 | 91 | #endif |
sam_grove |
0:6219434a0cb5 | 92 | |
sam_grove |
0:6219434a0cb5 | 93 | #endif /* __nmtMaster_h__ */ |