diff --git a/src/flashcart/ed64/ed64_ll.c b/src/flashcart/ed64/ed64_ll.c index b8c27780..19e42e75 100644 --- a/src/flashcart/ed64/ed64_ll.c +++ b/src/flashcart/ed64/ed64_ll.c @@ -120,8 +120,6 @@ void ed64_ll_set_sram_bank(uint8_t bank) { #include #include #include -#include "types.h" - void PI_Init(void) { PI_DMAWait(); @@ -144,7 +142,7 @@ void PI_DMAWait(void) { } -void PI_DMAFromSRAM(void *dest, u32 offset, u32 size) { +void PI_DMAFromSRAM(void *dest, unsigned long offset, unsigned long size) { IO_WRITE(PI_DRAM_ADDR_REG, K1_TO_PHYS(dest)); @@ -156,7 +154,7 @@ void PI_DMAFromSRAM(void *dest, u32 offset, u32 size) { } -void PI_DMAToSRAM(void *src, u32 offset, u32 size) { //void* +void PI_DMAToSRAM(void *src, unsigned long offset, unsigned long size) { //void* PI_DMAWait(); IO_WRITE(PI_STATUS_REG, 2); @@ -165,7 +163,7 @@ void PI_DMAToSRAM(void *src, u32 offset, u32 size) { //void* IO_WRITE(PI_RD_LEN_REG, (size - 1)); } -void PI_DMAFromCart(void* dest, void* src, u32 size) { +void PI_DMAFromCart(void* dest, void* src, unsigned long size) { PI_DMAWait(); IO_WRITE(PI_STATUS_REG, 0x03); @@ -175,7 +173,7 @@ void PI_DMAFromCart(void* dest, void* src, u32 size) { } -void PI_DMAToCart(void* dest, void* src, u32 size) { +void PI_DMAToCart(void* dest, void* src, unsigned long size) { PI_DMAWait(); IO_WRITE(PI_STATUS_REG, 0x02); @@ -186,11 +184,11 @@ void PI_DMAToCart(void* dest, void* src, u32 size) { // Wrapper to support unaligned access to memory -void PI_SafeDMAFromCart(void *dest, void *src, u32 size) { +void PI_SafeDMAFromCart(void *dest, void *src, unsigned long size) { if (!dest || !src || !size) return; - u32 unalignedSrc = ((u32)src) % 2; - u32 unalignedDest = ((u32)dest) % 8; + unsigned long unalignedSrc = ((unsigned long)src) % 2; + unsigned long unalignedDest = ((unsigned long)dest) % 8; //FIXME: Do i really need to check if size is 16bit aligned? if (!unalignedDest && !unalignedSrc && !(size % 2)) { @@ -200,10 +198,10 @@ void PI_SafeDMAFromCart(void *dest, void *src, u32 size) { return; } - void* newSrc = (void*)(((u32)src) - unalignedSrc); - u32 newSize = (size + unalignedSrc) + ((size + unalignedSrc) % 2); + void* newSrc = (void*)(((unsigned long)src) - unalignedSrc); + unsigned long newSize = (size + unalignedSrc) + ((size + unalignedSrc) % 2); - u8 *buffer = memalign(8, newSize); + unsigned char *buffer = memalign(8, newSize); PI_DMAFromCart(buffer, newSrc, newSize); PI_DMAWait(); @@ -212,7 +210,6 @@ void PI_SafeDMAFromCart(void *dest, void *src, u32 size) { free(buffer); } -#include "types.h" int getSRAM( uint8_t *buffer, int size){ dma_wait(); diff --git a/src/flashcart/ed64/ed64_ll.h b/src/flashcart/ed64/ed64_ll.h index ffa17736..f975630c 100644 --- a/src/flashcart/ed64/ed64_ll.h +++ b/src/flashcart/ed64/ed64_ll.h @@ -11,7 +11,6 @@ #include #include #include -#include "types.h" /** * @addtogroup ed64 @@ -51,22 +50,22 @@ void ed64_ll_set_save_type(ed64_save_type_t type); void data_cache_hit_writeback_invalidate(volatile void *, unsigned long); unsigned int CRC_Calculate(unsigned int crc, unsigned char* buf, unsigned int len); -void dma_write_sram(void* src, u32 offset, u32 size); -void dma_read_sram(void *dest, u32 offset, u32 size); +void dma_write_sram(void* src, unsigned long offset, unsigned long size); +void dma_read_sram(void *dest, unsigned long offset, unsigned long size); void dma_write_s(void * ram_address, unsigned long pi_address, unsigned long len); void dma_read_s(void * ram_address, unsigned long pi_address, unsigned long len); -int writeSram(void* src, u32 size); +int writeSram(void* src, unsigned long size); void setSDTiming(void); void PI_Init(void); void PI_Init_SRAM(void); void PI_DMAWait(void); -void PI_DMAFromCart(void* dest, void* src, u32 size); -void PI_DMAToCart(void* dest, void* src, u32 size); -void PI_DMAFromSRAM(void *dest, u32 offset, u32 size); -void PI_DMAToSRAM(void* src, u32 offset, u32 size); -void PI_SafeDMAFromCart(void *dest, void *src, u32 size); +void PI_DMAFromCart(void* dest, void* src, unsigned long size); +void PI_DMAToCart(void* dest, void* src, unsigned long size); +void PI_DMAFromSRAM(void *dest, unsigned long offset, unsigned long size); +void PI_DMAToSRAM(void* src, unsigned long offset, unsigned long size); +void PI_SafeDMAFromCart(void *dest, void *src, unsigned long size); //memory /*** MEMORY ***/ @@ -164,13 +163,13 @@ void *safe_memcpy(void *dest, const void *src, size_t n); #define VI_H_SCALE (VI_BASE_REG + 0x2C) #define VI_VSCALE (VI_BASE_REG + 0x30) -#define PHYS_TO_K0(x) ((u32)(x)|0x80000000) /* physical to kseg0 */ -#define K0_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* kseg0 to physical */ -#define PHYS_TO_K1(x) ((u32)(x)|0xA0000000) /* physical to kseg1 */ -#define K1_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* kseg1 to physical */ +#define PHYS_TO_K0(x) ((unsigned long)(x)|0x80000000) /* physical to kseg0 */ +#define K0_TO_PHYS(x) ((unsigned long)(x)&0x1FFFFFFF) /* kseg0 to physical */ +#define PHYS_TO_K1(x) ((unsigned long)(x)|0xA0000000) /* physical to kseg1 */ +#define K1_TO_PHYS(x) ((unsigned long)(x)&0x1FFFFFFF) /* kseg1 to physical */ -#define IO_READ(addr) (*(volatile u32*)PHYS_TO_K1(addr)) -#define IO_WRITE(addr,data) (*(volatile u32*)PHYS_TO_K1(addr)=(u32)(data)) +#define IO_READ(addr) (*(volatile unsigned long*)PHYS_TO_K1(addr)) +#define IO_WRITE(addr,data) (*(volatile unsigned long*)PHYS_TO_K1(addr)=(unsigned long)(data)) #define FRAM_EXECUTE_CMD 0xD2000000 #define FRAM_STATUS_MODE_CMD 0xE1000000 diff --git a/src/flashcart/ed64/types.h b/src/flashcart/ed64/types.h deleted file mode 100644 index 625c877b..00000000 --- a/src/flashcart/ed64/types.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * File: types.h - * Author: KRIK - * - * Created on 16 ΐοπελό 2011 γ., 2:24 - */ - -#include - -#ifndef _TYPES_H -#define _TYPES_H - -#define u8 unsigned char -#define u16 unsigned short -#define u32 unsigned long -#define u64 unsigned long long - -#define vu8 volatile unsigned char -#define vu16 volatile unsigned short -#define vu32 volatile unsigned long -#define vu64 volatile unsigned long long - -#define s8 signed char -#define s16 short -#define s32 long -#define s64 long long - - -typedef volatile uint64_t sim_vu64; -typedef volatile uint64_t sim_vu64; -typedef unsigned int sim_u32; -typedef uint64_t sim_u64; - - -#endif /* _TYPES_H */ -