pdbox: Code cleanup

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26274 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Wincent Balin 2010-05-24 23:38:04 +00:00
parent fead75812b
commit 112ad0ac42
2 changed files with 14 additions and 20 deletions

View file

@ -399,7 +399,9 @@ static
#endif #endif
void sched_tick(t_time next_sys_time) void sched_tick(t_time next_sys_time)
{ {
#ifndef ROCKBOX
int countdown = 5000; int countdown = 5000;
#endif
while (clock_setlist && clock_setlist->c_settime < next_sys_time) while (clock_setlist && clock_setlist->c_settime < next_sys_time)
{ {
t_clock *c = clock_setlist; t_clock *c = clock_setlist;
@ -407,13 +409,13 @@ void sched_tick(t_time next_sys_time)
clock_unset(clock_setlist); clock_unset(clock_setlist);
outlet_setstacklim(); outlet_setstacklim();
(*c->c_fn)(c->c_owner); (*c->c_fn)(c->c_owner);
#ifndef ROCKBOX
if (!countdown--) if (!countdown--)
{ {
countdown = 5000; countdown = 5000;
#ifndef ROCKBOX
sys_pollgui(); sys_pollgui();
#endif
} }
#endif
if (sys_quit) if (sys_quit)
return; return;
} }

View file

@ -124,7 +124,7 @@ void gui_thread(void)
/* Core thread */ /* Core thread */
void core_thread(void) void core_thread(void)
{ {
/* Add the directory the called .pd resides in to lib directories. */ /* Add the directory the called .pd file resides in to lib directories. */
sys_findlibdir(filename); sys_findlibdir(filename);
/* Open the PD design file. */ /* Open the PD design file. */
@ -146,7 +146,7 @@ void core_thread(void)
while(sys_send_dacs() != SENDDACS_NO) while(sys_send_dacs() != SENDDACS_NO)
sched_tick(sys_time + sys_time_per_dsp_tick); sched_tick(sys_time + sys_time_per_dsp_tick);
yield(); rb->sleep(1);
} }
rb->thread_exit(); rb->thread_exit();
@ -178,12 +178,8 @@ enum plugin_status plugin_start(const void* parameter)
rb->splash(HZ, "Not enough memory!"); rb->splash(HZ, "Not enough memory!");
return PLUGIN_ERROR; return PLUGIN_ERROR;
} }
#if 1
init_memory_pool(mem_size, mem_pool); init_memory_pool(mem_size, mem_pool);
#endif
#if 0
set_memory_pool(mem_pool, mem_size);
#endif
/* Initialize net. */ /* Initialize net. */
net_init(); net_init();
@ -207,6 +203,12 @@ enum plugin_status plugin_start(const void* parameter)
DEFAULTADVANCE, /* Scheduler advance */ DEFAULTADVANCE, /* Scheduler advance */
1 /* Enable */); 1 /* Enable */);
/* Initialize scheduler time variables. */
sys_time = 0;
sys_time_per_dsp_tick = (TIMEUNITPERSEC) *
((double) sys_schedblocksize) / sys_dacsr;
/* Create stacks for threads. */ /* Create stacks for threads. */
core_stack = getbytes(CORESTACKSIZE); core_stack = getbytes(CORESTACKSIZE);
gui_stack = getbytes(GUISTACKSIZE); gui_stack = getbytes(GUISTACKSIZE);
@ -242,12 +244,6 @@ enum plugin_status plugin_start(const void* parameter)
if(core_thread_id == 0 || gui_thread_id == 0) if(core_thread_id == 0 || gui_thread_id == 0)
return PLUGIN_ERROR; return PLUGIN_ERROR;
/* Initialize scheduler time variables. */
sys_time = 0;
sys_time_per_dsp_tick = (TIMEUNITPERSEC) *
((double) sys_schedblocksize) / sys_dacsr;
/* Main loop. */ /* Main loop. */
while(!quit) while(!quit)
{ {
@ -272,12 +268,8 @@ enum plugin_status plugin_start(const void* parameter)
net_destroy(); net_destroy();
/* Clear memory pool. */ /* Clear memory pool. */
#if 1
destroy_memory_pool(mem_pool); destroy_memory_pool(mem_pool);
#endif
#if 0
clear_memory_pool();
#endif
return PLUGIN_OK; return PLUGIN_OK;
} }