pif.c
1.66 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <os.h>
#include <rmon.h>
#include <rcp.h>
#include "ostime.h"
#define NUM_MESSAGE 3
static OSMesgQueue intMesgQueue;
static OSMesg intMesgBuf[NUM_MESSAGE];
static OSContStatus sdata[MAXCONTROLLERS];
static OSContPad rdata[MAXCONTROLLERS];
int
pif(void)
{
OSIntMask savedMask, currentMask;
OSMesg actualMesg, expectedMesg;
int i;
int retValue;
int numFailures = 0;
u8 pattern;
int j=0;
int k=0;
OSTime t1, t2;
/*
* Create a single message queue and associate three
* interrupt events with it.
*/
osCreateMesgQueue(&intMesgQueue, intMesgBuf, NUM_MESSAGE);
osSetEventMesg(OS_EVENT_SI, &intMesgQueue, (OSMesg)0x33333333);
osContInit(&intMesgQueue, &pattern, &sdata[0]);
for (i = 0;i < MAXCONTROLLERS; i++) {
rmonPrintf("pattern 0x%x controller %d error 0x%x type 0x%x status 0x%x \n",
pattern, i, sdata[i].errno, sdata[i].type, sdata[i].status);
}
for (k = 1;k <= MAXCONTROLLERS; k++) {
rmonPrintf(" %d Controllers \n", k);
#ifndef _HW_VERSION_1
osContSetCh(k);
#endif
j = 0;
while(j++ < 10) {
osContStartReadData(&intMesgQueue);
(void) osRecvMesg(&intMesgQueue, &actualMesg, OS_MESG_BLOCK);
osContGetReadData(&rdata[0]);
for (i = 0;i < k; i++) {
rmonPrintf("controller %d error 0x%x button 0x%x stick_x 0x%x stick_y 0x%x\n",
i, rdata[i].errno,
rdata[i].button, rdata[i].stick_x, rdata[i].stick_y);
}
}
}
osContReset(&intMesgQueue, &sdata[0]);
for (i = 0;i < MAXCONTROLLERS; i++) {
rmonPrintf("error 0x%x type 0x%x status 0x%x \n",
sdata[i].errno,
sdata[i].type, sdata[i].status);
}
return(numFailures);
}