Skip to content

Commit 4b488b2

Browse files
committed
misc changes and cleanup
* support for building where int is 16-bit and char is not 8 bit * casts for types * a few typo fixes
1 parent a1ea880 commit 4b488b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+212
-208
lines changed

CPU.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ static int32_t cpuPrvMedia_signedSaturate32(int32_t sign)
772772
return (sign < 0) ? -0x80000000UL : 0x7ffffffful;
773773
}
774774

775-
static bool cpuPrvMemOpEx(struct ArmCpu *cpu, void* buf, uint32_t vaddr, uint_fast8_t size, bool write, bool priviledged, uint8_t* fsrP, uint_fast8_t memAccessFlags)
775+
static bool cpuPrvMemOpEx(struct ArmCpu *cpu, void* buf, uint32_t vaddr, uint_fast8_t size, bool write, bool priviledged, uint_fast8_t* fsrP, uint_fast8_t memAccessFlags)
776776
{
777777
uint32_t pa;
778778

@@ -809,12 +809,12 @@ static bool cpuPrvMemOpEx(struct ArmCpu *cpu, void* buf, uint32_t vaddr, uint_fa
809809
}
810810

811811
//for internal use
812-
static bool cpuPrvMemOp(struct ArmCpu *cpu, void* buf, uint32_t vaddr, uint_fast8_t size, bool write, bool priviledged, uint8_t* fsrP)
812+
static bool cpuPrvMemOp(struct ArmCpu *cpu, void* buf, uint32_t vaddr, uint_fast8_t size, bool write, bool priviledged, uint_fast8_t* fsrP)
813813
{
814814
if (cpuPrvMemOpEx(cpu, buf, vaddr, size, write, priviledged, fsrP, 0))
815815
return true;
816816

817-
fprintf(stderr, "%c of %u bytes to 0x%08x failed!\n", write ? 'W' : 'R', size, vaddr);
817+
fprintf(stderr, "%c of %u bytes to 0x%08lx failed!\n", (int)(write ? 'W' : 'R'), (unsigned)size, (unsigned long)vaddr);
818818
gdbStubDebugBreakRequested(cpu->debugStub);
819819

820820
return false;
@@ -1954,14 +1954,14 @@ static void cpuPrvExecInstr(struct ArmCpu *cpu, uint32_t instr, bool wasT , bool
19541954
if (cpu->regs[0] == 4) {
19551955

19561956
uint32_t addr = cpu->regs[1];
1957-
uint8_t ch, fsr;
1957+
uint8_t ch;
19581958

19591959
while (cpuPrvMemOp(cpu, &ch, addr++, 1, false, true, &fsr) && ch)
19601960
fprintf(stderr, "%c", ch);
19611961
}
19621962
else if (cpu->regs[0] == 3) {
19631963

1964-
uint8_t ch, fsr;
1964+
uint8_t ch;
19651965

19661966
if (cpuPrvMemOp(cpu, &ch, cpu->regs[1], 1, false, true, &fsr) && ch)
19671967
fprintf(stderr, "%c", ch);

MMU.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,9 @@ static void mmuPrvDumpUpdate(uint32_t va, uint32_t pa, uint32_t len, uint8_t dom
431431
if (valid != wasValid || dom != wasDom || ap != wasAp || c != wasC || b != wasB || expectPa != pa) { //not a continuation of what we've been at...
432432

433433
if (wasValid)
434-
fprintf(stderr, "0x%08x - 0x%08x -> 0x%08x - 0x%08x don%u ap%u %c %c\n",
435-
startVa, va_end, startPa, startPa + (va_end - startVa), wasDom, wasAp, wasC ? 'c' : ' ', wasB ? 'b' : ' ');
434+
fprintf(stderr, "0x%08lx - 0x%08lx -> 0x%08lx - 0x%08lx don%u ap%u %c %c\n",
435+
(unsigned long)startVa, (unsigned long)va_end, (unsigned long)startPa, (unsigned long)(startPa + (va_end - startVa)),
436+
wasDom, wasAp, (char)(wasC ? 'c' : ' '), (char)(wasB ? 'b' : ' '));
436437

437438
wasValid = valid;
438439
if (valid) { //start of a new range

ROM.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ struct ArmRom* romInit(struct ArmMem *mem, uint32_t adr, void **pieces, const ui
388388

389389
piece->base = adr;
390390
piece->size = *pieceSizes++;
391-
piece->buf = *pieces++;
391+
piece->buf = (uint32_t*)*pieces++;
392392
piece->rom = rom;
393393

394394
adr += piece->size;

ac97dev_WM9705.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ static uint16_t* wm9705prvGetVolReg(struct WM9705 *wm, uint32_t regAddr)
9494

9595
static bool wm9705prvCodecRegR(void *userData, uint32_t regAddr, uint16_t *regValP)
9696
{
97+
enum WM9705REG which = (enum WM9705REG)regAddr;
9798
struct WM9705 *wm = (struct WM9705*)userData;
98-
enum WM9705REG which = regAddr;
9999
uint16_t val;
100100

101-
fprintf(stderr, "codec read [0x%04x]\n", regAddr);
101+
fprintf(stderr, "codec read [0x%04x]\n", (unsigned)regAddr);
102102

103103
switch (which) {
104104
case RESET:
@@ -188,10 +188,10 @@ static bool wm9705prvCodecRegR(void *userData, uint32_t regAddr, uint16_t *regVa
188188

189189
static bool wm9705prvCodecRegW(void *userData, uint32_t regAddr, uint16_t val)
190190
{
191+
enum WM9705REG which = (enum WM9705REG)regAddr;
191192
struct WM9705 *wm = (struct WM9705*)userData;
192-
enum WM9705REG which = regAddr;
193193

194-
fprintf(stderr, "codec wri 0x%04x -> [0x%04x]\n", val, regAddr);
194+
fprintf(stderr, "codec wri 0x%04x -> [0x%04x]\n", (unsigned)val, (unsigned)regAddr);
195195

196196
switch (regAddr) {
197197
case VOLMASTER:

ac97dev_WM9712L.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static void wm9712LprvGpioRecalc(struct WM9712L *wm)
104104
static bool wm9712LprvCodecRegR(void *userData, uint32_t regAddr, uint16_t *regValP)
105105
{
106106
struct WM9712L *wm = (struct WM9712L*)userData;
107-
enum WM9712REG which = regAddr;
107+
enum WM9712REG which = (enum WM9712REG)regAddr;
108108
uint16_t val;
109109

110110
switch (which) {
@@ -242,21 +242,21 @@ static bool wm9712LprvCodecRegR(void *userData, uint32_t regAddr, uint16_t *regV
242242
break;
243243

244244
default:
245-
fprintf(stderr, "unknown reg read [0x%04x]\n", regAddr);
245+
fprintf(stderr, "unknown reg read [0x%04x]\n", (unsigned)regAddr);
246246
return false;
247247
}
248248

249-
fprintf(stderr, "codec read [0x%04x] -> %04x\n", regAddr, val);
249+
//fprintf(stderr, "codec read [0x%04x] -> %04x\n", (unsigned)regAddr, (unsigned)val);
250250
*regValP = val;
251251
return true;
252252
}
253253

254254
static bool wm9712LprvCodecRegW(void *userData, uint32_t regAddr, uint16_t val)
255255
{
256256
struct WM9712L *wm = (struct WM9712L*)userData;
257-
enum WM9712REG which = regAddr;
257+
enum WM9712REG which = (enum WM9712REG)regAddr;
258258

259-
fprintf(stderr, "codec wri [0x%04x] -> [0x%04x]\n", val, regAddr);
259+
//fprintf(stderr, "codec wri [0x%04x] -> [0x%04x]\n", (unsigned)val, (unsigned)regAddr);
260260

261261
switch (which) {
262262

@@ -376,7 +376,7 @@ static bool wm9712LprvCodecRegW(void *userData, uint32_t regAddr, uint16_t val)
376376
break;
377377

378378
default:
379-
fprintf(stderr, "unknown reg wri [0x%04x] -> [0x%04x]\n", val, regAddr);
379+
fprintf(stderr, "unknown reg wri [0x%04x] -> [0x%04x]\n", (unsigned)val, (unsigned)regAddr);
380380
return false;
381381
}
382382
return false;

cp15.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static bool cp15prvCoprocRegXferFunc(struct ArmCpu* cpu, void* userData, bool tw
8787

8888
tmp = val ^ cp15->control; //see what changed and mask off then chack for what we support changing of
8989
if (tmp & 0x84F0UL) {
90-
fprintf(stderr, "cp15: unknown bits changed (0x%08lx) 0x%08x -> 0x%08x, halting\n", tmp & 0x84F0UL, cp15->control, origVal);
90+
fprintf(stderr, "cp15: unknown bits changed (0x%08lx) 0x%08lx -> 0x%08lx, halting\n", (unsigned long)(tmp & 0x84F0UL), (unsigned long)cp15->control, (unsigned long)origVal);
9191
while (true);
9292
}
9393

@@ -230,7 +230,7 @@ static bool cp15prvCoprocRegXferFunc(struct ArmCpu* cpu, void* userData, bool tw
230230

231231
case 9: //cache lockdown
232232
if (CRm == 1 && op2 == 0)
233-
fprintf(stderr, "Attempt to lock 0x%08x+32 in icache\r\n", val);
233+
fprintf(stderr, "Attempt to lock 0x%08lx+32 in icache\r\n", (unsigned long)val);
234234
else if (CRm == 2 && op2 == 0)
235235
fprintf(stderr, "Dcache now %s lock mode\r\n", val ? "in" : "out of");
236236
else

deviceAceecaPDA32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void deviceSetup(struct SocPeriphs *sp, struct Keypad *kp, struct VSD *vsd, FILE
9292
mNand = nandInit(nandFile, &nandSpecs, pda32nandPrvReady, sp->gpio);
9393
sp->nand = mNand;
9494

95-
mWeirdBusAccess = ramInit(sp->mem, 0xa0000000, 0x800, malloc(0x800));
95+
mWeirdBusAccess = ramInit(sp->mem, 0xa0000000, 0x800, (uint32_t*)malloc(0x800));
9696
if (!mWeirdBusAccess)
9797
ERR("Cannot init RAM4");
9898

@@ -138,7 +138,7 @@ void deviceSetup(struct SocPeriphs *sp, struct Keypad *kp, struct VSD *vsd, FILE
138138
mAdc = (struct S3C24xxAdc*)sp->adc;
139139

140140
//battery is nearly full. device uses AIN0, 1:3.2 scale
141-
s3c24xxAdcSetAuxAdc(mAdc, 0, 4100 * 10 / 32);
141+
s3c24xxAdcSetAuxAdc(mAdc, 0, 4100UL * 10 / 32);
142142

143143
socBootload(sp->soc, 2048 | 0xc0000000ul, mNand); //PDA32 boots from NAND directly
144144
}

devicePalmTungstenC.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ void deviceSetup(struct SocPeriphs *sp, struct Keypad *kp, struct VSD *vsd, FILE
4040
if (!keypadDefineRow(kp, 0, 18) || !keypadDefineRow(kp, 1, 19) || !keypadDefineRow(kp, 2, 20) || !keypadDefineRow(kp, 3, 21) || !keypadDefineRow(kp, 4, 22) || !keypadDefineRow(kp, 5, 23) || !keypadDefineRow(kp, 6, 24) || !keypadDefineRow(kp, 7, 25) || !keypadDefineRow(kp, 8, 26) || !keypadDefineRow(kp, 9, 27) || !keypadDefineRow(kp, 10, 79) || !keypadDefineRow(kp, 11, 80))
4141
ERR("Cannot init keypad rows");
4242

43-
mWifiMemSpace1 = ramInit(sp->mem, 0x28000000, 1024, malloc(1024));
43+
mWifiMemSpace1 = ramInit(sp->mem, 0x28000000, 1024, (uint32_t*)malloc(1024));
4444
if(!mWifiMemSpace1)
4545
ERR("Cannot init RAM4");
4646

47-
mWifiMemSpace2 = ramInit(sp->mem, 0x20000000, 1024, malloc(1024));
47+
mWifiMemSpace2 = ramInit(sp->mem, 0x20000000, 1024, (uint32_t*)malloc(1024));
4848
if(!mWifiMemSpace2)
4949
ERR("Cannot init RAM3");
5050

devicePalmTungstenE.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void deviceSetup(struct SocPeriphs *sp, struct Keypad *kp, struct VSD *vsd, FILE
5050
{
5151
uint_fast8_t i;
5252

53-
mWeirdBusAccess = ramInit(sp->mem, 0x08000000, 0x280, malloc(0x280));
53+
mWeirdBusAccess = ramInit(sp->mem, 0x08000000, 0x280, (uint32_t*)malloc(0x280));
5454
if (!mWeirdBusAccess)
5555
ERR("Cannot init RAM4");
5656

devicePalmTungstenT.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void deviceSetup(struct SocPeriphs *sp, struct Keypad *kp, struct VSD *vsd, FILE
5151
{
5252
uint_fast8_t i;
5353

54-
mWeirdBusAccess = ramInit(sp->mem, 0x08000000, 0x280, malloc(0x280));
54+
mWeirdBusAccess = ramInit(sp->mem, 0x08000000, 0x280, (uint32_t*)malloc(0x280));
5555
if (!mWeirdBusAccess)
5656
ERR("Cannot init RAM4");
5757

0 commit comments

Comments
 (0)