mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-08-18 17:17:23 +08:00
Moved definition of smp macros to globals.
This commit is contained in:
+1
-1
@@ -174,7 +174,7 @@ int ec_fsm_master_exec(
|
||||
ec_fsm_master_t *fsm /**< Master state machine. */
|
||||
)
|
||||
{
|
||||
ec_datagram_state_t state = smp_load_acquire(&datagram->state);
|
||||
ec_datagram_state_t state = smp_load_acquire(&fsm->datagram->state);
|
||||
|
||||
if (state == EC_DATAGRAM_SENT || state == EC_DATAGRAM_QUEUED) {
|
||||
// datagram was not sent or received yet.
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "../globals.h"
|
||||
#include "../include/ecrt.h"
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
/*****************************************************************************
|
||||
* EtherCAT master
|
||||
****************************************************************************/
|
||||
@@ -252,6 +254,28 @@ extern const char *ec_device_names[2]; // only main and backup!
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Define SMP macros on kernel versions where they did not exist yet.
|
||||
*/
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 47)
|
||||
|
||||
#define smp_store_release(p, v) \
|
||||
do { \
|
||||
smp_mb(); \
|
||||
ACCESS_ONCE(*p) = (v); \
|
||||
} while (0)
|
||||
|
||||
#define smp_load_acquire(p) \
|
||||
({ \
|
||||
typeof(*p) ___p1 = ACCESS_ONCE(*p); \
|
||||
smp_mb(); \
|
||||
___p1; \
|
||||
})
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern char *ec_master_version_str;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -62,23 +62,6 @@
|
||||
rt_mutex_lock_interruptible(lock, 0)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 47)
|
||||
|
||||
#define smp_store_release(p, v) \
|
||||
do { \
|
||||
smp_mb(); \
|
||||
ACCESS_ONCE(*p) = (v); \
|
||||
} while (0)
|
||||
|
||||
#define smp_load_acquire(p) \
|
||||
({ \
|
||||
typeof(*p) ___p1 = ACCESS_ONCE(*p); \
|
||||
smp_mb(); \
|
||||
___p1; \
|
||||
})
|
||||
|
||||
#endif
|
||||
|
||||
#include "master.h"
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user