Skip to content

Commit

Permalink
Introduce platform-specific EC_PRINT
Browse files Browse the repository at this point in the history
Rationale: not all operating systems use function printf for printing
console messages. This commits allows to define platform-specific
functions.
  • Loading branch information
Claudio Scordino committed Feb 4, 2019
1 parent 826be99 commit 26cde1d
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 8 deletions.
9 changes: 9 additions & 0 deletions osal/intime/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ extern "C"
{
#endif

// define if debug printf is needed
//#define EC_DEBUG

#ifdef EC_DEBUG
#define EC_PRINT printf
#else
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#ifdef _MSC_VER
#define PACKED_BEGIN __pragma(pack(push, 1))
Expand Down
9 changes: 9 additions & 0 deletions osal/linux/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ extern "C"
{
#endif

// define if debug printf is needed
//#define EC_DEBUG

#ifdef EC_DEBUG
#define EC_PRINT printf
#else
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#define PACKED_BEGIN
#define PACKED __attribute__((__packed__))
Expand Down
9 changes: 9 additions & 0 deletions osal/rtems/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ extern "C"
{
#endif

// define if debug printf is needed
//#define EC_DEBUG

#ifdef EC_DEBUG
#define EC_PRINT printf
#else
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#define PACKED_BEGIN
#define PACKED __attribute__((__packed__))
Expand Down
9 changes: 9 additions & 0 deletions osal/rtk/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ extern "C"
{
#endif

// define if debug printf is needed
//#define EC_DEBUG

#ifdef EC_DEBUG
#define EC_PRINT printf
#else
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#define PACKED_BEGIN
#define PACKED __attribute__((__packed__))
Expand Down
9 changes: 9 additions & 0 deletions osal/vxworks/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
#ifndef _osal_defs_
#define _osal_defs_

// define if debug printf is needed
//#define EC_DEBUG

#ifdef EC_DEBUG
#define EC_PRINT printf
#else
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#define PACKED_BEGIN
#define PACKED __attribute__((__packed__))
Expand Down
9 changes: 9 additions & 0 deletions osal/win32/osal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ extern "C"
{
#endif

// define if debug printf is needed
//#define EC_DEBUG

#ifdef EC_DEBUG
#define EC_PRINT printf
#else
#define EC_PRINT(...) do {} while (0)
#endif

#ifndef PACKED
#define PACKED_BEGIN __pragma(pack(push, 1))
#define PACKED
Expand Down
8 changes: 0 additions & 8 deletions soem/ethercatconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@
#include "ethercatsoe.h"
#include "ethercatconfig.h"

// define if debug printf is needed
//#define EC_DEBUG

#ifdef EC_DEBUG
#define EC_PRINT printf
#else
#define EC_PRINT(...) do {} while (0)
#endif

typedef struct
{
Expand Down

0 comments on commit 26cde1d

Please sign in to comment.