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