1 /*
2 * @file Proto.h
3 *
4 * @brief common include for resource manager.
5 *
6 *
7 * @ver 02.00.00.46_alpha1
8 *
9 * ============================================================================
10 *
11 * Copyright (c) 2010-2013, Texas Instruments Incorporated
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 *
17 * * Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 *
20 * * Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * * Neither the name of Texas Instruments Incorporated nor the names of
25 * its contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
30 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
32 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
35 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
36 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
37 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
38 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 * Contact information for paper mail:
40 * Texas Instruments
41 * Post Office Box 655303
42 * Dallas, Texas 75265
43 * Contact information:
44 * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
45 * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
46 * ============================================================================
47 *
48 */
51 #ifndef _SYSLINK_PROTO_H_INCLUDED
52 #define _SYSLINK_PROTO_H_INCLUDED
54 struct _iofunc_attr;
55 #define RESMGR_HANDLE_T struct _iofunc_attr
56 struct syslink_ocb;
57 #define IOFUNC_OCB_T struct syslink_ocb
58 #define RESMGR_OCB_T struct syslink_ocb
59 #define THREAD_POOL_PARAM_T dispatch_context_t
60 struct syslink_attr;
61 #define IOFUNC_ATTR_T struct syslink_attr
63 /* QNX specific header files */
65 #include <stdio.h>
66 #include <stdlib.h>
67 #include <string.h>
68 #include <errno.h>
69 #include <unistd.h>
70 #include <hw/inout.h>
71 #include <sys/iofunc.h>
72 #include <sys/dispatch.h>
73 #include <devctl.h>
74 #include <atomic.h>
75 #include <sys/slogcodes.h>
76 #include <ti/syslink/Std.h>
77 #include <sys/types.h>
78 #include <sys/ioctl.h>
79 #include <inttypes.h>
80 #include <fcntl.h>
81 #include <stdio.h>
82 #include <sys/mman.h>
84 #include "ti/syslink/utils/List.h"
85 #include <OsalThread.h>
86 #include <_MultiProc.h>
88 #define IPC_DEVICE_PATH "/dev/ipc"
90 /*
91 * Define our device attributes structure.
92 */
94 typedef struct syslink_attr {
95 iofunc_attr_t attr;
96 uint16_t procid;
97 } syslink_attr_t;
99 typedef struct named_device {
100 iofunc_mount_t mattr;
101 iofunc_attr_t cattr;
102 syslink_attr_t cattr_trace[MultiProc_MAXPROCESSORS];
103 int resmgr_id;
104 int resmgr_id_trace[MultiProc_MAXPROCESSORS];
105 iofunc_funcs_t mfuncs;
106 resmgr_connect_funcs_t cfuncs;
107 resmgr_connect_funcs_t cfuncs_trace[MultiProc_MAXPROCESSORS];
108 resmgr_io_funcs_t iofuncs;
109 resmgr_io_funcs_t iofuncs_trace[MultiProc_MAXPROCESSORS];
110 char device_name[_POSIX_PATH_MAX];
111 } named_device_t;
113 typedef struct syslink_dev {
114 dispatch_t * dpp;
115 thread_pool_t * tpool;
116 named_device_t syslink;
117 void * da_virt;
118 void * da_tesla_virt;
119 pthread_mutex_t lock;
120 Bool recover;
121 OsalThread_Handle ipc_recovery_work;
122 } syslink_dev_t;
124 typedef struct syslink_ocb {
125 iofunc_ocb_t ocb;
126 pid_t pid;
127 uint32_t ridx;
128 uint32_t widx;
129 } syslink_ocb_t;
131 int syslink_devctl(resmgr_context_t *ctp, io_devctl_t *msg, syslink_ocb_t *ocb);
133 #endif