forked from Imagelibrary/rtems
@@ -427,14 +427,8 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
|
|||||||
#if !defined(CONFIGURE_FILESYSTEM_ENTRY_RFS) && \
|
#if !defined(CONFIGURE_FILESYSTEM_ENTRY_RFS) && \
|
||||||
defined(CONFIGURE_FILESYSTEM_RFS)
|
defined(CONFIGURE_FILESYSTEM_RFS)
|
||||||
#include <rtems/rtems-rfs.h>
|
#include <rtems/rtems-rfs.h>
|
||||||
#if !defined(CONFIGURE_MAXIMUM_RFS_MOUNTS)
|
|
||||||
#define CONFIGURE_MAXIMUM_RFS_MOUNTS 1
|
|
||||||
#endif
|
|
||||||
#define CONFIGURE_FILESYSTEM_ENTRY_RFS \
|
#define CONFIGURE_FILESYSTEM_ENTRY_RFS \
|
||||||
{ RTEMS_FILESYSTEM_TYPE_RFS, rtems_rfs_rtems_initialise }
|
{ RTEMS_FILESYSTEM_TYPE_RFS, rtems_rfs_rtems_initialise }
|
||||||
#define _CONFIGURE_SEMAPHORES_FOR_RFS CONFIGURE_MAXIMUM_RFS_MOUNTS
|
|
||||||
#else
|
|
||||||
#define _CONFIGURE_SEMAPHORES_FOR_RFS 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -453,8 +447,7 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
|
|||||||
*/
|
*/
|
||||||
#define _CONFIGURE_SEMAPHORES_FOR_FILE_SYSTEMS \
|
#define _CONFIGURE_SEMAPHORES_FOR_FILE_SYSTEMS \
|
||||||
(_CONFIGURE_SEMAPHORES_FOR_FIFOS + \
|
(_CONFIGURE_SEMAPHORES_FOR_FIFOS + \
|
||||||
_CONFIGURE_SEMAPHORES_FOR_NFS + \
|
_CONFIGURE_SEMAPHORES_FOR_NFS)
|
||||||
_CONFIGURE_SEMAPHORES_FOR_RFS)
|
|
||||||
|
|
||||||
#ifdef CONFIGURE_INIT
|
#ifdef CONFIGURE_INIT
|
||||||
|
|
||||||
|
|||||||
@@ -29,13 +29,14 @@
|
|||||||
#if __rtems__
|
#if __rtems__
|
||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
#include <rtems/error.h>
|
#include <rtems/error.h>
|
||||||
|
#include <rtems/thread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RFS Mutex type.
|
* RFS Mutex type.
|
||||||
*/
|
*/
|
||||||
#if __rtems__
|
#if __rtems__
|
||||||
typedef rtems_id rtems_rfs_mutex;
|
typedef rtems_recursive_mutex rtems_rfs_mutex;
|
||||||
#else
|
#else
|
||||||
typedef uint32_t rtems_rfs_mutex; /* place holder */
|
typedef uint32_t rtems_rfs_mutex; /* place holder */
|
||||||
#endif
|
#endif
|
||||||
@@ -73,16 +74,7 @@ static inline int
|
|||||||
rtems_rfs_mutex_lock (rtems_rfs_mutex* mutex)
|
rtems_rfs_mutex_lock (rtems_rfs_mutex* mutex)
|
||||||
{
|
{
|
||||||
#if __rtems__
|
#if __rtems__
|
||||||
rtems_status_code sc = rtems_semaphore_obtain (*mutex, RTEMS_WAIT, 0);
|
rtems_recursive_mutex_lock(mutex);
|
||||||
if (sc != RTEMS_SUCCESSFUL)
|
|
||||||
{
|
|
||||||
#if RTEMS_RFS_TRACE
|
|
||||||
if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
|
|
||||||
printf ("rtems-rfs: mutex: obtain failed: %s\n",
|
|
||||||
rtems_status_text (sc));
|
|
||||||
#endif
|
|
||||||
return EIO;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -99,16 +91,7 @@ static inline int
|
|||||||
rtems_rfs_mutex_unlock (rtems_rfs_mutex* mutex)
|
rtems_rfs_mutex_unlock (rtems_rfs_mutex* mutex)
|
||||||
{
|
{
|
||||||
#if __rtems__
|
#if __rtems__
|
||||||
rtems_status_code sc = rtems_semaphore_release (*mutex);
|
rtems_recursive_mutex_unlock(mutex);
|
||||||
if (sc != RTEMS_SUCCESSFUL)
|
|
||||||
{
|
|
||||||
#if RTEMS_RFS_TRACE
|
|
||||||
if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
|
|
||||||
printf ("rtems-rfs: mutex: release failed: %s\n",
|
|
||||||
rtems_status_text (sc));
|
|
||||||
#endif
|
|
||||||
return EIO;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,30 +18,11 @@
|
|||||||
|
|
||||||
#include <rtems/rfs/rtems-rfs-mutex.h>
|
#include <rtems/rfs/rtems-rfs-mutex.h>
|
||||||
|
|
||||||
#if __rtems__
|
|
||||||
/**
|
|
||||||
* RTEMS_RFS Mutex Attributes
|
|
||||||
*/
|
|
||||||
#define RTEMS_RFS_MUTEX_ATTRIBS \
|
|
||||||
(RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | \
|
|
||||||
RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
rtems_rfs_mutex_create (rtems_rfs_mutex* mutex)
|
rtems_rfs_mutex_create (rtems_rfs_mutex* mutex)
|
||||||
{
|
{
|
||||||
#if __rtems__
|
#if __rtems__
|
||||||
rtems_status_code sc;
|
rtems_recursive_mutex_init(mutex, "RFS");
|
||||||
sc = rtems_semaphore_create (rtems_build_name ('R', 'F', 'S', 'm'),
|
|
||||||
1, RTEMS_RFS_MUTEX_ATTRIBS, 0,
|
|
||||||
mutex);
|
|
||||||
if (sc != RTEMS_SUCCESSFUL)
|
|
||||||
{
|
|
||||||
if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
|
|
||||||
printf ("rtems-rfs: mutex: open failed: %s\n",
|
|
||||||
rtems_status_text (sc));
|
|
||||||
return EIO;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -50,15 +31,7 @@ int
|
|||||||
rtems_rfs_mutex_destroy (rtems_rfs_mutex* mutex)
|
rtems_rfs_mutex_destroy (rtems_rfs_mutex* mutex)
|
||||||
{
|
{
|
||||||
#if __rtems__
|
#if __rtems__
|
||||||
rtems_status_code sc;
|
rtems_recursive_mutex_destroy(mutex);
|
||||||
sc = rtems_semaphore_delete (*mutex);
|
|
||||||
if (sc != RTEMS_SUCCESSFUL)
|
|
||||||
{
|
|
||||||
if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
|
|
||||||
printf ("rtems-rfs: mutex: close failed: %s\n",
|
|
||||||
rtems_status_text (sc));
|
|
||||||
return EIO;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user