You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Fixed usb library
This commit is contained in:
3
Makefile
3
Makefile
@@ -170,9 +170,6 @@ $(eval $(call validate-option,UNF,0 1))
|
||||
ifeq ($(UNF),1)
|
||||
DEFINES += UNF=1
|
||||
SRC_DIRS += src/usb
|
||||
ULTRALIB := ultra_d
|
||||
else
|
||||
ULTRALIB := ultra_rom
|
||||
endif
|
||||
|
||||
|
||||
|
||||
8
sm64.ld
8
sm64.ld
@@ -132,7 +132,7 @@ SECTIONS
|
||||
BUILD_DIR/src/usb*.o(.text);
|
||||
#endif
|
||||
BUILD_DIR/src/audio*.o(.text);
|
||||
#if defined(ISVPRINT) || defined(UNF)
|
||||
#if defined(ISVPRINT)
|
||||
*/libultra_d.a:*.o(.text);
|
||||
#else
|
||||
*/libultra_rom.a:*.o(.text);
|
||||
@@ -158,7 +158,7 @@ SECTIONS
|
||||
#ifdef GZIP
|
||||
*/libz.a:*.o(.*data*);
|
||||
#endif
|
||||
#if defined(ISVPRINT) || defined(UNF)
|
||||
#if defined(ISVPRINT)
|
||||
*/libultra_d.a:*.o(.*data*);
|
||||
#else
|
||||
*/libultra_rom.a:*.o(.*data*);
|
||||
@@ -178,7 +178,7 @@ SECTIONS
|
||||
BUILD_DIR/src/usb*.o(.rodata*);
|
||||
#endif
|
||||
BUILD_DIR/src/audio*.o(.rodata*);
|
||||
#if defined(ISVPRINT) || defined(UNF)
|
||||
#if defined(ISVPRINT)
|
||||
*/libultra_d.a:*.o(.*rodata*);
|
||||
#else
|
||||
*/libultra_rom.a:*.o(.*rodata*);
|
||||
@@ -208,7 +208,7 @@ SECTIONS
|
||||
BUILD_DIR/src/gzip*.o(.bss*);
|
||||
#endif
|
||||
BUILD_DIR/src/audio*.o(.*bss*);
|
||||
#if defined(ISVPRINT) || defined(UNF)
|
||||
#if defined(ISVPRINT)
|
||||
*/libultra_d.a:*.o(COMMON);
|
||||
*/libultra_d.a:*.o(.scommon);
|
||||
*/libultra_d.a:*.o(.*bss*);
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#if defined(RNC1) || defined(RNC2)
|
||||
#include <rnc.h>
|
||||
#endif
|
||||
#ifdef UNF
|
||||
#include "usb/usb.h"
|
||||
#include "usb/debug.h"
|
||||
#endif
|
||||
|
||||
|
||||
// round up to the next multiple
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
#define DEBUG_MODE 1 // Enable/Disable debug mode
|
||||
#define DEBUG_INIT_MSG 1 // Print a message when debug mode has initialized
|
||||
#define USE_FAULTTHREAD 1 // Create a fault detection thread (libultra only)
|
||||
#define OVERWRITE_OSPRINT 1 // Replaces osSyncPrintf calls with debug_printf (libultra only)
|
||||
#define OVERWRITE_OSPRINT 0 // Replaces osSyncPrintf calls with debug_printf (libultra only)
|
||||
#define MAX_COMMANDS 25 // The max amount of user defined commands possible
|
||||
|
||||
#define osSyncPrintf debug_printf // Temporary until libultra_d is linked instead
|
||||
|
||||
// Fault thread definitions (libultra only)
|
||||
#define FAULT_THREAD_ID 13
|
||||
|
||||
@@ -973,6 +973,15 @@ static void usb_everdrive_readdata(void* buff, u32 pi_address, u32 len)
|
||||
#ifdef LIBDRAGON
|
||||
data_cache_hit_writeback_invalidate(buff, len);
|
||||
disable_interrupts();
|
||||
// Write the data to the PI
|
||||
usb_everdrive_wait_pidma();
|
||||
IO_WRITE(PI_STATUS_REG, 3);
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_RAMADDRESS) = (u32)buff;
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_PIADDRESS) = pi_address;
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_WRITELENGTH) = len-1;
|
||||
usb_everdrive_wait_pidma();
|
||||
// Enable system interrupts
|
||||
enable_interrupts();
|
||||
#else
|
||||
osInvalDCache(buff, len);
|
||||
#if USE_OSRAW
|
||||
@@ -986,23 +995,6 @@ static void usb_everdrive_readdata(void* buff, u32 pi_address, u32 len)
|
||||
(void)osRecvMesg(&dmaMessageQ, NULL, OS_MESG_BLOCK);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Write the data to the PI
|
||||
usb_everdrive_wait_pidma();
|
||||
IO_WRITE(PI_STATUS_REG, 3);
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_RAMADDRESS) = (u32)buff;
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_PIADDRESS) = pi_address;
|
||||
#ifdef LIBDRAGON
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_WRITELENGTH) = len-1;
|
||||
#else
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_READLENGTH) = len-1;
|
||||
#endif
|
||||
usb_everdrive_wait_pidma();
|
||||
|
||||
// Enable system interrupts
|
||||
#ifdef LIBDRAGON
|
||||
enable_interrupts();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1036,6 +1028,15 @@ static void usb_everdrive_writedata(void* buff, u32 pi_address, u32 len)
|
||||
#ifdef LIBDRAGON
|
||||
data_cache_hit_writeback(buff, len);
|
||||
disable_interrupts();
|
||||
// Write the data to the PI
|
||||
usb_everdrive_wait_pidma();
|
||||
IO_WRITE(PI_STATUS_REG, 3);
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_RAMADDRESS) = (u32)buff;
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_PIADDRESS) = pi_address;
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_READLENGTH) = len-1;
|
||||
usb_everdrive_wait_pidma();
|
||||
// Enable system interrupts
|
||||
enable_interrupts();
|
||||
#else
|
||||
osWritebackDCache(buff, len);
|
||||
#if USE_OSRAW
|
||||
@@ -1049,23 +1050,6 @@ static void usb_everdrive_writedata(void* buff, u32 pi_address, u32 len)
|
||||
(void)osRecvMesg(&dmaMessageQ, NULL, OS_MESG_BLOCK);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Write the data to the PI
|
||||
usb_everdrive_wait_pidma();
|
||||
IO_WRITE(PI_STATUS_REG, 3);
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_RAMADDRESS) = (u32)buff;
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_PIADDRESS) = pi_address;
|
||||
#ifdef LIBDRAGON
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_READLENGTH) = len-1;
|
||||
#else
|
||||
*(volatile unsigned long *)(N64_PI_ADDRESS + N64_PI_WRITELENGTH) = len-1;
|
||||
#endif
|
||||
usb_everdrive_wait_pidma();
|
||||
|
||||
// Enable system interrupts
|
||||
#ifdef LIBDRAGON
|
||||
enable_interrupts();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user