nico@207: nico@207:
nico@207: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 nico@207: 00024 #ifndef __def_h__ nico@207: 00025 #define __def_h__ nico@207: 00026 nico@207: 00027 #include "config.h" nico@207: 00028 nico@207: 00031 #define OD_SUCCESSFUL 0x00000000 nico@207: 00032 #define OD_READ_NOT_ALLOWED 0x06010001 nico@207: 00033 #define OD_WRITE_NOT_ALLOWED 0x06010002 nico@207: 00034 #define OD_NO_SUCH_OBJECT 0x06020000 nico@207: 00035 #define OD_NOT_MAPPABLE 0x06040041 nico@207: 00036 #define OD_LENGTH_DATA_INVALID 0x06070010 nico@207: 00037 #define OD_NO_SUCH_SUBINDEX 0x06090011 nico@207: 00038 #define OD_VALUE_TOO_LOW 0x06090031 /* Value range test result */ nico@207: 00039 #define OD_VALUE_TOO_HIGH 0x06090032 /* Value range test result */ nico@207: 00040 /* Others SDO abort codes nico@207: 00041 */ nico@207: 00042 #define SDOABT_TOGGLE_NOT_ALTERNED 0x05030000 nico@207: 00043 #define SDOABT_TIMED_OUT 0x05040000 nico@207: 00044 #define SDOABT_OUT_OF_MEMORY 0x05040005 /* Size data exceed SDO_MAX_LENGTH_TRANSFERT */ nico@207: 00045 #define SDOABT_GENERAL_ERROR 0x08000000 /* Error size of SDO message */ nico@207: 00046 #define SDOABT_LOCAL_CTRL_ERROR 0x08000021 nico@207: 00047 nico@207: 00048 /******************** CONSTANTS ****************/ nico@207: 00049 nico@207: 00053 /* Should not be modified */ nico@207: 00054 #define REQUEST 1 nico@207: 00055 #define NOT_A_REQUEST 0 nico@207: 00056 nico@207: 00057 /* Misc constants */ nico@207: 00058 /* -------------- */ nico@207: 00059 /* Should not be modified */ nico@207: 00060 #define Rx 0 nico@207: 00061 #define Tx 1 nico@207: 00062 #define TRUE 1 nico@207: 00063 #define FALSE 0 nico@207: 00064 nico@207: 00065 /* TODO: remove this limitation. do bit granularity mapping */ nico@207: 00066 #define PDO_MAX_LEN 8 nico@207: 00067 nico@207: 00070 #define SDO_RESET 0x0 /* Transmission not started. Init state. */ nico@207: 00071 #define SDO_FINISHED 0x1 /* data are available */ nico@207: 00072 #define SDO_ABORTED_RCV 0x80 /* Received an abort message. Data not available */ nico@207: 00073 #define SDO_ABORTED_INTERNAL 0x85 /* Aborted but not because of an abort message. */ nico@207: 00074 #define SDO_DOWNLOAD_IN_PROGRESS 0x2 nico@207: 00075 #define SDO_UPLOAD_IN_PROGRESS 0x3 nico@207: 00076 nico@207: 00077 /* Status of the node during the SDO transfert : */ nico@207: 00078 #define SDO_SERVER 0x1 nico@207: 00079 #define SDO_CLIENT 0x2 nico@207: 00080 #define SDO_UNKNOWN 0x3 nico@207: 00081 nico@207: 00082 /* Function Codes nico@207: 00083 --------------- nico@207: 00084 defined in the canopen DS301 nico@207: 00085 */ nico@207: 00086 #define NMT 0x0 nico@207: 00087 #define SYNC 0x1 nico@207: 00088 #define TIME_STAMP 0x2 nico@207: 00089 #define PDO1tx 0x3 nico@207: 00090 #define PDO1rx 0x4 nico@207: 00091 #define PDO2tx 0x5 nico@207: 00092 #define PDO2rx 0x6 nico@207: 00093 #define PDO3tx 0x7 nico@207: 00094 #define PDO3rx 0x8 nico@207: 00095 #define PDO4tx 0x9 nico@207: 00096 #define PDO4rx 0xA nico@207: 00097 #define SDOtx 0xB nico@207: 00098 #define SDOrx 0xC nico@207: 00099 #define NODE_GUARD 0xE nico@207: 00100 nico@207: 00101 /* NMT Command Specifier, sent by master to change a slave state */ nico@207: 00102 /* ------------------------------------------------------------- */ nico@207: 00103 /* Should not be modified */ nico@207: 00104 #define NMT_Start_Node 0x01 nico@207: 00105 #define NMT_Stop_Node 0x02 nico@207: 00106 #define NMT_Enter_PreOperational 0x80 nico@207: 00107 #define NMT_Reset_Node 0x81 nico@207: 00108 #define NMT_Reset_Comunication 0x82 nico@207: 00109 nico@207: 00110 /* constantes used in the different state machines */ nico@207: 00111 /* ----------------------------------------------- */ nico@207: 00112 /* Must not be modified */ nico@207: 00113 #define state1 0x01 nico@207: 00114 #define state2 0x02 nico@207: 00115 #define state3 0x03 nico@207: 00116 #define state4 0x04 nico@207: 00117 #define state5 0x05 nico@207: 00118 #define state6 0x06 nico@207: 00119 #define state7 0x07 nico@207: 00120 #define state8 0x08 nico@207: 00121 #define state9 0x09 nico@207: 00122 #define state10 0x0A nico@207: 00123 #define state11 0x0B nico@207: 00124 nico@207: 00125 #endif /* __def_h__ */ nico@207: 00126 nico@207: