nodepriv.h revision 318b5df99bbbe58eb9f80105d9534117ac2f25ce
1/*
2 * nodepriv.h
3 *
4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5 *
6 * Private node header shared by NODE and DISP.
7 *
8 * Copyright (C) 2005-2006 Texas Instruments, Inc.
9 *
10 * This package is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 */
18
19#ifndef NODEPRIV_
20#define NODEPRIV_
21
22#include <dspbridge/strmdefs.h>
23#include <dspbridge/nodedefs.h>
24#include <dspbridge/nldrdefs.h>
25
26/* DSP address of node environment structure */
27typedef u32 nodeenv;
28
29/*
30 *  Node create structures
31 */
32
33/* Message node */
34struct node_msgargs {
35	u32 max_msgs;		/* Max # of simultaneous messages for node */
36	u32 seg_id;		/* Segment for allocating message buffers */
37	u32 notify_type;	/* Notify type (SEM_post, SWI_post, etc.) */
38	u32 arg_length;		/* Length in 32-bit words of arg data block */
39	u8 *pdata;		/* Argument data for node */
40};
41
42struct node_strmdef {
43	u32 buf_size;		/* Size of buffers for SIO stream */
44	u32 num_bufs;		/* max # of buffers in SIO stream at once */
45	u32 seg_id;		/* Memory segment id to allocate buffers */
46	u32 utimeout;		/* Timeout for blocking SIO calls */
47	u32 buf_alignment;	/* Buffer alignment */
48	char *sz_device;	/* Device name for stream */
49};
50
51/* Task node */
52struct node_taskargs {
53	struct node_msgargs node_msg_args;
54	s32 prio;
55	u32 stack_size;
56	u32 sys_stack_size;
57	u32 stack_seg;
58	u32 udsp_heap_res_addr;	/* DSP virtual heap address */
59	u32 udsp_heap_addr;	/* DSP virtual heap address */
60	u32 heap_size;		/* Heap size */
61	u32 ugpp_heap_addr;	/* GPP virtual heap address */
62	u32 profile_id;		/* Profile ID */
63	u32 num_inputs;
64	u32 num_outputs;
65	u32 ul_dais_arg;	/* Address of iAlg object */
66	struct node_strmdef *strm_in_def;
67	struct node_strmdef *strm_out_def;
68};
69
70/*
71 *  ======== node_createargs ========
72 */
73struct node_createargs {
74	union {
75		struct node_msgargs node_msg_args;
76		struct node_taskargs task_arg_obj;
77	} asa;
78};
79
80/*
81 *  ======== node_get_channel_id ========
82 *  Purpose:
83 *      Get the channel index reserved for a stream connection between the
84 *      host and a node. This index is reserved when node_connect() is called
85 *      to connect the node with the host. This index should be passed to
86 *      the CHNL_Open function when the stream is actually opened.
87 *  Parameters:
88 *      hnode:          Node object allocated from node_allocate().
89 *      dir:           Input (DSP_TONODE) or output (DSP_FROMNODE).
90 *      index:         Stream index.
91 *      chan_id:        Location to store channel index.
92 *  Returns:
93 *      0:        Success.
94 *      -EFAULT:    Invalid hnode.
95 *      -EPERM:  Not a task or DAIS socket node.
96 *      -EINVAL:     The node's stream corresponding to index and dir
97 *                      is not a stream to or from the host.
98 *  Requires:
99 *      node_init(void) called.
100 *      Valid dir.
101 *      chan_id != NULL.
102 *  Ensures:
103 */
104extern int node_get_channel_id(struct node_object *hnode,
105				      u32 dir, u32 index, OUT u32 *chan_id);
106
107/*
108 *  ======== node_get_strm_mgr ========
109 *  Purpose:
110 *      Get the STRM manager for a node.
111 *  Parameters:
112 *      hnode:          Node allocated with node_allocate().
113 *      strm_man:       Location to store STRM manager on output.
114 *  Returns:
115 *      0:        Success.
116 *      -EFAULT:    Invalid hnode.
117 *  Requires:
118 *      strm_man != NULL.
119 *  Ensures:
120 */
121extern int node_get_strm_mgr(struct node_object *hnode,
122				    struct strm_mgr **strm_man);
123
124/*
125 *  ======== node_get_timeout ========
126 *  Purpose:
127 *      Get the timeout value of a node.
128 *  Parameters:
129 *      hnode:      Node allocated with node_allocate(), or DSP_HGPPNODE.
130 *  Returns:
131 *      Node's timeout value.
132 *  Requires:
133 *      Valid hnode.
134 *  Ensures:
135 */
136extern u32 node_get_timeout(struct node_object *hnode);
137
138/*
139 *  ======== node_get_type ========
140 *  Purpose:
141 *      Get the type (device, message, task, or XDAIS socket) of a node.
142 *  Parameters:
143 *      hnode:      Node allocated with node_allocate(), or DSP_HGPPNODE.
144 *  Returns:
145 *      Node type:  NODE_DEVICE, NODE_TASK, NODE_XDAIS, or NODE_GPP.
146 *  Requires:
147 *      Valid hnode.
148 *  Ensures:
149 */
150extern enum node_type node_get_type(struct node_object *hnode);
151
152/*
153 *  ======== get_node_info ========
154 *  Purpose:
155 *      Get node information without holding semaphore.
156 *  Parameters:
157 *      hnode:      Node allocated with node_allocate(), or DSP_HGPPNODE.
158 *  Returns:
159 *      Node info:  priority, device owner, no. of streams, execution state
160 *                  NDB properties.
161 *  Requires:
162 *      Valid hnode.
163 *  Ensures:
164 */
165extern void get_node_info(struct node_object *hnode,
166			  struct dsp_nodeinfo *node_info);
167
168/*
169 *  ======== node_get_load_type ========
170 *  Purpose:
171 *      Get the load type (dynamic, overlay, static) of a node.
172 *  Parameters:
173 *      hnode:      Node allocated with node_allocate(), or DSP_HGPPNODE.
174 *  Returns:
175 *      Node type:  NLDR_DYNAMICLOAD, NLDR_OVLYLOAD, NLDR_STATICLOAD
176 *  Requires:
177 *      Valid hnode.
178 *  Ensures:
179 */
180extern enum nldr_loadtype node_get_load_type(struct node_object *hnode);
181
182#endif /* NODEPRIV_ */
183