File: cd.c

package info (click to toggle)
scummvm 1.4.1-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 77,184 kB
  • sloc: cpp: 1,031,793; asm: 28,817; ansic: 11,557; sh: 6,671; perl: 2,616; python: 2,544; xml: 1,782; java: 1,105; makefile: 1,054; objc: 779; sed: 11; php: 1
file content (53 lines) | stat: -rw-r--r-- 1,110 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*********************************************************************
 * Copyright (C) 2003 Tord Lindstrom (pukko@home.se)
 * This file is subject to the terms and conditions of the PS2Link License.
 * See the file LICENSE in the main directory of this distribution for more
 * details.
 */

#include <tamtypes.h>
#include <kernel.h>
#include <sifrpc.h>

#define CDVD_INIT_BIND_RPC 0x80000592

static SifRpcClientData_t cdvdCd __attribute__((aligned(64)));
static char sendBuffer[256] __attribute__((aligned(16)));

int cdvdInitialised = 0;


void cdvdExit(void)
{
    cdvdInitialised = 0;
}


int cdvdInit(int mode)
{
	int i=0,len=0,ret=0;
    u8  *pkt;

    cdvdCd.server = NULL;

    do {
        if ((ret = SifBindRpc(&cdvdCd, CDVD_INIT_BIND_RPC, 0)) < 0) {
            return -1;
        }
        if (!cdvdCd.server) {
            nopdelay();
        }
    }
	while(!cdvdCd.server);

    pkt = sendBuffer;
    PUSHDATA( int, pkt, mode, i);
    pkt += i; len += i;

	if ((ret = SifCallRpc(&cdvdCd, 0, 0, sendBuffer, len, NULL, 0, 0, 0)) < 0)
        return -1;

    cdvdInitialised = 1;

    return 0;
}