nico@207: nico@207: nico@207: CanFestival: /home/epimerde/documents/tc11/CanFestival-3/include/states.h Source File nico@207: nico@207: nico@207: nico@207: nico@207:
nico@207:
nico@207:
nico@207:
nico@207:

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

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

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