1*418b791dSBob Badour /*
2*418b791dSBob Badour * Copyright (c) 2019, The Linux Foundation. All rights reserved.
3*418b791dSBob Badour *
4*418b791dSBob Badour * Redistribution and use in source and binary forms, with or without
5*418b791dSBob Badour * modification, are permitted provided that the following conditions are
6*418b791dSBob Badour * met:
7*418b791dSBob Badour * * Redistributions of source code must retain the above copyright
8*418b791dSBob Badour * notice, this list of conditions and the following disclaimer.
9*418b791dSBob Badour * * Redistributions in binary form must reproduce the above
10*418b791dSBob Badour * copyright notice, this list of conditions and the following
11*418b791dSBob Badour * disclaimer in the documentation and/or other materials provided
12*418b791dSBob Badour * with the distribution.
13*418b791dSBob Badour * * Neither the name of The Linux Foundation nor the names of its
14*418b791dSBob Badour * contributors may be used to endorse or promote products derived
15*418b791dSBob Badour * from this software without specific prior written permission.
16*418b791dSBob Badour *
17*418b791dSBob Badour * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18*418b791dSBob Badour * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19*418b791dSBob Badour * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20*418b791dSBob Badour * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21*418b791dSBob Badour * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22*418b791dSBob Badour * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23*418b791dSBob Badour * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24*418b791dSBob Badour * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25*418b791dSBob Badour * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26*418b791dSBob Badour * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27*418b791dSBob Badour * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*418b791dSBob Badour */
29*418b791dSBob Badour
30*418b791dSBob Badour #ifndef _ADSPMSGD_APPS_SKEL_H
31*418b791dSBob Badour #define _ADSPMSGD_APPS_SKEL_H
32*418b791dSBob Badour #include "adspmsgd_apps.h"
33*418b791dSBob Badour #ifndef _QAIC_ENV_H
34*418b791dSBob Badour #define _QAIC_ENV_H
35*418b791dSBob Badour
36*418b791dSBob Badour #ifdef __GNUC__
37*418b791dSBob Badour #ifdef __clang__
38*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wunknown-pragmas"
39*418b791dSBob Badour #else
40*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wpragmas"
41*418b791dSBob Badour #endif
42*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wuninitialized"
43*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wunused-parameter"
44*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wunused-function"
45*418b791dSBob Badour #endif
46*418b791dSBob Badour
47*418b791dSBob Badour #ifndef _ATTRIBUTE_UNUSED
48*418b791dSBob Badour
49*418b791dSBob Badour #ifdef _WIN32
50*418b791dSBob Badour #define _ATTRIBUTE_UNUSED
51*418b791dSBob Badour #else
52*418b791dSBob Badour #define _ATTRIBUTE_UNUSED __attribute__ ((unused))
53*418b791dSBob Badour #endif
54*418b791dSBob Badour
55*418b791dSBob Badour #endif // _ATTRIBUTE_UNUSED
56*418b791dSBob Badour
57*418b791dSBob Badour #ifndef __QAIC_REMOTE
58*418b791dSBob Badour #define __QAIC_REMOTE(ff) ff
59*418b791dSBob Badour #endif //__QAIC_REMOTE
60*418b791dSBob Badour
61*418b791dSBob Badour #ifndef __QAIC_HEADER
62*418b791dSBob Badour #define __QAIC_HEADER(ff) ff
63*418b791dSBob Badour #endif //__QAIC_HEADER
64*418b791dSBob Badour
65*418b791dSBob Badour #ifndef __QAIC_HEADER_EXPORT
66*418b791dSBob Badour #define __QAIC_HEADER_EXPORT
67*418b791dSBob Badour #endif // __QAIC_HEADER_EXPORT
68*418b791dSBob Badour
69*418b791dSBob Badour #ifndef __QAIC_HEADER_ATTRIBUTE
70*418b791dSBob Badour #define __QAIC_HEADER_ATTRIBUTE
71*418b791dSBob Badour #endif // __QAIC_HEADER_ATTRIBUTE
72*418b791dSBob Badour
73*418b791dSBob Badour #ifndef __QAIC_IMPL
74*418b791dSBob Badour #define __QAIC_IMPL(ff) ff
75*418b791dSBob Badour #endif //__QAIC_IMPL
76*418b791dSBob Badour
77*418b791dSBob Badour #ifndef __QAIC_IMPL_EXPORT
78*418b791dSBob Badour #define __QAIC_IMPL_EXPORT
79*418b791dSBob Badour #endif // __QAIC_IMPL_EXPORT
80*418b791dSBob Badour
81*418b791dSBob Badour #ifndef __QAIC_IMPL_ATTRIBUTE
82*418b791dSBob Badour #define __QAIC_IMPL_ATTRIBUTE
83*418b791dSBob Badour #endif // __QAIC_IMPL_ATTRIBUTE
84*418b791dSBob Badour
85*418b791dSBob Badour #ifndef __QAIC_STUB
86*418b791dSBob Badour #define __QAIC_STUB(ff) ff
87*418b791dSBob Badour #endif //__QAIC_STUB
88*418b791dSBob Badour
89*418b791dSBob Badour #ifndef __QAIC_STUB_EXPORT
90*418b791dSBob Badour #define __QAIC_STUB_EXPORT
91*418b791dSBob Badour #endif // __QAIC_STUB_EXPORT
92*418b791dSBob Badour
93*418b791dSBob Badour #ifndef __QAIC_STUB_ATTRIBUTE
94*418b791dSBob Badour #define __QAIC_STUB_ATTRIBUTE
95*418b791dSBob Badour #endif // __QAIC_STUB_ATTRIBUTE
96*418b791dSBob Badour
97*418b791dSBob Badour #ifndef __QAIC_SKEL
98*418b791dSBob Badour #define __QAIC_SKEL(ff) ff
99*418b791dSBob Badour #endif //__QAIC_SKEL__
100*418b791dSBob Badour
101*418b791dSBob Badour #ifndef __QAIC_SKEL_EXPORT
102*418b791dSBob Badour #define __QAIC_SKEL_EXPORT
103*418b791dSBob Badour #endif // __QAIC_SKEL_EXPORT
104*418b791dSBob Badour
105*418b791dSBob Badour #ifndef __QAIC_SKEL_ATTRIBUTE
106*418b791dSBob Badour #define __QAIC_SKEL_ATTRIBUTE
107*418b791dSBob Badour #endif // __QAIC_SKEL_ATTRIBUTE
108*418b791dSBob Badour
109*418b791dSBob Badour #ifdef __QAIC_DEBUG__
110*418b791dSBob Badour #ifndef __QAIC_DBG_PRINTF__
111*418b791dSBob Badour #include <stdio.h>
112*418b791dSBob Badour #define __QAIC_DBG_PRINTF__( ee ) do { printf ee ; } while(0)
113*418b791dSBob Badour #endif
114*418b791dSBob Badour #else
115*418b791dSBob Badour #define __QAIC_DBG_PRINTF__( ee ) (void)0
116*418b791dSBob Badour #endif
117*418b791dSBob Badour
118*418b791dSBob Badour
119*418b791dSBob Badour #define _OFFSET(src, sof) ((void*)(((char*)(src)) + (sof)))
120*418b791dSBob Badour
121*418b791dSBob Badour #define _COPY(dst, dof, src, sof, sz) \
122*418b791dSBob Badour do {\
123*418b791dSBob Badour struct __copy { \
124*418b791dSBob Badour char ar[sz]; \
125*418b791dSBob Badour };\
126*418b791dSBob Badour *(struct __copy*)_OFFSET(dst, dof) = *(struct __copy*)_OFFSET(src, sof);\
127*418b791dSBob Badour } while (0)
128*418b791dSBob Badour
129*418b791dSBob Badour #define _COPYIF(dst, dof, src, sof, sz) \
130*418b791dSBob Badour do {\
131*418b791dSBob Badour if(_OFFSET(dst, dof) != _OFFSET(src, sof)) {\
132*418b791dSBob Badour _COPY(dst, dof, src, sof, sz); \
133*418b791dSBob Badour } \
134*418b791dSBob Badour } while (0)
135*418b791dSBob Badour
136*418b791dSBob Badour _ATTRIBUTE_UNUSED
_qaic_memmove(void * dst,void * src,int size)137*418b791dSBob Badour static __inline void _qaic_memmove(void* dst, void* src, int size) {
138*418b791dSBob Badour int i;
139*418b791dSBob Badour for(i = 0; i < size; ++i) {
140*418b791dSBob Badour ((char*)dst)[i] = ((char*)src)[i];
141*418b791dSBob Badour }
142*418b791dSBob Badour }
143*418b791dSBob Badour
144*418b791dSBob Badour #define _MEMMOVEIF(dst, src, sz) \
145*418b791dSBob Badour do {\
146*418b791dSBob Badour if(dst != src) {\
147*418b791dSBob Badour _qaic_memmove(dst, src, sz);\
148*418b791dSBob Badour } \
149*418b791dSBob Badour } while (0)
150*418b791dSBob Badour
151*418b791dSBob Badour
152*418b791dSBob Badour #define _ASSIGN(dst, src, sof) \
153*418b791dSBob Badour do {\
154*418b791dSBob Badour dst = OFFSET(src, sof); \
155*418b791dSBob Badour } while (0)
156*418b791dSBob Badour
157*418b791dSBob Badour #define _STD_STRLEN_IF(str) (str == 0 ? 0 : strlen(str))
158*418b791dSBob Badour
159*418b791dSBob Badour #include "AEEStdErr.h"
160*418b791dSBob Badour
161*418b791dSBob Badour #define _TRY(ee, func) \
162*418b791dSBob Badour do { \
163*418b791dSBob Badour if (AEE_SUCCESS != ((ee) = func)) {\
164*418b791dSBob Badour __QAIC_DBG_PRINTF__((__FILE__ ":%d:error:%d:%s\n", __LINE__, (int)(ee),#func));\
165*418b791dSBob Badour goto ee##bail;\
166*418b791dSBob Badour } \
167*418b791dSBob Badour } while (0)
168*418b791dSBob Badour
169*418b791dSBob Badour #define _CATCH(exception) exception##bail: if (exception != AEE_SUCCESS)
170*418b791dSBob Badour
171*418b791dSBob Badour #define _ASSERT(nErr, ff) _TRY(nErr, 0 == (ff) ? AEE_EBADPARM : AEE_SUCCESS)
172*418b791dSBob Badour
173*418b791dSBob Badour #ifdef __QAIC_DEBUG__
174*418b791dSBob Badour #define _ALLOCATE(nErr, pal, size, alignment, pv) _TRY(nErr, _allocator_alloc(pal, __FILE_LINE__, size, alignment, (void**)&pv))
175*418b791dSBob Badour #else
176*418b791dSBob Badour #define _ALLOCATE(nErr, pal, size, alignment, pv) _TRY(nErr, _allocator_alloc(pal, 0, size, alignment, (void**)&pv))
177*418b791dSBob Badour #endif
178*418b791dSBob Badour
179*418b791dSBob Badour
180*418b791dSBob Badour #endif // _QAIC_ENV_H
181*418b791dSBob Badour
182*418b791dSBob Badour #include "remote.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_APPS_SLIM_H
439*418b791dSBob Badour #define _ADSPMSGD_APPS_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 Type types[1];
451*418b791dSBob Badour static const Type types[1] = {{0x1,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x1}};
452*418b791dSBob Badour static const Parameter parameters[1] = {{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(types[0]),(const uintptr_t)0x0}}, 9,SLIM_IFPTR32(0x4,0x8),0,0}};
453*418b791dSBob Badour static const Parameter* const parameterArrays[1] = {(&(parameters[0]))};
454*418b791dSBob Badour static const Method methods[1] = {{REMOTE_SCALARS_MAKEX(0,0,0x2,0x0,0x0,0x0),0x4,0x0,2,1,(&(parameterArrays[0])),0x4,0x0}};
455*418b791dSBob Badour static const Method* const methodArrays[1] = {&(methods[0])};
456*418b791dSBob Badour static const char strings[23] = "log_message_buffer\0log\0";
457*418b791dSBob Badour static const uint16_t methodStrings[2] = {19,0};
458*418b791dSBob Badour static const uint16_t methodStringsArrays[1] = {0};
459*418b791dSBob Badour __QAIC_SLIM_EXPORT const Interface __QAIC_SLIM(adspmsgd_apps_slim) = {1,&(methodArrays[0]),0,0,&(methodStringsArrays [0]),methodStrings,strings};
460*418b791dSBob Badour #endif //_ADSPMSGD_APPS_SLIM_H
461*418b791dSBob Badour #ifdef __cplusplus
462*418b791dSBob Badour extern "C" {
463*418b791dSBob Badour #endif
_skel_method(int (* _pfn)(char *,uint32_t),uint32_t _sc,remote_arg * _pra)464*418b791dSBob Badour static __inline int _skel_method(int (*_pfn)(char*, uint32_t), uint32_t _sc, remote_arg* _pra) {
465*418b791dSBob Badour remote_arg* _praEnd;
466*418b791dSBob Badour char* _in0[1];
467*418b791dSBob Badour uint32_t _in0Len[1];
468*418b791dSBob Badour uint32_t* _primIn;
469*418b791dSBob Badour remote_arg* _praIn;
470*418b791dSBob Badour int _nErr = 0;
471*418b791dSBob Badour _praEnd = ((_pra + REMOTE_SCALARS_INBUFS(_sc)) + REMOTE_SCALARS_OUTBUFS(_sc));
472*418b791dSBob Badour _ASSERT(_nErr, (_pra + 2) <= _praEnd);
473*418b791dSBob Badour _ASSERT(_nErr, _pra[0].buf.nLen >= 4);
474*418b791dSBob Badour _primIn = _pra[0].buf.pv;
475*418b791dSBob Badour _COPY(_in0Len, 0, _primIn, 0, 4);
476*418b791dSBob Badour _praIn = (_pra + 1);
477*418b791dSBob Badour _ASSERT(_nErr, (int)((_praIn[0].buf.nLen / 1)) >= (int)(_in0Len[0]));
478*418b791dSBob Badour _in0[0] = _praIn[0].buf.pv;
479*418b791dSBob Badour _TRY(_nErr, _pfn(*_in0, *_in0Len));
480*418b791dSBob Badour _CATCH(_nErr) {}
481*418b791dSBob Badour return _nErr;
482*418b791dSBob Badour }
__QAIC_SKEL(adspmsgd_apps_skel_invoke)483*418b791dSBob Badour __QAIC_SKEL_EXPORT int __QAIC_SKEL(adspmsgd_apps_skel_invoke)(uint32_t _sc, remote_arg* _pra) __QAIC_SKEL_ATTRIBUTE {
484*418b791dSBob Badour switch(REMOTE_SCALARS_METHOD(_sc))
485*418b791dSBob Badour {
486*418b791dSBob Badour case 0:
487*418b791dSBob Badour return _skel_method((void*)__QAIC_IMPL(adspmsgd_apps_log), _sc, _pra);
488*418b791dSBob Badour }
489*418b791dSBob Badour return AEE_EUNSUPPORTED;
490*418b791dSBob Badour }
491*418b791dSBob Badour #ifdef __cplusplus
492*418b791dSBob Badour }
493*418b791dSBob Badour #endif
494*418b791dSBob Badour #endif //_ADSPMSGD_APPS_SKEL_H
495