summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2014-08-08 01:39:29 -0400
committerMichael Sevakis <jethead71@rockbox.org>2014-08-08 01:59:59 -0400
commit981d028c09d10ed867f2f955f58d60b753c64f29 (patch)
tree0dab835a14c5cb3e740be4e46be93c42aec76bc5 /apps
parent53d9f2e6a7564e487bdac87f6e28c662e8407458 (diff)
downloadrockbox-981d028c09d10ed867f2f955f58d60b753c64f29.zip
rockbox-981d028c09d10ed867f2f955f58d60b753c64f29.tar.gz
rockbox-981d028c09d10ed867f2f955f58d60b753c64f29.tar.bz2
rockbox-981d028c09d10ed867f2f955f58d60b753c64f29.tar.xz
Do some kernel cleanup
* Seal away private thread and kernel definitions and declarations into the internal headers in order to better hide internal structure. * Add a thread-common.c file that keeps shared functions together. List functions aren't messed with since that's about to be changed to different ones. * It is necessary to modify some ARM/PP stuff since GCC was complaining about constant pool distance and I would rather not force dump it. Just bl the cache calls in the startup and exit code and let it use veneers if it must. * Clean up redundant #includes in relevant areas and reorganize them. * Expunge useless and dangerous stuff like remove_thread(). Change-Id: I6e22932fad61a9fac30fd1363c071074ee7ab382
Diffstat (limited to 'apps')
-rw-r--r--apps/debug_menu.c68
-rw-r--r--apps/main.c3
2 files changed, 16 insertions, 55 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index bc2a73f..a11cff9 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -133,69 +133,44 @@
#include "talk.h"
-/*---------------------------------------------------*/
-/* SPECIAL DEBUG STUFF */
-/*---------------------------------------------------*/
-extern struct thread_entry threads[MAXTHREADS];
-
-static char thread_status_char(unsigned status)
-{
- static const char thread_status_chars[THREAD_NUM_STATES+1] =
- {
- [0 ... THREAD_NUM_STATES] = '?',
- [STATE_RUNNING] = 'R',
- [STATE_BLOCKED] = 'B',
- [STATE_SLEEPING] = 'S',
- [STATE_BLOCKED_W_TMO] = 'T',
- [STATE_FROZEN] = 'F',
- [STATE_KILLED] = 'K',
- };
-
- if (status > THREAD_NUM_STATES)
- status = THREAD_NUM_STATES;
-
- return thread_status_chars[status];
-}
-
static const char* threads_getname(int selected_item, void *data,
char *buffer, size_t buffer_len)
{
(void)data;
- struct thread_entry *thread;
- char name[32];
#if NUM_CORES > 1
if (selected_item < (int)NUM_CORES)
{
+ struct core_debug_info coreinfo;
+ core_get_debug_info(selected_item, &coreinfo);
snprintf(buffer, buffer_len, "Idle (%d): %2d%%", selected_item,
- idle_stack_usage(selected_item));
+ coreinfo.idle_stack_usage);
return buffer;
}
selected_item -= NUM_CORES;
#endif
- thread = &threads[selected_item];
-
- if (thread->state == STATE_KILLED)
+ struct thread_debug_info threadinfo;
+ if (thread_get_debug_info(selected_item, &threadinfo) <= 0)
{
snprintf(buffer, buffer_len, "%2d: ---", selected_item);
return buffer;
}
- thread_get_name(name, 32, thread);
-
snprintf(buffer, buffer_len,
- "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d %d ") "%2d%% %s",
+ "%2d: " IF_COP("(%d) ") "%s " IF_PRIO("%d %d ") "%2d%% %s",
selected_item,
- IF_COP(thread->core,)
-#ifdef HAVE_SCHEDULER_BOOSTCTRL
- (thread->cpu_boost) ? '+' :
+#if NUM_CORES > 1
+ threadinfo.core,
+#endif
+ threadinfo.statusstr,
+#ifdef HAVE_PRIORITY_SCHEDULING
+ threadinfo.base_priority,
+ threadinfo.current_priority,
#endif
- ((thread->state == STATE_RUNNING) ? '*' : ' '),
- thread_status_char(thread->state),
- IF_PRIO(thread->base_priority, thread->priority, )
- thread_stack_usage(thread), name);
+ threadinfo.stack_usage,
+ threadinfo.name);
return buffer;
}
@@ -203,19 +178,6 @@ static const char* threads_getname(int selected_item, void *data,
static int dbg_threads_action_callback(int action, struct gui_synclist *lists)
{
(void)lists;
-#ifdef ROCKBOX_HAS_LOGF
- if (action == ACTION_STD_OK)
- {
- int selpos = gui_synclist_get_sel_pos(lists);
-#if NUM_CORES > 1
- if (selpos >= NUM_CORES)
- remove_thread(threads[selpos - NUM_CORES].id);
-#else
- remove_thread(threads[selpos].id);
-#endif
- return ACTION_REDRAW;
- }
-#endif /* ROCKBOX_HAS_LOGF */
if (action == ACTION_NONE)
action = ACTION_REDRAW;
return action;
diff --git a/apps/main.c b/apps/main.c
index 7dc6175..6c6f0d6 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -28,7 +28,7 @@
#include "rtc.h"
#include "debug.h"
#include "led.h"
-#include "kernel.h"
+#include "../kernel-internal.h"
#include "button.h"
#include "tree.h"
#include "filetypes.h"
@@ -44,7 +44,6 @@
#endif
#include "audio.h"
#include "mp3_playback.h"
-#include "thread.h"
#include "settings.h"
#include "backlight.h"
#include "status.h"