mirror of
https://github.com/OpenEtherCATsociety/SOEM.git
synced 2026-02-06 09:03:10 +08:00
Rename PACKED to OSAL_PACKED
Use a less generic name to avoid namespace conflicts. Fixes #835. Change-Id: I222878742ed7d02d19ad50ff732adabfe4f0729a
This commit is contained in:
@@ -25,10 +25,10 @@ extern "C" {
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef PACKED
|
||||
#define PACKED_BEGIN
|
||||
#define PACKED __attribute__((__packed__))
|
||||
#define PACKED_END
|
||||
#ifndef OSAL_PACKED
|
||||
#define OSAL_PACKED_BEGIN
|
||||
#define OSAL_PACKED __attribute__((__packed__))
|
||||
#define OSAL_PACKED_END
|
||||
#endif
|
||||
|
||||
int osal_gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
|
||||
@@ -21,15 +21,15 @@ extern "C" {
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef PACKED
|
||||
#ifndef OSAL_PACKED
|
||||
#ifdef _MSC_VER
|
||||
#define PACKED_BEGIN __pragma(pack(push, 1))
|
||||
#define PACKED
|
||||
#define PACKED_END __pragma(pack(pop))
|
||||
#define OSAL_PACKED_BEGIN __pragma(pack(push, 1))
|
||||
#define OSAL_PACKED
|
||||
#define OSAL_PACKED_END __pragma(pack(pop))
|
||||
#elif defined(__GNUC__)
|
||||
#define PACKED_BEGIN
|
||||
#define PACKED __attribute__((__packed__))
|
||||
#define PACKED_END
|
||||
#define OSAL_PACKED_BEGIN
|
||||
#define OSAL_PACKED __attribute__((__packed__))
|
||||
#define OSAL_PACKED_END
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ extern "C" {
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef PACKED
|
||||
#define PACKED_BEGIN
|
||||
#define PACKED __attribute__((__packed__))
|
||||
#define PACKED_END
|
||||
#ifndef OSAL_PACKED
|
||||
#define OSAL_PACKED_BEGIN
|
||||
#define OSAL_PACKED __attribute__((__packed__))
|
||||
#define OSAL_PACKED_END
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
@@ -21,10 +21,10 @@ extern "C" {
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef PACKED
|
||||
#define PACKED_BEGIN
|
||||
#define PACKED __attribute__((__packed__))
|
||||
#define PACKED_END
|
||||
#ifndef OSAL_PACKED
|
||||
#define OSAL_PACKED_BEGIN
|
||||
#define OSAL_PACKED __attribute__((__packed__))
|
||||
#define OSAL_PACKED_END
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef PACKED
|
||||
#define PACKED_BEGIN
|
||||
#define PACKED __attribute__((__packed__))
|
||||
#define PACKED_END
|
||||
#ifndef OSAL_PACKED
|
||||
#define OSAL_PACKED_BEGIN
|
||||
#define OSAL_PACKED __attribute__((__packed__))
|
||||
#define OSAL_PACKED_END
|
||||
#endif
|
||||
|
||||
#define OSAL_THREAD_HANDLE TASK_ID
|
||||
|
||||
@@ -133,12 +133,12 @@ typedef struct eoe_ip4_addr
|
||||
} eoe_ip4_addr_t;
|
||||
|
||||
/** EOE ethernet address */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED eoe_ethaddr
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED eoe_ethaddr
|
||||
{
|
||||
uint8_t addr[EOE_ETHADDR_LENGTH];
|
||||
} eoe_ethaddr_t;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** EoE IP request structure, storage only, no need to pack */
|
||||
typedef struct eoe_param
|
||||
@@ -160,8 +160,8 @@ typedef struct eoe_param
|
||||
/** EOE structure.
|
||||
* Used to interpret EoE mailbox packets.
|
||||
*/
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
ec_mbxheadert mbxheader;
|
||||
uint16_t frameinfo1;
|
||||
@@ -172,7 +172,7 @@ typedef struct PACKED
|
||||
};
|
||||
uint8 data[EC_MAXEOEDATA];
|
||||
} ec_EOEt;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
int ecx_EOEdefinehook(ecx_contextt *context, void *hook);
|
||||
int ecx_EOEsetIp(ecx_contextt *context,
|
||||
|
||||
@@ -27,8 +27,8 @@ struct ec_adapter
|
||||
};
|
||||
|
||||
/** record for FMMU */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED ec_fmmu
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED ec_fmmu
|
||||
{
|
||||
uint32 LogStart;
|
||||
uint16 LogLength;
|
||||
@@ -41,26 +41,26 @@ typedef struct PACKED ec_fmmu
|
||||
uint8 unused1;
|
||||
uint16 unused2;
|
||||
} ec_fmmut;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** record for sync manager */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED ec_sm
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED ec_sm
|
||||
{
|
||||
uint16 StartAddr;
|
||||
uint16 SMlength;
|
||||
uint32 SMflags;
|
||||
} ec_smt;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED ec_state_status
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED ec_state_status
|
||||
{
|
||||
uint16 State;
|
||||
uint16 Unused;
|
||||
uint16 ALstatuscode;
|
||||
} ec_state_status;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** mailbox buffer array */
|
||||
typedef uint8 ec_mbxbuft[EC_MAXMBX + 1];
|
||||
@@ -430,25 +430,25 @@ typedef struct ec_eepromPDO
|
||||
} ec_eepromPDOt;
|
||||
|
||||
/** standard ethercat mailbox header */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED ec_mbxheader
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED ec_mbxheader
|
||||
{
|
||||
uint16 length;
|
||||
uint16 address;
|
||||
uint8 priority;
|
||||
uint8 mbxtype;
|
||||
} ec_mbxheadert;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** ALstatus and ALstatus code */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED ec_alstatus
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED ec_alstatus
|
||||
{
|
||||
uint16 alstatus;
|
||||
uint16 unused;
|
||||
uint16 alstatuscode;
|
||||
} ec_alstatust;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** stack structure to store segmented LRD/LWR/LRW constructs */
|
||||
typedef struct ec_idxstack
|
||||
@@ -471,34 +471,34 @@ typedef struct ec_ering
|
||||
} ec_eringt;
|
||||
|
||||
/** SyncManager Communication Type structure for CA */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED ec_SMcommtype
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED ec_SMcommtype
|
||||
{
|
||||
uint8 n;
|
||||
uint8 nu1;
|
||||
uint8 SMtype[EC_MAXSM];
|
||||
} ec_SMcommtypet;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** SDO assign structure for CA */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED ec_PDOassign
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED ec_PDOassign
|
||||
{
|
||||
uint8 n;
|
||||
uint8 nu1;
|
||||
uint16 index[256];
|
||||
} ec_PDOassignt;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** SDO description structure for CA */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED ec_PDOdesc
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED ec_PDOdesc
|
||||
{
|
||||
uint8 n;
|
||||
uint8 nu1;
|
||||
uint32 PDO[256];
|
||||
} ec_PDOdesct;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** Context structure , referenced by all ecx functions*/
|
||||
struct ecx_context
|
||||
|
||||
@@ -29,8 +29,8 @@ extern "C" {
|
||||
#define EC_IDN_ATCONFIG 16
|
||||
|
||||
/** SoE name structure */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
/** current length in bytes of list */
|
||||
uint16 currentlength;
|
||||
@@ -38,11 +38,11 @@ typedef struct PACKED
|
||||
uint16 maxlength;
|
||||
char name[EC_SOE_MAXNAME];
|
||||
} ec_SoEnamet;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** SoE list structure */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
/** current length in bytes of list */
|
||||
uint16 currentlength;
|
||||
@@ -56,11 +56,11 @@ typedef struct PACKED
|
||||
uint64 lword[1];
|
||||
};
|
||||
} ec_SoElistt;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** SoE IDN mapping structure */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
/** current length in bytes of list */
|
||||
uint16 currentlength;
|
||||
@@ -68,7 +68,7 @@ typedef struct PACKED
|
||||
uint16 maxlength;
|
||||
uint16 idn[EC_SOE_MAXMAPPING];
|
||||
} ec_SoEmappingt;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
#define EC_SOE_LENGTH_1 0x00
|
||||
#define EC_SOE_LENGTH_2 0x01
|
||||
@@ -84,8 +84,8 @@ PACKED_END
|
||||
#define EC_SOE_TYPE_PARAMETER 0x07
|
||||
|
||||
/** SoE attribute structure */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
/** evaluation factor for display purposes */
|
||||
uint32 evafactor : 16;
|
||||
@@ -108,7 +108,7 @@ typedef struct PACKED
|
||||
uint32 wpop : 1;
|
||||
uint32 reserved2 : 1;
|
||||
} ec_SoEattributet;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
int ecx_SoEread(ecx_contextt *context, uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int *psize, void *p, int timeout);
|
||||
int ecx_SoEwrite(ecx_contextt *context, uint16 slave, uint8 driveNo, uint8 elementflags, uint16 idn, int psize, void *p, int timeout);
|
||||
|
||||
@@ -62,8 +62,8 @@ extern "C" {
|
||||
typedef uint8 ec_bufT[EC_BUFSIZE];
|
||||
|
||||
/** ethernet header definition */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
/** destination MAC */
|
||||
uint16 da0, da1, da2;
|
||||
@@ -72,14 +72,14 @@ typedef struct PACKED
|
||||
/** ethernet type */
|
||||
uint16 etype;
|
||||
} ec_etherheadert;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** ethernet header size */
|
||||
#define ETH_HEADERSIZE sizeof(ec_etherheadert)
|
||||
|
||||
/** EtherCAT datagram header definition */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
/** length of EtherCAT datagram */
|
||||
uint16 elength;
|
||||
@@ -96,7 +96,7 @@ typedef struct PACKED
|
||||
/** interrupt, currently unused */
|
||||
uint16 irpt;
|
||||
} ec_comt;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** EtherCAT header size */
|
||||
#define EC_HEADERSIZE sizeof(ec_comt)
|
||||
|
||||
@@ -25,10 +25,10 @@ extern "C" {
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef PACKED
|
||||
#define PACKED_BEGIN
|
||||
#define PACKED __attribute__((__packed__))
|
||||
#define PACKED_END
|
||||
#ifndef OSAL_PACKED
|
||||
#define OSAL_PACKED_BEGIN
|
||||
#define OSAL_PACKED __attribute__((__packed__))
|
||||
#define OSAL_PACKED_END
|
||||
#endif
|
||||
|
||||
#define ec_timet struct timespec
|
||||
|
||||
@@ -24,10 +24,10 @@ extern "C" {
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef PACKED
|
||||
#define PACKED_BEGIN
|
||||
#define PACKED __attribute__((__packed__))
|
||||
#define PACKED_END
|
||||
#ifndef OSAL_PACKED
|
||||
#define OSAL_PACKED_BEGIN
|
||||
#define OSAL_PACKED __attribute__((__packed__))
|
||||
#define OSAL_PACKED_END
|
||||
#endif
|
||||
|
||||
#define ec_timet struct timespec
|
||||
|
||||
@@ -25,14 +25,14 @@ extern "C" {
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef PACKED
|
||||
#define PACKED
|
||||
#ifndef OSAL_PACKED
|
||||
#define OSAL_PACKED
|
||||
#ifdef __GNUC__
|
||||
#define PACKED_BEGIN _Pragma("pack(push,1)")
|
||||
#define PACKED_END _Pragma("pack(pop)")
|
||||
#define OSAL_PACKED_BEGIN _Pragma("pack(push,1)")
|
||||
#define OSAL_PACKED_END _Pragma("pack(pop)")
|
||||
#else
|
||||
#define PACKED_BEGIN __pragma(pack(push, 1))
|
||||
#define PACKED_END __pragma(pack(pop))
|
||||
#define OSAL_PACKED_BEGIN __pragma(pack(push, 1))
|
||||
#define OSAL_PACKED_END __pragma(pack(pop))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
12
src/ec_coe.c
12
src/ec_coe.c
@@ -17,8 +17,8 @@
|
||||
#include "oshw.h"
|
||||
|
||||
/** SDO structure, not to be confused with EcSDOserviceT */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
ec_mbxheadert MbxHeader;
|
||||
uint16 CANOpen;
|
||||
@@ -32,11 +32,11 @@ typedef struct PACKED
|
||||
uint32 ldata[0x80];
|
||||
};
|
||||
} ec_SDOt;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** SDO service structure */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
ec_mbxheadert MbxHeader;
|
||||
uint16 CANOpen;
|
||||
@@ -50,7 +50,7 @@ typedef struct PACKED
|
||||
uint32 ldata[0x80];
|
||||
};
|
||||
} ec_SDOservicet;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** Report SDO error.
|
||||
*
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
/** FOE structure.
|
||||
* Used for Read, Write, Data, Ack and Error mailbox packets.
|
||||
*/
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
ec_mbxheadert MbxHeader;
|
||||
uint8 OpCode;
|
||||
@@ -46,7 +46,7 @@ typedef struct PACKED
|
||||
char ErrorText[EC_MAXFOEDATA];
|
||||
};
|
||||
} ec_FOEt;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** FoE progress hook.
|
||||
*
|
||||
|
||||
@@ -25,28 +25,28 @@
|
||||
#define EC_LOCALDELAY 200
|
||||
|
||||
/** record for ethercat eeprom communications */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
uint16 comm;
|
||||
uint16 addr;
|
||||
uint16 d2;
|
||||
} ec_eepromt;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** mailbox error structure */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
ec_mbxheadert MbxHeader;
|
||||
uint16 Type;
|
||||
uint16 Detail;
|
||||
} ec_mbxerrort;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** emergency request structure */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
ec_mbxheadert MbxHeader;
|
||||
uint16 CANOpen;
|
||||
@@ -55,7 +55,7 @@ typedef struct PACKED
|
||||
uint8 bData;
|
||||
uint16 w1, w2;
|
||||
} ec_emcyt;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** Create list over available network adapters.
|
||||
*
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#define EC_SOE_MAX_DRIVES 8
|
||||
|
||||
/** SoE (Servo over EtherCAT) mailbox structure */
|
||||
PACKED_BEGIN
|
||||
typedef struct PACKED
|
||||
OSAL_PACKED_BEGIN
|
||||
typedef struct OSAL_PACKED
|
||||
{
|
||||
ec_mbxheadert MbxHeader;
|
||||
uint8 opCode : 3;
|
||||
@@ -32,7 +32,7 @@ typedef struct PACKED
|
||||
uint16 fragmentsleft;
|
||||
};
|
||||
} ec_SoEt;
|
||||
PACKED_END
|
||||
OSAL_PACKED_END
|
||||
|
||||
/** Report SoE error.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user