mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Give 5g owner's some immediate relief from playback trouble introduced in r16105 without reverting all the "spinlock" changes. A highly localized version of the patches in FS#8568. More permanent and correct measures are being worked out.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16367 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
fcd6cf24a2
commit
766587e3cb
1 changed files with 47 additions and 0 deletions
|
@ -93,6 +93,53 @@ static int multisectors; /* number of supported multisectors */
|
|||
static unsigned short identify_info[SECTOR_SIZE/2];
|
||||
|
||||
#ifdef MAX_PHYS_SECTOR_SIZE
|
||||
|
||||
/** This is temporary **/
|
||||
/* Define the mutex functions to use the special hack object */
|
||||
#define mutex_init ata_spin_init
|
||||
#define mutex_lock ata_spin_lock
|
||||
#define mutex_unlock ata_spin_unlock
|
||||
|
||||
void ata_spin_init(struct mutex *m)
|
||||
{
|
||||
m->thread = NULL;
|
||||
m->locked = 0;
|
||||
m->count = 0;
|
||||
#if CONFIG_CORELOCK == SW_CORELOCK
|
||||
corelock_init(&m->cl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ata_spin_lock(struct mutex *m)
|
||||
{
|
||||
struct thread_entry *current = thread_get_current();
|
||||
|
||||
if (current == m->thread)
|
||||
{
|
||||
m->count++;
|
||||
return;
|
||||
}
|
||||
|
||||
while (test_and_set(&m->locked, 1, &m->cl))
|
||||
yield();
|
||||
|
||||
m->thread = current;
|
||||
}
|
||||
|
||||
void ata_spin_unlock(struct mutex *m)
|
||||
{
|
||||
if (m->count > 0)
|
||||
{
|
||||
m->count--;
|
||||
return;
|
||||
}
|
||||
|
||||
m->thread = NULL;
|
||||
test_and_set(&m->locked, 0, &m->cl);
|
||||
}
|
||||
|
||||
/****/
|
||||
|
||||
struct sector_cache_entry {
|
||||
bool inuse;
|
||||
unsigned long sectornum; /* logical sector */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue