PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
sync.c
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# (c) 2009 Lion
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
11#include <errno.h>
12#include <stdio.h>
13#include <kernel.h>
14#include <libgs.h>
15
16#include "internal.h"
17
18void GsDrawSync(int mode)
19{
20 switch(mode)
21 {
22 case 0:
23 default:
24 GsDmaWait();
25 }
26}
27
28void GsHSync(int mode)
29{
30 switch(mode)
31 {
32 case 0:
33 GS_SET_CSR_hsync_intrupt(1);
34 while(!GS_GET_CSR_hsync_intrupt);
35 break;
36 default:
37 if(mode>1)
38 {
39 unsigned short i;
40
41 for(i=0;i<mode;i++)
42 {
43 GS_SET_CSR_hsync_intrupt(1);
44 while(!GS_GET_CSR_hsync_intrupt);
45 }
46 }
47 }
48}
49
50void GsVSync(int mode)
51{
52 switch(mode)
53 {
54 case 0: //just wait
55 GS_SET_CSR_vsync_intrupt(1);
56 while(!GS_GET_CSR_vsync_intrupt);
57 break;
58 default: // wait for num of vsync to pass
59 if(mode>1)
60 {
61 unsigned short i;
62
63 for(i=0;i<mode;i++)
64 {
65 GS_SET_CSR_vsync_intrupt(1);
66 while(!GS_GET_CSR_vsync_intrupt);
67
68 }
69 }
70 }
71}