]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blob - qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/Qnx/multiproc_devctl.c
Removed libcfg.a and moved _MultiProc_cfg into resource manager for QNX.
[ipc/ipcdev.git] / qnx / src / ipc3x_dev / ti / syslink / ipc / hlos / knl / Qnx / multiproc_devctl.c
1 /*
2  *  @file   multiproc_devctl.c
3  *
4  *  @brief      OS-specific implementation of MultiProc driver for Qnx
5  *
6  *
7  *  ============================================================================
8  *
9  *  Copyright (c) 2013, Texas Instruments Incorporated
10  *
11  *  Redistribution and use in source and binary forms, with or without
12  *  modification, are permitted provided that the following conditions
13  *  are met:
14  *
15  *  *  Redistributions of source code must retain the above copyright
16  *     notice, this list of conditions and the following disclaimer.
17  *
18  *  *  Redistributions in binary form must reproduce the above copyright
19  *     notice, this list of conditions and the following disclaimer in the
20  *     documentation and/or other materials provided with the distribution.
21  *
22  *  *  Neither the name of Texas Instruments Incorporated nor the names of
23  *     its contributors may be used to endorse or promote products derived
24  *     from this software without specific prior written permission.
25  *
26  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28  *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
30  *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31  *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32  *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
33  *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
34  *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
35  *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
36  *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  */
40 /* Standard headers */
41 #include <ti/syslink/Std.h>
43 /* QNX specific header include */
44 #include <ti/syslink/build/Qnx/resmgr/proto.h>
45 #include <ti/syslink/build/Qnx/resmgr/dcmd_syslink.h>
47 /* Module specific header files */
48 #include <ti/ipc/MultiProc.h>
49 #include <ti/syslink/inc/MultiProcDrvDefs.h>
51 /* Function prototypes */
52 int syslink_multiproc_getconfig(resmgr_context_t *ctp, io_devctl_t *msg,
53     syslink_ocb_t *ocb);
55 /**
56  * Handler for devctl() messages for multiproc module.
57  *
58  * Handles special devctl() messages that we export for control.
59  *
60  * \param ctp   Thread's associated context information.
61  * \param msg   The actual devctl() message.
62  * \param ocb   OCB associated with client's session.
63  *
64  * \return POSIX errno value.
65  *
66  * \retval EOK      Success.
67  * \retval ENOTSUP  Unsupported devctl().
68  */
69 int syslink_multiproc_devctl(resmgr_context_t *ctp, io_devctl_t *msg,
70     syslink_ocb_t *ocb)
71 {
72     switch (msg->i.dcmd) {
73         case DCMD_MULTIPROC_GETCONFIG:
74             return syslink_multiproc_getconfig( ctp, msg, ocb);
75             break;
77         default:
78             fprintf(stderr, "Invalid DEVCTL for multiproc 0x%x \n", msg->i.
79                 dcmd);
80             break;
81     }
83     return (_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) +
84         sizeof(MultiProcDrv_CmdArgs)));
85 }
87 /**
88  * Handler for multiproc getconfig API.
89  *
90  * \param ctp   Thread's associated context information.
91  * \param msg   The actual devctl() message.
92  * \param ocb   OCB associated with client's session.
93  *
94  * \return POSIX errno value.
95  *
96  * \retval EOK      Success.
97  * \retval ENOTSUP  Unsupported devctl().
98  */
99 int syslink_multiproc_getconfig(resmgr_context_t *ctp, io_devctl_t *msg,
100     syslink_ocb_t *ocb)
102     MultiProcDrv_CmdArgs * cargs = (MultiProcDrv_CmdArgs *)
103         (_DEVCTL_DATA (msg->i));
104     MultiProc_Config local_config;
105     MultiProc_getConfig (&local_config);
107     cargs->apiStatus = MultiProc_S_SUCCESS;
108     SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o) +
109         sizeof(MultiProcDrv_CmdArgs));
110     SETIOV(&ctp->iov[1], &local_config, sizeof(MultiProc_Config));
112     return _RESMGR_NPARTS(2);