mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
mcpx: Fixup compiler warnings in DSP code
This commit is contained in:
committed by
mborgerson
parent
416e12c3b3
commit
66f2e9decd
@@ -38,7 +38,6 @@
|
||||
|
||||
/* Defines */
|
||||
#define BITMASK(x) ((1<<(x))-1)
|
||||
#define ARRAYSIZE(x) (int)(sizeof(x)/sizeof(x[0]))
|
||||
|
||||
#define INTERRUPT_ABORT_FRAME (1 << 0)
|
||||
#define INTERRUPT_START_FRAME (1 << 1)
|
||||
@@ -133,7 +132,6 @@ static void write_peripheral(dsp_core_t* core, uint32_t address, uint32_t value)
|
||||
case 0xFFFFC4:
|
||||
if (value & 1) {
|
||||
core->is_idle = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0xFFFFC5:
|
||||
@@ -154,8 +152,6 @@ static void write_peripheral(dsp_core_t* core, uint32_t address, uint32_t value)
|
||||
case 0xFFFFD7:
|
||||
dsp_dma_write(&dsp->dma, DMA_CONFIGURATION, value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,6 +245,7 @@ uint32_t dsp_read_memory(DSPState* dsp, char space, uint32_t address)
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return dsp56k_read_memory(&dsp->core, space_id, address);
|
||||
@@ -270,6 +267,7 @@ void dsp_write_memory(DSPState* dsp, char space, uint32_t address, uint32_t valu
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
|
||||
dsp56k_write_memory(&dsp->core, space_id, address, value);
|
||||
@@ -301,22 +299,22 @@ void dsp_info(DSPState* dsp)
|
||||
|
||||
printf("DSP core information:\n");
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(stackname); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(stackname); i++) {
|
||||
printf("- %s stack:", stackname[i]);
|
||||
for (j = 0; j < ARRAYSIZE(dsp->core.stack[0]); j++) {
|
||||
for (j = 0; j < ARRAY_SIZE(dsp->core.stack[0]); j++) {
|
||||
printf(" %04x", dsp->core.stack[i][j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("- Interrupt IPL:");
|
||||
for (i = 0; i < ARRAYSIZE(dsp->core.interrupt_ipl); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(dsp->core.interrupt_ipl); i++) {
|
||||
printf(" %04x", dsp->core.interrupt_ipl[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("- Pending ints: ");
|
||||
for (i = 0; i < ARRAYSIZE(dsp->core.interrupt_is_pending); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(dsp->core.interrupt_is_pending); i++) {
|
||||
printf(" %04hx", dsp->core.interrupt_is_pending[i]);
|
||||
}
|
||||
printf("\n");
|
||||
@@ -451,7 +449,7 @@ int dsp_get_register_address(DSPState* dsp, const char *regname, uint32_t **addr
|
||||
|
||||
/* bisect */
|
||||
l = 0;
|
||||
r = ARRAYSIZE(registers) - 1;
|
||||
r = ARRAY_SIZE(registers) - 1;
|
||||
do {
|
||||
m = (l+r) >> 1;
|
||||
for (i = 0; i < len; i++) {
|
||||
|
||||
+14
-14
@@ -22,14 +22,15 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/bswap.h"
|
||||
#include "dsp_cpu.h"
|
||||
|
||||
#include "dsp_cpu.h"
|
||||
|
||||
#define TRACE_DSP_DISASM 0
|
||||
#define TRACE_DSP_DISASM_REG 0
|
||||
@@ -38,7 +39,6 @@
|
||||
#define DPRINTF(s, ...) printf(s, ## __VA_ARGS__)
|
||||
|
||||
#define BITMASK(x) ((1<<(x))-1)
|
||||
#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
|
||||
|
||||
// #define DSP_COUNT_IPS /* Count instruction per seconds */
|
||||
|
||||
@@ -353,7 +353,7 @@ static const OpcodeEntry nonparallel_opcodes[] = {
|
||||
};
|
||||
|
||||
static bool matches_initialised;
|
||||
static uint32_t nonparallel_matches[ARRAYSIZE(nonparallel_opcodes)][2];
|
||||
static uint32_t nonparallel_matches[ARRAY_SIZE(nonparallel_opcodes)][2];
|
||||
|
||||
/**********************************
|
||||
* Emulator kernel
|
||||
@@ -364,7 +364,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++) {
|
||||
for (i=0; i<ARRAY_SIZE(nonparallel_opcodes); i++) {
|
||||
const OpcodeEntry t = nonparallel_opcodes[i];
|
||||
assert(strlen(t.template) == 24);
|
||||
|
||||
@@ -424,7 +424,7 @@ void dsp56k_reset_cpu(dsp_core_t* dsp)
|
||||
}
|
||||
|
||||
static const OpcodeEntry *lookup_opcode_slow(uint32_t op) {
|
||||
for (int i = 0; i < ARRAYSIZE(nonparallel_opcodes); i++) {
|
||||
for (int i = 0; i < ARRAY_SIZE(nonparallel_opcodes); i++) {
|
||||
if ((op & nonparallel_matches[i][0]) == nonparallel_matches[i][1]) {
|
||||
if (nonparallel_opcodes[i].match_func
|
||||
&& !nonparallel_opcodes[i].match_func(op)) continue;
|
||||
@@ -594,20 +594,20 @@ static void disasm_reg_compare(dsp_core_t* dsp)
|
||||
|
||||
static const char* disasm_get_instruction_text(dsp_core_t* dsp)
|
||||
{
|
||||
const int len = sizeof(dsp->disasm_str_instr);
|
||||
// const int len = sizeof(dsp->disasm_str_instr);
|
||||
// uint64_t count, cycles;
|
||||
// uint16_t cycle_diff;
|
||||
// float percentage;
|
||||
int offset;
|
||||
// int offset;
|
||||
|
||||
if (dsp->disasm_is_looping) {
|
||||
dsp->disasm_str_instr2[0] = 0;
|
||||
}
|
||||
if (dsp->disasm_cur_inst_len == 1) {
|
||||
offset = sprintf(dsp->disasm_str_instr2, "p:%04x %06x (%02d cyc) %-*s\n", dsp->disasm_prev_inst_pc, dsp->disasm_cur_inst, dsp->instr_cycle, len, dsp->disasm_str_instr);
|
||||
} else {
|
||||
offset = sprintf(dsp->disasm_str_instr2, "p:%04x %06x %06x (%02d cyc) %-*s\n", dsp->disasm_prev_inst_pc, dsp->disasm_cur_inst, read_memory_p(dsp, dsp->disasm_prev_inst_pc + 1), dsp->instr_cycle, len, dsp->disasm_str_instr);
|
||||
}
|
||||
// if (dsp->disasm_cur_inst_len == 1) {
|
||||
// offset = sprintf(dsp->disasm_str_instr2, "p:%04x %06x (%02d cyc) %-*s\n", dsp->disasm_prev_inst_pc, dsp->disasm_cur_inst, dsp->instr_cycle, len, dsp->disasm_str_instr);
|
||||
// } else {
|
||||
// offset = sprintf(dsp->disasm_str_instr2, "p:%04x %06x %06x (%02d cyc) %-*s\n", dsp->disasm_prev_inst_pc, dsp->disasm_cur_inst, read_memory_p(dsp, dsp->disasm_prev_inst_pc + 1), dsp->instr_cycle, len, dsp->disasm_str_instr);
|
||||
// }
|
||||
// if (offset > 2 && Profile_DspAddressData(dsp->disasm_prev_inst_pc, &percentage, &count, &cycles, &cycle_diff)) {
|
||||
// offset -= 2;
|
||||
// sprintf(str_instr2+offset, "%5.2f%% (%"PRId64", %"PRId64", %d)\n",
|
||||
@@ -1089,7 +1089,7 @@ static void write_memory_disasm(dsp_core_t* dsp, int space, uint32_t address, ui
|
||||
}
|
||||
|
||||
curvalue = read_memory_disasm(dsp, space, address);
|
||||
if (dsp->disasm_memory_ptr < ARRAYSIZE(dsp->str_disasm_memory)) {
|
||||
if (dsp->disasm_memory_ptr < ARRAY_SIZE(dsp->str_disasm_memory)) {
|
||||
sprintf(dsp->str_disasm_memory[dsp->disasm_memory_ptr], "Mem: %c:0x%04x 0x%06x -> 0x%06x", space_c, address, oldvalue, curvalue);
|
||||
dsp->disasm_memory_ptr ++;
|
||||
}
|
||||
|
||||
+103
-103
File diff suppressed because it is too large
Load Diff
@@ -146,11 +146,9 @@ static void dsp_dma_run(DSPDMAState *s)
|
||||
|
||||
while (!(s->next_block & NODE_POINTER_EOL)) {
|
||||
uint32_t addr = s->next_block & NODE_POINTER_VAL;
|
||||
uint32_t block_addr = 0;
|
||||
int block_space = DSP_SPACE_X;
|
||||
|
||||
// FIXME: Are these block addresses BYTE addresses or WORD addresses?
|
||||
// Need to understand this DMA engine better.
|
||||
uint32_t block_addr;
|
||||
int block_space;
|
||||
if (addr < 0x1800) {
|
||||
assert(addr+6 < 0x1800);
|
||||
block_space = DSP_SPACE_X;
|
||||
@@ -199,19 +197,19 @@ static void dsp_dma_run(DSPDMAState *s)
|
||||
uint32_t channel_count = (count & 0xF) + 1;
|
||||
uint32_t block_count = count >> 4;
|
||||
|
||||
unsigned int item_size;
|
||||
unsigned int item_size = 4;
|
||||
uint32_t item_mask = 0xffffffff;
|
||||
// bool lsb = (format == 6); // FIXME
|
||||
|
||||
switch(format) {
|
||||
case 1:
|
||||
item_size = 2;
|
||||
item_mask = 0x0000FFFF;
|
||||
item_mask = 0x0000ffff;
|
||||
break;
|
||||
case 2:
|
||||
case 6:
|
||||
item_size = 4;
|
||||
item_mask = 0x00FFFFFF;
|
||||
item_mask = 0x00ffffff;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown dsp dma format: 0x%x\n", format);
|
||||
@@ -220,9 +218,9 @@ static void dsp_dma_run(DSPDMAState *s)
|
||||
}
|
||||
|
||||
size_t scratch_addr = scratch_base + scratch_offset;
|
||||
uint32_t mem_address = 0;
|
||||
int mem_space = DSP_SPACE_X;
|
||||
|
||||
uint32_t mem_address;
|
||||
int mem_space;
|
||||
if (dsp_offset < 0x1800) {
|
||||
assert(dsp_offset+count < 0x1800);
|
||||
mem_space = DSP_SPACE_X;
|
||||
@@ -274,7 +272,6 @@ static void dsp_dma_run(DSPDMAState *s)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < count; i++) {
|
||||
uint32_t v = dsp56k_read_memory(s->core, mem_space, mem_address+i);
|
||||
@@ -334,6 +331,7 @@ static void dsp_dma_run(DSPDMAState *s)
|
||||
v = (*(uint32_t*)(scratch_buf + i*4)) & item_mask;
|
||||
break;
|
||||
default:
|
||||
v = 0;
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
+134
-136
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user