mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-29 13:03:36 +01:00
Merge pull request 'Add fx-9860G Slim hardware detection and support to gint' (#18) from calamari/gint-slim:dev into dev
Reviewed-on: https://gitea.planet-casio.com/Lephenixnoir/gint/pulls/18
This commit is contained in:
commit
97701e8eed
10 changed files with 84 additions and 12 deletions
|
@ -135,9 +135,9 @@ typedef struct {
|
|||
is useful for demo/replays that input events without the physical keyboard,
|
||||
and a couple of corner uses like control over USB.
|
||||
|
||||
The keyboard device has built-in event transformations, which modifty the
|
||||
The keyboard device has built-in event transformations, which modify the
|
||||
stream of events by adding information, combining modifiers, and removing
|
||||
undesired events. Because the event transformation reky on the current state
|
||||
undesired events. Because the event transformation rely on the current state
|
||||
of the keyboard, they must be run by the driver whenever events are read, so
|
||||
they are tied to the device.
|
||||
|
||||
|
@ -173,7 +173,7 @@ typedef struct {
|
|||
|
||||
/* Candidate key for repeats (or 0 if no key is candidate yet) */
|
||||
int rep_key;
|
||||
/* Number of repeats alreay sent */
|
||||
/* Number of repeats already sent */
|
||||
int rep_count;
|
||||
/* Time since key was first pressed (us) */
|
||||
int rep_time;
|
||||
|
@ -181,7 +181,7 @@ typedef struct {
|
|||
int rep_delay;
|
||||
|
||||
/* Latest state of keys we are aware of. At every processing step, the
|
||||
different between this and the fresh information is queued and this
|
||||
difference between this and the fresh information is queued and this
|
||||
is updated. state_now is identical to the real state obtained from
|
||||
the device unless earlier events failed to be queued, in which case
|
||||
a difference is maintained so they will be reconsidered later. */
|
||||
|
|
|
@ -45,6 +45,12 @@ void hw_detect(void);
|
|||
#define isSH4() (!isSH3())
|
||||
#endif
|
||||
|
||||
#if defined(FX9860G)
|
||||
#define isSlim() (gint[HWCALC] == HWCALC_FX9860G_SLIM)
|
||||
#else
|
||||
#define isSlim() 0
|
||||
#endif
|
||||
|
||||
#ifdef FXCG50
|
||||
#define isSH3() 0
|
||||
#define isSH4() 1
|
||||
|
@ -105,6 +111,8 @@ void hw_detect(void);
|
|||
#define HWCALC_FXCG50 5
|
||||
/* fx-CG 50 emulator, hardcoded in kernel/inth.S */
|
||||
#define HWCALC_FXCG_MANAGER 6
|
||||
/* fx-9860G Slim, SH-3-based fx-9860G with hardware differences */
|
||||
#define HWCALC_FX9860G_SLIM 7
|
||||
|
||||
/*
|
||||
** Keyboard
|
||||
|
|
|
@ -207,7 +207,7 @@ enum {
|
|||
/* Enable modifiers keys */
|
||||
GETKEY_MOD_SHIFT = 0x01,
|
||||
GETKEY_MOD_ALPHA = 0x02,
|
||||
/* SHIFT + OPTN toggles backlight (requires GETKEY_MOD_SHIFT) */
|
||||
/* SHIFT + OPTN (requires GETKEY_MOD_SHIFT) or LIGHT toggles backlight */
|
||||
GETKEY_BACKLIGHT = 0x04,
|
||||
/* MENU triggers a task switch and displays the main menu */
|
||||
GETKEY_MENU = 0x08,
|
||||
|
|
|
@ -75,6 +75,10 @@ enum {
|
|||
of the matrix one could use a ghosting effect to boot the calc. */
|
||||
KEY_ACON = 0x07,
|
||||
|
||||
/* Virtual key codes */
|
||||
KEY_HELP = 0x20, /* fx-9860G Slim: 0x75 */
|
||||
KEY_LIGHT = 0x10, /* fx-9860G Slim: 0x76 */
|
||||
|
||||
/* Key aliases (handle with care =D) */
|
||||
KEY_X2 = KEY_SQUARE,
|
||||
KEY_CARET = KEY_POWER,
|
||||
|
|
|
@ -69,7 +69,8 @@ void hw_detect(void)
|
|||
gint[HWCALC] = HWCALC_FX9860G_SH4;
|
||||
if(gint[HWMPU] == HWMPU_SH7337 || gint[HWMPU] == HWMPU_SH7355)
|
||||
{
|
||||
gint[HWCALC] = HWCALC_FX9860G_SH3;
|
||||
gint[HWCALC] = (SH7705_PFC.PEDR & 0x08) ? HWCALC_FX9860G_SH3 :
|
||||
HWCALC_FX9860G_SLIM;
|
||||
}
|
||||
|
||||
/* Tell Graph 35+E II from OS version (this is accurate unless someone
|
||||
|
|
|
@ -102,7 +102,7 @@ _gint_inth_7305:
|
|||
|
||||
#ifdef FX9860G
|
||||
|
||||
/* SH7705-TYPE INTERRUT HANDLER ENTRY - 56 BYTES */
|
||||
/* SH7705-TYPE INTERRUPT HANDLER ENTRY - 56 BYTES */
|
||||
|
||||
_gint_inth_7705:
|
||||
/* Save caller-saved registers as before */
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <gint/gint.h>
|
||||
#include <gint/display.h>
|
||||
#include <gint/hardware.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -17,7 +18,10 @@ static int __osmenu_id;
|
|||
|
||||
static void __osmenu_handler(void)
|
||||
{
|
||||
__PutKeyCode(0x04, 0x09, 0);
|
||||
if(isSlim())
|
||||
__PutKeyCode(0x07, 0x0A, 0);
|
||||
else
|
||||
__PutKeyCode(0x04, 0x09, 0);
|
||||
|
||||
__Timer_Stop(__osmenu_id);
|
||||
__Timer_Deinstall(__osmenu_id);
|
||||
|
|
|
@ -51,7 +51,8 @@ key_event_t getkey_opt(int opt, volatile int *timeout)
|
|||
#ifdef FX9860G
|
||||
/* Backlight toggle */
|
||||
if((opt & GETKEY_BACKLIGHT) && e.type == KEYEV_DOWN &&
|
||||
e.key == KEY_OPTN && e.shift && !e.alpha)
|
||||
((e.key == KEY_LIGHT) ||
|
||||
(e.key == KEY_OPTN && e.shift && !e.alpha)))
|
||||
{
|
||||
t6k11_backlight(-1);
|
||||
continue;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <gint/defs/types.h>
|
||||
#include <gint/mpu/pfc.h>
|
||||
#include <gint/hardware.h>
|
||||
|
||||
/* This file is SH7705-only. */
|
||||
#ifdef FX9860G
|
||||
|
@ -111,12 +112,57 @@ uint8_t iokbd_row(int row)
|
|||
return input;
|
||||
}
|
||||
|
||||
static const uint16_t SLIM_SC[] = {
|
||||
0x0940, 0x0920, 0x0910, 0x0908, 0x0904, 0x0902,
|
||||
0x0840, 0x0820, 0x0810, 0x0808,
|
||||
0x0740, 0x0720, 0x0710, 0x0708, 0x0704, 0x0702,
|
||||
0x0640, 0x0620, 0x0610, 0x0608, 0x0604, 0x0602,
|
||||
0x0540, 0x0520, 0x0510, 0x0508, 0x0504, 0x0502,
|
||||
0x0440, 0x0420, 0x0410, 0x0408, 0x0404, 0x0402,
|
||||
0x0340, 0x0320, 0x0310, 0x0308, 0x0304, 0x0302,
|
||||
0x0240, 0x0220, 0x0210, 0x0208, 0x0204, 0x0202,
|
||||
0x0101,
|
||||
0x0020, 0x0010, 0x0008, 0x0004, 0x0002
|
||||
};
|
||||
|
||||
#define SCANCODE_COUNT (sizeof(SLIM_SC) / sizeof(uint16_t))
|
||||
|
||||
static const uint16_t SLIM_TR[] = {
|
||||
0x0940, 0x0620, 0x0720, 0x0710, 0x0804, 0x0802,
|
||||
0x0808, 0x0640, 0x0840, 0x0740,
|
||||
0x0910, 0x0608, 0x0502, 0x0810, 0x0280, 0x0180,
|
||||
0x0920, 0x0610, 0x0504, 0x0820, 0x0704, 0x0702,
|
||||
0x0904, 0x0602, 0x0420, 0x0320, 0x0220, 0x0120,
|
||||
0x0908, 0x0604, 0x0440, 0x0340, 0x0240, 0x0140,
|
||||
0x0708, 0x0520, 0x0408, 0x0308, 0x0208, 0x0108,
|
||||
0x0902, 0x0540, 0x0410, 0x0310, 0x0210, 0x0110,
|
||||
0x0001,
|
||||
0x0510, 0x0508, 0x0304, 0x0104, 0x0204
|
||||
};
|
||||
|
||||
/* iokbd_scan() - scan ports A/B/M to generate 12 rows of key data */
|
||||
void iokbd_scan(uint8_t *scan)
|
||||
{
|
||||
/* Scan each row independently; the gain from scanning them altogether
|
||||
/* Scan each row independently; the gain from scanning them all together
|
||||
is probably not worth it */
|
||||
for(int i = 0; i < 12; i++) scan[i] = iokbd_row(i);
|
||||
|
||||
/* Translate fx-9860G Slim scancodes to standard scancodes */
|
||||
if(isSlim())
|
||||
{
|
||||
uint8_t slim_scan[12];
|
||||
for(uint i = 0; i < 10; i++)
|
||||
{
|
||||
slim_scan[i] = scan[i];
|
||||
scan[i] = 0x00;
|
||||
}
|
||||
|
||||
for(uint i = 0; i < SCANCODE_COUNT; ++i)
|
||||
{
|
||||
if(slim_scan[SLIM_SC[i] >> 8] & (SLIM_SC[i] & 0xFF))
|
||||
scan[SLIM_TR[i] >> 8] |= (SLIM_TR[i] & 0xFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* FX9860G */
|
||||
|
|
|
@ -168,8 +168,16 @@ void t6k11_backlight(int setting)
|
|||
TODO: Document the PFC to remove these addresses */
|
||||
if(isSH3())
|
||||
{
|
||||
port = (void *)0xa400012c;
|
||||
mask = 0x80;
|
||||
if(isSlim())
|
||||
{
|
||||
port = (void *)0xa4000126;
|
||||
mask = 0x20;
|
||||
}
|
||||
else
|
||||
{
|
||||
port = (void *)0xa400012c;
|
||||
mask = 0x80;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue