minor cleanups

This commit is contained in:
espes 2015-06-14 20:16:14 +10:00
parent 9a882a9db9
commit 77374dde69
6 changed files with 16 additions and 21 deletions

View File

@ -1 +1 @@
obj-y += dsp.o dsp_cpu.o
obj-y += dsp.o dsp_cpu.o dsp_dma.o

View File

@ -172,10 +172,11 @@ void dsp_run(DSPState* dsp, int cycles)
}
void dsp_bootstrap(DSPState* dsp, const uint32_t* pram, size_t len)
void dsp_bootstrap(DSPState* dsp)
{
assert(sizeof(dsp->core.pram) >= len);
memcpy(dsp->core.pram, pram, len);
// scratch memory is dma'd in to pram by the bootrom
dsp->dma.scratch_rw(dsp->dma.scratch_rw_opaque,
(uint8_t*)dsp->core.pram, 0, 0x600, false);
}
void dsp_start_frame(DSPState* dsp)

View File

@ -32,7 +32,7 @@
typedef struct DSPState DSPState;
typedef void (*dsp_scratch_rw_func)(
uint8_t* ptr, uint64_t addr, size_t len, bool dir);
void* opaque, uint8_t* ptr, uint64_t addr, size_t len, bool dir);
/* Dsp commands */
DSPState* dsp_init(void* scratch_rw_opaque, dsp_scratch_rw_func scratch_rw);
@ -42,7 +42,7 @@ void dsp_reset(DSPState* dsp);
void dsp_step(DSPState* dsp);
void dsp_run(DSPState* dsp, int cycles);
void dsp_bootstrap(DSPState* dsp, const uint32_t* pmem, size_t len);
void dsp_bootstrap(DSPState* dsp);
void dsp_start_frame(DSPState* dsp);

View File

@ -359,6 +359,7 @@ void dsp56k_reset_cpu(dsp_core_t* dsp)
{
int i;
if (!matches_initialised) {
matches_initialised = true;
for (i=0; i<ARRAYSIZE(nonparallel_opcodes); i++) {
const OpcodeEntry t = nonparallel_opcodes[i];
assert(strlen(t.template) == 24);
@ -376,7 +377,6 @@ void dsp56k_reset_cpu(dsp_core_t* dsp)
nonparallel_matches[i][0] = mask;
nonparallel_matches[i][1] = match;
}
matches_initialised = true;
}
/* Memory */
@ -411,7 +411,6 @@ void dsp56k_reset_cpu(dsp_core_t* dsp)
/* runtime shit */
dsp->executing_for_disasm = false;
// start_time = SDL_GetTicks();
dsp->num_inst = 0;
@ -480,7 +479,7 @@ static uint16_t disasm_instruction(dsp_core_t* dsp, dsp_trace_disasm_t mode)
static void disasm_reg_save(dsp_core_t* dsp)
{
memcpy(dsp->disasm_registers_save, dsp->registers , sizeof(dsp->disasm_registers_save));
#if DSP_DISASM_REG_PC
#ifdef DSP_DISASM_REG_PC
dsp->pc_save = dsp->pc;
#endif
}
@ -566,7 +565,7 @@ static void disasm_reg_compare(dsp_core_t* dsp)
}
}
#if DSP_DISASM_REG_PC
#ifdef DSP_DISASM_REG_PC
if (pc_save != dsp->pc) {
fprintf(stderr,"\tReg: pc $%04x -> $%04x\n", pc_save, dsp->pc);
}

View File

@ -96,12 +96,11 @@ static void dsp_dma_run(DSPDMAState *s)
uint8_t* scratch_buf = calloc(count, item_size);
assert(s->scratch_rw);
if (control & NODE_CONTROL_DIRECTION) {
int i;
for (i=0; i<count; i++) {
uint32_t v = dsp56k_read_memory(s->core, mem_space, mem_address+i);
uint32_t v = dsp56k_read_memory(s->core,
mem_space, mem_address+i);
switch(item_size) {
case 4:
*(uint32_t*)(scratch_buf + i*4) = v;
@ -113,10 +112,12 @@ static void dsp_dma_run(DSPDMAState *s)
}
// write to scratch memory
s->scratch_rw(scratch_buf, scratch_addr, count*item_size, 1);
s->scratch_rw(s->scratch_rw_opaque,
scratch_buf, scratch_addr, count*item_size, 1);
} else {
// read from scratch memory
s->scratch_rw(scratch_buf, scratch_addr, count*item_size, 0);
s->scratch_rw(s->scratch_rw_opaque,
scratch_buf, scratch_addr, count*item_size, 0);
int i;
for (i=0; i<count; i++) {

View File

@ -7835,12 +7835,6 @@ static void emu_stop(dsp_core_t* dsp)
DPRINTF("Dsp: STOP instruction\n");
}
static void emu_swi(dsp_core_t* dsp)
{
/* Raise interrupt p:0x0006 */
dsp->instr_cycle += 6;
}
static void emu_sub_imm(dsp_core_t* dsp)
{
uint32_t xx = (dsp->cur_inst >> 8) & BITMASK(6);