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 timeout;		/* 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 dsp_heap_res_addr;	/* DSP virtual heap address */
59	u32 dsp_heap_addr;	/* DSP virtual heap address */
60	u32 heap_size;		/* Heap size */
61	u32 gpp_heap_addr;	/* GPP virtual heap address */
62	u32 profile_id;		/* Profile ID */
63	u32 num_inputs;
64	u32 num_outputs;
65	u32 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 *      Valid dir.
100 *      chan_id != NULL.
101 *  Ensures:
102 */
103extern int node_get_channel_id(struct node_object *hnode,
104				      u32 dir, u32 index, u32 *chan_id);
105
106/*
107 *  ======== node_get_strm_mgr ========
108 *  Purpose:
109 *      Get the STRM manager for a node.
110 *  Parameters:
111 *      hnode:          Node allocated with node_allocate().
112 *      strm_man:       Location to store STRM manager on output.
113 *  Returns:
114 *      0:        Success.
115 *      -EFAULT:    Invalid hnode.
116 *  Requires:
117 *      strm_man != NULL.
118 *  Ensures:
119 */
120extern int node_get_strm_mgr(struct node_object *hnode,
121				    struct strm_mgr **strm_man);
122
123/*
124 *  ======== node_get_timeout ========
125 *  Purpose:
126 *      Get the timeout value of a node.
127 *  Parameters:
128 *      hnode:      Node allocated with node_allocate(), or DSP_HGPPNODE.
129 *  Returns:
130 *      Node's timeout value.
131 *  Requires:
132 *      Valid hnode.
133 *  Ensures:
134 */
135extern u32 node_get_timeout(struct node_object *hnode);
136
137/*
138 *  ======== node_get_type ========
139 *  Purpose:
140 *      Get the type (device, message, task, or XDAIS socket) of a node.
141 *  Parameters:
142 *      hnode:      Node allocated with node_allocate(), or DSP_HGPPNODE.
143 *  Returns:
144 *      Node type:  NODE_DEVICE, NODE_TASK, NODE_XDAIS, or NODE_GPP.
145 *  Requires:
146 *      Valid hnode.
147 *  Ensures:
148 */
149extern enum node_type node_get_type(struct node_object *hnode);
150
151/*
152 *  ======== get_node_info ========
153 *  Purpose:
154 *      Get node information without holding semaphore.
155 *  Parameters:
156 *      hnode:      Node allocated with node_allocate(), or DSP_HGPPNODE.
157 *  Returns:
158 *      Node info:  priority, device owner, no. of streams, execution state
159 *                  NDB properties.
160 *  Requires:
161 *      Valid hnode.
162 *  Ensures:
163 */
164extern void get_node_info(struct node_object *hnode,
165			  struct dsp_nodeinfo *node_info);
166
167/*
168 *  ======== node_get_load_type ========
169 *  Purpose:
170 *      Get the load type (dynamic, overlay, static) of a node.
171 *  Parameters:
172 *      hnode:      Node allocated with node_allocate(), or DSP_HGPPNODE.
173 *  Returns:
174 *      Node type:  NLDR_DYNAMICLOAD, NLDR_OVLYLOAD, NLDR_STATICLOAD
175 *  Requires:
176 *      Valid hnode.
177 *  Ensures:
178 */
179extern enum nldr_loadtype node_get_load_type(struct node_object *hnode);
180
181#endif /* NODEPRIV_ */
182