Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
nmtMaster.c
00001 /* 00002 This file is part of CanFestival, a library implementing CanOpen 00003 Stack. 00004 00005 Copyright (C): Edouard TISSERANT and Francis DUPIN 00006 00007 See COPYING file for copyrights details. 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with this library; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00022 USA 00023 */ 00024 /*! 00025 ** @file nmtMaster.c 00026 ** @author Edouard TISSERANT and Francis DUPIN 00027 ** @date Tue Jun 5 08:47:18 2007 00028 ** 00029 ** @brief 00030 ** 00031 ** 00032 */ 00033 #include "nmtMaster.h" 00034 #include "canfestival.h" 00035 #include "sysdep.h" 00036 00037 /*! 00038 ** 00039 ** 00040 ** @param d 00041 ** @param Node_ID 00042 ** @param cs 00043 ** 00044 ** @return 00045 **/ 00046 UNS8 masterSendNMTstateChange(CO_Data* d, UNS8 Node_ID, UNS8 cs) 00047 { 00048 Message m; 00049 00050 MSG_WAR(0x3501, "Send_NMT cs : ", cs); 00051 MSG_WAR(0x3502, " to node : ", Node_ID); 00052 /* message configuration */ 00053 m.cob_id = 0x0000; /*(NMT) << 7*/ 00054 m.rtr = NOT_A_REQUEST; 00055 m.len = 2; 00056 m.data[0] = cs; 00057 m.data[1] = Node_ID; 00058 00059 return canSend(d->canHandle,&m); 00060 } 00061 00062 00063 /*! 00064 ** 00065 ** 00066 ** @param d 00067 ** @param nodeId 00068 ** 00069 ** @return 00070 **/ 00071 UNS8 masterSendNMTnodeguard(CO_Data* d, UNS8 nodeId) 00072 { 00073 Message m; 00074 00075 /* message configuration */ 00076 UNS16 tmp = nodeId | (NODE_GUARD << 7); 00077 m.cob_id = UNS16_LE(tmp); 00078 m.rtr = REQUEST; 00079 m.len = 0; 00080 00081 MSG_WAR(0x3503, "Send_NODE_GUARD to node : ", nodeId); 00082 00083 return canSend(d->canHandle,&m); 00084 } 00085 00086 /*! 00087 ** 00088 ** 00089 ** @param d 00090 ** @param nodeId 00091 ** 00092 ** @return 00093 **/ 00094 UNS8 masterRequestNodeState(CO_Data* d, UNS8 nodeId) 00095 { 00096 /* FIXME: should warn for bad toggle bit. */ 00097 00098 /* NMTable configuration to indicate that the master is waiting 00099 for a Node_Guard frame from the slave whose node_id is ID 00100 */ 00101 d->NMTable[nodeId] = Unknown_state; /* A state that does not exist 00102 */ 00103 00104 if (nodeId == 0) { /* NMT broadcast */ 00105 UNS8 i = 0; 00106 for (i = 0 ; i < NMT_MAX_NODE_ID ; i++) { 00107 d->NMTable[i] = Unknown_state; 00108 } 00109 } 00110 return masterSendNMTnodeguard(d,nodeId); 00111 } 00112
Generated on Tue Jul 12 2022 17:11:51 by
1.7.2