changeset 1880:f1b7f56dba25

* include/linux/spinlock.h (DEFINE_SPINLOCK): Added. * include/linux/slab.h (vfree): Added vmalloc and vfree which map to malloc and free. * include/linux/rwsem.h: New file. eCos does not have read/write semaphores so these are mapped to normal semaphores.
author asl
date Sat, 22 Jan 2005 16:50:09 +0000
parents d1092abb41a0
children 9558d3d305bf
files packages/compat/linux/current/ChangeLog packages/compat/linux/current/include/linux/rwsem.h packages/compat/linux/current/include/linux/slab.h packages/compat/linux/current/include/linux/spinlock.h
diffstat 4 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/compat/linux/current/ChangeLog
+++ b/packages/compat/linux/current/ChangeLog
@@ -1,3 +1,11 @@
+2005-01-22  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* include/linux/spinlock.h (DEFINE_SPINLOCK): Added.
+	* include/linux/slab.h (vfree): Added vmalloc and vfree which map
+	to malloc and free.
+	* include/linux/rwsem.h: New file. eCos does not have read/write
+	semaphores so these are mapped to normal semaphores.
+	
 2004-08-12  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* include/linux/spinlock.h: Add CYG_UNUSED_PARAM() calls to avoid
new file mode 100644
--- /dev/null
+++ b/packages/compat/linux/current/include/linux/rwsem.h
@@ -0,0 +1,20 @@
+#ifndef __LINUX_RWSEM_H__
+#define __LINUX_RWSEM_H__
+
+// eCos does not have the concept of a read/write semaphore. So just
+// map them onto normal semaphores and hope we don't deadlock
+// somewhere.
+
+#include <asm/semaphore.h>
+
+struct rw_semaphore;
+
+#define down_read(sem) cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem)
+#define down_read_trylock(sem) cyg_drv_mutex_trylock((cyg_drv_mutex_t *)sem)
+#define down_write(sem) cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem)
+#define down_write_trylock(sem) cyg_drv_mutex_trylock((cyg_drv_mutex_t *)sem)
+#define up_read(sem) cyg_drv_mutex_unlock((cyg_drv_mutex_t *)sem)
+#define up_write(sem) cyg_drv_mutex_unlock((cyg_drv_mutex_t *)sem)
+#define downgrade_write(sem) 
+
+#endif // __LINUX_RWSEM_H__ 
--- a/packages/compat/linux/current/include/linux/slab.h
+++ b/packages/compat/linux/current/include/linux/slab.h
@@ -7,6 +7,8 @@
 
 #define kmalloc(x, y) malloc(x)
 #define kfree(x) free(x)
+#define vmalloc(x) malloc(x)
+#define vfree(x) free(x)
 
 #endif /* __LINUX_SLAB_H__ */
 
--- a/packages/compat/linux/current/include/linux/spinlock.h
+++ b/packages/compat/linux/current/include/linux/spinlock.h
@@ -4,6 +4,7 @@
 
 typedef struct { } spinlock_t;
 #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
+#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
 
 #define spin_lock_init(lock)             \
 CYG_MACRO_START;                         \