xref: /aosp_15_r20/external/fastrpc/src/adspmsgd_adsp1_stub.c (revision 418b791d679beb2078b579a3b6936cf330c41799)
1*418b791dSBob Badour #ifndef _ADSPMSGD_ADSP1_STUB_H
2*418b791dSBob Badour #define _ADSPMSGD_ADSP1_STUB_H
3*418b791dSBob Badour /*
4*418b791dSBob Badour  * Copyright (c) 2019, The Linux Foundation. All rights reserved.
5*418b791dSBob Badour  *
6*418b791dSBob Badour  * Redistribution and use in source and binary forms, with or without
7*418b791dSBob Badour  * modification, are permitted provided that the following conditions are
8*418b791dSBob Badour  * met:
9*418b791dSBob Badour  *    * Redistributions of source code must retain the above copyright
10*418b791dSBob Badour  *      notice, this list of conditions and the following disclaimer.
11*418b791dSBob Badour  *    * Redistributions in binary form must reproduce the above
12*418b791dSBob Badour  *      copyright notice, this list of conditions and the following
13*418b791dSBob Badour  *      disclaimer in the documentation and/or other materials provided
14*418b791dSBob Badour  *      with the distribution.
15*418b791dSBob Badour  *    * Neither the name of The Linux Foundation nor the names of its
16*418b791dSBob Badour  *      contributors may be used to endorse or promote products derived
17*418b791dSBob Badour  *      from this software without specific prior written permission.
18*418b791dSBob Badour  *
19*418b791dSBob Badour  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
20*418b791dSBob Badour  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21*418b791dSBob Badour  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
22*418b791dSBob Badour  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
23*418b791dSBob Badour  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*418b791dSBob Badour  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*418b791dSBob Badour  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
26*418b791dSBob Badour  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27*418b791dSBob Badour  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28*418b791dSBob Badour  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
29*418b791dSBob Badour  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*418b791dSBob Badour  */
31*418b791dSBob Badour #include "adspmsgd_adsp1.h"
32*418b791dSBob Badour #ifndef _QAIC_ENV_H
33*418b791dSBob Badour #define _QAIC_ENV_H
34*418b791dSBob Badour 
35*418b791dSBob Badour #ifdef __GNUC__
36*418b791dSBob Badour #ifdef __clang__
37*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wunknown-pragmas"
38*418b791dSBob Badour #else
39*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wpragmas"
40*418b791dSBob Badour #endif
41*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wuninitialized"
42*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wunused-parameter"
43*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wunused-function"
44*418b791dSBob Badour #endif
45*418b791dSBob Badour 
46*418b791dSBob Badour #ifndef _ATTRIBUTE_UNUSED
47*418b791dSBob Badour 
48*418b791dSBob Badour #ifdef _WIN32
49*418b791dSBob Badour #define _ATTRIBUTE_UNUSED
50*418b791dSBob Badour #else
51*418b791dSBob Badour #define _ATTRIBUTE_UNUSED __attribute__ ((unused))
52*418b791dSBob Badour #endif
53*418b791dSBob Badour 
54*418b791dSBob Badour #endif // _ATTRIBUTE_UNUSED
55*418b791dSBob Badour 
56*418b791dSBob Badour #ifndef __QAIC_REMOTE
57*418b791dSBob Badour #define __QAIC_REMOTE(ff) ff
58*418b791dSBob Badour #endif //__QAIC_REMOTE
59*418b791dSBob Badour 
60*418b791dSBob Badour #ifndef __QAIC_HEADER
61*418b791dSBob Badour #define __QAIC_HEADER(ff) ff
62*418b791dSBob Badour #endif //__QAIC_HEADER
63*418b791dSBob Badour 
64*418b791dSBob Badour #ifndef __QAIC_HEADER_EXPORT
65*418b791dSBob Badour #define __QAIC_HEADER_EXPORT
66*418b791dSBob Badour #endif // __QAIC_HEADER_EXPORT
67*418b791dSBob Badour 
68*418b791dSBob Badour #ifndef __QAIC_HEADER_ATTRIBUTE
69*418b791dSBob Badour #define __QAIC_HEADER_ATTRIBUTE
70*418b791dSBob Badour #endif // __QAIC_HEADER_ATTRIBUTE
71*418b791dSBob Badour 
72*418b791dSBob Badour #ifndef __QAIC_IMPL
73*418b791dSBob Badour #define __QAIC_IMPL(ff) ff
74*418b791dSBob Badour #endif //__QAIC_IMPL
75*418b791dSBob Badour 
76*418b791dSBob Badour #ifndef __QAIC_IMPL_EXPORT
77*418b791dSBob Badour #define __QAIC_IMPL_EXPORT
78*418b791dSBob Badour #endif // __QAIC_IMPL_EXPORT
79*418b791dSBob Badour 
80*418b791dSBob Badour #ifndef __QAIC_IMPL_ATTRIBUTE
81*418b791dSBob Badour #define __QAIC_IMPL_ATTRIBUTE
82*418b791dSBob Badour #endif // __QAIC_IMPL_ATTRIBUTE
83*418b791dSBob Badour 
84*418b791dSBob Badour #ifndef __QAIC_STUB
85*418b791dSBob Badour #define __QAIC_STUB(ff) ff
86*418b791dSBob Badour #endif //__QAIC_STUB
87*418b791dSBob Badour 
88*418b791dSBob Badour #ifndef __QAIC_STUB_EXPORT
89*418b791dSBob Badour #define __QAIC_STUB_EXPORT
90*418b791dSBob Badour #endif // __QAIC_STUB_EXPORT
91*418b791dSBob Badour 
92*418b791dSBob Badour #ifndef __QAIC_STUB_ATTRIBUTE
93*418b791dSBob Badour #define __QAIC_STUB_ATTRIBUTE
94*418b791dSBob Badour #endif // __QAIC_STUB_ATTRIBUTE
95*418b791dSBob Badour 
96*418b791dSBob Badour #ifndef __QAIC_SKEL
97*418b791dSBob Badour #define __QAIC_SKEL(ff) ff
98*418b791dSBob Badour #endif //__QAIC_SKEL__
99*418b791dSBob Badour 
100*418b791dSBob Badour #ifndef __QAIC_SKEL_EXPORT
101*418b791dSBob Badour #define __QAIC_SKEL_EXPORT
102*418b791dSBob Badour #endif // __QAIC_SKEL_EXPORT
103*418b791dSBob Badour 
104*418b791dSBob Badour #ifndef __QAIC_SKEL_ATTRIBUTE
105*418b791dSBob Badour #define __QAIC_SKEL_ATTRIBUTE
106*418b791dSBob Badour #endif // __QAIC_SKEL_ATTRIBUTE
107*418b791dSBob Badour 
108*418b791dSBob Badour #ifdef __QAIC_DEBUG__
109*418b791dSBob Badour    #ifndef __QAIC_DBG_PRINTF__
110*418b791dSBob Badour    #include <stdio.h>
111*418b791dSBob Badour    #define __QAIC_DBG_PRINTF__( ee ) do { printf ee ; } while(0)
112*418b791dSBob Badour    #endif
113*418b791dSBob Badour #else
114*418b791dSBob Badour    #define __QAIC_DBG_PRINTF__( ee ) (void)0
115*418b791dSBob Badour #endif
116*418b791dSBob Badour 
117*418b791dSBob Badour 
118*418b791dSBob Badour #define _OFFSET(src, sof)  ((void*)(((char*)(src)) + (sof)))
119*418b791dSBob Badour 
120*418b791dSBob Badour #define _COPY(dst, dof, src, sof, sz)  \
121*418b791dSBob Badour    do {\
122*418b791dSBob Badour          struct __copy { \
123*418b791dSBob Badour             char ar[sz]; \
124*418b791dSBob Badour          };\
125*418b791dSBob Badour          *(struct __copy*)_OFFSET(dst, dof) = *(struct __copy*)_OFFSET(src, sof);\
126*418b791dSBob Badour    } while (0)
127*418b791dSBob Badour 
128*418b791dSBob Badour #define _COPYIF(dst, dof, src, sof, sz)  \
129*418b791dSBob Badour    do {\
130*418b791dSBob Badour       if(_OFFSET(dst, dof) != _OFFSET(src, sof)) {\
131*418b791dSBob Badour          _COPY(dst, dof, src, sof, sz); \
132*418b791dSBob Badour       } \
133*418b791dSBob Badour    } while (0)
134*418b791dSBob Badour 
135*418b791dSBob Badour _ATTRIBUTE_UNUSED
_qaic_memmove(void * dst,void * src,int size)136*418b791dSBob Badour static __inline void _qaic_memmove(void* dst, void* src, int size) {
137*418b791dSBob Badour    int i;
138*418b791dSBob Badour    for(i = 0; i < size; ++i) {
139*418b791dSBob Badour       ((char*)dst)[i] = ((char*)src)[i];
140*418b791dSBob Badour    }
141*418b791dSBob Badour }
142*418b791dSBob Badour 
143*418b791dSBob Badour #define _MEMMOVEIF(dst, src, sz)  \
144*418b791dSBob Badour    do {\
145*418b791dSBob Badour       if(dst != src) {\
146*418b791dSBob Badour          _qaic_memmove(dst, src, sz);\
147*418b791dSBob Badour       } \
148*418b791dSBob Badour    } while (0)
149*418b791dSBob Badour 
150*418b791dSBob Badour 
151*418b791dSBob Badour #define _ASSIGN(dst, src, sof)  \
152*418b791dSBob Badour    do {\
153*418b791dSBob Badour       dst = OFFSET(src, sof); \
154*418b791dSBob Badour    } while (0)
155*418b791dSBob Badour 
156*418b791dSBob Badour #define _STD_STRLEN_IF(str) (str == 0 ? 0 : strlen(str))
157*418b791dSBob Badour 
158*418b791dSBob Badour #include "AEEStdErr.h"
159*418b791dSBob Badour 
160*418b791dSBob Badour #define _TRY(ee, func) \
161*418b791dSBob Badour    do { \
162*418b791dSBob Badour       if (AEE_SUCCESS != ((ee) = func)) {\
163*418b791dSBob Badour          __QAIC_DBG_PRINTF__((__FILE__ ":%d:error:%d:%s\n", __LINE__, (int)(ee),#func));\
164*418b791dSBob Badour          goto ee##bail;\
165*418b791dSBob Badour       } \
166*418b791dSBob Badour    } while (0)
167*418b791dSBob Badour 
168*418b791dSBob Badour #define _CATCH(exception) exception##bail: if (exception != AEE_SUCCESS)
169*418b791dSBob Badour 
170*418b791dSBob Badour #define _ASSERT(nErr, ff) _TRY(nErr, 0 == (ff) ? AEE_EBADPARM : AEE_SUCCESS)
171*418b791dSBob Badour 
172*418b791dSBob Badour #ifdef __QAIC_DEBUG__
173*418b791dSBob Badour #define _ALLOCATE(nErr, pal, size, alignment, pv) _TRY(nErr, _allocator_alloc(pal, __FILE_LINE__, size, alignment, (void**)&pv))
174*418b791dSBob Badour #else
175*418b791dSBob Badour #define _ALLOCATE(nErr, pal, size, alignment, pv) _TRY(nErr, _allocator_alloc(pal, 0, size, alignment, (void**)&pv))
176*418b791dSBob Badour #endif
177*418b791dSBob Badour 
178*418b791dSBob Badour 
179*418b791dSBob Badour #endif // _QAIC_ENV_H
180*418b791dSBob Badour 
181*418b791dSBob Badour #include "remote.h"
182*418b791dSBob Badour #include <string.h>
183*418b791dSBob Badour #ifndef _ALLOCATOR_H
184*418b791dSBob Badour #define _ALLOCATOR_H
185*418b791dSBob Badour 
186*418b791dSBob Badour #include <stdlib.h>
187*418b791dSBob Badour #include <stdint.h>
188*418b791dSBob Badour 
189*418b791dSBob Badour typedef struct _heap _heap;
190*418b791dSBob Badour struct _heap {
191*418b791dSBob Badour    _heap* pPrev;
192*418b791dSBob Badour    const char* loc;
193*418b791dSBob Badour    uint64_t buf;
194*418b791dSBob Badour };
195*418b791dSBob Badour 
196*418b791dSBob Badour typedef struct _allocator {
197*418b791dSBob Badour    _heap* pheap;
198*418b791dSBob Badour    uint8_t* stack;
199*418b791dSBob Badour    uint8_t* stackEnd;
200*418b791dSBob Badour    int nSize;
201*418b791dSBob Badour } _allocator;
202*418b791dSBob Badour 
203*418b791dSBob Badour _ATTRIBUTE_UNUSED
_heap_alloc(_heap ** ppa,const char * loc,int size,void ** ppbuf)204*418b791dSBob Badour static __inline int _heap_alloc(_heap** ppa, const char* loc, int size, void** ppbuf) {
205*418b791dSBob Badour    _heap* pn = 0;
206*418b791dSBob Badour    pn = malloc(size + sizeof(_heap) - sizeof(uint64_t));
207*418b791dSBob Badour    if(pn != 0) {
208*418b791dSBob Badour       pn->pPrev = *ppa;
209*418b791dSBob Badour       pn->loc = loc;
210*418b791dSBob Badour       *ppa = pn;
211*418b791dSBob Badour       *ppbuf = (void*)&(pn->buf);
212*418b791dSBob Badour       return 0;
213*418b791dSBob Badour    } else {
214*418b791dSBob Badour       return -1;
215*418b791dSBob Badour    }
216*418b791dSBob Badour }
217*418b791dSBob Badour #define _ALIGN_SIZE(x, y) (((x) + (y-1)) & ~(y-1))
218*418b791dSBob Badour 
219*418b791dSBob Badour _ATTRIBUTE_UNUSED
_allocator_alloc(_allocator * me,const char * loc,int size,unsigned int al,void ** ppbuf)220*418b791dSBob Badour static __inline int _allocator_alloc(_allocator* me,
221*418b791dSBob Badour                                     const char* loc,
222*418b791dSBob Badour                                     int size,
223*418b791dSBob Badour                                     unsigned int al,
224*418b791dSBob Badour                                     void** ppbuf) {
225*418b791dSBob Badour    if(size < 0) {
226*418b791dSBob Badour       return -1;
227*418b791dSBob Badour    } else if (size == 0) {
228*418b791dSBob Badour       *ppbuf = 0;
229*418b791dSBob Badour       return 0;
230*418b791dSBob Badour    }
231*418b791dSBob Badour    if((_ALIGN_SIZE((uintptr_t)me->stackEnd, al) + size) < (uintptr_t)me->stack + me->nSize) {
232*418b791dSBob Badour       *ppbuf = (uint8_t*)_ALIGN_SIZE((uintptr_t)me->stackEnd, al);
233*418b791dSBob Badour       me->stackEnd = (uint8_t*)_ALIGN_SIZE((uintptr_t)me->stackEnd, al) + size;
234*418b791dSBob Badour       return 0;
235*418b791dSBob Badour    } else {
236*418b791dSBob Badour       return _heap_alloc(&me->pheap, loc, size, ppbuf);
237*418b791dSBob Badour    }
238*418b791dSBob Badour }
239*418b791dSBob Badour 
240*418b791dSBob Badour _ATTRIBUTE_UNUSED
_allocator_deinit(_allocator * me)241*418b791dSBob Badour static __inline void _allocator_deinit(_allocator* me) {
242*418b791dSBob Badour    _heap* pa = me->pheap;
243*418b791dSBob Badour    while(pa != 0) {
244*418b791dSBob Badour       _heap* pn = pa;
245*418b791dSBob Badour       const char* loc = pn->loc;
246*418b791dSBob Badour       (void)loc;
247*418b791dSBob Badour       pa = pn->pPrev;
248*418b791dSBob Badour       free(pn);
249*418b791dSBob Badour    }
250*418b791dSBob Badour }
251*418b791dSBob Badour 
252*418b791dSBob Badour _ATTRIBUTE_UNUSED
_allocator_init(_allocator * me,uint8_t * stack,int stackSize)253*418b791dSBob Badour static __inline void _allocator_init(_allocator* me, uint8_t* stack, int stackSize) {
254*418b791dSBob Badour    me->stack =  stack;
255*418b791dSBob Badour    me->stackEnd =  stack + stackSize;
256*418b791dSBob Badour    me->nSize = stackSize;
257*418b791dSBob Badour    me->pheap = 0;
258*418b791dSBob Badour }
259*418b791dSBob Badour 
260*418b791dSBob Badour 
261*418b791dSBob Badour #endif // _ALLOCATOR_H
262*418b791dSBob Badour 
263*418b791dSBob Badour #ifndef SLIM_H
264*418b791dSBob Badour #define SLIM_H
265*418b791dSBob Badour 
266*418b791dSBob Badour #include <stdint.h>
267*418b791dSBob Badour 
268*418b791dSBob Badour //a C data structure for the idl types that can be used to implement
269*418b791dSBob Badour //static and dynamic language bindings fairly efficiently.
270*418b791dSBob Badour //
271*418b791dSBob Badour //the goal is to have a minimal ROM and RAM footprint and without
272*418b791dSBob Badour //doing too many allocations.  A good way to package these things seemed
273*418b791dSBob Badour //like the module boundary, so all the idls within  one module can share
274*418b791dSBob Badour //all the type references.
275*418b791dSBob Badour 
276*418b791dSBob Badour 
277*418b791dSBob Badour #define PARAMETER_IN       0x0
278*418b791dSBob Badour #define PARAMETER_OUT      0x1
279*418b791dSBob Badour #define PARAMETER_INOUT    0x2
280*418b791dSBob Badour #define PARAMETER_ROUT     0x3
281*418b791dSBob Badour #define PARAMETER_INROUT   0x4
282*418b791dSBob Badour 
283*418b791dSBob Badour //the types that we get from idl
284*418b791dSBob Badour #define TYPE_OBJECT             0x0
285*418b791dSBob Badour #define TYPE_INTERFACE          0x1
286*418b791dSBob Badour #define TYPE_PRIMITIVE          0x2
287*418b791dSBob Badour #define TYPE_ENUM               0x3
288*418b791dSBob Badour #define TYPE_STRING             0x4
289*418b791dSBob Badour #define TYPE_WSTRING            0x5
290*418b791dSBob Badour #define TYPE_STRUCTURE          0x6
291*418b791dSBob Badour #define TYPE_UNION              0x7
292*418b791dSBob Badour #define TYPE_ARRAY              0x8
293*418b791dSBob Badour #define TYPE_SEQUENCE           0x9
294*418b791dSBob Badour 
295*418b791dSBob Badour //these require the pack/unpack to recurse
296*418b791dSBob Badour //so it's a hint to those languages that can optimize in cases where
297*418b791dSBob Badour //recursion isn't necessary.
298*418b791dSBob Badour #define TYPE_COMPLEX_STRUCTURE  (0x10 | TYPE_STRUCTURE)
299*418b791dSBob Badour #define TYPE_COMPLEX_UNION      (0x10 | TYPE_UNION)
300*418b791dSBob Badour #define TYPE_COMPLEX_ARRAY      (0x10 | TYPE_ARRAY)
301*418b791dSBob Badour #define TYPE_COMPLEX_SEQUENCE   (0x10 | TYPE_SEQUENCE)
302*418b791dSBob Badour 
303*418b791dSBob Badour 
304*418b791dSBob Badour typedef struct Type Type;
305*418b791dSBob Badour 
306*418b791dSBob Badour #define INHERIT_TYPE\
307*418b791dSBob Badour    int32_t nativeSize;                /*in the simple case its the same as wire size and alignment*/\
308*418b791dSBob Badour    union {\
309*418b791dSBob Badour       struct {\
310*418b791dSBob Badour          const uintptr_t         p1;\
311*418b791dSBob Badour          const uintptr_t         p2;\
312*418b791dSBob Badour       } _cast;\
313*418b791dSBob Badour       struct {\
314*418b791dSBob Badour          uint32_t  iid;\
315*418b791dSBob Badour          uint32_t  bNotNil;\
316*418b791dSBob Badour       } object;\
317*418b791dSBob Badour       struct {\
318*418b791dSBob Badour          const Type  *arrayType;\
319*418b791dSBob Badour          int32_t      nItems;\
320*418b791dSBob Badour       } array;\
321*418b791dSBob Badour       struct {\
322*418b791dSBob Badour          const Type *seqType;\
323*418b791dSBob Badour          int32_t      nMaxLen;\
324*418b791dSBob Badour       } seqSimple; \
325*418b791dSBob Badour       struct {\
326*418b791dSBob Badour          uint32_t bFloating;\
327*418b791dSBob Badour          uint32_t bSigned;\
328*418b791dSBob Badour       } prim; \
329*418b791dSBob Badour       const SequenceType* seqComplex;\
330*418b791dSBob Badour       const UnionType  *unionType;\
331*418b791dSBob Badour       const StructType *structType;\
332*418b791dSBob Badour       int32_t         stringMaxLen;\
333*418b791dSBob Badour       uint8_t        bInterfaceNotNil;\
334*418b791dSBob Badour    } param;\
335*418b791dSBob Badour    uint8_t    type;\
336*418b791dSBob Badour    uint8_t    nativeAlignment\
337*418b791dSBob Badour 
338*418b791dSBob Badour typedef struct UnionType UnionType;
339*418b791dSBob Badour typedef struct StructType StructType;
340*418b791dSBob Badour typedef struct SequenceType SequenceType;
341*418b791dSBob Badour struct Type {
342*418b791dSBob Badour    INHERIT_TYPE;
343*418b791dSBob Badour };
344*418b791dSBob Badour 
345*418b791dSBob Badour struct SequenceType {
346*418b791dSBob Badour    const Type *         seqType;
347*418b791dSBob Badour    uint32_t               nMaxLen;
348*418b791dSBob Badour    uint32_t               inSize;
349*418b791dSBob Badour    uint32_t               routSizePrimIn;
350*418b791dSBob Badour    uint32_t               routSizePrimROut;
351*418b791dSBob Badour };
352*418b791dSBob Badour 
353*418b791dSBob Badour //byte offset from the start of the case values for
354*418b791dSBob Badour //this unions case value array.  it MUST be aligned
355*418b791dSBob Badour //at the alignment requrements for the descriptor
356*418b791dSBob Badour //
357*418b791dSBob Badour //if negative it means that the unions cases are
358*418b791dSBob Badour //simple enumerators, so the value read from the descriptor
359*418b791dSBob Badour //can be used directly to find the correct case
360*418b791dSBob Badour typedef union CaseValuePtr CaseValuePtr;
361*418b791dSBob Badour union CaseValuePtr {
362*418b791dSBob Badour    const uint8_t*   value8s;
363*418b791dSBob Badour    const uint16_t*  value16s;
364*418b791dSBob Badour    const uint32_t*  value32s;
365*418b791dSBob Badour    const uint64_t*  value64s;
366*418b791dSBob Badour };
367*418b791dSBob Badour 
368*418b791dSBob Badour //these are only used in complex cases
369*418b791dSBob Badour //so I pulled them out of the type definition as references to make
370*418b791dSBob Badour //the type smaller
371*418b791dSBob Badour struct UnionType {
372*418b791dSBob Badour    const Type           *descriptor;
373*418b791dSBob Badour    uint32_t               nCases;
374*418b791dSBob Badour    const CaseValuePtr   caseValues;
375*418b791dSBob Badour    const Type * const   *cases;
376*418b791dSBob Badour    int32_t               inSize;
377*418b791dSBob Badour    int32_t               routSizePrimIn;
378*418b791dSBob Badour    int32_t               routSizePrimROut;
379*418b791dSBob Badour    uint8_t                inAlignment;
380*418b791dSBob Badour    uint8_t                routAlignmentPrimIn;
381*418b791dSBob Badour    uint8_t                routAlignmentPrimROut;
382*418b791dSBob Badour    uint8_t                inCaseAlignment;
383*418b791dSBob Badour    uint8_t                routCaseAlignmentPrimIn;
384*418b791dSBob Badour    uint8_t                routCaseAlignmentPrimROut;
385*418b791dSBob Badour    uint8_t                nativeCaseAlignment;
386*418b791dSBob Badour    uint8_t              bDefaultCase;
387*418b791dSBob Badour };
388*418b791dSBob Badour 
389*418b791dSBob Badour struct StructType {
390*418b791dSBob Badour    uint32_t               nMembers;
391*418b791dSBob Badour    const Type * const   *members;
392*418b791dSBob Badour    int32_t               inSize;
393*418b791dSBob Badour    int32_t               routSizePrimIn;
394*418b791dSBob Badour    int32_t               routSizePrimROut;
395*418b791dSBob Badour    uint8_t                inAlignment;
396*418b791dSBob Badour    uint8_t                routAlignmentPrimIn;
397*418b791dSBob Badour    uint8_t                routAlignmentPrimROut;
398*418b791dSBob Badour };
399*418b791dSBob Badour 
400*418b791dSBob Badour typedef struct Parameter Parameter;
401*418b791dSBob Badour struct Parameter {
402*418b791dSBob Badour    INHERIT_TYPE;
403*418b791dSBob Badour    uint8_t    mode;
404*418b791dSBob Badour    uint8_t  bNotNil;
405*418b791dSBob Badour };
406*418b791dSBob Badour 
407*418b791dSBob Badour #define SLIM_IFPTR32(is32,is64) (sizeof(uintptr_t) == 4 ? (is32) : (is64))
408*418b791dSBob Badour #define SLIM_SCALARS_IS_DYNAMIC(u) (((u) & 0x00ffffff) == 0x00ffffff)
409*418b791dSBob Badour 
410*418b791dSBob Badour typedef struct Method Method;
411*418b791dSBob Badour struct Method {
412*418b791dSBob Badour    uint32_t                    uScalars;            //no method index
413*418b791dSBob Badour    int32_t                     primInSize;
414*418b791dSBob Badour    int32_t                     primROutSize;
415*418b791dSBob Badour    int                         maxArgs;
416*418b791dSBob Badour    int                         numParams;
417*418b791dSBob Badour    const Parameter * const     *params;
418*418b791dSBob Badour    uint8_t                       primInAlignment;
419*418b791dSBob Badour    uint8_t                       primROutAlignment;
420*418b791dSBob Badour };
421*418b791dSBob Badour 
422*418b791dSBob Badour typedef struct Interface Interface;
423*418b791dSBob Badour 
424*418b791dSBob Badour struct Interface {
425*418b791dSBob Badour    int                            nMethods;
426*418b791dSBob Badour    const Method  * const          *methodArray;
427*418b791dSBob Badour    int                            nIIds;
428*418b791dSBob Badour    const uint32_t                   *iids;
429*418b791dSBob Badour    const uint16_t*                  methodStringArray;
430*418b791dSBob Badour    const uint16_t*                  methodStrings;
431*418b791dSBob Badour    const char*                    strings;
432*418b791dSBob Badour };
433*418b791dSBob Badour 
434*418b791dSBob Badour 
435*418b791dSBob Badour #endif //SLIM_H
436*418b791dSBob Badour 
437*418b791dSBob Badour 
438*418b791dSBob Badour #ifndef _ADSPMSGD_ADSP1_SLIM_H
439*418b791dSBob Badour #define _ADSPMSGD_ADSP1_SLIM_H
440*418b791dSBob Badour #include "remote.h"
441*418b791dSBob Badour #include <stdint.h>
442*418b791dSBob Badour 
443*418b791dSBob Badour #ifndef __QAIC_SLIM
444*418b791dSBob Badour #define __QAIC_SLIM(ff) ff
445*418b791dSBob Badour #endif
446*418b791dSBob Badour #ifndef __QAIC_SLIM_EXPORT
447*418b791dSBob Badour #define __QAIC_SLIM_EXPORT
448*418b791dSBob Badour #endif
449*418b791dSBob Badour 
450*418b791dSBob Badour static const Parameter parameters[3] = {{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)0x0,0}}, 4,SLIM_IFPTR32(0x4,0x8),0,0},{SLIM_IFPTR32(0x4,0x8),{{(const uintptr_t)0xdeadc0de,(const uintptr_t)0}}, 0,SLIM_IFPTR32(0x4,0x8),3,0},{SLIM_IFPTR32(0x4,0x8),{{(const uintptr_t)0xdeadc0de,(const uintptr_t)0}}, 0,SLIM_IFPTR32(0x4,0x8),0,0}};
451*418b791dSBob Badour static const Parameter* const parameterArrays[3] = {(&(parameters[0])),(&(parameters[1])),(&(parameters[2]))};
452*418b791dSBob Badour static const Method methods[3] = {{REMOTE_SCALARS_MAKEX(0,0,0x2,0x0,0x0,0x1),0x4,0x0,2,2,(&(parameterArrays[0])),0x4,0x1},{REMOTE_SCALARS_MAKEX(0,0,0x0,0x0,0x1,0x0),0x0,0x0,1,1,(&(parameterArrays[2])),0x1,0x0},{REMOTE_SCALARS_MAKEX(0,0,0x0,0x0,0x0,0x0),0x0,0x0,0,0,0,0x0,0x0}};
453*418b791dSBob Badour static const Method* const methodArrays[4] = {&(methods[0]),&(methods[1]),&(methods[2]),&(methods[2])};
454*418b791dSBob Badour static const char strings[30] = "deinit\0init2\0close\0open\0uri\0h\0";
455*418b791dSBob Badour static const uint16_t methodStrings[7] = {19,24,28,13,28,0,7};
456*418b791dSBob Badour static const uint16_t methodStringsArrays[4] = {0,3,6,5};
457*418b791dSBob Badour __QAIC_SLIM_EXPORT const Interface __QAIC_SLIM(adspmsgd_adsp1_slim) = {4,&(methodArrays[0]),0,0,&(methodStringsArrays [0]),methodStrings,strings};
458*418b791dSBob Badour #endif //_ADSPMSGD_ADSP1_SLIM_H
__QAIC_STUB(adspmsgd_adsp1_skel_handle_invoke)459*418b791dSBob Badour __QAIC_STUB_EXPORT int __QAIC_STUB(adspmsgd_adsp1_skel_handle_invoke)(remote_handle64 _h, uint32_t _sc, remote_arg* _pra) __QAIC_STUB_ATTRIBUTE {
460*418b791dSBob Badour    return __QAIC_REMOTE(remote_handle64_invoke)(_h, _sc, _pra);
461*418b791dSBob Badour }
462*418b791dSBob Badour #ifdef __cplusplus
463*418b791dSBob Badour extern "C" {
464*418b791dSBob Badour #endif
__QAIC_STUB(adspmsgd_adsp1_open)465*418b791dSBob Badour __QAIC_STUB_EXPORT int __QAIC_STUB(adspmsgd_adsp1_open)(const char* uri, remote_handle64* h) __QAIC_STUB_ATTRIBUTE {
466*418b791dSBob Badour    return __QAIC_REMOTE(remote_handle64_open)(uri, h);
467*418b791dSBob Badour }
__QAIC_STUB(adspmsgd_adsp1_close)468*418b791dSBob Badour __QAIC_STUB_EXPORT int __QAIC_STUB(adspmsgd_adsp1_close)(remote_handle64 h) __QAIC_STUB_ATTRIBUTE {
469*418b791dSBob Badour    return __QAIC_REMOTE(remote_handle64_close)(h);
470*418b791dSBob Badour }
_stub_method(remote_handle64 _handle,uint32_t _mid)471*418b791dSBob Badour static __inline int _stub_method(remote_handle64 _handle, uint32_t _mid) {
472*418b791dSBob Badour    remote_arg* _pra = 0;
473*418b791dSBob Badour    int _nErr = 0;
474*418b791dSBob Badour    _TRY(_nErr, __QAIC_REMOTE(remote_handle64_invoke)(_handle, REMOTE_SCALARS_MAKEX(0, _mid, 0, 0, 0, 0), _pra));
475*418b791dSBob Badour    _CATCH(_nErr) {}
476*418b791dSBob Badour    return _nErr;
477*418b791dSBob Badour }
__QAIC_STUB(adspmsgd_adsp1_init2)478*418b791dSBob Badour __QAIC_STUB_EXPORT int __QAIC_STUB(adspmsgd_adsp1_init2)(remote_handle64 _handle) __QAIC_STUB_ATTRIBUTE {
479*418b791dSBob Badour    uint32_t _mid = 2;
480*418b791dSBob Badour    return _stub_method(_handle, _mid);
481*418b791dSBob Badour }
__QAIC_STUB(adspmsgd_adsp1_deinit)482*418b791dSBob Badour __QAIC_STUB_EXPORT int __QAIC_STUB(adspmsgd_adsp1_deinit)(remote_handle64 _handle) __QAIC_STUB_ATTRIBUTE {
483*418b791dSBob Badour    uint32_t _mid = 3;
484*418b791dSBob Badour    return _stub_method(_handle, _mid);
485*418b791dSBob Badour }
486*418b791dSBob Badour #ifdef __cplusplus
487*418b791dSBob Badour }
488*418b791dSBob Badour #endif
489*418b791dSBob Badour #endif //_ADSPMSGD_ADSP1_STUB_H
490