Update ali1429.c
This commit is contained in:
@@ -11,13 +11,11 @@
|
||||
* Note: This chipset has no datasheet, everything were done via
|
||||
* reverse engineering the BIOS of various machines using it.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Tiseno100,
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2020-2021 Tiseno100.
|
||||
* Copyright 2021-2021 Miran Grca.
|
||||
* Copyright 2020,2021 Tiseno100.
|
||||
* Copyright 2021,2021 Miran Grca.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -74,6 +72,7 @@
|
||||
1 1 0: CLK2IN/12
|
||||
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@@ -97,9 +96,11 @@
|
||||
|
||||
#define GREEN dev->is_g /* Is G Variant */
|
||||
|
||||
|
||||
#ifdef ENABLE_ALI1429_LOG
|
||||
int ali1429_do_log = ENABLE_ALI1429_LOG;
|
||||
|
||||
|
||||
static void
|
||||
ali1429_log(const char *fmt, ...)
|
||||
{
|
||||
@@ -115,12 +116,14 @@ ali1429_log(const char *fmt, ...)
|
||||
#define ali1429_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t is_g, index, cfg_locked, reg_57h,
|
||||
regs[90];
|
||||
} ali1429_t;
|
||||
|
||||
|
||||
static void
|
||||
ali1429_shadow_recalc(ali1429_t *dev)
|
||||
{
|
||||
@@ -144,6 +147,7 @@ ali1429_shadow_recalc(ali1429_t *dev)
|
||||
flushmmucache_nopc();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ali1429_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
@@ -161,13 +165,14 @@ ali1429_write(uint16_t addr, uint8_t val, void *priv)
|
||||
#endif
|
||||
|
||||
if (dev->index == 0x03)
|
||||
dev->cfg_locked = !(val == 0xc5);
|
||||
dev->cfg_locked = (val != 0xc5);
|
||||
|
||||
if (!dev->cfg_locked) {
|
||||
pclog("M1429: dev->regs[%02x] = %02x\n", dev->index, val);
|
||||
|
||||
/* Common M1429 Registers */
|
||||
switch (dev->index) {
|
||||
case 0x10:
|
||||
case 0x11:
|
||||
case 0x10: case 0x11:
|
||||
dev->regs[dev->index] = val;
|
||||
break;
|
||||
|
||||
@@ -179,14 +184,12 @@ ali1429_write(uint16_t addr, uint8_t val, void *priv)
|
||||
mem_remap_top(0);
|
||||
break;
|
||||
|
||||
case 0x13:
|
||||
case 0x14:
|
||||
case 0x13: case 0x14:
|
||||
dev->regs[dev->index] = val;
|
||||
ali1429_shadow_recalc(dev);
|
||||
break;
|
||||
|
||||
case 0x15:
|
||||
case 0x16:
|
||||
case 0x15: case 0x16:
|
||||
case 0x17:
|
||||
dev->regs[dev->index] = val;
|
||||
break;
|
||||
@@ -197,8 +200,7 @@ ali1429_write(uint16_t addr, uint8_t val, void *priv)
|
||||
cpu_update_waitstates();
|
||||
break;
|
||||
|
||||
case 0x19:
|
||||
case 0x1a:
|
||||
case 0x19: case 0x1a:
|
||||
case 0x1e:
|
||||
dev->regs[dev->index] = val;
|
||||
break;
|
||||
@@ -207,8 +209,7 @@ ali1429_write(uint16_t addr, uint8_t val, void *priv)
|
||||
dev->regs[dev->index] = val;
|
||||
|
||||
switch(val & 7) {
|
||||
case 0:
|
||||
case 7: /* Illegal */
|
||||
case 0: case 7: /* Illegal */
|
||||
cpu_set_isa_speed(7159091);
|
||||
break;
|
||||
|
||||
@@ -247,8 +248,7 @@ ali1429_write(uint16_t addr, uint8_t val, void *priv)
|
||||
if (GREEN) {
|
||||
switch (dev->index) {
|
||||
case 0x30 ... 0x41:
|
||||
case 0x43:
|
||||
case 0x45:
|
||||
case 0x43: case 0x45:
|
||||
case 0x4a:
|
||||
dev->regs[dev->index] = val;
|
||||
break;
|
||||
@@ -263,6 +263,7 @@ ali1429_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
ali1429_read(uint16_t addr, void *priv)
|
||||
{
|
||||
@@ -279,6 +280,7 @@ ali1429_read(uint16_t addr, void *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ali1429_close(void *priv)
|
||||
{
|
||||
@@ -287,6 +289,7 @@ ali1429_close(void *priv)
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ali1429_defaults(ali1429_t *dev)
|
||||
{
|
||||
@@ -314,6 +317,7 @@ ali1429_defaults(ali1429_t *dev)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
ali1429_init(const device_t *info)
|
||||
{
|
||||
|
Reference in New Issue
Block a user