etisserant@0: /* etisserant@0: This file is part of CanFestival, a library implementing CanOpen Stack. etisserant@0: etisserant@0: Copyright (C): Edouard TISSERANT and Francis DUPIN etisserant@0: etisserant@0: See COPYING file for copyrights details. etisserant@0: etisserant@0: This library is free software; you can redistribute it and/or etisserant@0: modify it under the terms of the GNU Lesser General Public etisserant@0: License as published by the Free Software Foundation; either etisserant@0: version 2.1 of the License, or (at your option) any later version. etisserant@0: etisserant@0: This library is distributed in the hope that it will be useful, etisserant@0: but WITHOUT ANY WARRANTY; without even the implied warranty of etisserant@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU etisserant@0: Lesser General Public License for more details. etisserant@0: etisserant@0: You should have received a copy of the GNU Lesser General Public etisserant@0: License along with this library; if not, write to the Free Software etisserant@0: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA etisserant@0: */ etisserant@0: etisserant@0: etisserant@0: #ifndef __def_h__ etisserant@0: #define __def_h__ etisserant@0: hacking@675: #include etisserant@0: etisserant@0: /** definitions used for object dictionary access. ie SDO Abort codes . (See DS 301 v.4.02 p.48) etisserant@0: */ etisserant@0: #define OD_SUCCESSFUL 0x00000000 etisserant@0: #define OD_READ_NOT_ALLOWED 0x06010001 etisserant@0: #define OD_WRITE_NOT_ALLOWED 0x06010002 etisserant@0: #define OD_NO_SUCH_OBJECT 0x06020000 etisserant@0: #define OD_NOT_MAPPABLE 0x06040041 etisserant@0: #define OD_LENGTH_DATA_INVALID 0x06070010 etisserant@0: #define OD_NO_SUCH_SUBINDEX 0x06090011 luis@288: #define OD_VALUE_RANGE_EXCEEDED 0x06090030 /* Value range test result */ etisserant@0: #define OD_VALUE_TOO_LOW 0x06090031 /* Value range test result */ etisserant@0: #define OD_VALUE_TOO_HIGH 0x06090032 /* Value range test result */ etisserant@0: /* Others SDO abort codes etisserant@0: */ etisserant@0: #define SDOABT_TOGGLE_NOT_ALTERNED 0x05030000 etisserant@0: #define SDOABT_TIMED_OUT 0x05040000 JaFojtik@694: #define SDOABT_OUT_OF_MEMORY 0x05040005 /* Size data exceed SDO_MAX_LENGTH_TRANSFER */ etisserant@0: #define SDOABT_GENERAL_ERROR 0x08000000 /* Error size of SDO message */ etisserant@0: #define SDOABT_LOCAL_CTRL_ERROR 0x08000021 etisserant@0: etisserant@0: /******************** CONSTANTS ****************/ etisserant@0: etisserant@0: /** Constantes which permit to define if a PDO frame etisserant@0: is a request one or a data one etisserant@0: */ etisserant@0: /* Should not be modified */ etisserant@0: #define REQUEST 1 etisserant@0: #define NOT_A_REQUEST 0 etisserant@0: frdupin@71: /* Misc constants */ frdupin@71: /* -------------- */ etisserant@0: /* Should not be modified */ etisserant@0: #define Rx 0 etisserant@0: #define Tx 1 etisserant@320: #ifndef TRUE etisserant@0: #define TRUE 1 etisserant@320: #endif etisserant@320: #ifndef FALSE etisserant@0: #define FALSE 0 etisserant@320: #endif etisserant@235: etisserant@0: /** Status of the SDO transmission etisserant@0: */ frdupin@71: #define SDO_RESET 0x0 /* Transmission not started. Init state. */ frdupin@71: #define SDO_FINISHED 0x1 /* data are available */ frdupin@71: #define SDO_ABORTED_RCV 0x80 /* Received an abort message. Data not available */ frdupin@71: #define SDO_ABORTED_INTERNAL 0x85 /* Aborted but not because of an abort message. */ etisserant@0: #define SDO_DOWNLOAD_IN_PROGRESS 0x2 etisserant@0: #define SDO_UPLOAD_IN_PROGRESS 0x3 fbeaulier@664: #define SDO_BLOCK_DOWNLOAD_IN_PROGRESS 0x4 fbeaulier@664: #define SDO_BLOCK_UPLOAD_IN_PROGRESS 0x5 fbeaulier@664: fbeaulier@664: /** getReadResultNetworkDict may return any of above status value or this one fbeaulier@664: */ fbeaulier@664: #define SDO_PROVIDED_BUFFER_TOO_SMALL 0x8A etisserant@0: JaFojtik@694: /* Status of the node during the SDO transfer : */ etisserant@0: #define SDO_SERVER 0x1 etisserant@0: #define SDO_CLIENT 0x2 etisserant@0: #define SDO_UNKNOWN 0x3 etisserant@0: etisserant@301: /* SDOrx ccs: client command specifier */ etisserant@301: #define DOWNLOAD_SEGMENT_REQUEST 0 etisserant@301: #define INITIATE_DOWNLOAD_REQUEST 1 etisserant@301: #define INITIATE_UPLOAD_REQUEST 2 etisserant@301: #define UPLOAD_SEGMENT_REQUEST 3 etisserant@301: #define ABORT_TRANSFER_REQUEST 4 fbeaulier@664: #define BLOCK_UPLOAD_REQUEST 5 fbeaulier@664: #define BLOCK_DOWNLOAD_REQUEST 6 etisserant@301: etisserant@301: /* SDOtx scs: server command specifier */ etisserant@301: #define UPLOAD_SEGMENT_RESPONSE 0 etisserant@301: #define DOWNLOAD_SEGMENT_RESPONSE 1 etisserant@301: #define INITIATE_DOWNLOAD_RESPONSE 3 etisserant@301: #define INITIATE_UPLOAD_RESPONSE 2 etisserant@301: #define ABORT_TRANSFER_REQUEST 4 fbeaulier@664: #define BLOCK_DOWNLOAD_RESPONSE 5 fbeaulier@664: #define BLOCK_UPLOAD_RESPONSE 6 etisserant@301: fbeaulier@664: /* SDO block upload client subcommand */ fbeaulier@664: #define SDO_BCS_INITIATE_UPLOAD_REQUEST 0 fbeaulier@664: #define SDO_BCS_END_UPLOAD_REQUEST 1 fbeaulier@664: #define SDO_BCS_UPLOAD_RESPONSE 2 fbeaulier@664: #define SDO_BCS_START_UPLOAD 3 fbeaulier@664: fbeaulier@664: /* SDO block upload server subcommand */ fbeaulier@664: #define SDO_BSS_INITIATE_UPLOAD_RESPONSE 0 fbeaulier@664: #define SDO_BSS_END_UPLOAD_RESPONSE 1 fbeaulier@664: fbeaulier@664: /* SDO block download client subcommand */ fbeaulier@664: #define SDO_BCS_INITIATE_DOWNLOAD_REQUEST 0 fbeaulier@664: #define SDO_BCS_END_DOWNLOAD_REQUEST 1 fbeaulier@664: fbeaulier@664: /* SDO block download server subcommand */ fbeaulier@664: #define SDO_BSS_INITIATE_DOWNLOAD_RESPONSE 0 fbeaulier@664: #define SDO_BSS_END_DOWNLOAD_RESPONSE 1 fbeaulier@664: #define SDO_BSS_DOWNLOAD_RESPONSE 2 etisserant@301: etisserant@0: /* Function Codes frdupin@71: --------------- etisserant@0: defined in the canopen DS301 etisserant@0: */ etisserant@0: #define NMT 0x0 etisserant@0: #define SYNC 0x1 etisserant@0: #define TIME_STAMP 0x2 etisserant@0: #define PDO1tx 0x3 etisserant@0: #define PDO1rx 0x4 etisserant@0: #define PDO2tx 0x5 etisserant@0: #define PDO2rx 0x6 etisserant@0: #define PDO3tx 0x7 etisserant@0: #define PDO3rx 0x8 etisserant@0: #define PDO4tx 0x9 etisserant@0: #define PDO4rx 0xA etisserant@0: #define SDOtx 0xB etisserant@0: #define SDOrx 0xC etisserant@0: #define NODE_GUARD 0xE etisserant@343: #define LSS 0xF etisserant@0: frdupin@71: /* NMT Command Specifier, sent by master to change a slave state */ frdupin@71: /* ------------------------------------------------------------- */ etisserant@0: /* Should not be modified */ etisserant@0: #define NMT_Start_Node 0x01 etisserant@0: #define NMT_Stop_Node 0x02 etisserant@0: #define NMT_Enter_PreOperational 0x80 etisserant@0: #define NMT_Reset_Node 0x81 etisserant@0: #define NMT_Reset_Comunication 0x82 etisserant@0: etisserant@343: /** Status of the LSS transmission etisserant@343: */ etisserant@343: #define LSS_RESET 0x0 /* Transmission not started. Init state. */ etisserant@343: #define LSS_FINISHED 0x1 /* data are available */ etisserant@343: #define LSS_ABORTED_INTERNAL 0x2 /* Aborted but not because of an abort message. */ etisserant@343: #define LSS_TRANS_IN_PROGRESS 0x3 etisserant@343: frdupin@71: /* constantes used in the different state machines */ frdupin@71: /* ----------------------------------------------- */ etisserant@0: /* Must not be modified */ etisserant@0: #define state1 0x01 etisserant@0: #define state2 0x02 etisserant@0: #define state3 0x03 etisserant@0: #define state4 0x04 etisserant@0: #define state5 0x05 etisserant@0: #define state6 0x06 etisserant@0: #define state7 0x07 etisserant@0: #define state8 0x08 etisserant@0: #define state9 0x09 etisserant@0: #define state10 0x0A etisserant@0: #define state11 0x0B etisserant@0: frdupin@71: #endif /* __def_h__ */ etisserant@0: