index 475b3cf63d3b0a17a3d39f24828102e306b5a187..a2c41d465cf620061dee34001b2474de073ade63 100644 (file)
/*
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2014, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
-/* SysLink/IPC Headers: */
-#include <Std.h>
-#include <SysLink.h>
+/* IPC Headers */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
#include <ti/ipc/MessageQ.h>
/* App defines: Must match on remote proc side: */
#include <ti/ipc/MessageQ.h>
/* App defines: Must match on remote proc side: */
#define NUM_LOOPS_DFLT 1000
#define NUM_THREADS_DFLT 10
#define NUM_LOOPS_DFLT 1000
#define NUM_THREADS_DFLT 10
-#define MAX_NUM_THREADS 50
+#define MAX_NUM_THREADS 25
#define ONE_PROCESS_ONLY (-1)
/** ============================================================================
#define ONE_PROCESS_ONLY (-1)
/** ============================================================================
{
struct thread_info threads[MAX_NUM_THREADS];
int ret,i;
{
struct thread_info threads[MAX_NUM_THREADS];
int ret,i;
- void *res;
- Int32 status = 0;
+ Int32 status = 0;
/* Parse Args: */
numLoops = NUM_LOOPS_DFLT;
/* Parse Args: */
numLoops = NUM_LOOPS_DFLT;
break;
default:
printf("Usage: %s [<numThreads>] [<numLoops>] [<Process #]>\n",
break;
default:
printf("Usage: %s [<numThreads>] [<numLoops>] [<Process #]>\n",
- argv[0]);
- printf("\tDefaults: numThreads: 10, numLoops: 100\n");
- printf("\tMax Threads: 100\n");
+ argv[0]);
+ printf("\tDefaults: numThreads: %d, numLoops: %d\n",
+ NUM_THREADS_DFLT, NUM_LOOPS_DFLT);
+ printf("\tMax Threads: %d\n", MAX_NUM_THREADS);
exit(0);
}
exit(0);
}
+
+ if (numThreads > MAX_NUM_THREADS) {
+ printf("Error: Maximum number of threads supported is %d\n",
+ MAX_NUM_THREADS);
+ exit(EXIT_FAILURE);
+ }
+
printf("Using numThreads: %d, numLoops: %d\n", numThreads, numLoops);
if (procNum != ONE_PROCESS_ONLY) {
printf("ProcNum: %d\n", procNum);
}
printf("Using numThreads: %d, numLoops: %d\n", numThreads, numLoops);
if (procNum != ONE_PROCESS_ONLY) {
printf("ProcNum: %d\n", procNum);
}
- status = SysLink_setup();
+ status = Ipc_start();
if (status < 0) {
if (status < 0) {
- printf ("SysLink_setup failed: status = 0x%x\n", status);
+ printf ("Ipc_start failed: status = 0x%x\n", status);
goto exit;
}
goto exit;
}
/* Join all threads: */
for (i = 0; i < numThreads; i++) {
/* Join all threads: */
for (i = 0; i < numThreads; i++) {
- ret = pthread_join(threads[i].thread_id, &res);
+ ret = pthread_join(threads[i].thread_id, NULL);
if (ret != 0) {
printf("MessageQMulti: failed to join thread: %d, %s\n",
if (ret != 0) {
printf("MessageQMulti: failed to join thread: %d, %s\n",
- i, strerror(ret));
+ threads[i].thread_num, strerror(ret));
}
}
- printf("MessageQMulti: Joined with thread %d; returned value was %s\n",
- threads[i].thread_num, (char *) res);
- free(res); /* Free memory allocated by thread */
+ printf("MessageQMulti: Joined with thread %d\n",threads[i].thread_num);
}
}
- SysLink_destroy();
+ Ipc_stop();
exit:
exit: