summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dbb9fd2)
raw | patch | inline | side by side (parent: dbb9fd2)
author | Angela Stegmaier <angelabaker@ti.com> | |
Tue, 7 May 2013 09:41:45 +0000 (04:41 -0500) | ||
committer | Chris Ring <cring@ti.com> | |
Thu, 9 May 2013 17:47:41 +0000 (10:47 -0700) |
Add an error test case to test for MMU fault
detection.
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
detection.
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
index ad4c9cda142c28a4422827ed7925b0bedf4073b9..0a210c25ed67d2fcedf6a425ccec53be3325bbf1 100644 (file)
static Int32 fxnAdd3(UInt32 size, UInt32 *data);
static Int32 fxnAddX(UInt32 size, UInt32 *data);
static Int32 MxServer_skel_compute(UInt32 size, UInt32 *data);
+static Int32 fxnFault(UInt32 size, UInt32 *data);
/* MxServer skel function array */
static RcmServer_FxnDesc mxSkelAry[] = {
{ "MxServer_add", MxServer_skel_add },
{ "fxnAdd3", fxnAdd3 },
{ "fxnAddX", fxnAddX },
- { "MxServer_compute", MxServer_skel_compute }
+ { "MxServer_compute", MxServer_skel_compute },
+ { "fxnFault", fxnFault }
};
/* MxServer skel function table */
{ MmType_Dir_Out, MmType_Param_S32, 1 }, /* return */
{ MmType_Dir_In, MmType_PtrType(MmType_Param_VOID), 1 }
}
+ },
+ { "fxnFault", 2,
+ {
+ { MmType_Dir_Out, MmType_Param_S32, 1 }, /* return */
+ { MmType_Dir_In, MmType_PtrType(MmType_Param_U32), 1 }
+ }
}
};
return(result);
}
+/*
+ * ======== fxnAddX ========
+ */
+Int32 fxnFault(UInt32 size, UInt32 *data)
+{
+ MmType_Param *payload = (MmType_Param *)data;
+ Int a;
+
+ a = (UInt32)payload[0].data;
+
+ switch (a) {
+ case 1:
+ System_printf("Generating read MMU Fault...\n");
+ a = *(volatile int *)(0x96000000);
+ break;
+ case 2:
+ System_printf("Generating write MMU Fault...\n");
+ *(volatile int *)(0x96000000) = 0x1;
+ break;
+ default:
+ System_printf("Invalid fxnFault test\n");
+ break;
+ }
+
+ return(0);
+}
+
/*
* ======== register_MxServer ========
*
diff --git a/qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/rpmsg-rpc-stress.use b/qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/rpmsg-rpc-stress.use
index f1f7df4ee8e49c9e905b5091430fd652e5b5ce95..8c9c0172289954968ab2ce71e9ea65fa1a5283a7 100644 (file)
rpmsg-rpc Stress Test
Syntax:
- rpmsg-rpc-stress -t <test_no> [-c <id>] [-f <func_id>] [-x <num>] [-l <num>]
+ rpmsg-rpc-stress -t <test_no> -c <id> [-f <func_id>] [-x <num>] [-l <num>] [-s <sub_test>]
Where:
- -t <test_no> Test number to be run. Valid values are 1-3.
+ -t <test_no> Test number to be run. Valid values are 1-4.
1: Run multi-srvmgr test
2: Run multi-thread test
3: Run select test
- -c <id> Core ID with which to communicate.
- 0: IPU CORE0 (default)
- 1: IPU CORE1 or IPU SMP
- 2: DSP
+ 4: Run error test
+ -c <id> Core ID with which to communicate. Must match MultiProc ID of core.
+ For example, for OMAP5, valid values are:
+ 1: IPU CORE1 or IPU SMP
+ 2: DSP
-f <func_id> 1: FxnTriple (default)
2: FxnAdd
3: FxnAdd3
Default is 1.
-l <num> For test 2, the number of threads communicating with the
remote OMX ServiceMgr. Default is 1.
+ -s <sub_test> For test 4, sub_test Ids can be:
+ 1: MMU Fault (read access) (default)
+ 2: MMU Fault (write access)
Examples:
rpmsg-rpc-stress -t 1 Runs the Multi-SrvMgr test with 1
diff --git a/qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/tests_rpc_stress.c b/qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/tests_rpc_stress.c
index f79438dc836690644e1cbebf59babfaa157ae0e6..b653ce64e9f8650b42e2c659c49d8896a57a4957 100644 (file)
FXN_IDX_FXNADD,
FXN_IDX_FXNADD3,
FXN_IDX_FXNADDX,
+ FXN_IDX_FXNCOMPUTE,
+ FXN_IDX_FXNFAULT,
FXN_IDX_MAX
};
sem_t * sem;
int thread_num;
int func_idx;
+ int sub_test;
} test_exec_args;
static pthread_t * clientThreads = NULL;
function->translations[0].base = ((fxn_addx_args *)ptr)->array;
}
break;
+ case FXN_IDX_FXNFAULT:
+ function->num_params = 1;
+ function->params[0].type = RPPC_PARAM_TYPE_ATOMIC;
+ function->params[0].size = sizeof(int);
+ function->params[0].data = args->sub_test;
+ function->num_translations = 0;
+ break;
}
if (test_status == -1)
return ret;
}
+int test_errors(int core_id, int num_comps, int sub_test)
+{
+ int ret = 0;
+ int i = 0, j = 0;
+ int fd;
+ struct rppc_create_instance connreq;
+ test_exec_args args;
+
+ /* Connect to the rpc_example ServiceMgr on the specified core: */
+ fd = open("/dev/rpc_example", O_RDWR);
+ if (fd < 0) {
+ perror("Can't open rpc_example device");
+ ret = -1;
+ return -1;
+ }
+ strcpy(connreq.name, "rpc_example");
+
+ /* Create an rpc_example server instance, and rebind its address to this
+ * file descriptor.
+ */
+ ret = ioctl(fd, RPPC_IOC_CREATE, &connreq);
+ if (ret < 0) {
+ perror("Can't connect to rpc_example instance");
+ close(fd);
+ return -1;
+ }
+ printf("rpc_sample: Connected to %s\n", connreq.name);
+
+ clientThreads = malloc(sizeof(pthread_t));
+ if (!clientThreads) {
+ ret = close(fd);
+ if (ret < 0) {
+ perror("Can't close rpc_example fd ??");
+ }
+ return -1;
+ }
+
+ args.fd = fd;
+ args.start_num = 1;
+ args.test_num = 1;
+ args.sem = NULL;
+ args.thread_num = i;
+ args.func_idx = FXN_IDX_FXNFAULT;
+ args.sub_test = sub_test;
+ ret = pthread_create(&clientThreads[0], NULL, test_exec_call,
+ (void *)&args);
+ if (ret < 0) {
+ perror("Can't create thread");
+ ret = close(fd);
+ if (ret < 0) {
+ perror("Can't close rpc_example fd ??");
+ }
+ return -1;
+ }
+ printf("Created thread %d\n", i);
+
+ printf("Join thread %d\n", j);
+ pthread_join(clientThreads[0], NULL);
+
+ free(clientThreads);
+
+ /* Terminate connection and destroy rpc_example instance */
+ ret = close(fd);
+ if (ret < 0) {
+ perror("Can't close rpc_example fd ??");
+ ret = -1;
+ }
+ printf("rpc_sample: Closed connection to %s!\n", connreq.name);
+
+ return ret;
+}
+
int main(int argc, char *argv[])
{
int ret;
int num_comps = 1;
int num_threads = 1;
int func_idx = 1;
+ int sub_test = 0;
int c;
while (1)
{
- c = getopt (argc, argv, "t:c:x:l:f:");
+ c = getopt (argc, argv, "t:c:x:l:f:s:");
if (c == -1)
break;
case 'f':
func_idx = atoi(optarg);
break;
+ case 's':
+ sub_test = atoi(optarg);
+ break;
default:
printf ("Unrecognized argument\n");
}
}
- if (test_id < 0 || test_id > 3) {
+ if (test_id < 0 || test_id > 4) {
printf("Invalid test id\n");
return 1;
}
}
ret = test_rpc_stress_select(core_id, num_comps, func_idx);
break;
+ case 4:
+ /* MMU fault test */
+ if (core_id < 0 || core_id > 4) {
+ printf("Invalid core id\n");
+ return 1;
+ }
+ if (num_comps < 0) {
+ printf("Invalid num comps id\n");
+ return 1;
+ }
+ ret = test_errors(core_id, num_comps, sub_test);
+ break;
default:
break;
}