Introduce platform-specific EC_PRINT

Rationale: not all operating systems use function printf for printing
console messages. This commits allows to define platform-specific
functions.
This commit is contained in:
Claudio Scordino 2019-01-29 11:58:16 +01:00
parent 826be99bab
commit 26cde1dc94
7 changed files with 54 additions and 8 deletions

View File

@ -11,6 +11,15 @@ extern "C"
{ {
#endif #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 #ifndef PACKED
#ifdef _MSC_VER #ifdef _MSC_VER
#define PACKED_BEGIN __pragma(pack(push, 1)) #define PACKED_BEGIN __pragma(pack(push, 1))

View File

@ -11,6 +11,15 @@ extern "C"
{ {
#endif #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 #ifndef PACKED
#define PACKED_BEGIN #define PACKED_BEGIN
#define PACKED __attribute__((__packed__)) #define PACKED __attribute__((__packed__))

View File

@ -11,6 +11,15 @@ extern "C"
{ {
#endif #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 #ifndef PACKED
#define PACKED_BEGIN #define PACKED_BEGIN
#define PACKED __attribute__((__packed__)) #define PACKED __attribute__((__packed__))

View File

@ -11,6 +11,15 @@ extern "C"
{ {
#endif #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 #ifndef PACKED
#define PACKED_BEGIN #define PACKED_BEGIN
#define PACKED __attribute__((__packed__)) #define PACKED __attribute__((__packed__))

View File

@ -6,6 +6,15 @@
#ifndef _osal_defs_ #ifndef _osal_defs_
#define _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 #ifndef PACKED
#define PACKED_BEGIN #define PACKED_BEGIN
#define PACKED __attribute__((__packed__)) #define PACKED __attribute__((__packed__))

View File

@ -11,6 +11,15 @@ extern "C"
{ {
#endif #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 #ifndef PACKED
#define PACKED_BEGIN __pragma(pack(push, 1)) #define PACKED_BEGIN __pragma(pack(push, 1))
#define PACKED #define PACKED

View File

@ -22,14 +22,6 @@
#include "ethercatsoe.h" #include "ethercatsoe.h"
#include "ethercatconfig.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 typedef struct
{ {