Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename PACKED macro to SOEM_PACKED to avoid collision with fmtlib #835

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/tutorial.txt
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ set_output_int16(EL4001_1,0,slave_EL4001_1.out1);
Target can handle non aligned pointers to the IOmap
\code

typedef struct PACKED
typedef struct SOEM_PACKED
{
int16 outvalue1;
int16 outvalue2;
Expand Down
8 changes: 3 additions & 5 deletions osal/erika/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ extern "C"
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#define PACKED_BEGIN
#define PACKED __attribute__((__packed__))
#define PACKED_END
#endif
#define SOEM_PACKED_BEGIN
#define SOEM_PACKED __attribute__((__packed__))
#define SOEM_PACKED_END

int osal_gettimeofday(struct timeval *tv, struct timezone *tz);
void *osal_malloc(size_t size);
Expand Down
18 changes: 8 additions & 10 deletions osal/intime/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ extern "C"
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#ifdef _MSC_VER
#define PACKED_BEGIN __pragma(pack(push, 1))
#define PACKED
#define PACKED_END __pragma(pack(pop))
#elif defined(__GNUC__)
#define PACKED_BEGIN
#define PACKED __attribute__((__packed__))
#define PACKED_END
#endif
#ifdef _MSC_VER
#define SOEM_PACKED_BEGIN __pragma(pack(push, 1))
#define SOEM_PACKED
#define SOEM_PACKED_END __pragma(pack(pop))
#elif defined(__GNUC__)
#define SOEM_PACKED_BEGIN
#define SOEM_PACKED __attribute__((__packed__))
#define SOEM_PACKED_END
#endif

#define OSAL_THREAD_HANDLE RTHANDLE
Expand Down
8 changes: 3 additions & 5 deletions osal/linux/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ extern "C"
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#define PACKED_BEGIN
#define PACKED __attribute__((__packed__))
#define PACKED_END
#endif
#define SOEM_PACKED_BEGIN
#define SOEM_PACKED __attribute__((__packed__))
#define SOEM_PACKED_END

#include <pthread.h>
#define OSAL_THREAD_HANDLE pthread_t *
Expand Down
8 changes: 3 additions & 5 deletions osal/macosx/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ extern "C"
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#define PACKED_BEGIN
#define PACKED __attribute__((__packed__))
#define PACKED_END
#endif
#define SOEM_PACKED_BEGIN
#define SOEM_PACKED __attribute__((__packed__))
#define SOEM_PACKED_END

#include <pthread.h>
#define OSAL_THREAD_HANDLE pthread_t *
Expand Down
8 changes: 3 additions & 5 deletions osal/rtems/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ extern "C"
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#define PACKED_BEGIN
#define PACKED __attribute__((__packed__))
#define PACKED_END
#endif
#define SOEM_PACKED_BEGIN
#define SOEM_PACKED __attribute__((__packed__))
#define SOEM_PACKED_END

#include <pthread.h>
#define OSAL_THREAD_HANDLE pthread_t *
Expand Down
8 changes: 3 additions & 5 deletions osal/rtk/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ extern "C"
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#define PACKED_BEGIN
#define PACKED __attribute__((__packed__))
#define PACKED_END
#endif
#define SOEM_PACKED_BEGIN
#define SOEM_PACKED __attribute__((__packed__))
#define SOEM_PACKED_END

#define OSAL_THREAD_HANDLE task_t *
#define OSAL_THREAD_FUNC void
Expand Down
8 changes: 3 additions & 5 deletions osal/vxworks/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#define PACKED_BEGIN
#define PACKED __attribute__((__packed__))
#define PACKED_END
#endif
#define SOEM_PACKED_BEGIN
#define SOEM_PACKED __attribute__((__packed__))
#define SOEM_PACKED_END

#define OSAL_THREAD_HANDLE TASK_ID
#define OSAL_THREAD_FUNC void
Expand Down
8 changes: 3 additions & 5 deletions osal/win32/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ extern "C"
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#define PACKED_BEGIN __pragma(pack(push, 1))
#define PACKED
#define PACKED_END __pragma(pack(pop))
#endif
#define SOEM_PACKED_BEGIN __pragma(pack(push, 1))
#define SOEM_PACKED
#define SOEM_PACKED_END __pragma(pack(pop))

#define OSAL_THREAD_HANDLE HANDLE
#define OSAL_THREAD_FUNC void
Expand Down
12 changes: 6 additions & 6 deletions soem/ethercatcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "ethercatcoe.h"

/** SDO structure, not to be confused with EcSDOserviceT */
PACKED_BEGIN
typedef struct PACKED
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED
{
ec_mbxheadert MbxHeader;
uint16 CANOpen;
Expand All @@ -35,11 +35,11 @@ typedef struct PACKED
uint32 ldata[0x80];
};
} ec_SDOt;
PACKED_END
SOEM_PACKED_END

/** SDO service structure */
PACKED_BEGIN
typedef struct PACKED
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED
{
ec_mbxheadert MbxHeader;
uint16 CANOpen;
Expand All @@ -53,7 +53,7 @@ typedef struct PACKED
uint32 ldata[0x80];
};
} ec_SDOservicet;
PACKED_END
SOEM_PACKED_END

/** Report SDO error.
*
Expand Down
12 changes: 6 additions & 6 deletions soem/ethercateoe.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ typedef struct eoe_ip4_addr {
}eoe_ip4_addr_t;

/** EOE ethernet address */
PACKED_BEGIN
typedef struct PACKED eoe_ethaddr
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED eoe_ethaddr
{
uint8_t addr[EOE_ETHADDR_LENGTH];
} eoe_ethaddr_t;
PACKED_END
SOEM_PACKED_END

/** EoE IP request structure, storage only, no need to pack */
typedef struct eoe_param
Expand All @@ -160,8 +160,8 @@ typedef struct eoe_param
/** EOE structure.
* Used to interpret EoE mailbox packets.
*/
PACKED_BEGIN
typedef struct PACKED
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED
{
ec_mbxheadert mbxheader;
uint16_t frameinfo1;
Expand All @@ -172,7 +172,7 @@ typedef struct PACKED
};
uint8 data[EC_MAXEOEDATA];
} ec_EOEt;
PACKED_END
SOEM_PACKED_END

int ecx_EOEdefinehook(ecx_contextt *context, void *hook);
int ecx_EOEsetIp(ecx_contextt *context,
Expand Down
6 changes: 3 additions & 3 deletions soem/ethercatfoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
/** FOE structure.
* Used for Read, Write, Data, Ack and Error mailbox packets.
*/
PACKED_BEGIN
typedef struct PACKED
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED
{
ec_mbxheadert MbxHeader;
uint8 OpCode;
Expand All @@ -43,7 +43,7 @@ typedef struct PACKED
char ErrorText[EC_MAXFOEDATA];
};
} ec_FOEt;
PACKED_END
SOEM_PACKED_END

/** FoE progress hook.
*
Expand Down
18 changes: 9 additions & 9 deletions soem/ethercatmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,28 @@
#define EC_LOCALDELAY 200

/** record for ethercat eeprom communications */
PACKED_BEGIN
typedef struct PACKED
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED
{
uint16 comm;
uint16 addr;
uint16 d2;
} ec_eepromt;
PACKED_END
SOEM_PACKED_END

/** mailbox error structure */
PACKED_BEGIN
typedef struct PACKED
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED
{
ec_mbxheadert MbxHeader;
uint16 Type;
uint16 Detail;
} ec_mbxerrort;
PACKED_END
SOEM_PACKED_END

/** emergency request structure */
PACKED_BEGIN
typedef struct PACKED
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED
{
ec_mbxheadert MbxHeader;
uint16 CANOpen;
Expand All @@ -56,7 +56,7 @@ typedef struct PACKED
uint8 bData;
uint16 w1,w2;
} ec_emcyt;
PACKED_END
SOEM_PACKED_END

#ifdef EC_VER1
/** Main slave data array.
Expand Down
48 changes: 24 additions & 24 deletions soem/ethercatmain.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ struct ec_adapter
};

/** record for FMMU */
PACKED_BEGIN
typedef struct PACKED ec_fmmu
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED ec_fmmu
{
uint32 LogStart;
uint16 LogLength;
Expand All @@ -63,26 +63,26 @@ typedef struct PACKED ec_fmmu
uint8 unused1;
uint16 unused2;
} ec_fmmut;
PACKED_END
SOEM_PACKED_END

/** record for sync manager */
PACKED_BEGIN
typedef struct PACKED ec_sm
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED ec_sm
{
uint16 StartAddr;
uint16 SMlength;
uint32 SMflags;
} ec_smt;
PACKED_END
SOEM_PACKED_END

PACKED_BEGIN
typedef struct PACKED ec_state_status
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED ec_state_status
{
uint16 State;
uint16 Unused;
uint16 ALstatuscode;
} ec_state_status;
PACKED_END
SOEM_PACKED_END

#define ECT_MBXPROT_AOE 0x0001
#define ECT_MBXPROT_EOE 0x0002
Expand Down Expand Up @@ -312,25 +312,25 @@ typedef struct ec_eepromPDO
typedef uint8 ec_mbxbuft[EC_MAXMBX + 1];

/** standard ethercat mailbox header */
PACKED_BEGIN
typedef struct PACKED ec_mbxheader
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED ec_mbxheader
{
uint16 length;
uint16 address;
uint8 priority;
uint8 mbxtype;
} ec_mbxheadert;
PACKED_END
SOEM_PACKED_END

/** ALstatus and ALstatus code */
PACKED_BEGIN
typedef struct PACKED ec_alstatus
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED ec_alstatus
{
uint16 alstatus;
uint16 unused;
uint16 alstatuscode;
} ec_alstatust;
PACKED_END
SOEM_PACKED_END

/** stack structure to store segmented LRD/LWR/LRW constructs */
typedef struct ec_idxstack
Expand All @@ -352,34 +352,34 @@ typedef struct ec_ering
} ec_eringt;

/** SyncManager Communication Type structure for CA */
PACKED_BEGIN
typedef struct PACKED ec_SMcommtype
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED ec_SMcommtype
{
uint8 n;
uint8 nu1;
uint8 SMtype[EC_MAXSM];
} ec_SMcommtypet;
PACKED_END
SOEM_PACKED_END

/** SDO assign structure for CA */
PACKED_BEGIN
typedef struct PACKED ec_PDOassign
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED ec_PDOassign
{
uint8 n;
uint8 nu1;
uint16 index[256];
} ec_PDOassignt;
PACKED_END
SOEM_PACKED_END

/** SDO description structure for CA */
PACKED_BEGIN
typedef struct PACKED ec_PDOdesc
SOEM_PACKED_BEGIN
typedef struct SOEM_PACKED ec_PDOdesc
{
uint8 n;
uint8 nu1;
uint32 PDO[256];
} ec_PDOdesct;
PACKED_END
SOEM_PACKED_END

/** Context structure , referenced by all ecx functions*/
struct ecx_context
Expand Down
Loading