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