mirror of
https://github.com/libretro/Mu.git
synced 2026-09-23 15:15:43 +00:00
Fake cycle counting seems to be working
This commit is contained in:
@@ -23,7 +23,7 @@ I am planning on adding Tungsten T3 support as soon as possible.
|
||||
|
||||
## Credits
|
||||
[Firebird Emu](https://github.com/nspire-emus/firebird) (ARMv5TE Core)
|
||||
[uARM](https://dmitry.gr/?r=05.Projects&proj=07.%20Linux%20on%208bit) (PXA255 CPU Peripherals)
|
||||
[uARM](https://dmitry.gr/?r=05.Projects&proj=07.%20Linux%20on%208bit) (PXA260 CPU Peripherals)
|
||||
[Musashi v3.4](https://github.com/kstenerud/Musashi) (last version that builds outside of MAME)(68k Core)
|
||||
[blip_buf 1.1.0](https://github.com/TASVideos/BizHawk/tree/master/blip_buf) (Audio Resampler)
|
||||
https://www.iconarchive.com/show/crystal-clear-icons-by-everaldo/App-palm-icon.html (Desktop Icon)
|
||||
|
||||
@@ -44,6 +44,9 @@ bool pxa260Init(uint8_t** returnRom, uint8_t** returnRam){
|
||||
uint32_t mem_offset = 0;
|
||||
uint8_t i;
|
||||
|
||||
//set timing callback pointers
|
||||
pxa260TimingInit();
|
||||
|
||||
//enable dynarec if available
|
||||
do_translate = true;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "../tps65010.h"
|
||||
#include "pxa260.h"
|
||||
#include "pxa260_IC.h"
|
||||
#include "pxa260Timing.h"
|
||||
#include "pxa260I2c.h"
|
||||
|
||||
|
||||
@@ -73,6 +74,8 @@ void pxa260I2cWriteWord(uint32_t address, uint32_t value){
|
||||
if(value & 0x0008){
|
||||
uint8_t index;
|
||||
|
||||
debugLog("I2C transfer attempted\n");
|
||||
|
||||
for(index = 0; index < 8; index++){
|
||||
uint8_t receiveValue = tps65010I2cExchange((pxa260I2cBuffer & 1 << 7 - index) ? I2C_1 : I2C_0);
|
||||
|
||||
@@ -82,17 +85,11 @@ void pxa260I2cWriteWord(uint32_t address, uint32_t value){
|
||||
pxa260I2cBus = receiveValue;
|
||||
}
|
||||
}
|
||||
|
||||
pxa260TimingQueueEvent(200, PXA260_TIMING_CALLBACK_I2C_TRANSMIT_EMPTY);
|
||||
}
|
||||
if(value & 0x0002)
|
||||
tps65010I2cExchange(I2C_STOP);
|
||||
|
||||
//TODO: run the CPU 200 opcodes here
|
||||
//just storing the trigger code here untill delays work
|
||||
|
||||
if(value & 0x0100){
|
||||
pxa260I2cIsr |= 0x0040;
|
||||
pxa260icInt(&pxa260Ic, PXA260_I_I2C, true);
|
||||
}
|
||||
return;
|
||||
|
||||
case ISR:
|
||||
@@ -117,3 +114,10 @@ void pxa260I2cWriteWord(uint32_t address, uint32_t value){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void pxa260I2cTransmitEmpty(void){
|
||||
pxa260I2cIsr |= 0x0040;
|
||||
if(pxa260I2cIcr & 0x0100)
|
||||
pxa260icInt(&pxa260Ic, PXA260_I_I2C, true);
|
||||
debugLog("I2C transmit empty triggered\n");
|
||||
}
|
||||
|
||||
@@ -32,4 +32,6 @@ void pxa260I2cReset(void);
|
||||
uint32_t pxa260I2cReadWord(uint32_t address);
|
||||
void pxa260I2cWriteWord(uint32_t address, uint32_t value);
|
||||
|
||||
void pxa260I2cTransmitEmpty(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "../armv5te/emu.h"
|
||||
#include "../armv5te/cpu.h"
|
||||
#include "pxa260I2c.h"
|
||||
#include "pxa260Timing.h"
|
||||
|
||||
|
||||
@@ -22,6 +23,10 @@ static int32_t pxa260TimingGetDurationUntilNextEvent(int32_t duration/*call with
|
||||
return duration;
|
||||
}
|
||||
|
||||
void pxa260TimingInit(void){
|
||||
pxa260TimingCallbacks[PXA260_TIMING_CALLBACK_I2C_TRANSMIT_EMPTY] = pxa260I2cTransmitEmpty;
|
||||
}
|
||||
|
||||
void pxa260TimingReset(void){
|
||||
memset(pxa260TimingQueuedEvents, 0x00, sizeof(pxa260TimingQueuedEvents));
|
||||
}
|
||||
@@ -87,11 +92,12 @@ void pxa260TimingRun(int32_t cycles){
|
||||
cpu_arm_loop();
|
||||
}
|
||||
|
||||
if(pxa260TimingLeftoverCycles > 0){
|
||||
//remove the unused cycles
|
||||
addCycles -= pxa260TimingLeftoverCycles;
|
||||
pxa260TimingLeftoverCycles = 0;
|
||||
}
|
||||
//if more then the requested cycles are executed count those too
|
||||
addCycles += cycle_count_delta;
|
||||
|
||||
//remove the unused cycles
|
||||
addCycles -= pxa260TimingLeftoverCycles;
|
||||
pxa260TimingLeftoverCycles = 0;
|
||||
|
||||
for(index = 0; index < sizeof(pxa260TimingQueuedEvents) / sizeof(event_t); index++){
|
||||
if(pxa260TimingQueuedEvents[index].active){
|
||||
|
||||
@@ -18,6 +18,7 @@ typedef struct{
|
||||
extern void (*pxa260TimingCallbacks[])(void);//saving a function pointer in a state is not portable and will crash even on the same system between program loads with ASLR
|
||||
extern event_t pxa260TimingQueuedEvents[];
|
||||
|
||||
void pxa260TimingInit(void);
|
||||
void pxa260TimingReset(void);
|
||||
|
||||
void pxa260TimingQueueEvent(int32_t wait, uint8_t callbackId);
|
||||
|
||||
Reference in New Issue
Block a user