Skip to content

Commit

Permalink
Fix various type mismatch errors
Browse files Browse the repository at this point in the history
  • Loading branch information
neuschaefer committed Nov 19, 2024
1 parent afed828 commit dc7cdbc
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions arcgrackle/source/arcfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2295,7 +2295,7 @@ static FS_METADATA s_Metadata[FILE_TABLE_SIZE] = { 0 };

DSTATUS disk_initialize(void) { return RES_OK; }

DRESULT disk_readp(ULONG DeviceId, BYTE* buff, DWORD sector, UINT offset, UINT count) {
DRESULT disk_readp(UINT DeviceId, BYTE* buff, DWORD sector, UINT offset, UINT count) {
if (DeviceId >= FILE_TABLE_SIZE) return RES_PARERR;
PFS_METADATA Meta = &s_Metadata[DeviceId];
if (Meta->Type != FS_FAT) return RES_PARERR;
Expand Down Expand Up @@ -2333,7 +2333,7 @@ DRESULT disk_readp(ULONG DeviceId, BYTE* buff, DWORD sector, UINT offset, UINT c
return RES_OK;
}

DRESULT disk_writep(ULONG DeviceId, const BYTE* buff, DWORD sc) {
DRESULT disk_writep(UINT DeviceId, const BYTE* buff, DWORD sc) {
if (DeviceId >= FILE_TABLE_SIZE) return RES_PARERR;
PFS_METADATA Meta = &s_Metadata[DeviceId];
if (Meta->Type != FS_FAT) return RES_PARERR;
Expand Down
1 change: 0 additions & 1 deletion arcgrackle/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,5 +808,4 @@ void ARC_NORETURN FwMain(PHW_DESCRIPTION Desc) {
ArcMain();
// should never reach here
while (1) {}
return 0;
}
12 changes: 6 additions & 6 deletions arcgrackle/source/usbohci.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ static u32 _phys_to_virt(u32 phys) {
// return uncached address if possible
if (phys >= 0xf0000000) return phys;
if (phys < 0x10000000) return 0x90000000 + phys;
if (phys < 0x80000000) return NULL;
if (phys >= 0x90000000) return NULL;
if (phys < 0x80000000) return 0;
if (phys >= 0x90000000) return 0;
return phys + (0xC0000000 - 0x80000000);
}

static PVOID phys_to_virt(u32 phys) { return (PVOID)_phys_to_virt(phys); }

static u32 virt_to_phys(PVOID _virt) {
u32 virt = (u32)_virt;
if (virt < 0x80000000) return NULL;
if (virt < 0x80000000) return 0;
if (virt < 0x90000000) return (virt - 0x80000000);
if (virt < 0xA0000000) return (virt - 0x90000000);
if (virt < 0xC0000000) return NULL;
if (virt < 0xC0000000) return 0;
if (virt < 0xD0000000) return (virt - 0xC0000000 + 0x80000000);
if (virt < 0xF0000000) return NULL;
if (virt < 0xF0000000) return 0;
return virt;
}

Expand Down Expand Up @@ -238,7 +238,7 @@ ohci_init (void *bar)
init_device_entry (controller, 0);
OHCI_INST (controller)->roothub = controller->devices[0];

controller->reg_base = (u32)virt_to_phys((u32)bar);
controller->reg_base = (u32)virt_to_phys(bar);
OHCI_INST(controller)->opreg = (opreg_t*)bar;
usb_debug("OHCI Version %x.%x\n",
(READ_OPREG(OHCI_INST(controller), HcRevision) >> 4) & 0xf,
Expand Down
2 changes: 1 addition & 1 deletion arcloader_grackle/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ static bool FbSetDepthNv(OFHANDLE Screen) {
NV_PRMCIO_CRTC[1] = 0x03;
__asm__ volatile ("eieio");
// Set PRAMDAC_GENERAL_CONTROL
volatile U32LE* NV_PRAMDAC_GENERAL_CONTROL = (volatile ULONG*)(PCRTC + 0x80600);
volatile U32LE* NV_PRAMDAC_GENERAL_CONTROL = (volatile U32LE*)(PCRTC + 0x80600);
NV_PRAMDAC_GENERAL_CONTROL->v = 0x101130; // PIXMIX_ON | VGA_STATE_SEL | ALT_MODE_SEL | BPC_8BITS
__asm__ volatile ("eieio");
// NV_CIO_CR_OFFSET = stride / 8
Expand Down
2 changes: 1 addition & 1 deletion arcloader_unin/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ static bool FbSetDepthNv(OFHANDLE Screen) {
NV_PRMCIO_CRTC[1] = 0x03 | PixelDepth7;
__asm__ volatile ("eieio");
// Set PRAMDAC_GENERAL_CONTROL
volatile U32LE* NV_PRAMDAC_GENERAL_CONTROL = (volatile ULONG*)(PCRTC + 0x80600);
volatile U32LE* NV_PRAMDAC_GENERAL_CONTROL = (volatile U32LE*)(PCRTC + 0x80600);
NV_PRAMDAC_GENERAL_CONTROL->v = 0x101130; // PIXMIX_ON | VGA_STATE_SEL | ALT_MODE_SEL | BPC_8BITS
__asm__ volatile ("eieio");
// NV_CIO_CR_OFFSET = stride / 8
Expand Down
4 changes: 2 additions & 2 deletions arcunin/source/arcfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,7 @@ static FS_METADATA s_Metadata[FILE_TABLE_SIZE] = { 0 };

DSTATUS disk_initialize(void) { return RES_OK; }

DRESULT disk_readp(ULONG DeviceId, BYTE* buff, DWORD sector, UINT offset, UINT count) {
DRESULT disk_readp(UINT DeviceId, BYTE* buff, DWORD sector, UINT offset, UINT count) {
if (DeviceId >= FILE_TABLE_SIZE) return RES_PARERR;
PFS_METADATA Meta = &s_Metadata[DeviceId];
if (Meta->Type != FS_FAT) return RES_PARERR;
Expand Down Expand Up @@ -1962,7 +1962,7 @@ DRESULT disk_readp(ULONG DeviceId, BYTE* buff, DWORD sector, UINT offset, UINT c
return RES_OK;
}

DRESULT disk_writep(ULONG DeviceId, const BYTE* buff, DWORD sc) {
DRESULT disk_writep(UINT DeviceId, const BYTE* buff, DWORD sc) {
if (DeviceId >= FILE_TABLE_SIZE) return RES_PARERR;
PFS_METADATA Meta = &s_Metadata[DeviceId];
if (Meta->Type != FS_FAT) return RES_PARERR;
Expand Down
1 change: 0 additions & 1 deletion arcunin/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,5 +832,4 @@ void ARC_NORETURN FwMain(PHW_DESCRIPTION Desc) {
ArcMain();
// should never reach here
while (1) {}
return 0;
}
6 changes: 3 additions & 3 deletions arcunin/source/usbohci.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static void endian_swap64(void* buf, ULONG len) {
static u32 _phys_to_virt(u32 phys) {
// return uncached address if possible
if (phys < 0x10000000) return 0x70000000 + phys;
if (phys < 0x80000000) return NULL;
if (phys < 0x80000000) return 0;
if (phys >= 0x90000000) return phys;
return phys - (0x80000000 - 0x60000000);
}
Expand All @@ -67,7 +67,7 @@ static PVOID phys_to_virt(u32 phys) { return (PVOID)_phys_to_virt(phys); }

static u32 virt_to_phys(PVOID _virt) {
u32 virt = (u32)_virt;
if (virt < 0x60000000) return NULL;
if (virt < 0x60000000) return 0;
if (virt < 0x70000000) return (virt - 0x60000000 + 0x80000000);
if (virt < 0x80000000) return (virt - 0x70000000);
if (virt < 0x90000000) return (virt - 0x80000000);
Expand Down Expand Up @@ -245,7 +245,7 @@ ohci_init (void *bar)
init_device_entry (controller, 0);
OHCI_INST (controller)->roothub = controller->devices[0];

controller->reg_base = (u32)virt_to_phys((u32)bar);
controller->reg_base = (u32)virt_to_phys(bar);
OHCI_INST(controller)->opreg = (opreg_t*)bar;
usb_debug("OHCI Version %x.%x\n",
(READ_OPREG(OHCI_INST(controller), HcRevision) >> 4) & 0xf,
Expand Down

0 comments on commit dc7cdbc

Please sign in to comment.