Fix some more straggling stuff

* HWCODEC bootloaders

* Remove references to thread structures outside the kernel. They are
private and should not be used elsewhere. The mrobe-100 is an offender
that gets squashed.

* The ata.c hack stuff for large sector disks on iPod Video gets squashed
for the same reason. I will no longer maintain it, period; please find
the real reason for its difficulties.

Change-Id: Iae1a675beac887754eb3cc59b560c941077523f5
This commit is contained in:
Michael Sevakis 2014-08-08 03:23:29 -04:00
parent 4ea4cdfc11
commit 9a3400a4a6
5 changed files with 7 additions and 88 deletions

View file

@ -79,74 +79,6 @@
static unsigned int ata_thread_id = 0; static unsigned int ata_thread_id = 0;
#endif #endif
#if defined(MAX_PHYS_SECTOR_SIZE) && MEMORYSIZE == 64
/* Hack - what's the deal with 5g? */
struct ata_lock
{
struct thread_entry *thread;
int count;
volatile unsigned char locked;
IF_COP( struct corelock cl; )
};
static void ata_lock_init(struct ata_lock *l)
{
corelock_init(&l->cl);
l->locked = 0;
l->count = 0;
l->thread = NULL;
}
static void ata_lock_lock(struct ata_lock *l)
{
struct thread_entry * const current = thread_self_entry();
if (current == l->thread)
{
l->count++;
return;
}
corelock_lock(&l->cl);
IF_PRIO( current->skip_count = -1; )
while (l->locked != 0)
{
corelock_unlock(&l->cl);
switch_thread();
corelock_lock(&l->cl);
}
l->locked = 1;
l->thread = current;
corelock_unlock(&l->cl);
}
static void ata_lock_unlock(struct ata_lock *l)
{
if (l->count > 0)
{
l->count--;
return;
}
corelock_lock(&l->cl);
IF_PRIO( l->thread->skip_count = 0; )
l->thread = NULL;
l->locked = 0;
corelock_unlock(&l->cl);
}
#define mutex ata_lock
#define mutex_init ata_lock_init
#define mutex_lock ata_lock_lock
#define mutex_unlock ata_lock_unlock
#endif /* MAX_PHYS_SECTOR_SIZE */
#if defined(HAVE_USBSTACK) && defined(USE_ROCKBOX_USB) #if defined(HAVE_USBSTACK) && defined(USE_ROCKBOX_USB)
#define ALLOW_USB_SPINDOWN #define ALLOW_USB_SPINDOWN
#endif #endif

View file

@ -189,10 +189,6 @@ void switch_thread(void)
#include "thread-pp.c" #include "thread-pp.c"
#endif /* CPU_PP */ #endif /* CPU_PP */
#ifndef IF_NO_SKIP_YIELD
#define IF_NO_SKIP_YIELD(...)
#endif
/* /*
* End Processor-specific section * End Processor-specific section
***************************************************************************/ ***************************************************************************/
@ -1014,8 +1010,7 @@ unsigned int wakeup_thread_(struct thread_entry **list
{ {
/* No PIP - just boost the thread by aging */ /* No PIP - just boost the thread by aging */
#ifdef HAVE_PRIORITY_SCHEDULING #ifdef HAVE_PRIORITY_SCHEDULING
IF_NO_SKIP_YIELD( if (thread->skip_count != -1) ) thread->skip_count = thread->priority;
thread->skip_count = thread->priority;
#endif /* HAVE_PRIORITY_SCHEDULING */ #endif /* HAVE_PRIORITY_SCHEDULING */
remove_from_list_l(list, thread); remove_from_list_l(list, thread);
core_schedule_wakeup(thread); core_schedule_wakeup(thread);
@ -1303,9 +1298,8 @@ void switch_thread(void)
#endif #endif
#ifdef HAVE_PRIORITY_SCHEDULING #ifdef HAVE_PRIORITY_SCHEDULING
IF_NO_SKIP_YIELD( if (thread->skip_count != -1) )
/* Reset the value of thread's skip count */ /* Reset the value of thread's skip count */
thread->skip_count = 0; thread->skip_count = 0;
#endif #endif
for (;;) for (;;)
@ -1365,7 +1359,6 @@ void switch_thread(void)
* processes aging; they must give up the processor by going * processes aging; they must give up the processor by going
* off the run list. */ * off the run list. */
if (LIKELY(priority <= max) || if (LIKELY(priority <= max) ||
IF_NO_SKIP_YIELD( thread->skip_count == -1 || )
(priority > PRIORITY_REALTIME && (priority > PRIORITY_REALTIME &&
(diff = priority - max, (diff = priority - max,
++thread->skip_count > diff*diff))) ++thread->skip_count > diff*diff)))

View file

@ -500,14 +500,14 @@ void lcd_remote_off(void)
void lcd_remote_on(void) void lcd_remote_on(void)
{ {
/* Only wake the remote thread if it's in the blocked state. */ if (semaphore_wait(&rc_thread_wakeup, 0) == OBJ_WAIT_TIMEDOUT ||
struct thread_entry *rc_thread = thread_id_entry(remote_thread_id); (rc_status & RC_FORCE_DETECT))
if (rc_thread->state == STATE_BLOCKED || (rc_status & RC_FORCE_DETECT))
{ {
rc_status &= ~RC_FORCE_DETECT; rc_status &= ~RC_FORCE_DETECT;
rc_status &= ~RC_POWER_OFF; rc_status &= ~RC_POWER_OFF;
semaphore_release(&rc_thread_wakeup);
} }
semaphore_release(&rc_thread_wakeup);
} }
bool remote_detect(void) bool remote_detect(void)

View file

@ -21,11 +21,6 @@
* *
****************************************************************************/ ****************************************************************************/
#if defined(MAX_PHYS_SECTOR_SIZE) && MEMORYSIZE == 64
/* Support a special workaround object for large-sector disks */
#define IF_NO_SKIP_YIELD(...) __VA_ARGS__
#endif
#if NUM_CORES == 1 #if NUM_CORES == 1
/* Single-core variants for FORCE_SINGLE_CORE */ /* Single-core variants for FORCE_SINGLE_CORE */
static inline void core_sleep(void) static inline void core_sleep(void)

View file

@ -29,8 +29,7 @@
#include "cpu.h" #include "cpu.h"
#include "system.h" #include "system.h"
#include "lcd.h" #include "lcd.h"
#include "kernel.h" #include "../kernel-internal.h"
#include "thread.h"
#include "storage.h" #include "storage.h"
#include "disk.h" #include "disk.h"
#include "font.h" #include "font.h"