Page 1 of 1

hsync counter?

Posted: Tue May 24, 2005 5:46 am
by Steve F
I read somewhere that the hsync count (or line count) can be used to tell how far into the frame processing a process is and that PS2 makes this available. I can't find it in the docs. Do I need to set up my own hsync call back counter or is hsync count already in the SDK?

Posted: Tue May 24, 2005 6:11 am
by Saotome
actually thats pretty simple, its not worth to implement special functions for that in the SDK ;)

i only used the VR-interrupt, but HR shouldn't be that different

Code: Select all

void vrStartHandler(u32 cause)
{
	vrcounter++;
}
//-----------------------------------------------
void install_vrStartHandler(void)
{
	asm volatile ("di");
	
	AddIntcHandler(2, vrStartHandler, 0);
	EnableIntc(2);

	asm volatile ("ei");
}
for hsync you have to replace the "2" with some other value, dont know which (2 is for vrStart, 3 is for vrEnd - maybe 0 or 1 or >2?).

or you could use one of the 4 timers on the EE, and tell it to count "H-BLNKs".

Posted: Thu Aug 04, 2005 2:02 pm
by shawn_t
Check out my blurb on EE timers: EE Timers

The enum:

Code: Select all

enum
{
   kINTC_GS,
   kINTC_SBUS,
   kINTC_VBLANK_START,
   kINTC_VBLANK_END,
   kINTC_VIF0,
   kINTC_VIF1,
   kINTC_VU0,
   kINTC_VU1,
   kINTC_IPU,
   kINTC_TIMER0,
   kINTC_TIMER1
}; 
enumerates the interrupts. I'm not familiar with an interrupt for an H-BLNK, but as mentioned, you can easily set up any of the EE timers to count H-BLNKS.

If you still don't understand how to set it up for counting H-BLNK's, then let me know and I'll explain it.