/home/epimerde/documents/tc11/CanFestival-3/include/states.h

Go to the documentation of this file.
00001 /*
00002 This file is part of CanFestival, a library implementing CanOpen Stack. 
00003 
00004 Copyright (C): Edouard TISSERANT and Francis DUPIN
00005 
00006 See COPYING file for copyrights details.
00007 
00008 This library is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU Lesser General Public
00010 License as published by the Free Software Foundation; either
00011 version 2.1 of the License, or (at your option) any later version.
00012 
00013 This library is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 Lesser General Public License for more details.
00017 
00018 You should have received a copy of the GNU Lesser General Public
00019 License along with this library; if not, write to the Free Software
00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 */
00022 
00023 #ifndef __states_h__
00024 #define __states_h__
00025 
00026 #include <applicfg.h>
00027 
00028 /* The nodes states 
00029  * -----------------
00030  * values are choosen so, that they can be sent directly
00031  * for heartbeat messages...
00032  * Must be coded on 7 bits only
00033  * */
00034 /* Should not be modified */
00035 enum enum_nodeState {
00036   Initialisation  = 0x00, 
00037   Disconnected    = 0x01,
00038   Connecting      = 0x02,
00039   Preparing       = 0x02,
00040   Stopped         = 0x04,
00041   Operational     = 0x05,
00042   Pre_operational = 0x7F,
00043   Unknown_state   = 0x0F
00044 };
00045 
00046 typedef enum enum_nodeState e_nodeState;
00047 
00048 typedef struct
00049 {
00050         UNS8 csBoot_Up;
00051         UNS8 csSDO;
00052         UNS8 csEmergency;
00053         UNS8 csSYNC;
00054         UNS8 csHeartbeat;
00055         UNS8 csPDO;
00056 } s_state_communication;
00057 
00061 typedef void (*initialisation_t)(void);
00062 typedef void (*preOperational_t)(void);
00063 typedef void (*operational_t)(void);
00064 typedef void (*stopped_t)(void);
00065 
00066 void _initialisation(void);
00067 void _preOperational(void);
00068 void _operational(void);
00069 void _stopped(void);
00070 
00071 #include "data.h"
00072 
00073 /************************* prototypes ******************************/
00074 
00077 void canDispatch(CO_Data* d, Message *m);
00078 
00081 e_nodeState getState (CO_Data* d);
00082 
00085 UNS8 setState (CO_Data* d, e_nodeState newState);
00086 
00089 UNS8 getNodeId (CO_Data* d);
00090 
00093 void setNodeId (CO_Data* d, UNS8 nodeId);
00094 
00098 /* void initResetMode (CO_Data* d); */
00099 
00100 
00104 void initPreOperationalMode (CO_Data* d);
00105 
00106 #endif

Generated on Mon Jun 4 16:29:06 2007 for CanFestival by  doxygen 1.5.1