sonarlint vid_sc1502x_ramdac.c

This commit is contained in:
Jasmine Iwanek
2023-07-31 17:30:17 -04:00
parent 060a1761e2
commit b80f43a970

View File

@@ -29,17 +29,17 @@
#include <86box/timer.h> #include <86box/timer.h>
#include <86box/video.h> #include <86box/video.h>
#include <86box/vid_svga.h> #include <86box/vid_svga.h>
#include <86box/plat_unused.h>
typedef struct typedef struct sc1502x_ramdac_t {
{
int state; int state;
uint8_t ctrl; uint8_t ctrl;
} sc1502x_ramdac_t; } sc1502x_ramdac_t;
void void
sc1502x_ramdac_out(uint16_t addr, uint8_t val, void *p, svga_t *svga) sc1502x_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga)
{ {
sc1502x_ramdac_t *ramdac = (sc1502x_ramdac_t *) p; sc1502x_ramdac_t *ramdac = (sc1502x_ramdac_t *) priv;
int oldbpp = 0; int oldbpp = 0;
switch (addr) { switch (addr) {
@@ -63,6 +63,9 @@ sc1502x_ramdac_out(uint16_t addr, uint8_t val, void *p, svga_t *svga)
case 0x20: case 0x20:
svga->bpp = 24; svga->bpp = 24;
break; break;
default:
break;
} }
break; break;
case 4: case 4:
@@ -81,13 +84,17 @@ sc1502x_ramdac_out(uint16_t addr, uint8_t val, void *p, svga_t *svga)
case 0x20: case 0x20:
svga->bpp = 24; svga->bpp = 24;
break; break;
default:
break;
} }
break;
} else { } else {
svga->bpp = 16; svga->bpp = 16;
break;
} }
break; break;
default:
break;
} }
if (oldbpp != svga->bpp) if (oldbpp != svga->bpp)
svga_recalctimings(svga); svga_recalctimings(svga);
@@ -100,6 +107,9 @@ sc1502x_ramdac_out(uint16_t addr, uint8_t val, void *p, svga_t *svga)
case 0x3C9: case 0x3C9:
ramdac->state = 0; ramdac->state = 0;
break; break;
default:
break;
} }
svga_out(addr, val, svga); svga_out(addr, val, svga);
@@ -125,13 +135,16 @@ sc1502x_ramdac_in(uint16_t addr, void *p, svga_t *svga)
case 0x3C9: case 0x3C9:
ramdac->state = 0; ramdac->state = 0;
break; break;
default:
break;
} }
return temp; return temp;
} }
static void * static void *
sc1502x_ramdac_init(const device_t *info) sc1502x_ramdac_init(UNUSED(const device_t *info))
{ {
sc1502x_ramdac_t *ramdac = (sc1502x_ramdac_t *) malloc(sizeof(sc1502x_ramdac_t)); sc1502x_ramdac_t *ramdac = (sc1502x_ramdac_t *) malloc(sizeof(sc1502x_ramdac_t));
memset(ramdac, 0, sizeof(sc1502x_ramdac_t)); memset(ramdac, 0, sizeof(sc1502x_ramdac_t));