--- include/asm-generic/hal.h | 10 +++++++++- include/rtdm/rtdm_driver.h | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) Index: xenomai/include/asm-generic/hal.h =================================================================== --- xenomai.orig/include/asm-generic/hal.h +++ xenomai/include/asm-generic/hal.h @@ -135,8 +135,16 @@ typedef rwlock_t rthal_rwlock_t; #define rthal_write_unlock(lock) write_unlock_hw(lock) #define rthal_read_lock(lock) read_lock_hw(lock) #define rthal_read_unlock(lock) read_unlock_hw(lock) + +#ifdef spin_lock_hw +#define rthal_spin_lock_init(lock) spin_lock_init(lock) #define rthal_spin_lock(lock) spin_lock_hw(lock) -#define rthal_spin_unlock(lock) spin_unlock_hw(lock) +#define rthal_spin_unlock(lock) spin_unlock_hw(lock) +#else /* !spin_lock_hw */ +#define rthal_spin_lock_init(lock) *(lock) = IPIPE_SPIN_LOCK_UNLOCKED +#define rthal_spin_lock(lock) spin_lock(lock) +#define rthal_spin_unlock(lock) spin_unlock(lock) +#endif /* !spin_lock_hw */ #define rthal_root_domain ipipe_root_domain #define rthal_current_domain ipipe_current_domain Index: xenomai/include/rtdm/rtdm_driver.h =================================================================== --- xenomai.orig/include/rtdm/rtdm_driver.h +++ xenomai/include/rtdm/rtdm_driver.h @@ -546,10 +546,10 @@ static inline nanosecs_abs_t rtdm_clock_ /** * Static lock initialisation */ -#define RTDM_LOCK_UNLOCKED SPIN_LOCK_UNLOCKED +#define RTDM_LOCK_UNLOCKED RTHAL_SPIN_LOCK_UNLOCKED /** Lock variable */ -typedef spinlock_t rtdm_lock_t; +typedef rthal_spinlock_t rtdm_lock_t; /** Variable to save the context while holding a lock */ typedef unsigned long rtdm_lockctx_t; @@ -569,7 +569,7 @@ typedef unsigned long rtdm * * Rescheduling: never. */ -#define rtdm_lock_init(lock) spin_lock_init(lock) +#define rtdm_lock_init(lock) rthal_spin_lock_init(lock) /** * Acquire lock from non-preemptible contexts