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