mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-28 21:44:15 +01:00
remove types.h
This commit is contained in:
parent
346371afa5
commit
64762bbcf7
@ -120,8 +120,6 @@ void ed64_ll_set_sram_bank(uint8_t bank) {
|
|||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
|
|
||||||
void PI_Init(void) {
|
void PI_Init(void) {
|
||||||
PI_DMAWait();
|
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));
|
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();
|
PI_DMAWait();
|
||||||
|
|
||||||
IO_WRITE(PI_STATUS_REG, 2);
|
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));
|
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();
|
PI_DMAWait();
|
||||||
|
|
||||||
IO_WRITE(PI_STATUS_REG, 0x03);
|
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();
|
PI_DMAWait();
|
||||||
|
|
||||||
IO_WRITE(PI_STATUS_REG, 0x02);
|
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
|
// 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;
|
if (!dest || !src || !size) return;
|
||||||
|
|
||||||
u32 unalignedSrc = ((u32)src) % 2;
|
unsigned long unalignedSrc = ((unsigned long)src) % 2;
|
||||||
u32 unalignedDest = ((u32)dest) % 8;
|
unsigned long unalignedDest = ((unsigned long)dest) % 8;
|
||||||
|
|
||||||
//FIXME: Do i really need to check if size is 16bit aligned?
|
//FIXME: Do i really need to check if size is 16bit aligned?
|
||||||
if (!unalignedDest && !unalignedSrc && !(size % 2)) {
|
if (!unalignedDest && !unalignedSrc && !(size % 2)) {
|
||||||
@ -200,10 +198,10 @@ void PI_SafeDMAFromCart(void *dest, void *src, u32 size) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* newSrc = (void*)(((u32)src) - unalignedSrc);
|
void* newSrc = (void*)(((unsigned long)src) - unalignedSrc);
|
||||||
u32 newSize = (size + unalignedSrc) + ((size + unalignedSrc) % 2);
|
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_DMAFromCart(buffer, newSrc, newSize);
|
||||||
PI_DMAWait();
|
PI_DMAWait();
|
||||||
|
|
||||||
@ -212,7 +210,6 @@ void PI_SafeDMAFromCart(void *dest, void *src, u32 size) {
|
|||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
int getSRAM( uint8_t *buffer, int size){
|
int getSRAM( uint8_t *buffer, int size){
|
||||||
dma_wait();
|
dma_wait();
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup ed64
|
* @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);
|
void data_cache_hit_writeback_invalidate(volatile void *, unsigned long);
|
||||||
unsigned int CRC_Calculate(unsigned int crc, unsigned char* buf, unsigned int len);
|
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_write_sram(void* src, unsigned long offset, unsigned long size);
|
||||||
void dma_read_sram(void *dest, u32 offset, u32 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_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);
|
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 setSDTiming(void);
|
||||||
|
|
||||||
|
|
||||||
void PI_Init(void);
|
void PI_Init(void);
|
||||||
void PI_Init_SRAM(void);
|
void PI_Init_SRAM(void);
|
||||||
void PI_DMAWait(void);
|
void PI_DMAWait(void);
|
||||||
void PI_DMAFromCart(void* dest, void* src, u32 size);
|
void PI_DMAFromCart(void* dest, void* src, unsigned long size);
|
||||||
void PI_DMAToCart(void* dest, void* src, u32 size);
|
void PI_DMAToCart(void* dest, void* src, unsigned long size);
|
||||||
void PI_DMAFromSRAM(void *dest, u32 offset, u32 size);
|
void PI_DMAFromSRAM(void *dest, unsigned long offset, unsigned long size);
|
||||||
void PI_DMAToSRAM(void* src, u32 offset, u32 size);
|
void PI_DMAToSRAM(void* src, unsigned long offset, unsigned long size);
|
||||||
void PI_SafeDMAFromCart(void *dest, void *src, u32 size);
|
void PI_SafeDMAFromCart(void *dest, void *src, unsigned long size);
|
||||||
|
|
||||||
//memory
|
//memory
|
||||||
/*** 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_H_SCALE (VI_BASE_REG + 0x2C)
|
||||||
#define VI_VSCALE (VI_BASE_REG + 0x30)
|
#define VI_VSCALE (VI_BASE_REG + 0x30)
|
||||||
|
|
||||||
#define PHYS_TO_K0(x) ((u32)(x)|0x80000000) /* physical to kseg0 */
|
#define PHYS_TO_K0(x) ((unsigned long)(x)|0x80000000) /* physical to kseg0 */
|
||||||
#define K0_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* kseg0 to physical */
|
#define K0_TO_PHYS(x) ((unsigned long)(x)&0x1FFFFFFF) /* kseg0 to physical */
|
||||||
#define PHYS_TO_K1(x) ((u32)(x)|0xA0000000) /* physical to kseg1 */
|
#define PHYS_TO_K1(x) ((unsigned long)(x)|0xA0000000) /* physical to kseg1 */
|
||||||
#define K1_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* kseg1 to physical */
|
#define K1_TO_PHYS(x) ((unsigned long)(x)&0x1FFFFFFF) /* kseg1 to physical */
|
||||||
|
|
||||||
#define IO_READ(addr) (*(volatile u32*)PHYS_TO_K1(addr))
|
#define IO_READ(addr) (*(volatile unsigned long*)PHYS_TO_K1(addr))
|
||||||
#define IO_WRITE(addr,data) (*(volatile u32*)PHYS_TO_K1(addr)=(u32)(data))
|
#define IO_WRITE(addr,data) (*(volatile unsigned long*)PHYS_TO_K1(addr)=(unsigned long)(data))
|
||||||
|
|
||||||
#define FRAM_EXECUTE_CMD 0xD2000000
|
#define FRAM_EXECUTE_CMD 0xD2000000
|
||||||
#define FRAM_STATUS_MODE_CMD 0xE1000000
|
#define FRAM_STATUS_MODE_CMD 0xE1000000
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* File: types.h
|
|
||||||
* Author: KRIK
|
|
||||||
*
|
|
||||||
* Created on 16 Àïðåëü 2011 ã., 2:24
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#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 */
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user