GitLab has been upgraded to 13.3.6. If you encounter any issues mail code@riscosopen.org

Commit 2c8ed4d4 authored by Jeffrey Lee's avatar Jeffrey Lee

Fix mutex implementation

Detail:
  c/dwc_common_riscos - Mutex lock/trylock functions had defective logic that would have resulted in them ignoring the lock state of the mutex and claiming it while it was still in use by another thread.
Admin:
  Tested on Raspberry Pi with high processor vectors


Version 0.07. Tagged as 'DWCDriver-0_07'
parent 153b386d
/* (0.06)
/* (0.07)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.06
#define Module_MajorVersion_CMHG 0.07
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 22 Jul 2012
#define Module_Date_CMHG 02 Aug 2012
#define Module_MajorVersion "0.06"
#define Module_Version 6
#define Module_MajorVersion "0.07"
#define Module_Version 7
#define Module_MinorVersion ""
#define Module_Date "22 Jul 2012"
#define Module_Date "02 Aug 2012"
#define Module_ApplicationDate "22-Jul-12"
#define Module_ApplicationDate "02-Aug-12"
#define Module_ComponentName "DWCDriver"
#define Module_ComponentPath "mixed/RiscOS/Sources/HWSupport/USB/Controllers/DWCDriver"
#define Module_FullVersion "0.06"
#define Module_HelpVersion "0.06 (22 Jul 2012)"
#define Module_LibraryVersionInfo "0:6"
#define Module_FullVersion "0.07"
#define Module_HelpVersion "0.07 (02 Aug 2012)"
#define Module_LibraryVersionInfo "0:7"
......@@ -800,7 +800,7 @@ void DWC_MUTEX_FREE(dwc_mutex_t *mutex)
Although this won't guarantee that the mutex is free if multiple threads are waiting */
uint32_t rt_handle = _swi(RT_ReadInfo,_IN(0)|_RETURN(0),RTReadInfo_Handle);
int irqs = ensure_irqs_off();
if(!mutex->pollword && (mutex->rt_handle != rt_handle))
while(!mutex->pollword && (mutex->rt_handle != rt_handle))
{
_swix(RT_Yield,_IN(1),&mutex->pollword);
}
......@@ -812,7 +812,7 @@ void DWC_MUTEX_LOCK(dwc_mutex_t *mutex)
{
uint32_t rt_handle = _swi(RT_ReadInfo,_IN(0)|_RETURN(0),RTReadInfo_Handle);
int irqs = ensure_irqs_off();
if(!mutex->pollword && (mutex->rt_handle == rt_handle))
while(!mutex->pollword && (mutex->rt_handle != rt_handle))
{
_swix(RT_Yield,_IN(1),&mutex->pollword);
}
......@@ -825,7 +825,7 @@ int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex)
{
uint32_t rt_handle = _swi(RT_ReadInfo,_IN(0)|_RETURN(0),RTReadInfo_Handle);
int irqs = ensure_irqs_off();
if(!mutex->pollword && (mutex->rt_handle == rt_handle))
if(!mutex->pollword && (mutex->rt_handle != rt_handle))
{
restore_irqs(irqs);
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment