This is just sot hat we can sync

This commit is contained in:
starfrost013
2024-12-13 18:33:37 +00:00
parent 89fa07d7b8
commit 2f1cac86a7
2 changed files with 19 additions and 3 deletions

View File

@@ -193,6 +193,7 @@ extern const device_config_t nv3_config[];
#define NV3_PRMIO_END 0x7FFF
#define NV3_PTIMER_START 0x9000 // Programmable Interval Timer
#define NV3_PTIMER_INTR 0x9100
#define NV3_PTIMER_INTR_ALARM 0 // Alarm interrupt
#define NV3_PTIMER_INTR_EN 0x9140
#define NV3_PTIMER_NUMERATOR 0x9200
#define NV3_PTIMER_DENOMINATOR 0x9210
@@ -301,6 +302,7 @@ extern const device_config_t nv3_config[];
#define NV3_PGRAPH_INTR_1 0x400104
#define NV3_PGRAPH_INTR_EN_0 0x400140 // Interrupt Control for PGRAPH #1
#define NV3_PGRAPH_INTR_EN_0_VBLANK 8 // Fired every frame
#define NV3_PGRAPH_INTR_EN_0_VBLANK_ENABLED 0x1 // Is the vblank interrupt enabled?
//todo: add what this does
#define NV3_PGRAPH_INTR_EN_1 0x400180 // Interrupt Control for PGRAPH #2 (it can receive two at onc)

View File

@@ -48,14 +48,28 @@ void nv3_ptimer_init()
nv_log("Done!\n");
}
// Handles the PTIMER alarm interrupt
void nv3_ptimer_interrupt(uint32_t num)
{
nv3->ptimer.interrupt_enable |= (1 << num);
nv3_pmc_handle_interrupts(true);
}
// Ticks the timer.
void nv3_ptimer_tick()
{
if (nv3->ptimer.time >= nv3->ptimer.alarm)
{
nv3_ptimer_interrupt(NV3_PTIMER_INTR_ALARM);
}
}
uint32_t nv3_ptimer_read(uint32_t address)
{
// before doing anything, check the subsystem enablement
// always enabled
nv_register_t* reg = nv_get_register(address, ptimer_registers, sizeof(ptimer_registers)/sizeof(ptimer_registers[0]));
// todo: friendly logging
nv_log("NV3: PTIMER Read from 0x%08x", address);
// if the register actually exists