mirror of
https://github.com/libretro/Mu.git
synced 2026-09-22 14:45:57 +00:00
Add namespaces to vars and make chip define headers subfiles of there chips
This commit is contained in:
@@ -239,7 +239,7 @@ HEADERS += \
|
||||
../../src/audio/blip_buf.h \
|
||||
../../src/dbvz.h \
|
||||
../../src/dbvzRegisterAccessors.c.h \
|
||||
../../src/dbvzRegisterNames.h \
|
||||
../../src/dbvzRegisterNames.c.h \
|
||||
../../src/dbvzTiming.c.h \
|
||||
../../src/debug/sandbox.h \
|
||||
../../src/debug/sandboxTrapNumToName.c.h \
|
||||
@@ -254,15 +254,15 @@ HEADERS += \
|
||||
../../src/m68k/m68kexternal.h \
|
||||
../../src/m68k/m68kops.h \
|
||||
../../src/pdiUsbD12.h \
|
||||
../../src/pdiUsbD12CommandNames.h \
|
||||
../../src/pdiUsbD12CommandNames.c.h \
|
||||
../../src/portability.h \
|
||||
../../src/sdCard.h \
|
||||
../../src/sdCardAccessors.c.h \
|
||||
../../src/sdCardCommandNames.h \
|
||||
../../src/sdCardCommandNames.c.h \
|
||||
../../src/sdCardCrcTables.c.h \
|
||||
../../src/sed1376.h \
|
||||
../../src/sed1376Accessors.c.h \
|
||||
../../src/sed1376RegisterNames.h \
|
||||
../../src/sed1376RegisterNames.c.h \
|
||||
../../src/silkscreen.h \
|
||||
debugviewer.h \
|
||||
emuwrapper.h \
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "dbvz.h"
|
||||
|
||||
|
||||
#include "dbvzRegisterNames.h"
|
||||
#include "dbvzRegisterNames.c.h"
|
||||
|
||||
|
||||
dbvz_chip_t dbvzChipSelects[DBVZ_CHIP_END];
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
#ifndef DBVZ_REGISTER_NAMES_H
|
||||
#define DBVZ_REGISTER_NAMES_H
|
||||
|
||||
/*Dragonball VZ Register Definitions*/
|
||||
#define HW_REG_ADDR(x) (0xFFFFF000 | (x))
|
||||
|
||||
/*SIM - System Integration Module*/
|
||||
#define SCR 0x000/*System Control Register*/
|
||||
@@ -176,5 +172,3 @@
|
||||
#define DRAMMC 0xC00/*DRAM Memory Configuration Register*/
|
||||
#define DRAMC 0xC02/*DRAM Control Register*/
|
||||
#define SDCTRL 0xC04/*SDRAM Control Register*/
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
//running a new command before finishing the previous one will result in corruption
|
||||
|
||||
|
||||
#include "pdiUsbD12CommandNames.h"
|
||||
#include "pdiUsbD12CommandNames.c.h"
|
||||
|
||||
#define PDIUSBD12_CMD_NONE 0xFF
|
||||
#define PDIUSBD12_TRANSFER_BUFFER_SIZE 131
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#ifndef PDI_USB_D12_COMMAND_NAMES_H
|
||||
#define PDI_USB_D12_COMMAND_NAMES_H
|
||||
/*PDIUSBD12 Commands*/
|
||||
|
||||
#define SELECT_ENDPOINT_CTRL_OUT 0x00
|
||||
@@ -19,5 +17,3 @@
|
||||
#define READ_INTERRUPT_REGISTER 0xF4
|
||||
|
||||
#define SET_DMA 0xFB
|
||||
|
||||
#endif
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "portability.h"
|
||||
|
||||
|
||||
#include "sdCardCommandNames.h"
|
||||
#include "sdCardCommandNames.c.h"
|
||||
|
||||
|
||||
#include "sdCardCrcTables.c.h"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#ifndef SD_CARD_COMMAND_NAMES_H
|
||||
#define SD_CARD_COMMAND_NAMES_H
|
||||
/*SD Card Commands*/
|
||||
/*Command Format:01IIIIIIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACCCCCCC1*/
|
||||
/*48 bits, I = index, A = argument, C = CRC*/
|
||||
@@ -63,5 +61,3 @@
|
||||
#define DR_ACCEPTED 0x05
|
||||
#define DR_CRC_ERROR 0x0B
|
||||
#define DR_WRITE_ERROR 0x0D
|
||||
|
||||
#endif
|
||||
@@ -21,7 +21,7 @@
|
||||
//The LCD power-off sequence is activated by programming the Power Save Mode Enable bit (REG[A0h] bit 0) to 1.
|
||||
|
||||
|
||||
#include "sed1376RegisterNames.h"
|
||||
#include "sed1376RegisterNames.c.h"
|
||||
|
||||
|
||||
uint16_t* sed1376Framebuffer;
|
||||
@@ -32,46 +32,46 @@ static uint8_t sed1376RLut[0x100];
|
||||
static uint8_t sed1376GLut[0x100];
|
||||
static uint8_t sed1376BLut[0x100];
|
||||
static uint16_t sed1376OutputLut[0x100];//used to speed up pixel conversion
|
||||
static uint32_t screenStartAddress;
|
||||
static uint16_t lineSize;
|
||||
static uint16_t (*renderPixel)(uint16_t x, uint16_t y);
|
||||
static uint32_t sed1376ScreenStartAddress;
|
||||
static uint16_t sed1376LineSize;
|
||||
static uint16_t (*sed1376RenderPixel)(uint16_t x, uint16_t y);
|
||||
|
||||
|
||||
#include "sed1376Accessors.c.h"
|
||||
|
||||
static uint32_t getBufferStartAddress(void){
|
||||
uint32_t screenStartAddress = sed1376Registers[DISP_ADDR_2] << 16 | sed1376Registers[DISP_ADDR_1] << 8 | sed1376Registers[DISP_ADDR_0];
|
||||
static uint32_t sed1376GetBufferStartAddress(void){
|
||||
uint32_t sed1376ScreenStartAddress = sed1376Registers[DISP_ADDR_2] << 16 | sed1376Registers[DISP_ADDR_1] << 8 | sed1376Registers[DISP_ADDR_0];
|
||||
switch((sed1376Registers[SPECIAL_EFFECT] & 0x03) * 90){
|
||||
case 0:
|
||||
//desired byte address / 4.
|
||||
screenStartAddress *= 4;
|
||||
sed1376ScreenStartAddress *= 4;
|
||||
break;
|
||||
|
||||
case 90:
|
||||
//((desired byte address + (panel height * bpp / 8)) / 4) - 1.
|
||||
screenStartAddress += 1;
|
||||
screenStartAddress *= 4;
|
||||
//screenStartAddress - (panelHeight * bpp / 8);
|
||||
sed1376ScreenStartAddress += 1;
|
||||
sed1376ScreenStartAddress *= 4;
|
||||
//sed1376ScreenStartAddress - (panelHeight * bpp / 8);
|
||||
break;
|
||||
|
||||
case 180:
|
||||
//((desired byte address + (panel width * panel height * bpp / 8)) / 4) - 1.
|
||||
screenStartAddress += 1;
|
||||
screenStartAddress *= 4;
|
||||
//screenStartAddress - (panelWidth * panelHeight * bpp / 8);
|
||||
sed1376ScreenStartAddress += 1;
|
||||
sed1376ScreenStartAddress *= 4;
|
||||
//sed1376ScreenStartAddress - (panelWidth * panelHeight * bpp / 8);
|
||||
break;
|
||||
|
||||
case 270:
|
||||
//(desired byte address + ((panel width - 1) * panel height * bpp / 8)) / 4.
|
||||
screenStartAddress *= 4;
|
||||
//screenStartAddress -= ((panelWidth - 1) * panelHeight * bpp / 8);
|
||||
sed1376ScreenStartAddress *= 4;
|
||||
//sed1376ScreenStartAddress -= ((panelWidth - 1) * panelHeight * bpp / 8);
|
||||
break;
|
||||
}
|
||||
|
||||
return screenStartAddress;
|
||||
return sed1376ScreenStartAddress;
|
||||
}
|
||||
|
||||
static uint32_t getPipStartAddress(void){
|
||||
static uint32_t sed1376GetPipStartAddress(void){
|
||||
uint32_t pipStartAddress = sed1376Registers[PIP_ADDR_2] << 16 | sed1376Registers[PIP_ADDR_1] << 8 | sed1376Registers[PIP_ADDR_0];
|
||||
switch((sed1376Registers[SPECIAL_EFFECT] & 0x03) * 90){
|
||||
case 0:
|
||||
@@ -114,7 +114,7 @@ void sed1376Reset(void){
|
||||
palmMisc.backlightLevel = 0;
|
||||
palmMisc.lcdOn = false;
|
||||
|
||||
renderPixel = NULL;
|
||||
sed1376RenderPixel = NULL;
|
||||
|
||||
sed1376Registers[REV_CODE] = 0x28;
|
||||
sed1376Registers[DISP_BUFF_SIZE] = 0x14;
|
||||
@@ -358,19 +358,19 @@ void sed1376Render(void){
|
||||
uint16_t rotation = 90 * (sed1376Registers[SPECIAL_EFFECT] & 0x03);
|
||||
uint32_t index;
|
||||
|
||||
screenStartAddress = getBufferStartAddress();
|
||||
lineSize = (sed1376Registers[LINE_SIZE_1] << 8 | sed1376Registers[LINE_SIZE_0]) * 4;
|
||||
sed1376ScreenStartAddress = sed1376GetBufferStartAddress();
|
||||
sed1376LineSize = (sed1376Registers[LINE_SIZE_1] << 8 | sed1376Registers[LINE_SIZE_0]) * 4;
|
||||
selectRenderer(color, bitDepth);
|
||||
|
||||
if(renderPixel){
|
||||
if(sed1376RenderPixel){
|
||||
uint16_t pixelX;
|
||||
uint16_t pixelY;
|
||||
|
||||
MULTITHREAD_DOUBLE_LOOP(pixelX, pixelY) for(pixelY = 0; pixelY < 160; pixelY++)
|
||||
for(pixelX = 0; pixelX < 160; pixelX++)
|
||||
sed1376Framebuffer[pixelY * 160 + pixelX] = renderPixel(pixelX, pixelY);
|
||||
sed1376Framebuffer[pixelY * 160 + pixelX] = sed1376RenderPixel(pixelX, pixelY);
|
||||
|
||||
//debugLog("Screen start address:0x%08X, buffer width:%d, swivel view:%d degrees\n", screenStartAddress, lineSize, rotation);
|
||||
//debugLog("Screen start address:0x%08X, buffer width:%d, swivel view:%d degrees\n", sed1376ScreenStartAddress, lineSize, rotation);
|
||||
//debugLog("Screen format, color:%s, BPP:%d\n", boolString(color), bitDepth);
|
||||
|
||||
if(pictureInPictureEnabled){
|
||||
@@ -392,11 +392,11 @@ void sed1376Render(void){
|
||||
if(pipStartX < 160 && pipStartY < 160){
|
||||
pipEndX = FAST_MIN(pipEndX, 160);
|
||||
pipEndY = FAST_MIN(pipEndY, 160);
|
||||
screenStartAddress = getPipStartAddress();
|
||||
lineSize = (sed1376Registers[PIP_LINE_SZ_1] << 8 | sed1376Registers[PIP_LINE_SZ_0]) * 4;
|
||||
sed1376ScreenStartAddress = sed1376GetPipStartAddress();
|
||||
sed1376LineSize = (sed1376Registers[PIP_LINE_SZ_1] << 8 | sed1376Registers[PIP_LINE_SZ_0]) * 4;
|
||||
MULTITHREAD_DOUBLE_LOOP(pixelX, pixelY) for(pixelY = pipStartY; pixelY < pipEndY; pixelY++)
|
||||
for(pixelX = pipStartX; pixelX < pipEndX; pixelX++)
|
||||
sed1376Framebuffer[pixelY * 160 + pixelX] = renderPixel(pixelX, pixelY);
|
||||
sed1376Framebuffer[pixelY * 160 + pixelX] = sed1376RenderPixel(pixelX, pixelY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,85 +30,85 @@ static uint16_t lutMonochromeValue(uint8_t lutIndex){
|
||||
|
||||
//monochrome
|
||||
static uint16_t get1BppMonochrome(uint16_t x, uint16_t y){
|
||||
return lutMonochromeValue(sed1376Ram[handlePanelDataSwaps(screenStartAddress + y * lineSize + x / 8)] >> (7 - x % 8) & 0x01);
|
||||
return lutMonochromeValue(sed1376Ram[handlePanelDataSwaps(sed1376ScreenStartAddress + y * sed1376LineSize + x / 8)] >> (7 - x % 8) & 0x01);
|
||||
}
|
||||
static uint16_t get2BppMonochrome(uint16_t x, uint16_t y){
|
||||
return lutMonochromeValue(sed1376Ram[handlePanelDataSwaps(screenStartAddress + y * lineSize + x / 4)] >> (6 - x % 4 * 2) & 0x03);
|
||||
return lutMonochromeValue(sed1376Ram[handlePanelDataSwaps(sed1376ScreenStartAddress + y * sed1376LineSize + x / 4)] >> (6 - x % 4 * 2) & 0x03);
|
||||
}
|
||||
static uint16_t get4BppMonochrome(uint16_t x, uint16_t y){
|
||||
return lutMonochromeValue(sed1376Ram[handlePanelDataSwaps(screenStartAddress + y * lineSize + x / 2)] >> (4 - x % 2 * 4) & 0x0F);
|
||||
return lutMonochromeValue(sed1376Ram[handlePanelDataSwaps(sed1376ScreenStartAddress + y * sed1376LineSize + x / 2)] >> (4 - x % 2 * 4) & 0x0F);
|
||||
}
|
||||
static uint16_t get8BppMonochrome(uint16_t x, uint16_t y){
|
||||
return lutMonochromeValue(sed1376Ram[handlePanelDataSwaps(screenStartAddress + y * lineSize + x)]);
|
||||
return lutMonochromeValue(sed1376Ram[handlePanelDataSwaps(sed1376ScreenStartAddress + y * sed1376LineSize + x)]);
|
||||
}
|
||||
static uint16_t get16BppMonochrome(uint16_t x, uint16_t y){
|
||||
uint16_t pixelValue = sed1376Ram[handlePanelDataSwaps(screenStartAddress + (y * lineSize + x) * 2)] << 8 | sed1376Ram[handlePanelDataSwaps(screenStartAddress + (y * lineSize + x) * 2 + 1)];
|
||||
uint16_t pixelValue = sed1376Ram[handlePanelDataSwaps(sed1376ScreenStartAddress + (y * sed1376LineSize + x) * 2)] << 8 | sed1376Ram[handlePanelDataSwaps(sed1376ScreenStartAddress + (y * sed1376LineSize + x) * 2 + 1)];
|
||||
return makeRgb16FromGreenComponent(pixelValue);
|
||||
}
|
||||
|
||||
//color
|
||||
static uint16_t get1BppColor(uint16_t x, uint16_t y){
|
||||
return sed1376OutputLut[sed1376Ram[handlePanelDataSwaps(screenStartAddress + y * lineSize + x / 8)] >> (7 - x % 8) & 0x01];
|
||||
return sed1376OutputLut[sed1376Ram[handlePanelDataSwaps(sed1376ScreenStartAddress + y * sed1376LineSize + x / 8)] >> (7 - x % 8) & 0x01];
|
||||
}
|
||||
static uint16_t get2BppColor(uint16_t x, uint16_t y){
|
||||
return sed1376OutputLut[sed1376Ram[handlePanelDataSwaps(screenStartAddress + y * lineSize + x / 4)] >> (6 - x % 4 * 2) & 0x03];
|
||||
return sed1376OutputLut[sed1376Ram[handlePanelDataSwaps(sed1376ScreenStartAddress + y * sed1376LineSize + x / 4)] >> (6 - x % 4 * 2) & 0x03];
|
||||
}
|
||||
static uint16_t get4BppColor(uint16_t x, uint16_t y){
|
||||
return sed1376OutputLut[sed1376Ram[handlePanelDataSwaps(screenStartAddress + y * lineSize + x / 2)] >> (4 - x % 2 * 4) & 0x0F];
|
||||
return sed1376OutputLut[sed1376Ram[handlePanelDataSwaps(sed1376ScreenStartAddress + y * sed1376LineSize + x / 2)] >> (4 - x % 2 * 4) & 0x0F];
|
||||
}
|
||||
static uint16_t get8BppColor(uint16_t x, uint16_t y){
|
||||
return sed1376OutputLut[sed1376Ram[handlePanelDataSwaps(screenStartAddress + y * lineSize + x)]];
|
||||
return sed1376OutputLut[sed1376Ram[handlePanelDataSwaps(sed1376ScreenStartAddress + y * sed1376LineSize + x)]];
|
||||
}
|
||||
static uint16_t get16BppColor(uint16_t x, uint16_t y){
|
||||
//this format is little endian, to use big endian data sed1376Registers[SPECIAL_EFFECT] & 0x40 must be set
|
||||
return sed1376Ram[handlePanelDataSwaps(screenStartAddress + (y * lineSize + x * 2) + 1)] << 8 | sed1376Ram[handlePanelDataSwaps(screenStartAddress + (y * lineSize + x * 2))];
|
||||
return sed1376Ram[handlePanelDataSwaps(sed1376ScreenStartAddress + (y * sed1376LineSize + x * 2) + 1)] << 8 | sed1376Ram[handlePanelDataSwaps(sed1376ScreenStartAddress + (y * sed1376LineSize + x * 2))];
|
||||
}
|
||||
|
||||
static void selectRenderer(bool color, uint8_t bpp){
|
||||
renderPixel = NULL;
|
||||
sed1376RenderPixel = NULL;
|
||||
if(color){
|
||||
switch(bpp){
|
||||
case 1:
|
||||
renderPixel = get1BppColor;
|
||||
sed1376RenderPixel = get1BppColor;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
renderPixel = get2BppColor;
|
||||
sed1376RenderPixel = get2BppColor;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
renderPixel = get4BppColor;
|
||||
sed1376RenderPixel = get4BppColor;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
renderPixel = get8BppColor;
|
||||
sed1376RenderPixel = get8BppColor;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
renderPixel = get16BppColor;
|
||||
sed1376RenderPixel = get16BppColor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
switch(bpp){
|
||||
case 1:
|
||||
renderPixel = get1BppMonochrome;
|
||||
sed1376RenderPixel = get1BppMonochrome;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
renderPixel = get2BppMonochrome;
|
||||
sed1376RenderPixel = get2BppMonochrome;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
renderPixel = get4BppMonochrome;
|
||||
sed1376RenderPixel = get4BppMonochrome;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
renderPixel = get8BppMonochrome;
|
||||
sed1376RenderPixel = get8BppMonochrome;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
renderPixel = get16BppMonochrome;
|
||||
sed1376RenderPixel = get16BppMonochrome;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#ifndef SED1376_REGISTER_NAMES_H
|
||||
#define SED1376_REGISTER_NAMES_H
|
||||
/*SED1376 Register Definitions*/
|
||||
|
||||
/*Read-Only Configuration Registers*/
|
||||
@@ -83,5 +81,3 @@
|
||||
#define PWM_CONFIG 0xB1
|
||||
#define PWM_LENGTH 0xB2
|
||||
#define PWM_DUTY_CYCLE 0xB3
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user