contchannelreset.c
1.2 KB
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
/*---------------------------------------------------------------------
Copyright (C) 1998, Nintendo.
File contresetone.c
Coded by Koji Mitsunari. Apr 22, 1998.
Modified by
Comments Controller Reset One Channel
$Id: contchannelreset.c,v 1.2 2003/03/25 20:42:04 blythe Exp $
---------------------------------------------------------------------*/
#include "osint.h"
#include "controller.h"
#include "siint.h"
#ifndef BBPLAYER
s32
__osContChannelReset(OSMesgQueue *mq, int channel)
{
s32 i, ret;
u8 *ptr = (u8 *)(&__osPfsPifRam);
/* Block to get resource token */
__osSiGetAccess();
__osPfsPifRam.pifstatus = CONT_FORMAT;
/* Set up reset command */
for (i = 0; i < channel; i++) {
*ptr++ = 0x00; /* skip */
}
*ptr++ = CHANNEL_RESET; /* Reset command */
*ptr = FORMAT_END;
ret = __osSiRawStartDma(OS_WRITE, &__osPfsPifRam);
(void)osRecvMesg(mq, (OSMesg *)NULL, OS_MESG_BLOCK);
/* trigger pifmacro */
ret = __osSiRawStartDma(OS_READ, &__osPfsPifRam);
(void)osRecvMesg(mq, (OSMesg *)NULL, OS_MESG_BLOCK);
/* reformat the 64 bytes RAM data and save in data array */
/* Return resource token */
__osSiRelAccess();
return(ret);
}
#endif