Sam Grove
/
canopen_slavenode
CANfestival - an open source CANopen framework
framework/include/def.h@0:6219434a0cb5, 2011-05-30 (annotated)
- Committer:
- sam_grove
- Date:
- Mon May 30 07:14:41 2011 +0000
- Revision:
- 0:6219434a0cb5
Initial public release of slave node framework port
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove |
0:6219434a0cb5 | 1 | /* |
sam_grove |
0:6219434a0cb5 | 2 | This file is part of CanFestival, a library implementing CanOpen Stack. |
sam_grove |
0:6219434a0cb5 | 3 | |
sam_grove |
0:6219434a0cb5 | 4 | Copyright (C): Edouard TISSERANT and Francis DUPIN |
sam_grove |
0:6219434a0cb5 | 5 | |
sam_grove |
0:6219434a0cb5 | 6 | See COPYING file for copyrights details. |
sam_grove |
0:6219434a0cb5 | 7 | |
sam_grove |
0:6219434a0cb5 | 8 | This library is free software; you can redistribute it and/or |
sam_grove |
0:6219434a0cb5 | 9 | modify it under the terms of the GNU Lesser General Public |
sam_grove |
0:6219434a0cb5 | 10 | License as published by the Free Software Foundation; either |
sam_grove |
0:6219434a0cb5 | 11 | version 2.1 of the License, or (at your option) any later version. |
sam_grove |
0:6219434a0cb5 | 12 | |
sam_grove |
0:6219434a0cb5 | 13 | This library is distributed in the hope that it will be useful, |
sam_grove |
0:6219434a0cb5 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
sam_grove |
0:6219434a0cb5 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
sam_grove |
0:6219434a0cb5 | 16 | Lesser General Public License for more details. |
sam_grove |
0:6219434a0cb5 | 17 | |
sam_grove |
0:6219434a0cb5 | 18 | You should have received a copy of the GNU Lesser General Public |
sam_grove |
0:6219434a0cb5 | 19 | License along with this library; if not, write to the Free Software |
sam_grove |
0:6219434a0cb5 | 20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
sam_grove |
0:6219434a0cb5 | 21 | */ |
sam_grove |
0:6219434a0cb5 | 22 | |
sam_grove |
0:6219434a0cb5 | 23 | |
sam_grove |
0:6219434a0cb5 | 24 | #ifndef __def_h__ |
sam_grove |
0:6219434a0cb5 | 25 | #define __def_h__ |
sam_grove |
0:6219434a0cb5 | 26 | |
sam_grove |
0:6219434a0cb5 | 27 | #include "config.h" |
sam_grove |
0:6219434a0cb5 | 28 | |
sam_grove |
0:6219434a0cb5 | 29 | /** definitions used for object dictionary access. ie SDO Abort codes . (See DS 301 v.4.02 p.48) |
sam_grove |
0:6219434a0cb5 | 30 | */ |
sam_grove |
0:6219434a0cb5 | 31 | #define OD_SUCCESSFUL 0x00000000 |
sam_grove |
0:6219434a0cb5 | 32 | #define OD_READ_NOT_ALLOWED 0x06010001 |
sam_grove |
0:6219434a0cb5 | 33 | #define OD_WRITE_NOT_ALLOWED 0x06010002 |
sam_grove |
0:6219434a0cb5 | 34 | #define OD_NO_SUCH_OBJECT 0x06020000 |
sam_grove |
0:6219434a0cb5 | 35 | #define OD_NOT_MAPPABLE 0x06040041 |
sam_grove |
0:6219434a0cb5 | 36 | #define OD_LENGTH_DATA_INVALID 0x06070010 |
sam_grove |
0:6219434a0cb5 | 37 | #define OD_NO_SUCH_SUBINDEX 0x06090011 |
sam_grove |
0:6219434a0cb5 | 38 | #define OD_VALUE_RANGE_EXCEEDED 0x06090030 /* Value range test result */ |
sam_grove |
0:6219434a0cb5 | 39 | #define OD_VALUE_TOO_LOW 0x06090031 /* Value range test result */ |
sam_grove |
0:6219434a0cb5 | 40 | #define OD_VALUE_TOO_HIGH 0x06090032 /* Value range test result */ |
sam_grove |
0:6219434a0cb5 | 41 | /* Others SDO abort codes |
sam_grove |
0:6219434a0cb5 | 42 | */ |
sam_grove |
0:6219434a0cb5 | 43 | #define SDOABT_TOGGLE_NOT_ALTERNED 0x05030000 |
sam_grove |
0:6219434a0cb5 | 44 | #define SDOABT_TIMED_OUT 0x05040000 |
sam_grove |
0:6219434a0cb5 | 45 | #define SDOABT_OUT_OF_MEMORY 0x05040005 /* Size data exceed SDO_MAX_LENGTH_TRANSFERT */ |
sam_grove |
0:6219434a0cb5 | 46 | #define SDOABT_GENERAL_ERROR 0x08000000 /* Error size of SDO message */ |
sam_grove |
0:6219434a0cb5 | 47 | #define SDOABT_LOCAL_CTRL_ERROR 0x08000021 |
sam_grove |
0:6219434a0cb5 | 48 | |
sam_grove |
0:6219434a0cb5 | 49 | /******************** CONSTANTS ****************/ |
sam_grove |
0:6219434a0cb5 | 50 | |
sam_grove |
0:6219434a0cb5 | 51 | /** Constantes which permit to define if a PDO frame |
sam_grove |
0:6219434a0cb5 | 52 | is a request one or a data one |
sam_grove |
0:6219434a0cb5 | 53 | */ |
sam_grove |
0:6219434a0cb5 | 54 | /* Should not be modified */ |
sam_grove |
0:6219434a0cb5 | 55 | #define REQUEST 1 |
sam_grove |
0:6219434a0cb5 | 56 | #define NOT_A_REQUEST 0 |
sam_grove |
0:6219434a0cb5 | 57 | |
sam_grove |
0:6219434a0cb5 | 58 | /* Misc constants */ |
sam_grove |
0:6219434a0cb5 | 59 | /* -------------- */ |
sam_grove |
0:6219434a0cb5 | 60 | /* Should not be modified */ |
sam_grove |
0:6219434a0cb5 | 61 | #define Rx 0 |
sam_grove |
0:6219434a0cb5 | 62 | #define Tx 1 |
sam_grove |
0:6219434a0cb5 | 63 | #ifndef TRUE |
sam_grove |
0:6219434a0cb5 | 64 | #define TRUE 1 |
sam_grove |
0:6219434a0cb5 | 65 | #endif |
sam_grove |
0:6219434a0cb5 | 66 | #ifndef FALSE |
sam_grove |
0:6219434a0cb5 | 67 | #define FALSE 0 |
sam_grove |
0:6219434a0cb5 | 68 | #endif |
sam_grove |
0:6219434a0cb5 | 69 | |
sam_grove |
0:6219434a0cb5 | 70 | /** Status of the SDO transmission |
sam_grove |
0:6219434a0cb5 | 71 | */ |
sam_grove |
0:6219434a0cb5 | 72 | #define SDO_RESET 0x0 /* Transmission not started. Init state. */ |
sam_grove |
0:6219434a0cb5 | 73 | #define SDO_FINISHED 0x1 /* data are available */ |
sam_grove |
0:6219434a0cb5 | 74 | #define SDO_ABORTED_RCV 0x80 /* Received an abort message. Data not available */ |
sam_grove |
0:6219434a0cb5 | 75 | #define SDO_ABORTED_INTERNAL 0x85 /* Aborted but not because of an abort message. */ |
sam_grove |
0:6219434a0cb5 | 76 | #define SDO_DOWNLOAD_IN_PROGRESS 0x2 |
sam_grove |
0:6219434a0cb5 | 77 | #define SDO_UPLOAD_IN_PROGRESS 0x3 |
sam_grove |
0:6219434a0cb5 | 78 | |
sam_grove |
0:6219434a0cb5 | 79 | /* Status of the node during the SDO transfert : */ |
sam_grove |
0:6219434a0cb5 | 80 | #define SDO_SERVER 0x1 |
sam_grove |
0:6219434a0cb5 | 81 | #define SDO_CLIENT 0x2 |
sam_grove |
0:6219434a0cb5 | 82 | #define SDO_UNKNOWN 0x3 |
sam_grove |
0:6219434a0cb5 | 83 | |
sam_grove |
0:6219434a0cb5 | 84 | /* SDOrx ccs: client command specifier */ |
sam_grove |
0:6219434a0cb5 | 85 | #define DOWNLOAD_SEGMENT_REQUEST 0 |
sam_grove |
0:6219434a0cb5 | 86 | #define INITIATE_DOWNLOAD_REQUEST 1 |
sam_grove |
0:6219434a0cb5 | 87 | #define INITIATE_UPLOAD_REQUEST 2 |
sam_grove |
0:6219434a0cb5 | 88 | #define UPLOAD_SEGMENT_REQUEST 3 |
sam_grove |
0:6219434a0cb5 | 89 | #define ABORT_TRANSFER_REQUEST 4 |
sam_grove |
0:6219434a0cb5 | 90 | |
sam_grove |
0:6219434a0cb5 | 91 | /* SDOtx scs: server command specifier */ |
sam_grove |
0:6219434a0cb5 | 92 | #define UPLOAD_SEGMENT_RESPONSE 0 |
sam_grove |
0:6219434a0cb5 | 93 | #define DOWNLOAD_SEGMENT_RESPONSE 1 |
sam_grove |
0:6219434a0cb5 | 94 | #define INITIATE_DOWNLOAD_RESPONSE 3 |
sam_grove |
0:6219434a0cb5 | 95 | #define INITIATE_UPLOAD_RESPONSE 2 |
sam_grove |
0:6219434a0cb5 | 96 | #define ABORT_TRANSFER_REQUEST 4 |
sam_grove |
0:6219434a0cb5 | 97 | |
sam_grove |
0:6219434a0cb5 | 98 | |
sam_grove |
0:6219434a0cb5 | 99 | /* Function Codes |
sam_grove |
0:6219434a0cb5 | 100 | --------------- |
sam_grove |
0:6219434a0cb5 | 101 | defined in the canopen DS301 |
sam_grove |
0:6219434a0cb5 | 102 | */ |
sam_grove |
0:6219434a0cb5 | 103 | #define NMT 0x0 |
sam_grove |
0:6219434a0cb5 | 104 | #define SYNC 0x1 |
sam_grove |
0:6219434a0cb5 | 105 | #define TIME_STAMP 0x2 |
sam_grove |
0:6219434a0cb5 | 106 | #define PDO1tx 0x3 |
sam_grove |
0:6219434a0cb5 | 107 | #define PDO1rx 0x4 |
sam_grove |
0:6219434a0cb5 | 108 | #define PDO2tx 0x5 |
sam_grove |
0:6219434a0cb5 | 109 | #define PDO2rx 0x6 |
sam_grove |
0:6219434a0cb5 | 110 | #define PDO3tx 0x7 |
sam_grove |
0:6219434a0cb5 | 111 | #define PDO3rx 0x8 |
sam_grove |
0:6219434a0cb5 | 112 | #define PDO4tx 0x9 |
sam_grove |
0:6219434a0cb5 | 113 | #define PDO4rx 0xA |
sam_grove |
0:6219434a0cb5 | 114 | #define SDOtx 0xB |
sam_grove |
0:6219434a0cb5 | 115 | #define SDOrx 0xC |
sam_grove |
0:6219434a0cb5 | 116 | #define NODE_GUARD 0xE |
sam_grove |
0:6219434a0cb5 | 117 | #define LSS 0xF |
sam_grove |
0:6219434a0cb5 | 118 | |
sam_grove |
0:6219434a0cb5 | 119 | /* NMT Command Specifier, sent by master to change a slave state */ |
sam_grove |
0:6219434a0cb5 | 120 | /* ------------------------------------------------------------- */ |
sam_grove |
0:6219434a0cb5 | 121 | /* Should not be modified */ |
sam_grove |
0:6219434a0cb5 | 122 | #define NMT_Start_Node 0x01 |
sam_grove |
0:6219434a0cb5 | 123 | #define NMT_Stop_Node 0x02 |
sam_grove |
0:6219434a0cb5 | 124 | #define NMT_Enter_PreOperational 0x80 |
sam_grove |
0:6219434a0cb5 | 125 | #define NMT_Reset_Node 0x81 |
sam_grove |
0:6219434a0cb5 | 126 | #define NMT_Reset_Comunication 0x82 |
sam_grove |
0:6219434a0cb5 | 127 | |
sam_grove |
0:6219434a0cb5 | 128 | /** Status of the LSS transmission |
sam_grove |
0:6219434a0cb5 | 129 | */ |
sam_grove |
0:6219434a0cb5 | 130 | #define LSS_RESET 0x0 /* Transmission not started. Init state. */ |
sam_grove |
0:6219434a0cb5 | 131 | #define LSS_FINISHED 0x1 /* data are available */ |
sam_grove |
0:6219434a0cb5 | 132 | #define LSS_ABORTED_INTERNAL 0x2 /* Aborted but not because of an abort message. */ |
sam_grove |
0:6219434a0cb5 | 133 | #define LSS_TRANS_IN_PROGRESS 0x3 |
sam_grove |
0:6219434a0cb5 | 134 | |
sam_grove |
0:6219434a0cb5 | 135 | /* constantes used in the different state machines */ |
sam_grove |
0:6219434a0cb5 | 136 | /* ----------------------------------------------- */ |
sam_grove |
0:6219434a0cb5 | 137 | /* Must not be modified */ |
sam_grove |
0:6219434a0cb5 | 138 | #define state1 0x01 |
sam_grove |
0:6219434a0cb5 | 139 | #define state2 0x02 |
sam_grove |
0:6219434a0cb5 | 140 | #define state3 0x03 |
sam_grove |
0:6219434a0cb5 | 141 | #define state4 0x04 |
sam_grove |
0:6219434a0cb5 | 142 | #define state5 0x05 |
sam_grove |
0:6219434a0cb5 | 143 | #define state6 0x06 |
sam_grove |
0:6219434a0cb5 | 144 | #define state7 0x07 |
sam_grove |
0:6219434a0cb5 | 145 | #define state8 0x08 |
sam_grove |
0:6219434a0cb5 | 146 | #define state9 0x09 |
sam_grove |
0:6219434a0cb5 | 147 | #define state10 0x0A |
sam_grove |
0:6219434a0cb5 | 148 | #define state11 0x0B |
sam_grove |
0:6219434a0cb5 | 149 | |
sam_grove |
0:6219434a0cb5 | 150 | #endif /* __def_h__ */ |
sam_grove |
0:6219434a0cb5 | 151 |