00001 /*************************************************************************** 00002 init.h - description 00003 ------------------- 00004 begin : Fri May 17 2002 00005 copyright : (C) 2002 by Raphael Zulliger 00006 email : zulli@hsr.ch 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This library is Copyright (c) Raphael Zulliger <zulli@gmx.net>. * 00012 * It is licensed under the GNU Library General Public License (LGPL). * 00013 * * 00014 ***************************************************************************/ 00015 00016 00024 #ifndef __init_h__ 00025 #define __init_h__ 00026 00027 #include <def.h> 00028 00032 enum eBaudRate { b10kBit=10, b20k=20, b50k=50, b100k=100, b125k=125, b250k=250, b500k=500, b800k=800, b1M=1000 }; 00033 00037 typedef struct td_s_sInitParameter 00038 { 00041 BYTE bNodeID; 00044 WORD wBaudRateIndex; 00047 WORD wProcSpeed; 00050 BYTE bIRQ; 00053 WORD wIO; 00054 } sInitParameter; 00055 00056 00062 BYTE initConnection( sInitParameter* initParameter ); 00063 00066 void closeConnection( void ); 00067 00068 00069 // variable which holds the node-id of this device 00072 extern BYTE bDeviceNodeId; 00075 extern BYTE bStateMachineState; 00076 00077 00078 00079 // defines for the state-machine 00080 // ----------------------------- 00081 // state-change commands 00084 #define START_REMOTE_NODE 0x01 00085 00087 #define STOP_REMOTE_NODE 0x02 00088 00090 #define ENTER_PRE_OPERATIONAL_STATE 0x80 00091 00093 #define RESET_REMOTE_NODE 0x81 00094 00096 #define RESET_REMOTE_COMMUNICATION 0x82 00097 00098 // possible state machine states 00099 // values are choosen so, that they can be sent directly for 00100 // heartbeat messages... 00103 #define OPERATIONAL (BYTE)0x05 00104 00106 #define STOPPED (BYTE)0x04 00107 00109 #define PRE_OPERATIONAL (BYTE)0x7F 00110 00112 #define INITIALISATION_NODE (BYTE)0x00 00113 00115 #define INITIALISATION_COMMUNICATION (BYTE)0x10 00116 00117 #endif // __init_h__