Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 91 additions & 13 deletions src/core/psxcounters.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/***************************************************************************

Check warning on line 1 in src/core/psxcounters.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ New issue: Overall Code Complexity

This module has a mean cyclomatic complexity of 4.73 across 15 functions. The mean complexity threshold is 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
* Copyright (C) 2010 by Blade_Arma *
* *
* This program is free software; you can redistribute it and/or modify *
Expand Down Expand Up @@ -43,7 +43,11 @@
m_rcnts[index].cycleStart = PCSX::g_emulator->m_cpu->m_regs.cycle;
m_rcnts[index].cycleStart -= value * m_rcnts[index].rate;

// TODO: <=.
// Hardware tested (SCPH-5501): counter reaches target value briefly before
// resetting. Fast reads can observe the target value; slow reads (printf) cannot.
// The comparison boundary needs more precise measurement to determine if
// reset happens on the same cycle as reaching target or the next cycle.
// TODO: determine exact reset timing with cycle-accurate measurement.
if (value < m_rcnts[index].target) {
m_rcnts[index].cycle = m_rcnts[index].target * m_rcnts[index].rate;
m_rcnts[index].counterState = CountToTarget;
Expand Down Expand Up @@ -132,7 +136,15 @@
m_rcnts[index].mode |= RcOverflow;
}

m_rcnts[index].mode |= RcIrqRequest;
// IRQ request flag (bit 10) behavior depends on bit 7 (toggle mode):
// Pulse mode (bit7=0): bit 10 resets to 1 after IRQ (short pulse low)
// Toggle mode (bit7=1): bit 10 toggles (XOR) on each IRQ
// Hardware verified: toggle mode produces different bit10 state than pulse mode.
if (m_rcnts[index].mode & RcIrqToggle) {
m_rcnts[index].mode ^= RcIrqRequest;
} else {
m_rcnts[index].mode |= RcIrqRequest;
}

Check warning on line 147 in src/core/psxcounters.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ Getting worse: Complex Method

PCSX::Counters::reset increases in cyclomatic complexity from 10 to 11, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

set();
}
Expand Down Expand Up @@ -179,24 +191,60 @@
m_hSyncCount++;
m_spuSyncCountdown--;

// Counter 0 gate: triggered by Hblank
if (isGateEnabled(0, m_rcnts[0].mode)) {
switch (gateSyncMode(m_rcnts[0].mode)) {
case 1: // Reset at Hblank
case 2: // Reset at Hblank + pause outside
writeCounterInternal(0, 0);
break;
case 3: // Pause until first Hblank, then free run
if (!m_rcnts[0].gateStarted) {
m_rcnts[0].gateStarted = 1;
recalculateRate(0);
writeCounterInternal(0, 0);
set();
}
break;
}
}
Comment on lines +200 to +216
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if gate mode 0 is expected to pause during Hblank based on test expectations
rg -n "GateMode0" src/mips/tests/timers/timers.c -A 15

Repository: grumpycoders/pcsx-redux

Length of output: 631


🏁 Script executed:

# Get more context around the code lines mentioned
head -220 src/core/psxcounters.cc | tail -50

Repository: grumpycoders/pcsx-redux

Length of output: 1577


🏁 Script executed:

# Search for mode 0 handling elsewhere in the file
rg -n "mode.*0|case 0" src/core/psxcounters.cc | head -30

Repository: grumpycoders/pcsx-redux

Length of output: 600


🏁 Script executed:

# Check what happens when gate is enabled but switch doesn't match any case
rg -n "isGateEnabled|gateSyncMode" src/core/psxcounters.cc -B 2 -A 10 | head -50

Repository: grumpycoders/pcsx-redux

Length of output: 2308


🏁 Script executed:

# Look for the function signature to understand the full context
rg -n "void.*Hblank|onHblank" src/core/psxcounters.cc -B 2 -A 30

Repository: grumpycoders/pcsx-redux

Length of output: 49


🏁 Script executed:

# Find gateSyncMode function definition
rg -n "gateSyncMode" src/core/psxcounters.cc -B 2 -A 5

Repository: grumpycoders/pcsx-redux

Length of output: 1684


🏁 Script executed:

# Find isGateEnabled function definition
rg -n "isGateEnabled" src/core/psxcounters.cc -B 2 -A 5

Repository: grumpycoders/pcsx-redux

Length of output: 1187


🏁 Script executed:

# Search for any references to mode 0 behavior in comments or code
rg -n "mode 0|sync.*0|SYNC_MODE" src/core/psxcounters.cc | head -20

Repository: grumpycoders/pcsx-redux

Length of output: 198


🏁 Script executed:

# Find header files and search for function definitions
fd -e "\.h" -e "\.hpp" src/core/ | head -20

Repository: grumpycoders/pcsx-redux

Length of output: 408


🏁 Script executed:

# Search for function definitions in header files
rg -n "gateSyncMode|isGateEnabled" src/core/ -g "*.h" -g "*.hpp" -B 2 -A 3

Repository: grumpycoders/pcsx-redux

Length of output: 575


🏁 Script executed:

# Check the complete writeCounterInternal and recalculateRate to understand gate behavior
rg -n "writeCounterInternal|recalculateRate" src/core/psxcounters.cc -B 2 -A 8 | head -80

Repository: grumpycoders/pcsx-redux

Length of output: 3007


Add missing gate mode 0 handling for Counter 0 (pause during HBlank).

The switch statement at lines 196-209 handles gate modes 1, 2, and 3, but mode 0 is missing. When gateSyncMode() returns 0, the switch falls through without any action, causing the counter to run at full speed instead of pausing during HBlank. The test timerC0GateMode0PauseDuringHblank expects mode 0 to produce a lower counter value than free-running, confirming the pause behavior should be implemented. This is inconsistent with Timer 2, which explicitly pauses on mode 0 (line 303-305).

🧰 Tools
🪛 Cppcheck (2.20.0)

[error] 210-210: failed to expand 'TYPESTRING', Invalid ## usage when expanding 'TYPESTRING1024'

(syntaxError)


[error] 197-197: failed to expand 'TYPESTRING', Invalid ## usage when expanding 'TYPESTRING256'

(syntaxError)


[error] 206-206: failed to expand 'TYPESTRING', Invalid ## usage when expanding 'TYPESTRING512'

(syntaxError)

🪛 GitHub Check: CodeScene Code Health Review (main)

[warning] 194-247: ❌ Getting worse: Complex Method
PCSX::Counters::update increases in cyclomatic complexity from 11 to 21, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.


[warning] 194-247: ❌ New issue: Bumpy Road Ahead
PCSX::Counters::update has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.


[warning] 194-247: ❌ New issue: Deep, Nested Complexity
PCSX::Counters::update has a nested complexity depth of 5, threshold = 4. This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/core/psxcounters.cc` around lines 194 - 210, The switch in the Counter 0
gate handling is missing case 0 (pause during HBlank); add a case 0 branch so
that when gateSyncMode(m_rcnts[0].mode) == 0 you reset/pause the counter (e.g.,
call writeCounterInternal(0, 0)) just like modes 1 and 2 do; update the switch
inside the isGateEnabled(0, m_rcnts[0].mode) block so Counter 0 pauses during
HBlank consistent with Timer 2 behavior, keeping existing calls to
recalculateRate(0)/set()/m_rcnts[0].gateStarted only where appropriate.


// Update spu.
if (m_spuSyncCountdown <= 0) {
// Scanlines until next sync
const auto scanlines = SpuUpdInterval[PCSX::g_emulator->settings.get<PCSX::Emulator::SettingVideo>()];
m_spuSyncCountdown = scanlines;

PCSX::g_emulator->m_spu->async(scanlines * m_rcnts[3].target);
}

// SIO1 callback on hsync to process data
if (m_pollSIO1) {
PCSX::g_emulator->m_sio1->poll();
}

// Trigger VBlank IRQ when VBlank starts
if (m_hSyncCount == VBlankStart[PCSX::g_emulator->settings.get<PCSX::Emulator::SettingVideo>()]) {
setIrq(0x01);
PCSX::g_emulator->vsync();

// Counter 1 gate: triggered by VBlank start
if (isGateEnabled(1, m_rcnts[1].mode)) {
switch (gateSyncMode(m_rcnts[1].mode)) {
case 1: // Reset at VBlank
case 2: // Reset at VBlank + pause outside
writeCounterInternal(1, 0);
break;
case 3: // Pause until first VBlank, then free run
if (!m_rcnts[1].gateStarted) {
m_rcnts[1].gateStarted = 1;
recalculateRate(1);
writeCounterInternal(1, 0);
set();
}
break;
}
}

Check warning on line 247 in src/core/psxcounters.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ Getting worse: Complex Method

PCSX::Counters::update increases in cyclomatic complexity from 11 to 21, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check warning on line 247 in src/core/psxcounters.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ New issue: Bumpy Road Ahead

PCSX::Counters::update has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.

Check warning on line 247 in src/core/psxcounters.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ New issue: Deep, Nested Complexity

PCSX::Counters::update has a nested complexity depth of 5, threshold = 4. This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health.
Comment on lines +237 to +253
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Gate mode 0 (pause during VBlank) also missing for counter 1.

Similar to counter 0, gate mode 0 for counter 1 (pause during VBlank) is not implemented. The switch only handles modes 1, 2, and 3.

🧰 Tools
🪛 GitHub Check: CodeScene Code Health Review (main)

[warning] 194-247: ❌ Getting worse: Complex Method
PCSX::Counters::update increases in cyclomatic complexity from 11 to 21, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.


[warning] 194-247: ❌ New issue: Bumpy Road Ahead
PCSX::Counters::update has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.


[warning] 194-247: ❌ New issue: Deep, Nested Complexity
PCSX::Counters::update has a nested complexity depth of 5, threshold = 4. This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/core/psxcounters.cc` around lines 231 - 247, Add handling for gate mode 0
for counter 1: inside the switch on gateSyncMode(m_rcnts[1].mode) add a case 0
that implements "pause during VBlank" the same way counter 0 does — update
m_rcnts[1].gateStarted appropriately, call recalculateRate(1) to refresh the
counter rate, and ensure the counter is paused (adjust writes via
writeCounterInternal(1, ...) or leave value unchanged per counter 0 logic) and
call set() if the counter start/stop state changes; use the same sequence of
operations and flag updates as in the counter 0 implementation to keep behavior
consistent.

}

if (m_hSyncCount >= m_HSyncTotal[PCSX::g_emulator->settings.get<PCSX::Emulator::SettingVideo>()]) {
Expand All @@ -213,43 +261,73 @@
set();
}

void PCSX::Counters::writeMode(uint32_t index, uint32_t value) {
verboseLog(1, "[RCNT %i] writeMode: %x\n", index, value);

update();
m_rcnts[index].mode = value;
m_rcnts[index].irqState = false;

void PCSX::Counters::recalculateRate(uint32_t index) {
uint16_t value = m_rcnts[index].mode;
switch (index) {
case 0:
if (value & Rc0PixelClock) {
m_rcnts[index].rate = 5;
// Dotclock rate depends on GPU horizontal resolution and video standard.
static constexpr uint32_t dotclockDividers[] = {10, 8, 5, 4, 7, 7};
auto hres = PCSX::g_emulator->m_gpu->m_display.info.hres;
auto videoMode = PCSX::g_emulator->m_gpu->m_display.info.mode;
uint32_t divider = dotclockDividers[static_cast<int>(hres)];
uint32_t videoCyclesPerScanline = (videoMode == GPU::CtrlDisplayMode::VM_PAL) ? 3406 : 3413;
uint32_t dotsPerScanline = videoCyclesPerScanline / divider;
uint32_t cpuCyclesPerScanline = (PCSX::g_emulator->m_psxClockSpeed /
(FrameRate[PCSX::g_emulator->settings.get<PCSX::Emulator::SettingVideo>()] *
m_HSyncTotal[PCSX::g_emulator->settings.get<PCSX::Emulator::SettingVideo>()]));
m_rcnts[index].rate = std::max<uint32_t>(cpuCyclesPerScanline / dotsPerScanline, 1);
} else {
m_rcnts[index].rate = 1;
}
break;
case 1:
if (value & Rc1HSyncClock) {
m_rcnts[index].rate = (PCSX::g_emulator->m_psxClockSpeed /
(FrameRate[PCSX::g_emulator->settings.get<PCSX::Emulator::SettingVideo>()] *
m_HSyncTotal[PCSX::g_emulator->settings.get<PCSX::Emulator::SettingVideo>()]));
} else {
m_rcnts[index].rate = 1;
}
break;
case 2:
if (value & Rc2OneEighthClock) {
m_rcnts[index].rate = 8;
} else {
m_rcnts[index].rate = 1;
}

// TODO: wcount must work.
// Timer 2 sync modes: 0,3 = stop counter; 1,2 = free run
// Hardware verified (SCPH-5501): modes 0,3 produce delta=0, modes 1,2 run normally.
if (value & Rc2Disable) {
m_rcnts[index].rate = 0xffffffff;
uint8_t syncMode = gateSyncMode(value);
if (syncMode == 0 || syncMode == 3) {
m_rcnts[index].rate = 0xffffffff;
}
}
break;
}
}

Check warning on line 309 in src/core/psxcounters.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ New issue: Complex Method

PCSX::Counters::recalculateRate has a cyclomatic complexity of 11, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check warning on line 309 in src/core/psxcounters.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ New issue: Bumpy Road Ahead

PCSX::Counters::recalculateRate has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.

void PCSX::Counters::writeMode(uint32_t index, uint32_t value) {
verboseLog(1, "[RCNT %i] writeMode: %x\n", index, value);

update();
m_rcnts[index].mode = value;
m_rcnts[index].irqState = false;

recalculateRate(index);

// Initialize gate state
m_rcnts[index].gateStarted = 0;

if (isGateEnabled(index, value)) {
uint8_t syncMode = gateSyncMode(value);
if (syncMode == 2 || syncMode == 3) {
// Mode 2: pause outside blank. Mode 3: pause until first blank.
// Both start paused.
m_rcnts[index].rate = 0xffffffff;
}
}

writeCounterInternal(index, 0);
set();
Expand Down
19 changes: 12 additions & 7 deletions src/core/psxcounters.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,30 @@ class Counters {
void set();
void reset(uint32_t index);
void calculateHsync();
void recalculateRate(uint32_t index);

struct Rcnt {
uint16_t mode, target;
uint32_t rate, irq, counterState, irqState;
uint64_t cycle, cycleStart;
uint32_t gateStarted; // Gate mode 3: first blank has occurred, counter is free running
};

// Gate mode helpers - derived from mode register, not stored
static bool isGateEnabled(uint32_t index, uint16_t mode) { return (index <= 1) && (mode & RcSyncEnable); }
static uint8_t gateSyncMode(uint16_t mode) { return (mode >> 1) & 3; }

enum {
Rc0Gate = 0x0001, // 0 not implemented
Rc1Gate = 0x0001, // 0 not implemented
Rc2Disable = 0x0001, // 0 partially implemented
RcUnknown1 = 0x0002, // 1 ?
RcUnknown2 = 0x0004, // 2 ?
RcSyncEnable = 0x0001, // 0 Sync/gate enable
Rc2Disable = 0x0001, // 0 Timer 2: modes 0,3 = stop counter
RcSyncMode0 = 0x0002, // 1 Sync mode bit 0
RcSyncMode1 = 0x0004, // 2 Sync mode bit 1
RcCountToTarget = 0x0008, // 3
RcIrqOnTarget = 0x0010, // 4
RcIrqOnOverflow = 0x0020, // 5
RcIrqRegenerate = 0x0040, // 6
RcUnknown7 = 0x0080, // 7 ?
Rc0PixelClock = 0x0100, // 8 fake implementation
RcIrqToggle = 0x0080, // 7 IRQ toggle mode (0=pulse, 1=toggle bit10)
Rc0PixelClock = 0x0100, // 8 dotclock (varies with GPU hres)
Rc1HSyncClock = 0x0100, // 8
Rc2Unknown8 = 0x0100, // 8 ?
Rc0Unknown9 = 0x0200, // 9 ?
Expand Down
11 changes: 6 additions & 5 deletions src/core/sstate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ void PCSX::Counters::serialize(SaveStateWrapper* w) {
counters.get<Rcnts>().value[i].get<RcntIRQState>().value = m_rcnts[i].irqState;
counters.get<Rcnts>().value[i].get<RcntCycle>().value = m_rcnts[i].cycle;
counters.get<Rcnts>().value[i].get<RcntCycleStart>().value = m_rcnts[i].cycleStart;
counters.get<Rcnts>().value[i].get<RcntGateStarted>().value = m_rcnts[i].gateStarted;
}
counters.get<HSyncCount>().value = m_hSyncCount;
counters.get<SPUSyncCountdown>().value = m_spuSyncCountdown;
Expand Down Expand Up @@ -433,20 +434,20 @@ void PCSX::Counters::deserialize(const SaveStateWrapper* w) {
m_rcnts[i].irqState = counters.get<Rcnts>().value[i].get<RcntIRQState>().value;
m_rcnts[i].cycle = counters.get<Rcnts>().value[i].get<RcntCycle>().value;
m_rcnts[i].cycleStart = counters.get<Rcnts>().value[i].get<RcntCycleStart>().value;
m_rcnts[i].gateStarted = counters.get<Rcnts>().value[i].get<RcntGateStarted>().value;
}
m_hSyncCount = counters.get<HSyncCount>().value;
m_spuSyncCountdown = counters.get<SPUSyncCountdown>().value;
m_psxNextCounter = counters.get<PSXNextCounter>().value;

calculateHsync();
// iCB: recalculate target count in case overclock is changed
// Recalculate rates from mode registers (handles overclock changes and dotclock)
m_rcnts[3].target =
(g_emulator->m_psxClockSpeed / (FrameRate[g_emulator->settings.get<Emulator::SettingVideo>()] *
m_HSyncTotal[g_emulator->settings.get<Emulator::SettingVideo>()]));
if (m_rcnts[1].rate != 1)
m_rcnts[1].rate =
(g_emulator->m_psxClockSpeed / (FrameRate[g_emulator->settings.get<Emulator::SettingVideo>()] *
m_HSyncTotal[g_emulator->settings.get<Emulator::SettingVideo>()]));
for (unsigned i = 0; i < 3; i++) {
recalculateRate(i);
}

m_audioFrames = g_emulator->m_spu->getCurrentFrames();
}
3 changes: 2 additions & 1 deletion src/core/sstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,9 @@ typedef Protobuf::Field<Protobuf::UInt32, TYPESTRING("counter_state"), 5> RcntCo
typedef Protobuf::Field<Protobuf::UInt32, TYPESTRING("irq_state"), 6> RcntIRQState;
typedef Protobuf::Field<Protobuf::UInt64, TYPESTRING("cycle"), 7> RcntCycle;
typedef Protobuf::Field<Protobuf::UInt64, TYPESTRING("cycle_start"), 8> RcntCycleStart;
typedef Protobuf::Field<Protobuf::UInt32, TYPESTRING("gate_started"), 9> RcntGateStarted;
typedef Protobuf::Message<TYPESTRING("Rcnt"), RcntMode, RcntTarget, RcntRate, RcntIRQ, RcntCounterState, RcntIRQState,
RcntCycle, RcntCycleStart>
RcntCycle, RcntCycleStart, RcntGateStarted>
Rcnt;
typedef Protobuf::RepeatedField<Rcnt, 4, TYPESTRING("rcnts"), 1> Rcnts;
typedef Protobuf::Field<Protobuf::UInt32, TYPESTRING("hsync_count"), 2> HSyncCount;
Expand Down
16 changes: 16 additions & 0 deletions src/mips/common/hardware/counters.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,19 @@ struct Counter {
};

#define COUNTERS ((volatile struct Counter *)0xbf801100)

enum {
TM_SYNC_EN = 0x0001,
TM_RESET_TARGET = 0x0008,
TM_IRQ_TARGET = 0x0010,
TM_IRQ_OVERFLOW = 0x0020,
TM_IRQ_REPEAT = 0x0040,
TM_IRQ_TOGGLE = 0x0080,
TM_CLK_EXTERNAL = 0x0100,
TM_CLK_DIV8 = 0x0200,
TM_IRQ_REQUEST = 0x0400,
TM_HIT_TARGET = 0x0800,
TM_HIT_OVERFLOW = 0x1000,
};

#define TM_SYNC_MODE(n) (((n) & 3) << 1)
2 changes: 2 additions & 0 deletions src/mips/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ all:
$(MAKE) -C memcpy all
$(MAKE) -C memset all
$(MAKE) -C pcdrv all
$(MAKE) -C timers all

clean:
$(MAKE) -C basic clean
Expand All @@ -17,3 +18,4 @@ clean:
$(MAKE) -C memcpy clean
$(MAKE) -C memset clean
$(MAKE) -C pcdrv clean
$(MAKE) -C timers clean
43 changes: 43 additions & 0 deletions src/mips/tests/common.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
USE_FUNCTION_SECTIONS = false
TYPE = ps-exe

SRCS = \
../uC-sdk-glue/BoardConsole.c \
../uC-sdk-glue/BoardInit.c \
../uC-sdk-glue/init.c \
\
../../../../third_party/uC-sdk/libc/src/cxx-glue.c \
../../../../third_party/uC-sdk/libc/src/errno.c \
../../../../third_party/uC-sdk/libc/src/initfini.c \
../../../../third_party/uC-sdk/libc/src/malloc.c \
../../../../third_party/uC-sdk/libc/src/qsort.c \
../../../../third_party/uC-sdk/libc/src/rand.c \
../../../../third_party/uC-sdk/libc/src/reent.c \
../../../../third_party/uC-sdk/libc/src/stdio.c \
../../../../third_party/uC-sdk/libc/src/string.c \
../../../../third_party/uC-sdk/libc/src/strto.c \
../../../../third_party/uC-sdk/libc/src/unistd.c \
../../../../third_party/uC-sdk/libc/src/xprintf.c \
../../../../third_party/uC-sdk/libc/src/xscanf.c \
../../../../third_party/uC-sdk/libc/src/yscanf.c \
../../../../third_party/uC-sdk/os/src/devfs.c \
../../../../third_party/uC-sdk/os/src/filesystem.c \
../../../../third_party/uC-sdk/os/src/fio.c \
../../../../third_party/uC-sdk/os/src/hash-djb2.c \
../../../../third_party/uC-sdk/os/src/init.c \
../../../../third_party/uC-sdk/os/src/osdebug.c \
../../../../third_party/uC-sdk/os/src/romfs.c \
../../../../third_party/uC-sdk/os/src/sbrk.c \
../../common/syscalls/printf.s \
../../common/crt0/uC-sdk-crt0.s \

CPPFLAGS = -DNOFLOATINGPOINT
CPPFLAGS += -I.
CPPFLAGS += -I../../../../third_party/uC-sdk/libc/include
CPPFLAGS += -I../../../../third_party/uC-sdk/os/include
CPPFLAGS += -I../../../../third_party/libcester/include
CPPFLAGS += -I../../openbios/uC-sdk-glue

ifeq ($(PCSX_TESTS),true)
CPPFLAGS += -DPCSX_TESTS=1
endif
8 changes: 8 additions & 0 deletions src/mips/tests/timers/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
TARGET = timers

include ../common.mk

SRCS += \
timers.c \

include ../../common.mk
Loading
Loading