video stuff moved out as it's project specific..
#include <unistd.h>
#include "../input.h"
+#include "soc.h"
+#include "plat_gp2x.h"
#include "in_gp2x.h"
#define IN_GP2X_PREFIX "gp2x:"
static int in_gp2x_get_mmsp2_bits(void)
{
- extern volatile unsigned short *gp2x_memregs;
int value;
- value = gp2x_memregs[0x1198>>1] & 0xff; // GPIO M
+ value = memregs[0x1198>>1] & 0xff; // GPIO M
if (value == 0xFD) value = 0xFA;
if (value == 0xF7) value = 0xEB;
if (value == 0xDF) value = 0xAF;
if (value == 0x7F) value = 0xBE;
- value |= gp2x_memregs[0x1184>>1] & 0xFF00; // GPIO C
- value |= gp2x_memregs[0x1186>>1] << 16; // GPIO D
+ value |= memregs[0x1184>>1] & 0xFF00; // GPIO C
+ value |= memregs[0x1186>>1] << 16; // GPIO D
value = ~value & 0x08c0ff55;
return value;
return value;
}
-#ifdef FAKE_IN_GP2X
-volatile unsigned short *gp2x_memregs;
-int gp2x_dev_id = -1;
-
-static int in_gp2x_get_fake_bits(void)
-{
- extern int current_keys;
- return current_keys;
-}
-#endif
-
static void in_gp2x_probe(void)
{
switch (gp2x_dev_id)
break;
// we'll use evdev for Caanoo
default:
-#ifdef FAKE_IN_GP2X
- in_gp2x_get_bits = in_gp2x_get_fake_bits;
- break;
-#endif
return;
}
--- /dev/null
+/*
+ * (C) notaz, 2013
+ *
+ * This work is licensed under the terms of any of these licenses
+ * (at your option):
+ * - GNU GPL, version 2 or later.
+ * - GNU LGPL, version 2.1 or later.
+ * - MAME license.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <linux/input.h>
+#include <errno.h>
+
+#include "../plat.h"
+#include "../input.h"
+#include "plat_gp2x.h"
+#include "soc.h"
+
+int default_cpu_clock;
+int gp2x_dev_id;
+
+static const char * const caanoo_keys[KEY_MAX + 1] = {
+ [0 ... KEY_MAX] = NULL,
+ [KEY_UP] = "Up",
+ [KEY_LEFT] = "Left",
+ [KEY_RIGHT] = "Right",
+ [KEY_DOWN] = "Down",
+ [BTN_TRIGGER] = "A",
+ [BTN_THUMB] = "X",
+ [BTN_THUMB2] = "B",
+ [BTN_TOP] = "Y",
+ [BTN_TOP2] = "L",
+ [BTN_PINKIE] = "R",
+ [BTN_BASE] = "Home",
+ [BTN_BASE2] = "Lock",
+ [BTN_BASE3] = "I",
+ [BTN_BASE4] = "II",
+ [BTN_BASE5] = "Push",
+};
+
+/* to be filled by mmsp2/pollux _init */
+struct plat_target plat_target;
+
+int plat_target_init(void)
+{
+ gp2x_soc_t soc;
+ FILE *f;
+
+ soc = soc_detect();
+ switch (soc)
+ {
+ case SOCID_MMSP2:
+ mmsp2_init();
+ default_cpu_clock = 200;
+ gp2x_dev_id = GP2X_DEV_GP2X;
+ break;
+ case SOCID_POLLUX:
+ pollux_init();
+ default_cpu_clock = 533;
+ f = fopen("/dev/accel", "rb");
+ if (f) {
+ printf("detected Caanoo\n");
+ gp2x_dev_id = GP2X_DEV_CAANOO;
+ fclose(f);
+ }
+ else {
+ printf("detected Wiz\n");
+ gp2x_dev_id = GP2X_DEV_WIZ;
+ }
+ break;
+ default:
+ printf("could not recognize SoC.\n");
+ break;
+ }
+
+ return 0;
+}
+
+/* to be called after in_probe */
+void plat_target_setup_input(void)
+{
+ if (gp2x_dev_id == GP2X_DEV_CAANOO)
+ in_set_config(in_name_to_id("evdev:pollux-analog"),
+ IN_CFG_KEY_NAMES,
+ caanoo_keys, sizeof(caanoo_keys));
+}
+
+void plat_target_finish(void)
+{
+ gp2x_soc_t soc;
+
+ soc = soc_detect();
+ switch (soc)
+ {
+ case SOCID_MMSP2:
+ mmsp2_finish();
+ break;
+ case SOCID_POLLUX:
+ pollux_finish();
+ break;
+ default:
+ break;
+ }
+}
extern int default_cpu_clock;
-/* video */
-void gp2x_video_changemode(int bpp);
-void gp2x_memcpy_all_buffers(void *data, int offset, int len);
-void gp2x_memset_all_buffers(int offset, int byte, int len);
-void gp2x_make_fb_bufferable(int yes);
-
-/* input */
-int gp2x_touchpad_read(int *x, int *y);
-
/* misc */
enum {
GP2X_DEV_GP2X = 1,
GP2X_DEV_CAANOO,
};
extern int gp2x_dev_id;
-extern int gp2x_current_bpp;
unsigned int plat_get_ticks_ms_good(void);
unsigned int plat_get_ticks_us_good(void);
-void gp2x_menu_init(void);
-
#endif
#include "soc.h"
-void (*gp2x_video_flip)(void);
-void (*gp2x_video_flip2)(void);
-void (*gp2x_video_changemode_ll)(int bpp);
-void (*gp2x_video_setpalette)(int *pal, int len);
-void (*gp2x_video_RGB_setscaling)(int ln_offs, int W, int H);
-void (*gp2x_video_wait_vsync)(void);
-
-void (*gp2x_set_cpuclk)(unsigned int mhz);
-
-void (*set_lcd_custom_rate)(int is_pal);
-void (*unset_lcd_custom_rate)(void);
-void (*set_lcd_gamma)(int g100, int A_SNs_curve);
-
-void (*set_ram_timings)(void);
-void (*unset_ram_timings)(void);
-int (*gp2x_read_battery)(void);
+volatile unsigned short *memregs;
+volatile unsigned int *memregl;
+int memdev = -1;
unsigned int (*gp2x_get_ticks_ms)(void);
unsigned int (*gp2x_get_ticks_us)(void);
-
gp2x_soc_t soc_detect(void)
{
volatile unsigned short *memregs;
static gp2x_soc_t ret = -2;
int pollux_chipname[0x30/4 + 1];
char *pollux_chipname_c = (char *)pollux_chipname;
- int memdev;
+ int memdev_tmp;
int i;
if ((int)ret != -2)
/* already detected */
return ret;
- memdev = open("/dev/mem", O_RDONLY);
- if (memdev == -1)
+ memdev_tmp = open("/dev/mem", O_RDONLY);
+ if (memdev_tmp == -1)
{
perror("open(/dev/mem)");
ret = -1;
return -1;
}
- memregs = mmap(0, 0x20000, PROT_READ, MAP_SHARED, memdev, 0xc0000000);
+ memregs = mmap(0, 0x20000, PROT_READ, MAP_SHARED,
+ memdev_tmp, 0xc0000000);
if (memregs == MAP_FAILED)
{
perror("mmap(memregs)");
- close(memdev);
+ close(memdev_tmp);
ret = -1;
return -1;
}
not_pollux_like:
out:
munmap((void *)memregs, 0x20000);
- close(memdev);
+ close(memdev_tmp);
return ret;
}
+
+extern volatile unsigned short *memregs;
+extern volatile unsigned int *memregl;
+extern int memdev;
+
typedef enum {
SOCID_MMSP2 = 1,
SOCID_POLLUX,
void pollux_init(void);
void pollux_finish(void);
-void dummy_init(void);
-void dummy_finish(void);
-
-/* SoC specific functions */
-extern void (*gp2x_video_flip)(void);
-extern void (*gp2x_video_flip2)(void);
-/* negative bpp means rotated mode (for Wiz) */
-extern void (*gp2x_video_changemode_ll)(int bpp);
-extern void (*gp2x_video_setpalette)(int *pal, int len);
-extern void (*gp2x_video_RGB_setscaling)(int ln_offs, int W, int H);
-extern void (*gp2x_video_wait_vsync)(void);
-
-extern void (*gp2x_set_cpuclk)(unsigned int mhz);
-
-extern void (*set_lcd_custom_rate)(int is_pal);
-extern void (*unset_lcd_custom_rate)(void);
-extern void (*set_lcd_gamma)(int g100, int A_SNs_curve);
-
-extern void (*set_ram_timings)(void);
-extern void (*unset_ram_timings)(void);
-extern int (*gp2x_read_battery)(void);
-
/* gettimeofday is not suitable for Wiz, at least fw 1.1 or lower */
extern unsigned int (*gp2x_get_ticks_ms)(void);
extern unsigned int (*gp2x_get_ticks_us)(void);
+++ /dev/null
-/*
- * (C) GraÅžvydas "notaz" Ignotas, 2009,2010
- *
- * This work is licensed under the terms of any of these licenses
- * (at your option):
- * - GNU GPL, version 2 or later.
- * - GNU LGPL, version 2.1 or later.
- * - MAME license.
- * See the COPYING file in the top-level directory.
- */
-
-/* dummy code for qemu testing, etc */
-#include <stdlib.h>
-
-#include "soc.h"
-#include "../emu.h"
-
-extern void *gp2x_screens[4];
-
-extern unsigned int plat_get_ticks_ms_good(void);
-extern unsigned int plat_get_ticks_us_good(void);
-
-/* video stuff */
-static void gp2x_video_flip_(void)
-{
-}
-
-/* doulblebuffered flip */
-static void gp2x_video_flip2_(void)
-{
-}
-
-static void gp2x_video_changemode_ll_(int bpp)
-{
-}
-
-static void gp2x_video_setpalette_(int *pal, int len)
-{
-}
-
-static void gp2x_video_RGB_setscaling_(int ln_offs, int W, int H)
-{
-}
-
-static void gp2x_video_wait_vsync_(void)
-{
-}
-
-/* RAM timings */
-static void set_ram_timings_(void)
-{
-}
-
-static void unset_ram_timings_(void)
-{
-}
-
-/* LCD refresh */
-static void set_lcd_custom_rate_(int is_pal)
-{
-}
-
-static void unset_lcd_custom_rate_(void)
-{
-}
-
-static void set_lcd_gamma_(int g100, int A_SNs_curve)
-{
-}
-
-static int gp2x_read_battery_(void)
-{
- return 0;
-}
-
-void dummy_init(void)
-{
- int i;
- g_screen_ptr = malloc(320 * 240 * 2);
- for (i = 0; i < array_size(gp2x_screens); i++)
- gp2x_screens[i] = g_screen_ptr;
-
- gp2x_video_flip = gp2x_video_flip_;
- gp2x_video_flip2 = gp2x_video_flip2_;
- gp2x_video_changemode_ll = gp2x_video_changemode_ll_;
- gp2x_video_setpalette = gp2x_video_setpalette_;
- gp2x_video_RGB_setscaling = gp2x_video_RGB_setscaling_;
- gp2x_video_wait_vsync = gp2x_video_wait_vsync_;
-
- set_lcd_custom_rate = set_lcd_custom_rate_;
- unset_lcd_custom_rate = unset_lcd_custom_rate_;
- set_lcd_gamma = set_lcd_gamma_;
-
- set_ram_timings = set_ram_timings_;
- unset_ram_timings = unset_ram_timings_;
- gp2x_read_battery = gp2x_read_battery_;
-
- gp2x_get_ticks_ms = plat_get_ticks_ms_good;
- gp2x_get_ticks_us = plat_get_ticks_us_good;
-}
-
-void dummy_finish(void)
-{
- free(gp2x_screens[0]);
-}
-
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
+#include <sys/ioctl.h>
#include <unistd.h>
+#include <linux/soundcard.h>
#include "soc.h"
#include "soc_mmsp2.h"
#include "plat_gp2x.h"
-#include "../emu.h"
#include "../plat.h"
-#include "../arm_utils.h"
-#include "940ctl.h"
-volatile unsigned short *gp2x_memregs;
-volatile unsigned long *gp2x_memregl;
-extern void *gp2x_screens[4];
-static int screensel = 0;
-
-int memdev = -1; /* used by code940 */
+static int mixerdev = -1;
static int touchdev = -1;
static int touchcal[7] = { 6203, 0, -1501397, 0, -4200, 16132680, 65536 };
-#define FRAMEBUFF_SIZE 0x30000
-#define FRAMEBUFF_WHOLESIZE (FRAMEBUFF_SIZE*4) // 320*240*2 + some more
-#define FRAMEBUFF_ADDR0 (0x4000000 - FRAMEBUFF_WHOLESIZE)
-#define FRAMEBUFF_ADDR1 (FRAMEBUFF_ADDR0 + FRAMEBUFF_SIZE)
-#define FRAMEBUFF_ADDR2 (FRAMEBUFF_ADDR1 + FRAMEBUFF_SIZE)
-#define FRAMEBUFF_ADDR3 (FRAMEBUFF_ADDR2 + FRAMEBUFF_SIZE)
-
-static const int gp2x_screenaddrs[4] = { FRAMEBUFF_ADDR0, FRAMEBUFF_ADDR1, FRAMEBUFF_ADDR2, FRAMEBUFF_ADDR3 };
-static int gp2x_screenaddrs_use[4];
-
static char gamma_was_changed = 0;
static char cpuclk_was_changed = 0;
-static unsigned short gp2x_screenaddr_old[4];
static unsigned short memtimex_old[2];
static unsigned short reg0910;
-/* video stuff */
-static void gp2x_video_flip_(void)
-{
- unsigned short lsw = (unsigned short) gp2x_screenaddrs_use[screensel&3];
- unsigned short msw = (unsigned short)(gp2x_screenaddrs_use[screensel&3] >> 16);
-
- gp2x_memregs[0x2910>>1] = msw;
- gp2x_memregs[0x2914>>1] = msw;
- gp2x_memregs[0x290E>>1] = lsw;
- gp2x_memregs[0x2912>>1] = lsw;
-
- // jump to other buffer:
- g_screen_ptr = gp2x_screens[++screensel&3];
-}
-
-/* doulblebuffered flip */
-static void gp2x_video_flip2_(void)
-{
- unsigned short msw = (unsigned short)(gp2x_screenaddrs_use[screensel&1] >> 16);
-
- gp2x_memregs[0x2910>>1] = msw;
- gp2x_memregs[0x2914>>1] = msw;
- gp2x_memregs[0x290E>>1] = 0;
- gp2x_memregs[0x2912>>1] = 0;
-
- // jump to other buffer:
- g_screen_ptr = gp2x_screens[++screensel&1];
-}
-
-static void gp2x_video_changemode_ll_(int bpp)
-{
- gp2x_memregs[0x28DA>>1] = (((bpp+1)/8)<<9)|0xAB; /*8/15/16/24bpp...*/
- gp2x_memregs[0x290C>>1] = 320*((bpp+1)/8); /*line width in bytes*/
-}
-
-static void gp2x_video_setpalette_(int *pal, int len)
-{
- unsigned short *g = (unsigned short *)pal;
- volatile unsigned short *memreg = &gp2x_memregs[0x295A>>1];
-
- gp2x_memregs[0x2958>>1] = 0;
-
- len *= 2;
- while (len--)
- *memreg = *g++;
-}
-
-static void gp2x_video_RGB_setscaling_(int ln_offs, int W, int H)
-{
- float escalaw, escalah;
- int bpp = (gp2x_memregs[0x28DA>>1]>>9)&0x3;
- unsigned short scalw;
-
- // set offset
- gp2x_screenaddrs_use[0] = gp2x_screenaddrs[0] + ln_offs * 320 * bpp;
- gp2x_screenaddrs_use[1] = gp2x_screenaddrs[1] + ln_offs * 320 * bpp;
- gp2x_screenaddrs_use[2] = gp2x_screenaddrs[2] + ln_offs * 320 * bpp;
- gp2x_screenaddrs_use[3] = gp2x_screenaddrs[3] + ln_offs * 320 * bpp;
-
- escalaw = 1024.0; // RGB Horiz LCD
- escalah = 320.0; // RGB Vert LCD
-
- if (gp2x_memregs[0x2800>>1]&0x100) //TV-Out
- {
- escalaw=489.0; // RGB Horiz TV (PAL, NTSC)
- if (gp2x_memregs[0x2818>>1] == 287) //PAL
- escalah=274.0; // RGB Vert TV PAL
- else if (gp2x_memregs[0x2818>>1] == 239) //NTSC
- escalah=331.0; // RGB Vert TV NTSC
- }
-
- // scale horizontal
- scalw = (unsigned short)((float)escalaw *(W/320.0));
- /* if there is no horizontal scaling, vertical doesn't work.
- * Here is a nasty wrokaround... */
- if (H != 240 && W == 320) scalw--;
- gp2x_memregs[0x2906>>1]=scalw;
- // scale vertical
- gp2x_memregl[0x2908>>2]=(unsigned long)((float)escalah *bpp *(H/240.0));
-}
-
-static void gp2x_video_wait_vsync_(void)
-{
- unsigned short v = gp2x_memregs[0x1182>>1];
- while (!((v ^ gp2x_memregs[0x1182>>1]) & 0x10))
- spend_cycles(1024);
-}
-
/* 940 */
void pause940(int yes)
{
if (yes)
- gp2x_memregs[0x0904>>1] &= 0xFFFE;
+ memregs[0x0904>>1] &= 0xFFFE;
else
- gp2x_memregs[0x0904>>1] |= 1;
+ memregs[0x0904>>1] |= 1;
}
void reset940(int yes, int bank)
{
- gp2x_memregs[0x3B48>>1] = ((yes&1) << 7) | (bank & 0x03);
+ memregs[0x3B48>>1] = ((yes&1) << 7) | (bank & 0x03);
}
/*
#define SYS_CLK_FREQ 7372800
-static void gp2x_set_cpuclk_(unsigned int mhz)
+static int cpu_current_mhz = 200;
+
+static int mmsp2_clock_get(void)
+{
+ // TODO: read the actual value?
+ return cpu_current_mhz;
+}
+
+static int mmsp2_clock_set(int mhz)
{
unsigned int mdiv, pdiv, sdiv = 0;
unsigned int v;
mdiv = (mhz * pdiv * 1000000) / SYS_CLK_FREQ;
if (mdiv & ~0xff) {
fprintf(stderr, "invalid cpuclk MHz: %u\n", mhz);
- return;
+ return -1;
}
v = ((mdiv-8)<<8) | ((pdiv-2)<<2) | sdiv;
- gp2x_memregs[0x910>>1] = v;
+ memregs[0x910>>1] = v;
for (i = 0; i < 10000; i++)
- if (!(gp2x_memregs[0x902>>1] & 1))
+ if (!(memregs[0x902>>1] & 1))
break;
cpuclk_was_changed = 1;
+ cpu_current_mhz = mhz;
+ return 0;
}
/* RAM timings */
if (t & ~mask) \
goto bad
+static __attribute__((noinline)) void spend_cycles(int c)
+{
+ asm volatile(
+ "0: subs %0, %0, #1 ;"
+ "bgt 0b"
+ : "=r" (c) : "0" (c) : "cc");
+}
+
static void set_ram_timing_vals(int tCAS, int tRC, int tRAS, int tWR, int tMRD, int tRFC, int tRP, int tRCD)
{
int i;
/* get spend_cycles() into cache */
spend_cycles(1);
- gp2x_memregs[0x3802>>1] = ((tMRD & 0xF) << 12) | ((tRFC & 0xF) << 8) | ((tRP & 0xF) << 4) | (tRCD & 0xF);
- gp2x_memregs[0x3804>>1] = 0x8000 | ((tCAS & 1) << 12) | ((tRC & 0xF) << 8) | ((tRAS & 0xF) << 4) | (tWR & 0xF);
+ memregs[0x3802>>1] = ((tMRD & 0xF) << 12) | ((tRFC & 0xF) << 8) | ((tRP & 0xF) << 4) | (tRCD & 0xF);
+ memregs[0x3804>>1] = 0x8000 | ((tCAS & 1) << 12) | ((tRC & 0xF) << 8) | ((tRAS & 0xF) << 4) | (tWR & 0xF);
/* be sure we don't access the mem while it's being reprogrammed */
spend_cycles(128*1024);
for (i = 0; i < 8*1024; i++)
- if (!(gp2x_memregs[0x3804>>1] & 0x8000))
+ if (!(memregs[0x3804>>1] & 0x8000))
break;
printf("RAM timings set.\n");
static void unset_ram_timings_(void)
{
- gp2x_memregs[0x3802>>1] = memtimex_old[0];
- gp2x_memregs[0x3804>>1] = memtimex_old[1] | 0x8000;
+ memregs[0x3802>>1] = memtimex_old[0];
+ memregs[0x3804>>1] = memtimex_old[1] | 0x8000;
printf("RAM timings reset to startup values.\n");
}
{
for (; set->reg; set++)
{
- unsigned short val = gp2x_memregs[set->reg >> 1];
+ unsigned short val = memregs[set->reg >> 1];
val &= set->valmask;
set->val = val;
}
{
for (; set->reg; set++)
{
- unsigned short val = gp2x_memregs[set->reg >> 1];
+ unsigned short val = memregs[set->reg >> 1];
val &= ~set->valmask;
val |= set->val;
- gp2x_memregs[set->reg >> 1] = val;
+ memregs[set->reg >> 1] = val;
}
}
-static void set_lcd_custom_rate_(int is_pal)
+static int mmsp2_lcdrate_set(int is_pal)
{
- if (gp2x_memregs[0x2800>>1] & 0x100) // tv-out
- return;
+ if (memregs[0x2800>>1] & 0x100) // tv-out
+ return 0;
printf("setting custom LCD refresh (%d Hz)... ", is_pal ? 100 : 120);
fflush(stdout);
set_reg_setting(is_pal ? lcd_rate_100 : lcd_rate_120);
printf("done.\n");
+ return 0;
}
static void unset_lcd_custom_rate_(void)
static void set_lcd_gamma_(int g100, int A_SNs_curve)
{
- float gamma = (float) g100 / 100;
+ float gamma = (float) g100 / 100.0f;
int i;
gamma = 1 / gamma;
+ if (g100 == 100)
+ A_SNs_curve = 0;
+
/* enable gamma */
- gp2x_memregs[0x2880>>1] &= ~(1<<12);
+ memregs[0x2880>>1] &= ~(1<<12);
- gp2x_memregs[0x295C>>1] = 0;
+ memregs[0x295C>>1] = 0;
for (i = 0; i < 256; i++)
{
unsigned char g;
}
else
{
- blah = i;
+ blah = (double)i;
}
g = (unsigned char)(255.0 * pow(blah/255.0, gamma));
//printf("%d : %d\n", i, g);
s = (g<<8) | g;
- gp2x_memregs[0x295E>>1]= s;
- gp2x_memregs[0x295E>>1]= g;
+ memregs[0x295E>>1]= s;
+ memregs[0x295E>>1]= g;
}
gamma_was_changed = 1;
}
-static int gp2x_read_battery_(void)
+static int mmsp2_gamma_set(int val, int black_level)
{
- return -1; /* TODO? */
+ set_lcd_gamma_(val, 1);
+ return 0;
}
/* these are not quite MMSP2 related,
fclose(f);
}
+static int step_volume(int *volume, int diff)
+{
+ int ret, val;
+
+ if (mixerdev < 0)
+ return -1;
+
+ *volume += diff;
+ if (*volume >= 100)
+ *volume = 100;
+ else if (*volume < 0)
+ *volume = 0;
+
+ val = *volume;
+ val |= val << 8;
+
+ ret = ioctl(mixerdev, SOUND_MIXER_WRITE_PCM, &val);
+ if (ret == -1) {
+ perror("WRITE_PCM");
+ return ret;
+ }
+
+ return 0;
+}
void mmsp2_init(void)
{
- int i;
-
memdev = open("/dev/mem", O_RDWR);
if (memdev == -1)
{
exit(1);
}
- gp2x_memregs = mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0xc0000000);
- if (gp2x_memregs == MAP_FAILED)
+ memregs = mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0xc0000000);
+ if (memregs == MAP_FAILED)
{
perror("mmap(memregs)");
exit(1);
}
- gp2x_memregl = (unsigned long *) gp2x_memregs;
+ memregl = (volatile unsigned int *) memregs;
- gp2x_memregs[0x2880>>1] &= ~0x383; // disable cursor, subpict, osd, video layers
-
- gp2x_screens[0] = mmap(0, FRAMEBUFF_WHOLESIZE, PROT_WRITE, MAP_SHARED,
- memdev, gp2x_screenaddrs[0]);
- if (gp2x_screens[0] == MAP_FAILED)
- {
- perror("mmap(g_screen_ptr)");
- exit(1);
- }
- printf("framebuffers:\n");
- printf(" %08x -> %p\n", gp2x_screenaddrs[0], gp2x_screens[0]);
- for (i = 1; i < 4; i++)
- {
- gp2x_screens[i] = (char *) gp2x_screens[i - 1] + FRAMEBUFF_SIZE;
- printf(" %08x -> %p\n", gp2x_screenaddrs[i], gp2x_screens[i]);
- }
-
- g_screen_ptr = gp2x_screens[0];
- screensel = 0;
-
- gp2x_screenaddr_old[0] = gp2x_memregs[0x290E>>1];
- gp2x_screenaddr_old[1] = gp2x_memregs[0x2910>>1];
- gp2x_screenaddr_old[2] = gp2x_memregs[0x2912>>1];
- gp2x_screenaddr_old[3] = gp2x_memregs[0x2914>>1];
-
- memcpy(gp2x_screenaddrs_use, gp2x_screenaddrs, sizeof(gp2x_screenaddrs));
+ memregs[0x2880>>1] &= ~0x383; // disable cursor, subpict, osd, video layers
/* save startup values: LCD refresh */
get_reg_setting(lcd_rate_defaults);
/* CPU and RAM timings */
- reg0910 = gp2x_memregs[0x0910>>1];
- memtimex_old[0] = gp2x_memregs[0x3802>>1];
- memtimex_old[1] = gp2x_memregs[0x3804>>1];
+ reg0910 = memregs[0x0910>>1];
+ memtimex_old[0] = memregs[0x3802>>1];
+ memtimex_old[1] = memregs[0x3804>>1];
/* touchscreen */
touchdev = open("/dev/touchscreen/wm97xx", O_RDONLY);
proc_set("/proc/sys/vm/max-readahead", "0\n");
proc_set("/proc/sys/vm/min-readahead", "0\n");
- /* code940 portion */
- sharedmem940_init();
-
- gp2x_video_flip = gp2x_video_flip_;
- gp2x_video_flip2 = gp2x_video_flip2_;
- gp2x_video_changemode_ll = gp2x_video_changemode_ll_;
- gp2x_video_setpalette = gp2x_video_setpalette_;
- gp2x_video_RGB_setscaling = gp2x_video_RGB_setscaling_;
- gp2x_video_wait_vsync = gp2x_video_wait_vsync_;
+ mixerdev = open("/dev/mixer", O_RDWR);
+ if (mixerdev == -1)
+ perror("open(/dev/mixer)");
- gp2x_set_cpuclk = gp2x_set_cpuclk_;
+ set_ram_timings_();
- set_lcd_custom_rate = set_lcd_custom_rate_;
- unset_lcd_custom_rate = unset_lcd_custom_rate_;
- set_lcd_gamma = set_lcd_gamma_;
-
- set_ram_timings = set_ram_timings_;
- unset_ram_timings = unset_ram_timings_;
- gp2x_read_battery = gp2x_read_battery_;
+ plat_target.cpu_clock_get = mmsp2_clock_get;
+ plat_target.cpu_clock_set = mmsp2_clock_set;
+ plat_target.lcdrate_set = mmsp2_lcdrate_set;
+ plat_target.gamma_set = mmsp2_gamma_set;
+ plat_target.step_volume = step_volume;
gp2x_get_ticks_ms = plat_get_ticks_ms_good;
gp2x_get_ticks_us = plat_get_ticks_us_good;
{
reset940(1, 3);
pause940(1);
- sharedmem940_finish();
-
- gp2x_video_RGB_setscaling_(0, 320, 240);
- gp2x_video_changemode_ll_(16);
-
- gp2x_memregs[0x290E>>1] = gp2x_screenaddr_old[0];
- gp2x_memregs[0x2910>>1] = gp2x_screenaddr_old[1];
- gp2x_memregs[0x2912>>1] = gp2x_screenaddr_old[2];
- gp2x_memregs[0x2914>>1] = gp2x_screenaddr_old[3];
unset_lcd_custom_rate_();
if (gamma_was_changed)
set_lcd_gamma_(100, 0);
unset_ram_timings_();
if (cpuclk_was_changed)
- gp2x_memregs[0x910>>1] = reg0910;
+ memregs[0x910>>1] = reg0910;
- munmap(gp2x_screens[0], FRAMEBUFF_WHOLESIZE);
- munmap((void *)gp2x_memregs, 0x10000);
+ munmap((void *)memregs, 0x10000);
close(memdev);
if (touchdev >= 0)
close(touchdev);
+ if (mixerdev >= 0)
+ close(mixerdev);
}
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <sys/ioctl.h>
-#include <linux/fb.h>
#include <linux/soundcard.h>
#include "soc.h"
#include "plat_gp2x.h"
#include "../plat.h"
-volatile unsigned short *memregs;
-volatile unsigned int *memregl;
-int memdev = -1;
-int gp2x_dev_id;
-
static int battdev = -1, mixerdev = -1;
static int cpu_clock_allowed;
static unsigned int saved_video_regs[2][6];
+static unsigned int timer_drift; // count per real second
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
-// TODO FIXME: merge
-#if 0
-extern void *gp2x_screens[4];
-
-#define fb_buf_count 4
-static unsigned int fb_paddr[fb_buf_count];
-static int fb_work_buf;
-static int fbdev = -1;
-
-static char cpuclk_was_changed = 0;
-static unsigned short memtimex_old[2];
-static unsigned int pllsetreg0_old;
-static unsigned int timer_drift; // count per real second
-static int last_pal_setting = 0;
-
-
-/* misc */
-static void pollux_set_fromenv(const char *env_var)
-{
- const char *set_string;
- set_string = getenv(env_var);
- if (set_string)
- pollux_set(memregs, set_string);
- else
- printf("env var %s not defined.\n", env_var);
-}
-
-/* video stuff */
-static void pollux_video_flip(int buf_count)
-{
- memregl[0x406C>>2] = fb_paddr[fb_work_buf];
- memregl[0x4058>>2] |= 0x10;
- fb_work_buf++;
- if (fb_work_buf >= buf_count)
- fb_work_buf = 0;
- g_screen_ptr = gp2x_screens[fb_work_buf];
-}
-
-static void gp2x_video_flip_(void)
-{
- pollux_video_flip(fb_buf_count);
-}
-
-/* doulblebuffered flip */
-static void gp2x_video_flip2_(void)
-{
- pollux_video_flip(2);
-}
-
-static void gp2x_video_changemode_ll_(int bpp)
+/* note: both PLLs are programmed the same way,
+ * the databook incorrectly states that PLL1 differs */
+static int decode_pll(unsigned int reg)
{
- static int prev_bpp = 0;
- int code = 0, bytes = 2;
- int rot_cmd[2] = { 0, 0 };
- unsigned int r;
- char buff[32];
- int ret;
-
- if (bpp == prev_bpp)
- return;
- prev_bpp = bpp;
-
- printf("changemode: %dbpp rot=%d\n", abs(bpp), bpp < 0);
-
- /* negative bpp means rotated mode */
- rot_cmd[0] = (bpp < 0) ? 6 : 5;
- ret = ioctl(fbdev, _IOW('D', 90, int[2]), rot_cmd);
- if (ret < 0)
- perror("rot ioctl failed");
- memregl[0x4004>>2] = (bpp < 0) ? 0x013f00ef : 0x00ef013f;
- memregl[0x4000>>2] |= 1 << 3;
-
- /* the above ioctl resets LCD timings, so set them here */
- snprintf(buff, sizeof(buff), "POLLUX_LCD_TIMINGS_%s", last_pal_setting ? "PAL" : "NTSC");
- pollux_set_fromenv(buff);
-
- switch (abs(bpp))
- {
- case 8:
- code = 0x443a;
- bytes = 1;
- break;
-
- case 15:
- case 16:
- code = 0x4432;
- bytes = 2;
- break;
-
- default:
- printf("unhandled bpp request: %d\n", abs(bpp));
- return;
- }
+ long long v;
+ int p, m, s;
- memregl[0x405c>>2] = bytes;
- memregl[0x4060>>2] = bytes * (bpp < 0 ? 240 : 320);
+ p = (reg >> 18) & 0x3f;
+ m = (reg >> 8) & 0x3ff;
+ s = reg & 0xff;
- r = memregl[0x4058>>2];
- r = (r & 0xffff) | (code << 16) | 0x10;
- memregl[0x4058>>2] = r;
-}
+ if (p == 0)
+ p = 1;
-static void gp2x_video_setpalette_(int *pal, int len)
-{
- /* pollux palette is 16bpp only.. */
- int i;
- for (i = 0; i < len; i++)
- {
- int c = pal[i];
- c = ((c >> 8) & 0xf800) | ((c >> 5) & 0x07c0) | ((c >> 3) & 0x001f);
- memregl[0x4070>>2] = (i << 24) | c;
- }
+ v = 27000000; // master clock
+ v = v * m / (p << s);
+ return v;
}
-static void gp2x_video_RGB_setscaling_(int ln_offs, int W, int H)
-{
- /* maybe a job for 3d hardware? */
-}
+#define TIMER_BASE3 0x1980
+#define TIMER_REG(x) memregl[(TIMER_BASE3 + x) >> 2]
-static void gp2x_video_wait_vsync_(void)
+static unsigned int gp2x_get_ticks_us_(void)
{
- while (!(memregl[0x308c>>2] & (1 << 10)))
- spend_cycles(128);
- memregl[0x308c>>2] |= 1 << 10;
+ TIMER_REG(0x08) = 0x4b; /* run timer, latch value */
+ return TIMER_REG(0);
}
-/* CPU clock */
-static void gp2x_set_cpuclk_(unsigned int mhz)
+static unsigned int gp2x_get_ticks_ms_(void)
{
- char buff[24];
- snprintf(buff, sizeof(buff), "cpuclk=%u", mhz);
- pollux_set(memregs, buff);
-
- cpuclk_was_changed = 1;
+ /* approximate /= 1000 */
+ unsigned long long v64;
+ v64 = (unsigned long long)gp2x_get_ticks_us_() * 4294968;
+ return v64 >> 32;
}
-/* RAM timings */
-static void set_ram_timings_(void)
+static void timer_cleanup(void)
{
- pollux_set_fromenv("POLLUX_RAM_TIMINGS");
+ TIMER_REG(0x40) = 0x0c; /* be sure clocks are on */
+ TIMER_REG(0x08) = 0x23; /* stop the timer, clear irq in case it's pending */
+ TIMER_REG(0x00) = 0; /* clear counter */
+ TIMER_REG(0x40) = 0; /* clocks off */
+ TIMER_REG(0x44) = 0; /* dividers back to default */
}
-static void unset_ram_timings_(void)
+static void save_multiple_regs(unsigned int *dest, int base, int count)
{
+ const volatile unsigned int *regs = memregl + base / 4;
int i;
- memregs[0x14802>>1] = memtimex_old[0];
- memregs[0x14804>>1] = memtimex_old[1] | 0x8000;
-
- for (i = 0; i < 0x100000; i++)
- if (!(memregs[0x14804>>1] & 0x8000))
- break;
-
- printf("RAM timings reset to startup values.\n");
-}
-
-/* LCD refresh */
-static void set_lcd_custom_rate_(int is_pal)
-{
- /* just remember PAL/NTSC. We always set timings in _changemode_ll() */
- last_pal_setting = is_pal;
-}
-
-static void unset_lcd_custom_rate_(void)
-{
-}
-
-static void set_lcd_gamma_(int g100, int A_SNs_curve)
-{
- /* hm, the LCD possibly can do it (but not POLLUX) */
-}
-
-static int gp2x_read_battery_(void)
-{
- unsigned short magic_val = 0;
-
- if (battdev < 0)
- return -1;
- if (read(battdev, &magic_val, sizeof(magic_val)) != sizeof(magic_val))
- return -1;
- switch (magic_val) {
- default:
- case 1: return 100;
- case 2: return 66;
- case 3: return 40;
- case 4: return 0;
- }
+ for (i = 0; i < count; i++)
+ dest[i] = regs[i];
}
-#define TIMER_BASE3 0x1980
-#define TIMER_REG(x) memregl[(TIMER_BASE3 + x) >> 2]
-
-static unsigned int gp2x_get_ticks_us_(void)
+static void restore_multiple_regs(int base, const unsigned int *src, int count)
{
- TIMER_REG(0x08) = 0x4b; /* run timer, latch value */
- return TIMER_REG(0);
-}
+ volatile unsigned int *regs = memregl + base / 4;
+ int i;
-static unsigned int gp2x_get_ticks_ms_(void)
-{
- /* approximate /= 1000 */
- unsigned long long v64;
- v64 = (unsigned long long)gp2x_get_ticks_us_() * 4294968;
- return v64 >> 32;
+ for (i = 0; i < count; i++)
+ regs[i] = src[i];
}
int pollux_get_real_snd_rate(int req_rate)
return rate;
}
-void pollux_init(void)
-{
- struct fb_fix_screeninfo fbfix;
- int i, ret, rate, timer_div;
-
- memdev = open("/dev/mem", O_RDWR);
- if (memdev == -1) {
- perror("open(/dev/mem) failed");
- exit(1);
- }
-
- memregs = mmap(0, 0x20000, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0xc0000000);
- if (memregs == MAP_FAILED) {
- perror("mmap(memregs) failed");
- exit(1);
- }
- memregl = (volatile void *)memregs;
-
- fbdev = open("/dev/fb0", O_RDWR);
- if (fbdev < 0) {
- perror("can't open fbdev");
- exit(1);
- }
-
- ret = ioctl(fbdev, FBIOGET_FSCREENINFO, &fbfix);
- if (ret == -1) {
- perror("ioctl(fbdev) failed");
- exit(1);
- }
-
- printf("framebuffer: \"%s\" @ %08lx\n", fbfix.id, fbfix.smem_start);
- fb_paddr[0] = fbfix.smem_start;
-
- gp2x_screens[0] = mmap(0, 320*240*2*fb_buf_count, PROT_READ|PROT_WRITE,
- MAP_SHARED, memdev, fb_paddr[0]);
- if (gp2x_screens[0] == MAP_FAILED)
- {
- perror("mmap(gp2x_screens) failed");
- exit(1);
- }
- memset(gp2x_screens[0], 0, 320*240*2*fb_buf_count);
-
- printf(" %p -> %08x\n", gp2x_screens[0], fb_paddr[0]);
- for (i = 1; i < fb_buf_count; i++)
- {
- fb_paddr[i] = fb_paddr[i-1] + 320*240*2;
- gp2x_screens[i] = (char *)gp2x_screens[i-1] + 320*240*2;
- printf(" %p -> %08x\n", gp2x_screens[i], fb_paddr[i]);
- }
- fb_work_buf = 0;
- g_screen_ptr = gp2x_screens[0];
-
- battdev = open("/dev/pollux_batt", O_RDONLY);
- if (battdev < 0)
- perror("Warning: could't open pollux_batt");
-
- /* find what PLL1 runs at, for the timer */
- rate = decode_pll(memregl[0xf008>>2]);
- printf("PLL1 @ %dHz\n", rate);
-
- /* setup timer */
- timer_div = (rate + 500000) / 1000000;
- if (1 <= timer_div && timer_div <= 256) {
- timer_drift = (rate - (timer_div * 1000000)) / timer_div;
-
- if (TIMER_REG(0x08) & 8) {
- fprintf(stderr, "warning: timer in use, overriding!\n");
- timer_cleanup();
- }
-
- TIMER_REG(0x44) = ((timer_div - 1) << 4) | 2; /* using PLL1, divide by it's rate */
- TIMER_REG(0x40) = 0x0c; /* clocks on */
- TIMER_REG(0x08) = 0x6b; /* run timer, clear irq, latch value */
-
- gp2x_get_ticks_ms = gp2x_get_ticks_ms_;
- gp2x_get_ticks_us = gp2x_get_ticks_us_;
- }
- else {
- fprintf(stderr, "warning: could not make use of timer\n");
-
- // those functions are actually not good at all on Wiz kernel
- gp2x_get_ticks_ms = plat_get_ticks_ms_good;
- gp2x_get_ticks_us = plat_get_ticks_us_good;
- }
-
- pllsetreg0_old = memregl[0xf004>>2];
- memtimex_old[0] = memregs[0x14802>>1];
- memtimex_old[1] = memregs[0x14804>>1];
-
- gp2x_video_flip = gp2x_video_flip_;
- gp2x_video_flip2 = gp2x_video_flip2_;
- gp2x_video_changemode_ll = gp2x_video_changemode_ll_;
- gp2x_video_setpalette = gp2x_video_setpalette_;
- gp2x_video_RGB_setscaling = gp2x_video_RGB_setscaling_;
- gp2x_video_wait_vsync = gp2x_video_wait_vsync_;
-
- /* some firmwares have sys clk on PLL0, we can't adjust CPU clock
- * by reprogramming the PLL0 then, as it overclocks system bus */
- if ((memregl[0xf000>>2] & 0x03000030) == 0x01000000)
- gp2x_set_cpuclk = gp2x_set_cpuclk_;
- else {
- fprintf(stderr, "unexpected PLL config (%08x), overclocking disabled\n",
- memregl[0xf000>>2]);
- gp2x_set_cpuclk = NULL;
- }
-
- set_lcd_custom_rate = set_lcd_custom_rate_;
- unset_lcd_custom_rate = unset_lcd_custom_rate_;
- set_lcd_gamma = set_lcd_gamma_;
-
- set_ram_timings = set_ram_timings_;
- unset_ram_timings = unset_ram_timings_;
- gp2x_read_battery = gp2x_read_battery_;
-}
-
-void pollux_finish(void)
-{
- /* switch to default fb mem, turn portrait off */
- memregl[0x406C>>2] = fb_paddr[0];
- memregl[0x4058>>2] |= 0x10;
- close(fbdev);
-
- gp2x_video_changemode_ll_(16);
- unset_ram_timings_();
- if (cpuclk_was_changed) {
- memregl[0xf004>>2] = pllsetreg0_old;
- memregl[0xf07c>>2] |= 0x8000;
- }
- timer_cleanup();
-
- munmap((void *)memregs, 0x20000);
- close(memdev);
- if (battdev >= 0)
- close(battdev);
-}
-#endif
-
-/* note: both PLLs are programmed the same way,
- * the databook incorrectly states that PLL1 differs */
-static int decode_pll(unsigned int reg)
-{
- long long v;
- int p, m, s;
-
- p = (reg >> 18) & 0x3f;
- m = (reg >> 8) & 0x3ff;
- s = reg & 0xff;
-
- if (p == 0)
- p = 1;
-
- v = 27000000; // master clock
- v = v * m / (p << s);
- return v;
-}
-
-#define TIMER_BASE3 0x1980
-#define TIMER_REG(x) memregl[(TIMER_BASE3 + x) >> 2]
-
-static void timer_cleanup(void)
-{
- TIMER_REG(0x40) = 0x0c; /* be sure clocks are on */
- TIMER_REG(0x08) = 0x23; /* stop the timer, clear irq in case it's pending */
- TIMER_REG(0x00) = 0; /* clear counter */
- TIMER_REG(0x40) = 0; /* clocks off */
- TIMER_REG(0x44) = 0; /* dividers back to default */
-}
-
-static void save_multiple_regs(unsigned int *dest, int base, int count)
-{
- const volatile unsigned int *regs = memregl + base / 4;
- int i;
-
- for (i = 0; i < count; i++)
- dest[i] = regs[i];
-}
-
-static void restore_multiple_regs(int base, const unsigned int *src, int count)
-{
- volatile unsigned int *regs = memregl + base / 4;
- int i;
-
- for (i = 0; i < count; i++)
- regs[i] = src[i];
-}
-
/* newer API */
static int pollux_cpu_clock_get(void)
{
}
}
-static int step_volume(int is_up)
+static int step_volume(int *volume, int diff)
{
- static int volume = 50;
int ret, val;
if (mixerdev < 0)
return -1;
- if (is_up) {
- volume += 5;
- if (volume > 255) volume = 255;
- }
- else {
- volume -= 5;
- if (volume < 0) volume = 0;
- }
- val = volume;
+ *volume += diff;
+ if (*volume > 255)
+ *volume = 255;
+ else if (*volume < 0)
+ *volume = 0;
+
+ val = *volume;
val |= val << 8;
ret = ioctl(mixerdev, SOUND_MIXER_WRITE_PCM, &val);
- if (ret == -1)
+ if (ret == -1) {
perror("WRITE_PCM");
+ return ret;
+ }
- return ret;
+ return 0;
}
-struct plat_target plat_target = {
- pollux_cpu_clock_get,
- pollux_cpu_clock_set,
- pollux_bat_capacity_get,
-
- .step_volume = step_volume,
-};
-
-int plat_target_init(void)
+void pollux_init(void)
{
int rate, timer_div, timer_div2;
- FILE *f;
memdev = open("/dev/mem", O_RDWR);
if (memdev == -1) {
fprintf(stderr, "warning: timer in use, overriding!\n");
timer_cleanup();
}
- if (timer_rate != 1000000)
- fprintf(stderr, "warning: timer drift %d us\n", timer_rate - 1000000);
+ timer_drift = timer_rate - 1000000;
+ if (timer_drift != 0)
+ fprintf(stderr, "warning: timer drift %d us\n",
+ timer_drift);
timer_div2 = (timer_div2 + 3) & 3;
TIMER_REG(0x44) = ((timer_div - 1) << 4) | 2; /* using PLL1 */
TIMER_REG(0x40) = 0x0c; /* clocks on */
TIMER_REG(0x08) = 0x68 | timer_div2; /* run timer, clear irq, latch value */
}
- else
+ else {
fprintf(stderr, "warning: could not make use of timer\n");
+ // those functions are actually not good at all on Wiz kernel
+ gp2x_get_ticks_ms = plat_get_ticks_ms_good;
+ gp2x_get_ticks_us = plat_get_ticks_us_good;
+ }
+
battdev = open("/dev/pollux_batt", O_RDONLY);
if (battdev < 0)
perror("Warning: could't open pollux_batt");
- f = fopen("/dev/accel", "rb");
- if (f) {
- printf("detected Caanoo\n");
- gp2x_dev_id = GP2X_DEV_CAANOO;
- fclose(f);
- }
- else {
- printf("detected Wiz\n");
- gp2x_dev_id = GP2X_DEV_WIZ;
- }
-
mixerdev = open("/dev/mixer", O_RDWR);
if (mixerdev == -1)
perror("open(/dev/mixer)");
- return 0;
-}
+ plat_target.cpu_clock_get = pollux_cpu_clock_get;
+ plat_target.cpu_clock_set = pollux_cpu_clock_set;
+ plat_target.bat_capacity_get = pollux_bat_capacity_get;
+ plat_target.step_volume = step_volume;
-/* to be called after in_probe */
-void plat_target_setup_input(void)
-{
+ gp2x_get_ticks_ms = gp2x_get_ticks_ms_;
+ gp2x_get_ticks_us = gp2x_get_ticks_us_;
}
-void plat_target_finish(void)
+void pollux_finish(void)
{
timer_cleanup();
defbinds = DRV(drv_id).defbinds;
if (defbinds != NULL) {
for (i = 0; ; i++) {
- if (defbinds[i].bit == 0 && defbinds[i].code == 0)
+ if (defbinds[i].bit == 0 && defbinds[i].btype == 0
+ && defbinds[i].bit == 0)
break;
binds[IN_BIND_OFFS(defbinds[i].code, defbinds[i].btype)] =
1 << defbinds[i].bit;
void sndout_oss_stop(void)
{
+#ifdef __GP2X__
+ /* restarting audio on GP2X causes trouble */
+ return;
+#endif
+
if (sounddev < 0)
return;
#define mee_onoff_cust(name, id, var, mask, name_func) \
{ name, MB_OPT_CUSTONOFF, id, &(var), mask, 0, 0, 1, 1, 1, NULL, name_func, NULL, NULL }
+#define mee_range_cust_h(name, id, var, min, max, name_func, help) \
+ { name, MB_OPT_CUSTRANGE, id, &(var), 0, min, max, 1, 1, 1, NULL, name_func, NULL, help }
+
#define mee_range_cust(name, id, var, min, max, name_func) \
- { name, MB_OPT_CUSTRANGE, id, &(var), 0, min, max, 1, 1, 1, NULL, name_func, NULL, NULL }
+ mee_range_cust_h(name, id, var, min, max, name_func, NULL)
#define mee_enum_h(name, id, var, names_list, help) \
{ name, MB_OPT_ENUM, id, &(var), 0, 0, 0, 1, 1, 1, NULL, NULL, names_list, help }
int (*hwfilter_set)(int which);
int (*lcdrate_set)(int is_pal);
int (*gamma_set)(int val, int black_level);
- int (*step_volume)(int is_up);
+ int (*step_volume)(int *volume, int diff);
const char **vout_methods;
int vout_method;
int vout_fullscreen;
}
/* step sound volume up or down */
-static __inline int plat_target_step_volume(int is_up)
+static __inline int plat_target_step_volume(int *volume, int diff)
{
if (plat_target.step_volume)
- return plat_target.step_volume(is_up);
+ return plat_target.step_volume(volume, diff);
return -1;
}