歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

uclinux-2008R1-RC8(bf561)到VDSP5的移植(46):raw_rwlock_t

由於uclinux不支持smp,因此也沒有raw_rwlock_t這樣的定義,為此需要在include/asm/spinlock_types.h中添加此定義:

typedef struct {
     volatile testset_t lock;
} raw_rwlock_t;

#define __RAW_RW_LOCK_UNLOCKED { 0 }

然後在include/asm/spinlock_types.h中添加相關的操作:

static inline void __raw_read_lock(raw_rwlock_t *rw)
{
     adi_acquire_lock(&rw->lock);
}

static inline void __raw_read_unlock(raw_rwlock_t *rw)
{
     adi_release_lock(&rw->lock);
}

static inline void __raw_write_lock(raw_rwlock_t *rw)
{
     adi_acquire_lock(&rw->lock);
}

static inline void __raw_write_unlock(raw_rwlock_t *rw)
{
     adi_release_lock(&rw->lock);
}

Copyright © Linux教程網 All Rights Reserved