Skip to content

Commit 38203ce

Browse files
committed
debug header fixes for non debug + 64Drive 0 padding
1 parent 806f3f9 commit 38203ce

File tree

11 files changed

+61
-17
lines changed

11 files changed

+61
-17
lines changed

Examples/Libdragon/1. Hello World/debug.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
Settings macros
66
*********************************/
77

8+
// Enable/Disable debug
9+
#ifndef DEBUG_MODE
10+
#define DEBUG_MODE 1 // Enable/Disable debug mode
11+
#endif
12+
813
// Settings
9-
#define DEBUG_MODE 1 // Enable/Disable debug mode
1014
#define DEBUG_INIT_MSG 1 // Print a message when debug mode has initialized
1115
#define USE_FAULTTHREAD 1 // Create a fault detection thread (libultra only)
1216
#define OVERWRITE_OSPRINT 1 // Replaces osSyncPrintf calls with debug_printf (libultra only)
@@ -144,7 +148,7 @@
144148

145149
// Overwrite library functions with useless macros if debug mode is disabled
146150
#define debug_initialize()
147-
#define debug_printf
151+
#define debug_printf (void)
148152
#define debug_screenshot(a, b, c)
149153
#define debug_assert(a)
150154
#define debug_pollcommands()

Examples/Libdragon/3. Command Interpreter/debug.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
Settings macros
66
*********************************/
77

8+
// Enable/Disable debug
9+
#ifndef DEBUG_MODE
10+
#define DEBUG_MODE 1 // Enable/Disable debug mode
11+
#endif
12+
813
// Settings
9-
#define DEBUG_MODE 1 // Enable/Disable debug mode
1014
#define DEBUG_INIT_MSG 1 // Print a message when debug mode has initialized
1115
#define USE_FAULTTHREAD 1 // Create a fault detection thread (libultra only)
1216
#define OVERWRITE_OSPRINT 1 // Replaces osSyncPrintf calls with debug_printf (libultra only)
@@ -144,7 +148,7 @@
144148

145149
// Overwrite library functions with useless macros if debug mode is disabled
146150
#define debug_initialize()
147-
#define debug_printf
151+
#define debug_printf (void)
148152
#define debug_screenshot(a, b, c)
149153
#define debug_assert(a)
150154
#define debug_pollcommands()

Examples/Libultra/1. Hello World/debug.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
Settings macros
66
*********************************/
77

8+
// Enable/Disable debug
9+
#ifndef DEBUG_MODE
10+
#define DEBUG_MODE 1 // Enable/Disable debug mode
11+
#endif
12+
813
// Settings
9-
#define DEBUG_MODE 1 // Enable/Disable debug mode
1014
#define DEBUG_INIT_MSG 1 // Print a message when debug mode has initialized
1115
#define USE_FAULTTHREAD 1 // Create a fault detection thread (libultra only)
1216
#define OVERWRITE_OSPRINT 1 // Replaces osSyncPrintf calls with debug_printf (libultra only)
@@ -144,7 +148,7 @@
144148

145149
// Overwrite library functions with useless macros if debug mode is disabled
146150
#define debug_initialize()
147-
#define debug_printf
151+
#define debug_printf (void)
148152
#define debug_screenshot(a, b, c)
149153
#define debug_assert(a)
150154
#define debug_pollcommands()

Examples/Libultra/1. Hello World/usb.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ static u32 usb_64drive_cui_read(u32 offset)
921921

922922
static void usb_64drive_write(int datatype, const void* data, int size)
923923
{
924-
u32 left = size;
924+
s32 left = size;
925925
u32 pi_address = D64_BASE + DEBUG_ADDRESS;
926926

927927
// Return if previous transfer timed out
@@ -942,6 +942,10 @@ static void usb_64drive_write(int datatype, const void* data, int size)
942942

943943
// Copy data to PI DMA aligned buffer
944944
memcpy(usb_buffer, data, block);
945+
946+
// Pad the buffer with zeroes if it wasn't 4 byte aligned
947+
while (block%4)
948+
usb_buffer[block++] = 0;
945949

946950
// Copy block of data from RDRAM to SDRAM
947951
usb_dma_write(usb_buffer, pi_address, ALIGN(block, 2));

Examples/Libultra/2. Thread Faults/debug.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
Settings macros
66
*********************************/
77

8+
// Enable/Disable debug
9+
#ifndef DEBUG_MODE
10+
#define DEBUG_MODE 1 // Enable/Disable debug mode
11+
#endif
12+
813
// Settings
9-
#define DEBUG_MODE 1 // Enable/Disable debug mode
1014
#define DEBUG_INIT_MSG 1 // Print a message when debug mode has initialized
1115
#define USE_FAULTTHREAD 1 // Create a fault detection thread (libultra only)
1216
#define OVERWRITE_OSPRINT 1 // Replaces osSyncPrintf calls with debug_printf (libultra only)
@@ -144,7 +148,7 @@
144148

145149
// Overwrite library functions with useless macros if debug mode is disabled
146150
#define debug_initialize()
147-
#define debug_printf
151+
#define debug_printf (void)
148152
#define debug_screenshot(a, b, c)
149153
#define debug_assert(a)
150154
#define debug_pollcommands()

Examples/Libultra/2. Thread Faults/usb.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ static u32 usb_64drive_cui_read(u32 offset)
921921

922922
static void usb_64drive_write(int datatype, const void* data, int size)
923923
{
924-
u32 left = size;
924+
s32 left = size;
925925
u32 pi_address = D64_BASE + DEBUG_ADDRESS;
926926

927927
// Return if previous transfer timed out
@@ -942,6 +942,10 @@ static void usb_64drive_write(int datatype, const void* data, int size)
942942

943943
// Copy data to PI DMA aligned buffer
944944
memcpy(usb_buffer, data, block);
945+
946+
// Pad the buffer with zeroes if it wasn't 4 byte aligned
947+
while (block%4)
948+
usb_buffer[block++] = 0;
945949

946950
// Copy block of data from RDRAM to SDRAM
947951
usb_dma_write(usb_buffer, pi_address, ALIGN(block, 2));

Examples/Libultra/3. USB Read/usb.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ static u32 usb_64drive_cui_read(u32 offset)
921921

922922
static void usb_64drive_write(int datatype, const void* data, int size)
923923
{
924-
u32 left = size;
924+
s32 left = size;
925925
u32 pi_address = D64_BASE + DEBUG_ADDRESS;
926926

927927
// Return if previous transfer timed out
@@ -942,6 +942,10 @@ static void usb_64drive_write(int datatype, const void* data, int size)
942942

943943
// Copy data to PI DMA aligned buffer
944944
memcpy(usb_buffer, data, block);
945+
946+
// Pad the buffer with zeroes if it wasn't 4 byte aligned
947+
while (block%4)
948+
usb_buffer[block++] = 0;
945949

946950
// Copy block of data from RDRAM to SDRAM
947951
usb_dma_write(usb_buffer, pi_address, ALIGN(block, 2));

Examples/Libultra/4. Command Interpreter/debug.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
Settings macros
66
*********************************/
77

8+
// Enable/Disable debug
9+
#ifndef DEBUG_MODE
10+
#define DEBUG_MODE 1 // Enable/Disable debug mode
11+
#endif
12+
813
// Settings
9-
#define DEBUG_MODE 1 // Enable/Disable debug mode
1014
#define DEBUG_INIT_MSG 1 // Print a message when debug mode has initialized
1115
#define USE_FAULTTHREAD 1 // Create a fault detection thread (libultra only)
1216
#define OVERWRITE_OSPRINT 1 // Replaces osSyncPrintf calls with debug_printf (libultra only)
@@ -144,7 +148,7 @@
144148

145149
// Overwrite library functions with useless macros if debug mode is disabled
146150
#define debug_initialize()
147-
#define debug_printf
151+
#define debug_printf (void)
148152
#define debug_screenshot(a, b, c)
149153
#define debug_assert(a)
150154
#define debug_pollcommands()

Examples/Libultra/4. Command Interpreter/usb.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ static u32 usb_64drive_cui_read(u32 offset)
921921

922922
static void usb_64drive_write(int datatype, const void* data, int size)
923923
{
924-
u32 left = size;
924+
s32 left = size;
925925
u32 pi_address = D64_BASE + DEBUG_ADDRESS;
926926

927927
// Return if previous transfer timed out
@@ -942,6 +942,10 @@ static void usb_64drive_write(int datatype, const void* data, int size)
942942

943943
// Copy data to PI DMA aligned buffer
944944
memcpy(usb_buffer, data, block);
945+
946+
// Pad the buffer with zeroes if it wasn't 4 byte aligned
947+
while (block%4)
948+
usb_buffer[block++] = 0;
945949

946950
// Copy block of data from RDRAM to SDRAM
947951
usb_dma_write(usb_buffer, pi_address, ALIGN(block, 2));

USB+Debug Library/debug.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
Settings macros
66
*********************************/
77

8+
// Enable/Disable debug
9+
#ifndef DEBUG_MODE
10+
#define DEBUG_MODE 1 // Enable/Disable debug mode
11+
#endif
12+
813
// Settings
9-
#define DEBUG_MODE 1 // Enable/Disable debug mode
1014
#define DEBUG_INIT_MSG 1 // Print a message when debug mode has initialized
1115
#define USE_FAULTTHREAD 1 // Create a fault detection thread (libultra only)
1216
#define OVERWRITE_OSPRINT 1 // Replaces osSyncPrintf calls with debug_printf (libultra only)
@@ -144,7 +148,7 @@
144148

145149
// Overwrite library functions with useless macros if debug mode is disabled
146150
#define debug_initialize()
147-
#define debug_printf
151+
#define debug_printf (void)
148152
#define debug_screenshot(a, b, c)
149153
#define debug_assert(a)
150154
#define debug_pollcommands()

USB+Debug Library/usb.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ static u32 usb_64drive_cui_read(u32 offset)
921921

922922
static void usb_64drive_write(int datatype, const void* data, int size)
923923
{
924-
u32 left = size;
924+
s32 left = size;
925925
u32 pi_address = D64_BASE + DEBUG_ADDRESS;
926926

927927
// Return if previous transfer timed out
@@ -942,6 +942,10 @@ static void usb_64drive_write(int datatype, const void* data, int size)
942942

943943
// Copy data to PI DMA aligned buffer
944944
memcpy(usb_buffer, data, block);
945+
946+
// Pad the buffer with zeroes if it wasn't 4 byte aligned
947+
while (block%4)
948+
usb_buffer[block++] = 0;
945949

946950
// Copy block of data from RDRAM to SDRAM
947951
usb_dma_write(usb_buffer, pi_address, ALIGN(block, 2));

0 commit comments

Comments
 (0)