|
@@ -999,6 +999,7 @@ DWORD get_fattime(void)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#if FF_FS_REENTRANT
|
|
#if FF_FS_REENTRANT
|
|
|
|
|
+/* Old FatFs API (R0.14b and earlier) */
|
|
|
int ff_cre_syncobj(BYTE drv, FF_SYNC_t *m)
|
|
int ff_cre_syncobj(BYTE drv, FF_SYNC_t *m)
|
|
|
{
|
|
{
|
|
|
char name[8];
|
|
char name[8];
|
|
@@ -1036,6 +1037,44 @@ void ff_rel_grant(FF_SYNC_t m)
|
|
|
rt_mutex_release(m);
|
|
rt_mutex_release(m);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/* New FatFs API (R0.15 and later) */
|
|
|
|
|
+static rt_mutex_t Mutex[FF_VOLUMES + 1];
|
|
|
|
|
+
|
|
|
|
|
+int ff_mutex_create (int vol)
|
|
|
|
|
+{
|
|
|
|
|
+ char name[8];
|
|
|
|
|
+ rt_mutex_t mutex;
|
|
|
|
|
+
|
|
|
|
|
+ rt_snprintf(name, sizeof(name), "fat%d", vol);
|
|
|
|
|
+ mutex = rt_mutex_create(name, RT_IPC_FLAG_PRIO);
|
|
|
|
|
+ if (mutex != RT_NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ Mutex[vol] = mutex;
|
|
|
|
|
+ return RT_TRUE;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return RT_FALSE;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void ff_mutex_delete (int vol)
|
|
|
|
|
+{
|
|
|
|
|
+ if (Mutex[vol] != RT_NULL)
|
|
|
|
|
+ rt_mutex_delete(Mutex[vol]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+int ff_mutex_take (int vol)
|
|
|
|
|
+{
|
|
|
|
|
+ if (rt_mutex_take(Mutex[vol], FF_FS_TIMEOUT) == RT_EOK)
|
|
|
|
|
+ return RT_TRUE;
|
|
|
|
|
+
|
|
|
|
|
+ return RT_FALSE;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void ff_mutex_give (int vol)
|
|
|
|
|
+{
|
|
|
|
|
+ rt_mutex_release(Mutex[vol]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
/* Memory functions */
|
|
/* Memory functions */
|