ethercattype.h

Go to the documentation of this file.
00001 /*
00002  * Simple Open EtherCAT Master Library 
00003  *
00004  * File    : ethercattype.h
00005  * Version : 1.2.5
00006  * Date    : 09-04-2011
00007  * Copyright (C) 2005-2011 Speciaal Machinefabriek Ketels v.o.f.
00008  * Copyright (C) 2005-2011 Arthur Ketels
00009  * Copyright (C) 2008-2009 TU/e Technische Universiteit Eindhoven 
00010  *
00011  * SOEM is free software; you can redistribute it and/or modify it under
00012  * the terms of the GNU General Public License version 2 as published by the Free
00013  * Software Foundation.
00014  *
00015  * SOEM is distributed in the hope that it will be useful, but WITHOUT ANY
00016  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
00017  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00018  * for more details.
00019  *
00020  * As a special exception, if other files instantiate templates or use macros
00021  * or inline functions from this file, or you compile this file and link it
00022  * with other works to produce a work based on this file, this file does not
00023  * by itself cause the resulting work to be covered by the GNU General Public
00024  * License. However the source code for this file must still be made available
00025  * in accordance with section (3) of the GNU General Public License.
00026  *
00027  * This exception does not invalidate any other reasons why a work based on
00028  * this file might be covered by the GNU General Public License.
00029  *
00030  * The EtherCAT Technology, the trade name and logo “EtherCAT” are the intellectual
00031  * property of, and protected by Beckhoff Automation GmbH. You can use SOEM for
00032  * the sole purpose of creating, using and/or selling or otherwise distributing
00033  * an EtherCAT network master provided that an EtherCAT Master License is obtained
00034  * from Beckhoff Automation GmbH.
00035  *
00036  * In case you did not receive a copy of the EtherCAT Master License along with
00037  * SOEM write to Beckhoff Automation GmbH, Eiserstraße 5, D-33415 Verl, Germany
00038  * (www.beckhoff.com).
00039  */
00040 
00041 /** \file
00042  * \brief 
00043  * General typedefs and defines for EtherCAT.
00044  *
00045  * Defines that could need optimalisation for specific applications
00046  * are the EC_TIMEOUTxxx. Assumptions for the standard settings are a
00047  * standard linux PC or laptop and a wired connection to maximal 100 slaves.
00048  * For use with wireless connections or lots of slaves the timouts need
00049  * increasing. For fast systems running Xenomai and RT-net or alike the
00050  * timeouts need to be shorter. 
00051  */
00052 
00053 #ifndef _EC_TYPE_H
00054 #define _EC_TYPE_H
00055 
00056 /** Define Little or Big endian target */
00057 #define EC_LITTLE_ENDIAN
00058 
00059 #ifndef PACKED
00060 #define PACKED  __attribute__((__packed__))
00061 #endif
00062 
00063 #include <sys/time.h>
00064 
00065 /* General types */
00066 typedef unsigned char       boolean;
00067 #define TRUE                1
00068 #define FALSE               0
00069 typedef signed char         int8;
00070 typedef signed short        int16;
00071 typedef signed int          int32;
00072 typedef unsigned char       uint8;
00073 typedef unsigned short      uint16;
00074 typedef unsigned int        uint32;
00075 typedef signed long long    int64;
00076 typedef unsigned long long  uint64;
00077 
00078 /** return value general error */
00079 #define EC_ERROR      -3
00080 /** return value no frame returned */
00081 #define EC_NOFRAME      -1
00082 /** return value unknown frame received */
00083 #define EC_OTHERFRAME   -2
00084 /** maximum EtherCAT frame length in bytes */
00085 #define EC_MAXECATFRAME   1518
00086 /** maximum EtherCAT LRW frame length in bytes */
00087 /* MTU - Ethernet header - length - datagram header - WCK - FCS */
00088 #define EC_MAXLRWDATA   EC_MAXECATFRAME - 14 - 2 - 10 - 2 - 4
00089 //#define EC_MAXLRWDATA   45
00090 /** size of DC datagram used in first LRW frame */
00091 #define EC_FIRSTDCDATAGRAM  20
00092 /** standard frame buffer size in bytes */
00093 #define EC_BUFSIZE      EC_MAXECATFRAME
00094 /** datagram type EtherCAT */
00095 #define EC_ECATTYPE     0x1000
00096 /** number of frame buffers per channel (tx, rx1 rx2) */
00097 #define EC_MAXBUF     16
00098 /** timeout value in us for tx frame to return to rx */
00099 #define EC_TIMEOUTRET   500
00100 //#define EC_TIMEOUTRET   20000
00101 /** timeout value in us for return "safe" variant (f.e. wireless) */
00102 #define EC_TIMEOUTSAFE    20000
00103 /** timeout value in us for EEPROM access */
00104 #define EC_TIMEOUTEEP   20000
00105 /** timeout value in us for tx mailbox cycle */
00106 #define EC_TIMEOUTTXM   20000
00107 /** timeout value in us for rx mailbox cycle */
00108 #define EC_TIMEOUTRXM   700000
00109 /** timeout value in us for check statechange */
00110 #define EC_TIMEOUTSTATE   2000000
00111 /** size of EEPROM bitmap cache */
00112 #define EC_MAXEEPBITMAP   128
00113 /** size of EEPROM cache buffer */
00114 #define EC_MAXEEPBUF    EC_MAXEEPBITMAP << 5
00115 /** default number of retries if wkc <= 0 */
00116 #define EC_DEFAULTRETRIES 3
00117 
00118 /** definition for frame buffers */
00119 typedef uint8 ec_bufT[EC_BUFSIZE];
00120 
00121 /** ethernet header definition */
00122 typedef struct PACKED 
00123 {
00124   /** destination MAC */
00125   uint16  da0,da1,da2;
00126   /** source MAC */
00127   uint16  sa0,sa1,sa2;
00128   /** ethernet type */
00129   uint16  etype;
00130 } ec_etherheadert;
00131 
00132 /** ethernet header size */
00133 #define ETH_HEADERSIZE    sizeof(ec_etherheadert)
00134 
00135 /** EtherCAT datagram header definition */
00136 typedef struct PACKED
00137 {
00138   /** length of EtherCAT datagram */
00139   uint16  elength;
00140   /** EtherCAT command, see ec_cmdtype */
00141   uint8   command;
00142   /** index, used in SOEM for Tx to Rx recombination */
00143   uint8   index;
00144   /** ADP */
00145   uint16  ADP;
00146   /** ADO */
00147   uint16  ADO;
00148   /** length of data portion in datagram */
00149   uint16  dlength;
00150   /** interrupt, currently unused */
00151   uint16  irpt;
00152 } ec_comt;
00153 
00154 /** EtherCAT header size */
00155 #define EC_HEADERSIZE   sizeof(ec_comt)
00156 /** size of ec_comt.elength item in EtherCAT header */
00157 #define EC_ELENGTHSIZE    sizeof(uint16)
00158 /** offset position of command in EtherCAT header */
00159 #define EC_CMDOFFSET    EC_ELENGTHSIZE
00160 /** size of workcounter item in EtherCAT datagram */
00161 #define EC_WKCSIZE      sizeof(uint16)
00162 /** definition of datagram follows bit in ec_comt.dlength */
00163 #define EC_DATAGRAMFOLLOWS  (1 << 15)
00164 
00165 /** Possible error codes returned. */
00166 typedef enum
00167 {
00168     /** No error */
00169     EC_ERR_OK     = 0,
00170     /** Library already initialized. */
00171     EC_ERR_ALREADY_INITIALIZED,
00172     /** Library not initialized. */
00173     EC_ERR_NOT_INITIALIZED,
00174     /** Timeout occured during execution of the function. */
00175     EC_ERR_TIMEOUT,
00176     /** No slaves were found. */
00177     EC_ERR_NO_SLAVES,
00178     /** Function failed. */
00179     EC_ERR_NOK
00180 } ec_err;
00181 
00182 /** Possible EtherCAT slave states */
00183 typedef enum
00184 {
00185     /** Init state*/
00186     EC_STATE_INIT           = 0x01,
00187     /** Pre-operational. */
00188     EC_STATE_PRE_OP         = 0x02,
00189   /** Boot state*/
00190   EC_STATE_BOOT     = 0x03,
00191     /** Safe-operational. */
00192     EC_STATE_SAFE_OP        = 0x04,
00193     /** Operational */
00194     EC_STATE_OPERATIONAL    = 0x08,
00195     /** Error or ACK error */
00196     EC_STATE_ACK      = 0x10,
00197     EC_STATE_ERROR      = 0x10
00198 } ec_state;
00199 
00200 /** Possible buffer states */
00201 typedef enum
00202 {
00203   /** Empty */
00204     EC_BUF_EMPTY    = 0x00,
00205   /** Allocated, but not filled */
00206     EC_BUF_ALLOC    = 0x01,
00207   /** Transmitted */
00208     EC_BUF_TX     = 0x02,
00209   /** Received, but not consumed */
00210     EC_BUF_RCVD         = 0x03,
00211   /** Cycle completed */
00212     EC_BUF_COMPLETE   = 0x04
00213 } ec_bufstate;
00214 
00215 /** Ethercat data types */
00216 typedef enum
00217 {
00218     ECT_BOOLEAN         = 0x0001,
00219     ECT_INTEGER8        = 0x0002,
00220     ECT_INTEGER16       = 0x0003,
00221     ECT_INTEGER32       = 0x0004,
00222     ECT_UNSIGNED8       = 0x0005,
00223     ECT_UNSIGNED16      = 0x0006,
00224     ECT_UNSIGNED32      = 0x0007,
00225     ECT_REAL32          = 0x0008,
00226     ECT_VISIBLE_STRING  = 0x0009,
00227     ECT_OCTET_STRING    = 0x000A,
00228     ECT_UNICODE_STRING  = 0x000B,
00229     ECT_TIME_OF_DAY     = 0x000C,
00230     ECT_TIME_DIFFERENCE = 0x000D,
00231     ECT_DOMAIN          = 0x000F,
00232     ECT_INTEGER24       = 0x0010,
00233     ECT_REAL64          = 0x0011,
00234     ECT_INTEGER64       = 0x0015,
00235     ECT_UNSIGNED24      = 0x0016,
00236     ECT_UNSIGNED64      = 0x001B,
00237     ECT_BIT1            = 0x0030,
00238     ECT_BIT2            = 0x0031,
00239     ECT_BIT3            = 0x0032,
00240     ECT_BIT4            = 0x0033,
00241     ECT_BIT5            = 0x0034,
00242     ECT_BIT6            = 0x0035,
00243     ECT_BIT7            = 0x0036,
00244     ECT_BIT8            = 0x0037
00245 } ec_datatype;
00246 
00247 /** Ethercat command types */
00248 typedef enum 
00249 {
00250     /** No operation */
00251     EC_CMD_NOP          = 0x00,
00252     /** Auto Increment Read */
00253     EC_CMD_APRD,
00254     /** Auto Increment Write */
00255     EC_CMD_APWR,
00256     /** Auto Increment Read Write */
00257     EC_CMD_APRW,
00258     /** Configured Address Read */
00259     EC_CMD_FPRD,
00260     /** Configured Address Write */
00261     EC_CMD_FPWR,
00262     /** Configured Address Read Write */
00263     EC_CMD_FPRW,
00264     /** Broadcast Read */
00265     EC_CMD_BRD,
00266     /** Broaddcast Write */
00267     EC_CMD_BWR,
00268     /** Broadcast Read Write */
00269     EC_CMD_BRW,
00270     /** Logical Memory Read */
00271     EC_CMD_LRD,
00272     /** Logical Memory Write */
00273     EC_CMD_LWR,
00274     /** Logical Memory Read Write */
00275     EC_CMD_LRW,
00276     /** Auto Increment Read Mulitple Write */
00277     EC_CMD_ARMW,
00278     /** Configured Read Mulitple Write */
00279     EC_CMD_FRMW
00280     /** Reserved */
00281 } ec_cmdtype;
00282 
00283 /** Ethercat EEprom command types */
00284 typedef enum 
00285 {
00286     /** No operation */
00287     EC_ECMD_NOP         = 0x0000,
00288     /** Read */
00289     EC_ECMD_READ    = 0x0100,
00290     /** Write */
00291     EC_ECMD_WRITE   = 0x0201,
00292     /** Reload */
00293     EC_ECMD_RELOAD    = 0x0300
00294 } ec_ecmdtype;
00295 
00296 /** EEprom state machine read size */
00297 #define EC_ESTAT_R64    0x0040
00298 /** EEprom state machine busy flag */
00299 #define EC_ESTAT_BUSY   0x8000
00300 /** EEprom state machine error flag mask */
00301 #define EC_ESTAT_EMASK  0x7800
00302 /** EEprom state machine error acknowledge */
00303 #define EC_ESTAT_NACK 0x2000
00304 
00305 /* Ethercat SSI (Slave Information Interface) */
00306 
00307 /** Start address SII sections in Eeprom */
00308 #define ECT_SII_START   0x0040
00309 
00310 enum
00311 {
00312     /** SII category strings */
00313     ECT_SII_STRING      = 10,
00314     /** SII category general */
00315     ECT_SII_GENERAL     = 30,
00316     /** SII category FMMU */
00317     ECT_SII_FMMU        = 40,
00318     /** SII category SM */
00319     ECT_SII_SM          = 41,
00320     /** SII category PDO */
00321     ECT_SII_PDO         = 50
00322 };
00323 
00324 /** Item offsets in SII general section */
00325 enum
00326 {
00327     ECT_SII_MANUF       = 0x0008,
00328     ECT_SII_ID          = 0x000a,
00329     ECT_SII_REV         = 0x000c,
00330   ECT_SII_BOOTRXMBX = 0x0014,
00331   ECT_SII_BOOTTXMBX = 0x0016,
00332   ECT_SII_MBXSIZE     = 0x0019,
00333     ECT_SII_TXMBXADR    = 0x001a,
00334     ECT_SII_RXMBXADR    = 0x0018,
00335     ECT_SII_MBXPROTO  = 0x001c
00336     
00337 };
00338 
00339 /** Mailbox types definitions */
00340 enum
00341 {
00342   /** Error mailbox type */
00343   ECT_MBXT_ERR    = 0x00,
00344   /** ADS over EtherCAT mailbox type */
00345   ECT_MBXT_AOE,
00346   /** Ethernet over EtherCAT mailbox type */
00347   ECT_MBXT_EOE,
00348   /** CANopen over EtherCAT mailbox type */
00349   ECT_MBXT_COE,
00350   /** File over EtherCAT mailbox type */
00351   ECT_MBXT_FOE,
00352   /** Servo over EtherCAT mailbox type */
00353   ECT_MBXT_SOE,
00354   /** Vendor over EtherCAT mailbox type */
00355   ECT_MBXT_VOE    = 0x0f
00356 };
00357 
00358 /** CoE mailbox types */
00359 enum
00360 {
00361   ECT_COES_EMERGENCY  = 0x01,
00362   ECT_COES_SDOREQ,
00363   ECT_COES_SDORES,
00364   ECT_COES_TXPDO,
00365   ECT_COES_RXPDO,
00366   ECT_COES_TXPDO_RR,
00367   ECT_COES_RXPDO_RR,
00368   ECT_COES_SDOINFO
00369 };
00370 
00371 /** CoE SDO commands */
00372 enum
00373 {
00374   ECT_SDO_DOWN_INIT = 0x21,
00375   ECT_SDO_DOWN_INIT_CA = 0x31,
00376   ECT_SDO_UP_REQ = 0x40,
00377   ECT_SDO_UP_REQ_CA = 0x50,
00378   ECT_SDO_SEG_UP_REQ = 0x60,
00379   ECT_SDO_ABORT = 0x80
00380 };
00381 
00382 /** CoE Object Description commands */
00383 enum
00384 {
00385   ECT_GET_ODLIST_REQ = 0x01,
00386   ECT_GET_ODLIST_RES = 0x02,
00387   ECT_GET_OD_REQ = 0x03,
00388   ECT_GET_OD_RES = 0x04,
00389   ECT_GET_OE_REQ = 0x05,
00390   ECT_GET_OE_RES = 0x06,
00391   ECT_SDOINFO_ERROR = 0x07
00392 };
00393 
00394 /** FoE opcodes */
00395 enum
00396 {
00397   ECT_FOE_READ  = 0x01,
00398   ECT_FOE_WRITE,
00399   ECT_FOE_DATA,
00400   ECT_FOE_ACK,
00401   ECT_FOE_ERROR,
00402   ECT_FOE_BUSY
00403 };
00404 
00405 /** SoE opcodes */
00406 enum
00407 {
00408   ECT_SOE_READREQ = 0x01,
00409   ECT_SOE_READRES,
00410   ECT_SOE_WRITEREQ,
00411   ECT_SOE_WRITERES,
00412   ECT_SOE_NOTIFICATION,
00413   ECT_SOE_EMERGENCY
00414 };
00415 
00416 /** Ethercat registers */
00417 enum 
00418 {
00419     ECT_REG_TYPE        = 0x0000,
00420     ECT_REG_PORTDES   = 0x0007,
00421     ECT_REG_ESCSUP      = 0x0008,
00422     ECT_REG_STADR       = 0x0010,
00423     ECT_REG_ALIAS   = 0x0012,
00424     ECT_REG_DLCTL       = 0x0100,
00425     ECT_REG_DLPORT      = 0x0101,
00426     ECT_REG_DLALIAS     = 0x0103,
00427     ECT_REG_DLSTAT      = 0x0110,
00428     ECT_REG_ALCTL       = 0x0120,
00429     ECT_REG_ALSTAT      = 0x0130,
00430   ECT_REG_ALSTATCODE  = 0x0134,
00431     ECT_REG_PDICTL      = 0x0140,
00432     ECT_REG_IRQMASK     = 0x0200,
00433     ECT_REG_RXERR       = 0x0300,
00434   ECT_REG_EEPCFG    = 0x0500,
00435     ECT_REG_EEPCTL      = 0x0502,
00436     ECT_REG_EEPSTAT     = 0x0502,
00437     ECT_REG_EEPADR      = 0x0504,
00438     ECT_REG_EEPDAT      = 0x0508,
00439     ECT_REG_FMMU0       = 0x0600,
00440     ECT_REG_FMMU1       = ECT_REG_FMMU0 + 0x10,
00441     ECT_REG_FMMU2       = ECT_REG_FMMU1 + 0x10,
00442     ECT_REG_FMMU3       = ECT_REG_FMMU2 + 0x10,
00443     ECT_REG_SM0         = 0x0800,
00444     ECT_REG_SM1         = ECT_REG_SM0 + 0x08,
00445     ECT_REG_SM2         = ECT_REG_SM1 + 0x08,
00446     ECT_REG_SM3         = ECT_REG_SM2 + 0x08,
00447     ECT_REG_SM0STAT     = ECT_REG_SM0 + 0x05,
00448     ECT_REG_SM1STAT     = ECT_REG_SM1 + 0x05,
00449     ECT_REG_SM1ACT      = ECT_REG_SM1 + 0x06,
00450     ECT_REG_SM1CONTR    = ECT_REG_SM1 + 0x07,
00451     ECT_REG_DCTIME0     = 0x0900,
00452     ECT_REG_DCTIME1     = 0x0904,
00453     ECT_REG_DCTIME2     = 0x0908,
00454     ECT_REG_DCTIME3     = 0x090C,
00455     ECT_REG_DCSYSTIME   = 0x0910,
00456     ECT_REG_DCSOF       = 0x0918,
00457     ECT_REG_DCSYSOFFSET = 0x0920,
00458     ECT_REG_DCSYSDELAY  = 0x0928,
00459     ECT_REG_DCSYSDIFF   = 0x092C,
00460     ECT_REG_DCSPEEDCNT  = 0x0930,
00461     ECT_REG_DCTIMEFILT  = 0x0934,
00462     ECT_REG_DCCUC       = 0x0980,
00463     ECT_REG_DCSYNCACT   = 0x0981,
00464     ECT_REG_DCSTART0    = 0x0990,
00465     ECT_REG_DCCYCLE0    = 0x09A0,
00466     ECT_REG_DCCYCLE1    = 0x09A4
00467 };
00468 
00469 /** standard SDO Sync Manager Communication Type */
00470 #define ECT_SDO_SMCOMMTYPE    0x1c00
00471 /** standard SDO PDO assignment */
00472 #define ECT_SDO_PDOASSIGN   0x1c10
00473 /** standard SDO RxPDO assignment */
00474 #define ECT_SDO_RXPDOASSIGN     0x1c12
00475 /** standard SDO TxPDO assignment */
00476 #define ECT_SDO_TXPDOASSIGN     0x1c13
00477 
00478 /** Ethercat packet type */
00479 #define ETH_P_ECAT              0x88A4
00480 
00481 /** Error types */
00482 typedef enum
00483 {
00484     EC_ERR_TYPE_SDO_ERROR       = 0,
00485     EC_ERR_TYPE_EMERGENCY       = 1,
00486     EC_ERR_TYPE_PACKET_ERROR    = 3,
00487     EC_ERR_TYPE_SDOINFO_ERROR   = 4,
00488   EC_ERR_TYPE_FOE_ERROR     = 5,         
00489   EC_ERR_TYPE_FOE_BUF2SMALL   = 6,         
00490   EC_ERR_TYPE_FOE_PACKETNUMBER= 7,
00491   EC_ERR_TYPE_SOE_ERROR   = 8
00492 } ec_err_type;
00493 
00494 /** Struct to retrieve errors. */
00495 typedef struct
00496 {
00497     /** Time at which the error was generated. */
00498     struct timeval Time;
00499   /** Signal bit, error set but not read */
00500     boolean     Signal;
00501   /** Slave number that generated the error */
00502     uint16      Slave;
00503   /** CoE SDO index that generated the error */
00504     uint16      Index;
00505   /** CoE SDO subindex that generated the error */
00506     uint8       SubIdx;
00507     /** Type of error */
00508     ec_err_type Etype;
00509     union
00510     {
00511     /** General abortcode */
00512         int32   AbortCode;
00513     /** Specific error for Emergency mailbox */
00514         struct
00515         {
00516             uint16  ErrorCode;
00517             uint8   ErrorReg;
00518             uint8   b1;
00519             uint16  w1;
00520             uint16  w2;
00521         };
00522     };
00523 } ec_errort;
00524 
00525 /** Helper macros */
00526 /** Macro to make a word from 2 bytes */
00527 #define MK_WORD(msb, lsb)   ((((uint16)(msb))<<8) | (lsb))
00528 /** Macro to get hi byte of a word */
00529 #define HI_BYTE(w)          ((w) >> 8)
00530 /** Macro to get low byte of a word */
00531 #define LO_BYTE(w)          ((w) & 0x00ff)
00532 /** Macro to swap hi and low byte of a word */
00533 #define SWAP(w)             ((((w)& 0xff00) >> 8) | (((w) & 0x00ff) << 8))
00534 /** Macro to get hi word of a dword */
00535 #define LO_WORD(l)          ((l) & 0xffff)
00536 /** Macro to get hi word of a dword */
00537 #define HI_WORD(l)          ((l) >> 16)
00538 
00539 #define get_unaligned(ptr) \
00540   ({ __typeof__(*(ptr)) __tmp; memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
00541 
00542 #define put_unaligned32(val, ptr)        \
00543   ({   memcpy((ptr), &(val), 4);         \
00544       (void)0; })
00545 
00546 #define put_unaligned64(val, ptr)        \
00547   ({   memcpy((ptr), &(val), 8);         \
00548       (void)0; })
00549 
00550 #if !defined(EC_BIG_ENDIAN) && defined(EC_LITTLE_ENDIAN)
00551 
00552   #define htoes(A) (A)
00553   #define htoel(A) (A)
00554   #define htoell(A) (A)
00555   #define etohs(A) (A)
00556   #define etohl(A) (A)
00557   #define etohll(A) (A)
00558 
00559 #elif !defined(EC_LITTLE_ENDIAN) && defined(EC_BIG_ENDIAN)
00560 
00561   #define htoes(A) ((((uint16)(A) & 0xff00) >> 8) | \
00562                     (((uint16)(A) & 0x00ff) << 8))
00563   #define htoel(A) ((((uint32)(A) & 0xff000000) >> 24) | \
00564                     (((uint32)(A) & 0x00ff0000) >> 8)  | \
00565                     (((uint32)(A) & 0x0000ff00) << 8)  | \
00566                     (((uint32)(A) & 0x000000ff) << 24))
00567   #define htoell(A) ((((uint64)(A) & (uint64)0xff00000000000000ULL) >> 56) | \
00568                      (((uint64)(A) & (uint64)0x00ff000000000000ULL) >> 40) | \
00569                      (((uint64)(A) & (uint64)0x0000ff0000000000ULL) >> 24) | \
00570                      (((uint64)(A) & (uint64)0x000000ff00000000ULL) >> 8)  | \
00571                      (((uint64)(A) & (uint64)0x00000000ff000000ULL) << 8)  | \
00572                      (((uint64)(A) & (uint64)0x0000000000ff0000ULL) << 24) | \
00573                      (((uint64)(A) & (uint64)0x000000000000ff00ULL) << 40) | \
00574                      (((uint64)(A) & (uint64)0x00000000000000ffULL) << 56))
00575 
00576   #define etohs  htoes
00577   #define etohl  htoel
00578   #define etohll htoell
00579 
00580 #else
00581 
00582   #error "Must define one of EC_BIG_ENDIAN or EC_LITTLE_ENDIAN"
00583 
00584 #endif
00585 
00586 #endif /* _EC_TYPE_H */
Generated by  doxygen 1.6.3