X-Git-Url: https://git.ti.com/gitweb?p=ipc%2Fipcdev.git;a=blobdiff_plain;f=linux%2Fsrc%2Fapi%2FMultiProc.c;h=015955abed9fac4f6f3d631ebdc2da0fbb40147c;hp=d40cc76db8abe8be5997ca596dacd23b5e81ef88;hb=acb57370c949b917386606f9f50fa17225147ff9;hpb=6da9f8a60a668763094f4a1db0d14631d8055a84;ds=sidebyside diff --git a/linux/src/api/MultiProc.c b/linux/src/api/MultiProc.c index d40cc76..015955a 100644 --- a/linux/src/api/MultiProc.c +++ b/linux/src/api/MultiProc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014, Texas Instruments Incorporated + * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,9 +30,9 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* - * @file MultiProcQ.c + * @file MultiProcQ.c * - * @brief MultiProc Linux implementation + * @brief MultiProc Linux implementation */ /* Standard IPC header */ @@ -72,34 +72,81 @@ Void MultiProc_getConfig (MultiProc_Config * cfg) assert (cfg != NULL); handle = LAD_findHandle(); - if (handle == LAD_MAXNUMCLIENTS) { - PRINTVERBOSE1( - "MultiProc_getConfig: can't find connection to daemon for pid %d\n", - getpid()) - return; + if (handle == LAD_MAXNUMCLIENTS) { + PRINTVERBOSE1("MultiProc_getConfig: can't find connection to daemon " + "for pid %d\n", getpid()) + return; } cmd.cmd = LAD_MULTIPROC_GETCONFIG; cmd.clientId = handle; if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) { - PRINTVERBOSE1( - "MultiProc_getConfig: sending LAD command failed, status=%d\n", status) - return; + PRINTVERBOSE1("MultiProc_getConfig: sending LAD command failed, " + "status=%d\n", status) + return; } if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) { - PRINTVERBOSE1("MultiProc_getConfig: no LAD response, status=%d\n", status) - return; + PRINTVERBOSE1("MultiProc_getConfig: no LAD response, status=%d\n", + status) + return; } status = rsp.multiprocGetConfig.status; - PRINTVERBOSE2( - "MultiProc_getConfig: got LAD response for client %d, status=%d\n", - handle, status) + PRINTVERBOSE2("MultiProc_getConfig: got LAD response for client %d, " + "status=%d\n", handle, status) memcpy(cfg, &rsp.multiprocGetConfig.cfg, sizeof(*cfg)); return; } + +/* + * ======== MultiProc_rprocSetId ======== + */ +Int MultiProc_rprocSetId(UInt16 procId, UInt rprocId) +{ + Int status; + LAD_ClientHandle handle; + struct LAD_CommandObj cmd; + union LAD_ResponseObj rsp; + UInt16 clusterId; + + + handle = LAD_findHandle(); + + if (handle == LAD_MAXNUMCLIENTS) { + PRINTVERBOSE1("MultiProc_rprocSetId: can't find connection to daemon " + "for pid %d\n", getpid()) + return (-1); + } + + cmd.cmd = LAD_RPROC_SETID; + cmd.clientId = handle; + cmd.args.rprocSetId.procId = procId; + cmd.args.rprocSetId.rprocId = rprocId; + + if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) { + PRINTVERBOSE1("MultiProc_rprocSetId: sending LAD command failed, " + "status=%d\n", status) + return (status); + } + + if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) { + PRINTVERBOSE1("MultiProc_rprocSetId: no LAD response, status=%d\n", + status) + return (status); + } + status = rsp.status; + + PRINTVERBOSE2("MultiProc_rprocSetId: got LAD response for client %d, " + "status=%d\n", handle, status) + + /* update configuration in api state */ + clusterId = procId - _MultiProc_cfg.baseIdOfCluster; + _MultiProc_cfg.rprocList[clusterId] = rprocId; + + return (status); +}