gp2x: pollux: various fixes

This commit is contained in:
notaz 2013-10-04 03:15:13 +03:00
parent 9a5a0dc9ff
commit 39014486f9
4 changed files with 17 additions and 9 deletions

View file

@ -24,6 +24,7 @@
#include "soc.h" #include "soc.h"
#include "soc_mmsp2.h" #include "soc_mmsp2.h"
#include "plat_gp2x.h" #include "plat_gp2x.h"
#include "../linux/sndout_oss.h"
#include "../plat.h" #include "../plat.h"
static int mixerdev = -1; static int mixerdev = -1;
@ -429,6 +430,8 @@ void mmsp2_init(void)
gp2x_get_ticks_ms = plat_get_ticks_ms_good; gp2x_get_ticks_ms = plat_get_ticks_ms_good;
gp2x_get_ticks_us = plat_get_ticks_us_good; gp2x_get_ticks_us = plat_get_ticks_us_good;
sndout_oss_can_restart = 0;
} }
void mmsp2_finish(void) void mmsp2_finish(void)

View file

@ -86,7 +86,8 @@ static void unset_ram_timings(void)
static unsigned int gp2x_get_ticks_us_(void) static unsigned int gp2x_get_ticks_us_(void)
{ {
TIMER_REG(0x08) = 0x4b; /* run timer, latch value */ unsigned int div = TIMER_REG(0x08) & 3;
TIMER_REG(0x08) = 0x48 | div; /* run timer, latch value */
return TIMER_REG(0); return TIMER_REG(0);
} }
@ -302,6 +303,9 @@ void pollux_init(void)
TIMER_REG(0x44) = ((timer_div - 1) << 4) | 2; /* using PLL1 */ TIMER_REG(0x44) = ((timer_div - 1) << 4) | 2; /* using PLL1 */
TIMER_REG(0x40) = 0x0c; /* clocks on */ TIMER_REG(0x40) = 0x0c; /* clocks on */
TIMER_REG(0x08) = 0x68 | timer_div2; /* run timer, clear irq, latch value */ TIMER_REG(0x08) = 0x68 | timer_div2; /* run timer, clear irq, latch value */
gp2x_get_ticks_ms = gp2x_get_ticks_ms_;
gp2x_get_ticks_us = gp2x_get_ticks_us_;
} }
else { else {
fprintf(stderr, "warning: could not make use of timer\n"); fprintf(stderr, "warning: could not make use of timer\n");
@ -323,9 +327,6 @@ void pollux_init(void)
plat_target.cpu_clock_set = pollux_cpu_clock_set; plat_target.cpu_clock_set = pollux_cpu_clock_set;
plat_target.bat_capacity_get = pollux_bat_capacity_get; plat_target.bat_capacity_get = pollux_bat_capacity_get;
plat_target.step_volume = step_volume; plat_target.step_volume = step_volume;
gp2x_get_ticks_ms = gp2x_get_ticks_ms_;
gp2x_get_ticks_us = gp2x_get_ticks_us_;
} }
void pollux_finish(void) void pollux_finish(void)

View file

@ -21,6 +21,7 @@
#include "sndout_oss.h" #include "sndout_oss.h"
int sndout_oss_frag_frames = 1; int sndout_oss_frag_frames = 1;
int sndout_oss_can_restart = 1;
static int sounddev = -1, mixerdev = -1; static int sounddev = -1, mixerdev = -1;
static int can_write_safe; static int can_write_safe;
@ -41,15 +42,17 @@ int sndout_oss_init(void)
void sndout_oss_stop(void) void sndout_oss_stop(void)
{ {
#ifdef __GP2X__ /* restarting audio on GP2X causes trouble,
/* restarting audio on GP2X causes trouble */ * not restarting on Caanoo causes trouble */
return; if (!sndout_oss_can_restart)
#endif return;
if (sounddev < 0) if (sounddev < 0)
return; return;
ioctl(sounddev, SOUND_PCM_SYNC, 0); // sync causes trouble on Caanoo..
//ioctl(sounddev, SOUND_PCM_SYNC, 0);
close(sounddev); close(sounddev);
sounddev = -1; sounddev = -1;
} }

View file

@ -10,3 +10,4 @@ void sndout_oss_exit(void);
/* make oss fragment size to fit this much video frames */ /* make oss fragment size to fit this much video frames */
extern int sndout_oss_frag_frames; extern int sndout_oss_frag_frames;
extern int sndout_oss_can_restart;