Sam Grove / Mbed 2 deprecated canopen_slavenode

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers def.h Source File

def.h

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 
00024 #ifndef __def_h__
00025 #define __def_h__
00026 
00027 #include "config.h"
00028 
00029 /** definitions used for object dictionary access. ie SDO Abort codes . (See DS 301 v.4.02 p.48)
00030  */
00031 #define OD_SUCCESSFUL                0x00000000
00032 #define OD_READ_NOT_ALLOWED          0x06010001
00033 #define OD_WRITE_NOT_ALLOWED         0x06010002
00034 #define OD_NO_SUCH_OBJECT            0x06020000
00035 #define OD_NOT_MAPPABLE              0x06040041
00036 #define OD_LENGTH_DATA_INVALID       0x06070010
00037 #define OD_NO_SUCH_SUBINDEX          0x06090011
00038 #define OD_VALUE_RANGE_EXCEEDED      0x06090030 /* Value range test result */
00039 #define OD_VALUE_TOO_LOW             0x06090031 /* Value range test result */
00040 #define OD_VALUE_TOO_HIGH            0x06090032 /* Value range test result */
00041 /* Others SDO abort codes 
00042  */
00043 #define SDOABT_TOGGLE_NOT_ALTERNED   0x05030000
00044 #define SDOABT_TIMED_OUT             0x05040000
00045 #define SDOABT_OUT_OF_MEMORY         0x05040005 /* Size data exceed SDO_MAX_LENGTH_TRANSFERT */
00046 #define SDOABT_GENERAL_ERROR         0x08000000 /* Error size of SDO message */
00047 #define SDOABT_LOCAL_CTRL_ERROR      0x08000021 
00048 
00049 /******************** CONSTANTS ****************/
00050 
00051 /** Constantes which permit to define if a PDO frame
00052    is a request one or a data one
00053 */
00054 /* Should not be modified */
00055 #define REQUEST 1
00056 #define NOT_A_REQUEST 0
00057 
00058 /* Misc constants */
00059 /* -------------- */
00060 /* Should not be modified */
00061 #define Rx 0
00062 #define Tx 1
00063 #ifndef TRUE
00064 #define TRUE  1
00065 #endif
00066 #ifndef FALSE
00067 #define FALSE 0
00068 #endif
00069     
00070 /** Status of the SDO transmission
00071  */
00072 #define SDO_RESET                0x0      /* Transmission not started. Init state. */
00073 #define SDO_FINISHED             0x1      /* data are available */                          
00074 #define SDO_ABORTED_RCV          0x80     /* Received an abort message. Data not available */
00075 #define SDO_ABORTED_INTERNAL     0x85     /* Aborted but not because of an abort message. */
00076 #define SDO_DOWNLOAD_IN_PROGRESS 0x2 
00077 #define SDO_UPLOAD_IN_PROGRESS   0x3   
00078 
00079 /* Status of the node during the SDO transfert : */
00080 #define SDO_SERVER  0x1
00081 #define SDO_CLIENT  0x2
00082 #define SDO_UNKNOWN 0x3             
00083 
00084 /* SDOrx ccs: client command specifier */
00085 #define DOWNLOAD_SEGMENT_REQUEST     0
00086 #define INITIATE_DOWNLOAD_REQUEST    1
00087 #define INITIATE_UPLOAD_REQUEST      2
00088 #define UPLOAD_SEGMENT_REQUEST       3
00089 #define ABORT_TRANSFER_REQUEST       4
00090 
00091 /* SDOtx scs: server command specifier */
00092 #define UPLOAD_SEGMENT_RESPONSE      0
00093 #define DOWNLOAD_SEGMENT_RESPONSE    1
00094 #define INITIATE_DOWNLOAD_RESPONSE   3
00095 #define INITIATE_UPLOAD_RESPONSE     2
00096 #define ABORT_TRANSFER_REQUEST       4
00097 
00098 
00099 /*  Function Codes 
00100    ---------------
00101   defined in the canopen DS301 
00102 */
00103 #define NMT        0x0
00104 #define SYNC       0x1
00105 #define TIME_STAMP 0x2
00106 #define PDO1tx     0x3
00107 #define PDO1rx     0x4
00108 #define PDO2tx     0x5
00109 #define PDO2rx     0x6
00110 #define PDO3tx     0x7
00111 #define PDO3rx     0x8
00112 #define PDO4tx     0x9
00113 #define PDO4rx     0xA
00114 #define SDOtx      0xB
00115 #define SDOrx      0xC
00116 #define NODE_GUARD 0xE
00117 #define LSS        0xF
00118 
00119 /* NMT Command Specifier, sent by master to change a slave state */
00120 /* ------------------------------------------------------------- */
00121 /* Should not be modified */
00122 #define NMT_Start_Node              0x01
00123 #define NMT_Stop_Node               0x02
00124 #define NMT_Enter_PreOperational    0x80
00125 #define NMT_Reset_Node              0x81
00126 #define NMT_Reset_Comunication      0x82
00127 
00128 /** Status of the LSS transmission
00129  */
00130 #define LSS_RESET                0x0      /* Transmission not started. Init state. */
00131 #define LSS_FINISHED             0x1      /* data are available */                          
00132 #define LSS_ABORTED_INTERNAL     0x2     /* Aborted but not because of an abort message. */
00133 #define LSS_TRANS_IN_PROGRESS    0x3    
00134 
00135 /* constantes used in the different state machines */
00136 /* ----------------------------------------------- */
00137 /* Must not be modified */
00138 #define state1  0x01
00139 #define state2  0x02
00140 #define state3  0x03
00141 #define state4  0x04
00142 #define state5  0x05
00143 #define state6  0x06
00144 #define state7  0x07
00145 #define state8  0x08
00146 #define state9  0x09
00147 #define state10 0x0A
00148 #define state11 0x0B
00149 
00150 #endif /* __def_h__ */
00151