Last change
on this file since 1122 was 1101, checked in by iritscen, 7 years ago |
Added following to ps2launchargs:\n-Source code.\n-DLL needed to run ps2client.\n-Instructions for building uLaunchELF.
|
-
Property svn:executable
set to
*
|
File size:
943 bytes
|
Line | |
---|
1 | #include "launchelf.h"
|
---|
2 |
|
---|
3 | // Timer Define
|
---|
4 | #define T0_COUNT ((volatile unsigned long*)0x10000000)
|
---|
5 | #define T0_MODE ((volatile unsigned long*)0x10000010)
|
---|
6 |
|
---|
7 | static int TimerInterruptID = -1;
|
---|
8 | static u64 TimerInterruptCount = 0;
|
---|
9 |
|
---|
10 | // Timer Interrupt
|
---|
11 | int TimerInterrupt(int a)
|
---|
12 | {
|
---|
13 | TimerInterruptCount++;
|
---|
14 | *T0_MODE |= (1 << 11);
|
---|
15 | return -1;
|
---|
16 | }
|
---|
17 | // Timer Init
|
---|
18 | void TimerInit(void)
|
---|
19 | {
|
---|
20 | *T0_MODE = 0x0000;
|
---|
21 | TimerInterruptID = AddIntcHandler(9, TimerInterrupt, 0);
|
---|
22 | EnableIntc(9);
|
---|
23 | *T0_COUNT = 0;
|
---|
24 | *T0_MODE = ( 2 << 0 )+( 1 << 7 )+( 1 << 9 );
|
---|
25 | TimerInterruptCount = 0;
|
---|
26 | }
|
---|
27 | // Timer Count
|
---|
28 | u64 Timer(void)
|
---|
29 | {
|
---|
30 | u64 ticks = (*T0_COUNT + (TimerInterruptCount << 16)) * (1000.0F / ( 147456000.0F / 256.0F ));
|
---|
31 | return ticks;
|
---|
32 | }
|
---|
33 | // Timer End
|
---|
34 | void TimerEnd(void)
|
---|
35 | {
|
---|
36 | *T0_MODE = 0x0000;
|
---|
37 | if (TimerInterruptID >= 0){
|
---|
38 | DisableIntc(9);
|
---|
39 | RemoveIntcHandler(9, TimerInterruptID);
|
---|
40 | TimerInterruptID = -1;
|
---|
41 | }
|
---|
42 | TimerInterruptCount = 0;
|
---|
43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.