1 
2 /*
3  * Copyright (C) Texas Instruments - http://www.ti.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21 /* ====================================================================
22 *             Texas Instruments OMAP(TM) Platform Software
23 * (c) Copyright Texas Instruments, Incorporated. All Rights Reserved.
24 *
25 * Use of this software is controlled by the terms and conditions found
26 * in the license agreement under which this software has been supplied.
27 * ==================================================================== */
28 
29 /** LCML_Types.h
30  *  The LCML header file contains the definitions used by both the
31  *  application and the component to access common items.
32  */
33 #ifndef LCML_TYPES_H
34 #define LCML_TYPES_H
35 #include <OMX_Core.h>
36 #include <dbapi.h>
37 
38 
39 /* ======================================================================= */
40 /**
41  * Enum to distinguish between type of buffer
42  */
43 /*  ==================================================================== */
44 typedef enum {
45     INPUT_BUFFER,
46     OUTPUT_BUFFER
47 }Buffer_Type;
48 
49 /* ======================================================================= */
50 /**
51  * Enum for method of data transfer
52  */
53 /*  ==================================================================== */
54 typedef enum {
55     STREAM_METHOD,
56     DMM_METHOD,
57     DASF
58 }LCML_TransferMethod;
59 
60 
61 /* ======================================================================= */
62 /**
63  * Structure to maintain information regarding streams and related buffers.
64  */
65 /*  ==================================================================== */
66 typedef struct LCML_BUFFERINFO {
67     OMX_U32 nBuffers;
68     OMX_U32 nSize;
69     LCML_TransferMethod DataTrMethod;
70 }LCML_BUFFERINFO;
71 
72 
73 /* ======================================================================= */
74 /**
75  * Structure to encapsulate create phase args.
76  */
77 /*  ==================================================================== */
78 typedef struct LCML_CREATEPHASEARGS {
79     ULONG cbData;
80     /*for 2420*/
81     /*   BYTE cData[LCML_DATA_SIZE];*/
82     /*for 2430*/
83     unsigned short cData[LCML_DATA_SIZE];
84 }LCML_CREATEPHASEARGS;
85 /* ======================================================================= */
86 /**
87  * Enum to distinguish between dlls
88  */
89 /*  ==================================================================== */
90 typedef enum {
91     DLL_NODEOBJECT,
92     DLL_PROCESSOR,
93     DLL_DEPENDENT
94 }LCML_DllType;
95 
96 
97 /* ======================================================================= */
98 /**
99  * Enum to distinguish between types of events
100  */
101 /*  ==================================================================== */
102 typedef enum {
103     MESSAGING_EVENT,
104     STREAMING_EVENT
105 }DSP_EventType;
106 
107 
108 /* ======================================================================= */
109 /**
110  * Enum to establish component state
111  */
112 /*  ==================================================================== */
113 
114 
115 /* ADD MORE STATES */
116 typedef enum {
117     DOES_NOT_EXIST,
118     ACTIVE,
119     INACTIVE
120 } COMPONENT_Status;
121 
122 typedef struct NOTIFICATION_OBJ {
123     DSP_EventType msgType;
124 /*    DSP_HNOTIFICATION pNotifiObj;*/
125     struct DSP_NOTIFICATION notifiObj;
126 }NOTIFICATION_OBJ;
127 
128 
129 /* ======================================================================= */
130 /**
131  * Structure to capture uuid information.
132  */
133 /*  ==================================================================== */
134 typedef struct LCML_UUIDINFO {
135     struct DSP_UUID *uuid;
136 /*    OMX_STRING DllName;*/
137     OMX_U8 DllName[50];
138     LCML_DllType eDllType;
139 }LCML_UUIDINFO;
140 /* ======================================================================= */
141 /**
142  * Structure to encapsulate dll information.
143  */
144 /*  ==================================================================== */
145 
146 typedef struct LCML_DLLINFO {
147     unsigned int nNumOfDLLs;
148     LCML_UUIDINFO AllUUIDs[LCML_MAX_NUM_OF_DLLs];
149 }LCML_DLLINFO;
150 
151 
152 
153 
154 /* Stream mode types */
155 typedef enum {
156     MODE_PROCCOPY,   /* Processor(s) copy stream data payloads */
157     MODE_ZEROCOPY,   /* Stream buffer pointers swapped, no data copied */
158     MODE_LDMA,       /* Local DMA : OMAP's System-DMA device */
159     MODE_RDMA        /* Remote DMA: OMAP's DSP-DMA device */
160 } LCML_STRMMODE;
161 
162 /* ======================================================================= */
163 /**
164  * Structure to encapsulate dll information.
165  */
166 /*  ==================================================================== */
167 typedef struct LCML_STRMATTR {
168     unsigned int        uSegid;
169     unsigned int        uBufsize;
170     unsigned int        uNumBufs;
171     unsigned int        uAlignment;
172     unsigned int        uTimeout;
173     LCML_STRMMODE       lMode;
174     unsigned int        uDMAChnlId;
175     unsigned int        uDMAPriority;
176 } LCML_STRMATTR;
177 
178 
179 /* ======================================================================= */
180 /**
181  * Structure to encapsulate dll information.
182  */
183 /*  ==================================================================== */
184 
185 typedef struct LCML_DEVICERENDERING{
186     int TypeofDevice;
187     int TypeofRender;   /* 0 for playback and 1 for record*/
188     LCML_UUIDINFO AllUUIDs[LCML_MAX_NUM_OF_DLLs];
189     LCML_STRMATTR * DspStream;
190 }LCML_DEVICERENDERING;
191 
192 
193 /* ======================================================================= */
194 /**
195  * This enum is mean to abtract the enumerations of messages that are
196  * recieved from dsp processor.
197  */
198 /*  ==================================================================== */
199 
200 typedef enum
201 {
202     EMMCodecDspError = -200,
203     EMMCodecInternalError = -201,
204     EMMCodecInitError = -202,
205     EMMCodecDspMessageRecieved = 1,
206     EMMCodecBufferProcessed,
207     EMMCodecProcessingStarted,
208     EMMCodecProcessingPaused,
209     EMMCodecProcessingStoped,
210     EMMCodecProcessingEof,
211     EMMCodecBufferNotProcessed,
212     EMMCodecAlgCtrlAck,
213     EMMCodecStrmCtrlAck
214 
215 }TUsnCodecEvent;
216 
217 /* ======================================================================= */
218 /**
219  * This enum keeps track of the state of the codec in order to allow the messaging thread to decrease the timeout
220  * while waiting for events when in the stopped state so that the thread deletion latency will be minimal
221  */
222 /*  ==================================================================== */
223 
224 typedef enum
225 {
226     EMessagingThreadCodecRunning,
227     EMessagingThreadCodecStopped
228 }LCML_MESSAGINGTHREAD_STATE;
229 
230 /* ======================================================================= */
231 /**
232  * Structure used to store reserve address of buffer mapped to DSP
233  */
234 /*  ==================================================================== */
235 
236 typedef struct DMM_BUFFER_OBJ {
237     void* pAllocated;
238     void* pReserved;
239     void* pMapped;
240     void* bufReserved;
241     void* paramReserved;
242 /*  void* structReserved;*/
243     int nSize;
244 } DMM_BUFFER_OBJ;
245 
246 /* ======================================================================= */
247 /**
248  * Structure used to pass in the callback function. LCML call back functions
249  * are defined in this manner
250  */
251 /*  ==================================================================== */
252 
253 typedef struct LCML_CALLBACKTYPE {
254     void (*LCML_Callback) (TUsnCodecEvent event,void * args [10]);
255 }LCML_CALLBACKTYPE;
256 
257 /* ======================================================================= */
258 /**
259  * Structure maintaining information for LCML.
260  */
261 /*  ==================================================================== */
262 typedef struct LCML_DSP {
263     DSP_HNODE hNode;
264 	DSP_HNODE hDasfNode;
265     DSP_HPROCESSOR hProc;
266     DMM_BUFFER_OBJ InDmmBuffer[QUEUE_SIZE];
267     DMM_BUFFER_OBJ OutDmmBuffer[QUEUE_SIZE];
268     /*COMPONENT_Status CompStatus;*/
269     LCML_CALLBACKTYPE Callbacks;
270     /*needs to be filled by application*/
271     LCML_BUFFERINFO In_BufInfo;
272     LCML_BUFFERINFO Out_BufInfo;
273     OMX_U16 *pCrPhArgs;
274     LCML_DLLINFO NodeInfo;
275     LCML_DEVICERENDERING DeviceInfo;
276     OMX_U32 SegID;
277     OMX_U32 Timeout;
278     OMX_U32 Alignment;
279     OMX_S32 Priority;
280     OMX_U16 numStreams;
281     OMX_U32 ProfileID;
282 }LCML_DSP;
283 
284 
285 #endif /*LCML_TYPES_H*/
286