]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/commitdiff
Made rmDspClientTest compatible with latest IPC version DEV.RM_LLD.02.01.00.08
authorJustin Sobota <jsobota@ti.com>
Mon, 23 Feb 2015 22:50:49 +0000 (17:50 -0500)
committerJustin Sobota <jsobota@ti.com>
Mon, 23 Feb 2015 22:50:49 +0000 (17:50 -0500)
test/armv7/linux/build/makefile
test/armv7/linux/rm_dsp_client_test.c

index b7c0bd935849097e124a85d04c5c2d65fb8868f2..c775345894a942ce53c032f0da274963217ad5ca 100644 (file)
@@ -46,7 +46,7 @@ INCDIR := $(PDK_INSTALL_PATH);$(RM_INC_DIR);$(RM_ARM_LIN_TEST_DIR);$(DEVKIT_INST
 # Libraries
 RM_LIB = -lrm
 DAEMON_LIB = -ldaemon
-IPC_LIBS = -ltiipc -ltiipcutils
+IPC_LIBS = -ltitransportrpmsg -ltiipc -ltiipcutils
 
 ifeq ($(USEDYNAMIC_LIB), yes)
 #presuming ARM executable would depend on dynamic library dependency
index a88c04a168bd967d5e83a4bd64d5161a4f097a8d..92253d12e37aa794733cb63f2640d28154cb6ced 100644 (file)
@@ -43,6 +43,7 @@
 #include <ti/ipc/Std.h>
 #include <ti/ipc/Ipc.h>
 #include <ti/ipc/MessageQ.h>
+#include <ti/ipc/transports/TransportRpmsg.h>
 
 /* Socket Includes */
 #include "sockutils.h"
@@ -93,11 +94,11 @@ Int rmServerExchange_execute(UInt16 procId)
     MessageQ_Params_init(&msgParams);
     msgqHandle = MessageQ_create(SERVER_MESSAGEQ_NAME, &msgParams);
     if (msgqHandle == NULL) {
-       printf("Error in MessageQ_create\n");
-       goto exit;
+        printf("Error in MessageQ_create\n");
+        goto exit;
     }
     else {
-       printf("Local MessageQId: 0x%x\n", MessageQ_getQueueId(msgqHandle));
+        printf("Local MessageQId: 0x%x\n", MessageQ_getQueueId(msgqHandle));
     }
 
     snprintf(remoteQueueName, MAX_MESSAGEQ_NAME_LEN, "%s_%s", CLIENT_MESSAGEQ_NAME,
@@ -105,23 +106,23 @@ Int rmServerExchange_execute(UInt16 procId)
 
     /* Poll until remote side has it's messageQ created before we send: */
     do {
-       status = MessageQ_open(remoteQueueName, &queueId);
-       sleep (1);
+        status = MessageQ_open(remoteQueueName, &queueId);
+        sleep (1);
     } while (status == MessageQ_E_NOTFOUND);
 
     if (status < 0) {
-       printf("Error in MessageQ_open [%d]\n", status);
-       goto cleanup;
+        printf("Error in MessageQ_open [%d]\n", status);
+        goto cleanup;
     }
     else {
-       printf("Remote queueId  [0x%x]\n", queueId);
+        printf("Remote queueId  [0x%x]\n", queueId);
     }
 
     msg = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader));
     if (msg == NULL) {
-       printf("Error in MessageQ_alloc\n");
-       MessageQ_close(&queueId);
-       goto cleanup;
+        printf("Error in MessageQ_alloc\n");
+        MessageQ_close(&queueId);
+        goto cleanup;
     }
 
     /* handshake with DSP client so that it knows Linux's receive Q */
@@ -134,11 +135,11 @@ Int rmServerExchange_execute(UInt16 procId)
 
     /* open local sock for communication to RM Server */
     local_sock_name.type = sock_name_e;
-       local_sock_name.s.name = client_ex_sock_name;
+    local_sock_name.s.name = client_ex_sock_name;
     sock_to_server = sock_open(&local_sock_name);
     if (!sock_to_server) {
-       printf("Local socket to RM Server open failed\n");
-       return -1;
+        printf("Local socket to RM Server open failed\n");
+        return(-1);
     }
     /* RM Server sock */
     server_sock.type = sock_name_e;
@@ -154,40 +155,44 @@ Int rmServerExchange_execute(UInt16 procId)
         }
 
         rmPkt = &(((MsgQ_RmPacket *)rmMsg)->rmPkt);
-        printf("Received RM pkt of size %d from DSP client\n", rmPkt->pktLenBytes);
+        printf("Received RM pkt of size %d from DSP client\n",
+               rmPkt->pktLenBytes);
 
         /* Send received data to RM Server */
-        if (sock_send(sock_to_server, (char *)rmPkt, sizeof(*rmPkt), &server_sock)) {
-           printf("Failed to send data to RM Server\n");
+        if (sock_send(sock_to_server, (char *)rmPkt, sizeof(*rmPkt),
+                      &server_sock)) {
+            printf("Failed to send data to RM Server\n");
         }
 
         /* Wait for response from RM Server */
         rm_pkt_len = 0;
         err = sock_wait(sock_to_server, &rm_pkt_len, NULL, -1);
         if (err == -2) {
-           /* Timeout */
-           printf("Error socket timeout\n");
-           return -1;
+            /* Timeout */
+            printf("Error socket timeout\n");
+            return(-1);
         }
         else if (err < 0) {
-           printf("Error in reading from socket, error %d\n", err);
-           return -1;
-        }        
+            printf("Error in reading from socket, error %d\n", err);
+            return(-1);
+        }
 
         server_sock_addr.type = sock_addr_e;
         server_sock_addr.s.addr = &server_addr;
-        err = sock_recv(sock_to_server, (char *)rmPkt, rm_pkt_len, &server_sock_addr);
+        err = sock_recv(sock_to_server, (char *)rmPkt, rm_pkt_len,
+                        &server_sock_addr);
         if (err != rm_pkt_len) {
-           printf("recv RM pkt failed from socket, received = %d, expected = %d\n",
-                  err, rm_pkt_len);
-           return;
+            printf("recv RM pkt failed from socket, "
+                   "received = %d, expected = %d\n",
+                   err, rm_pkt_len);
+            return;
         }
 
         /* send back to DSP */
         status = MessageQ_put(queueId, rmMsg);
         if (status < 0) {
-            printf("Error in MessageQ_put [%d]\n", status);
-            break;
+             printf("Error in MessageQ_put [%d]\n", status);
+             break;
         }
     }
 
@@ -204,7 +209,7 @@ exit:
     return 0;
 }
 
-int main (int argc, char ** argv)
+int main(int argc, char ** argv)
 {
     Int32 status = 0;
     UInt16 procId = PROC_ID_DEFAULT;
@@ -212,18 +217,23 @@ int main (int argc, char ** argv)
     /* Parse Args: */
     switch (argc) {
         case 1:
-           /* use defaults */
-           break;
+            /* use defaults */
+            break;
         case 2:
-           procId = atoi(argv[2]);
-           break;
+            procId = atoi(argv[2]);
+            break;
         default:
-           printf("Usage: %s [<ProcId>]\n", argv[0]);
-           printf("\tDefaults: ProcId: %d\n", PROC_ID_DEFAULT);
-           exit(0);
+            printf("Usage: %s [<ProcId>]\n", argv[0]);
+            printf("\tDefaults: ProcId: %d\n", PROC_ID_DEFAULT);
+            exit(0);
     }
 
+    Ipc_transportConfig(&TransportRpmsg_Factory);
     status = Ipc_start();
+    if (status < 0) {
+        printf("Ipc_start failed with error %d\n", status);
+        return(0);
+    }
 
     if (procId >= MultiProc_getNumProcessors()) {
         printf("ProcId must be less than %d\n", MultiProc_getNumProcessors());
@@ -232,13 +242,8 @@ int main (int argc, char ** argv)
     }
     printf("Using procId : %d\n", procId);
 
-    if (status >= 0) {
-        rmServerExchange_execute(procId);
-        Ipc_stop();
-    }
-    else {
-        printf("Ipc_start failed: status = %d\n", status);
-    }
+    rmServerExchange_execute(procId);
+    Ipc_stop();
 
-    return(0);   
+    return(0);
 }