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 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 #else 157 #define _ALLOCATE(nErr, pal, size, alignment, pv) _TRY(nErr, _allocator_alloc(pal, 0, size, alignment, (void**)&pv)) 158 #endif 159 160 161 #endif // _QAIC_ENV_H 162 163 #include "remote.h" 164 #ifndef _ALLOCATOR_H 165 #define _ALLOCATOR_H 166 167 #include <stdlib.h> 168 #include <stdint.h> 169 170 typedef struct _heap _heap; 171 struct _heap { 172 _heap* pPrev; 173 const char* loc; 174 uint64_t buf; 175 }; 176 177 typedef struct _allocator { 178 _heap* pheap; 179 uint8_t* stack; 180 uint8_t* stackEnd; 181 int nSize; 182 } _allocator; 183 184 _ATTRIBUTE_UNUSED 185 static __inline int _heap_alloc(_heap** ppa, const char* loc, int size, void** ppbuf) { 186 _heap* pn = 0; 187 pn = malloc(size + sizeof(_heap) - sizeof(uint64_t)); 188 if(pn != 0) { 189 pn->pPrev = *ppa; 190 pn->loc = loc; 191 *ppa = pn; 192 *ppbuf = (void*)&(pn->buf); 193 return 0; 194 } else { 195 return -1; 196 } 197 } 198 #define _ALIGN_SIZE(x, y) (((x) + (y-1)) & ~(y-1)) 199 200 _ATTRIBUTE_UNUSED 201 static __inline int _allocator_alloc(_allocator* me, 202 const char* loc, 203 int size, 204 unsigned int al, 205 void** ppbuf) { 206 if(size < 0) { 207 return -1; 208 } else if (size == 0) { 209 *ppbuf = 0; 210 return 0; 211 } 212 if((_ALIGN_SIZE((uintptr_t)me->stackEnd, al) + size) < (uintptr_t)me->stack + me->nSize) { 213 *ppbuf = (uint8_t*)_ALIGN_SIZE((uintptr_t)me->stackEnd, al); 214 me->stackEnd = (uint8_t*)_ALIGN_SIZE((uintptr_t)me->stackEnd, al) + size; 215 return 0; 216 } else { 217 return _heap_alloc(&me->pheap, loc, size, ppbuf); 218 } 219 } 220 221 _ATTRIBUTE_UNUSED 222 static __inline void _allocator_deinit(_allocator* me) { 223 _heap* pa = me->pheap; 224 while(pa != 0) { 225 _heap* pn = pa; 226 const char* loc = pn->loc; 227 (void)loc; 228 pa = pn->pPrev; 229 free(pn); 230 } 231 } 232 233 _ATTRIBUTE_UNUSED 234 static __inline void _allocator_init(_allocator* me, uint8_t* stack, int stackSize) { 235 me->stack = stack; 236 me->stackEnd = stack + stackSize; 237 me->nSize = stackSize; 238 me->pheap = 0; 239 } 240 241 242 #endif // _ALLOCATOR_H 243 244 #ifndef SLIM_H 245 #define SLIM_H 246 247 #include <stdint.h> 248 249 //a C data structure for the idl types that can be used to implement 250 //static and dynamic language bindings fairly efficiently. 251 // 252 //the goal is to have a minimal ROM and RAM footprint and without 253 //doing too many allocations. A good way to package these things seemed 254 //like the module boundary, so all the idls within one module can share 255 //all the type references. 256 257 258 #define PARAMETER_IN 0x0 259 #define PARAMETER_OUT 0x1 260 #define PARAMETER_INOUT 0x2 261 #define PARAMETER_ROUT 0x3 262 #define PARAMETER_INROUT 0x4 263 264 //the types that we get from idl 265 #define TYPE_OBJECT 0x0 266 #define TYPE_INTERFACE 0x1 267 #define TYPE_PRIMITIVE 0x2 268 #define TYPE_ENUM 0x3 269 #define TYPE_STRING 0x4 270 #define TYPE_WSTRING 0x5 271 #define TYPE_STRUCTURE 0x6 272 #define TYPE_UNION 0x7 273 #define TYPE_ARRAY 0x8 274 #define TYPE_SEQUENCE 0x9 275 276 //these require the pack/unpack to recurse 277 //so it's a hint to those languages that can optimize in cases where 278 //recursion isn't necessary. 279 #define TYPE_COMPLEX_STRUCTURE (0x10 | TYPE_STRUCTURE) 280 #define TYPE_COMPLEX_UNION (0x10 | TYPE_UNION) 281 #define TYPE_COMPLEX_ARRAY (0x10 | TYPE_ARRAY) 282 #define TYPE_COMPLEX_SEQUENCE (0x10 | TYPE_SEQUENCE) 283 284 285 typedef struct Type Type; 286 287 #define INHERIT_TYPE\ 288 int32_t nativeSize; /*in the simple case its the same as wire size and alignment*/\ 289 union {\ 290 struct {\ 291 const uintptr_t p1;\ 292 const uintptr_t p2;\ 293 } _cast;\ 294 struct {\ 295 uint32_t iid;\ 296 uint32_t bNotNil;\ 297 } object;\ 298 struct {\ 299 const Type *arrayType;\ 300 int32_t nItems;\ 301 } array;\ 302 struct {\ 303 const Type *seqType;\ 304 int32_t nMaxLen;\ 305 } seqSimple; \ 306 struct {\ 307 uint32_t bFloating;\ 308 uint32_t bSigned;\ 309 } prim; \ 310 const SequenceType* seqComplex;\ 311 const UnionType *unionType;\ 312 const StructType *structType;\ 313 int32_t stringMaxLen;\ 314 uint8_t bInterfaceNotNil;\ 315 } param;\ 316 uint8_t type;\ 317 uint8_t nativeAlignment\ 318 319 typedef struct UnionType UnionType; 320 typedef struct StructType StructType; 321 typedef struct SequenceType SequenceType; 322 struct Type { 323 INHERIT_TYPE; 324 }; 325 326 struct SequenceType { 327 const Type * seqType; 328 uint32_t nMaxLen; 329 uint32_t inSize; 330 uint32_t routSizePrimIn; 331 uint32_t routSizePrimROut; 332 }; 333 334 //byte offset from the start of the case values for 335 //this unions case value array. it MUST be aligned 336 //at the alignment requrements for the descriptor 337 // 338 //if negative it means that the unions cases are 339 //simple enumerators, so the value read from the descriptor 340 //can be used directly to find the correct case 341 typedef union CaseValuePtr CaseValuePtr; 342 union CaseValuePtr { 343 const uint8_t* value8s; 344 const uint16_t* value16s; 345 const uint32_t* value32s; 346 const uint64_t* value64s; 347 }; 348 349 //these are only used in complex cases 350 //so I pulled them out of the type definition as references to make 351 //the type smaller 352 struct UnionType { 353 const Type *descriptor; 354 uint32_t nCases; 355 const CaseValuePtr caseValues; 356 const Type * const *cases; 357 int32_t inSize; 358 int32_t routSizePrimIn; 359 int32_t routSizePrimROut; 360 uint8_t inAlignment; 361 uint8_t routAlignmentPrimIn; 362 uint8_t routAlignmentPrimROut; 363 uint8_t inCaseAlignment; 364 uint8_t routCaseAlignmentPrimIn; 365 uint8_t routCaseAlignmentPrimROut; 366 uint8_t nativeCaseAlignment; 367 uint8_t bDefaultCase; 368 }; 369 370 struct StructType { 371 uint32_t nMembers; 372 const Type * const *members; 373 int32_t inSize; 374 int32_t routSizePrimIn; 375 int32_t routSizePrimROut; 376 uint8_t inAlignment; 377 uint8_t routAlignmentPrimIn; 378 uint8_t routAlignmentPrimROut; 379 }; 380 381 typedef struct Parameter Parameter; 382 struct Parameter { 383 INHERIT_TYPE; 384 uint8_t mode; 385 uint8_t bNotNil; 386 }; 387 388 #define SLIM_IFPTR32(is32,is64) (sizeof(uintptr_t) == 4 ? (is32) : (is64)) 389 #define SLIM_SCALARS_IS_DYNAMIC(u) (((u) & 0x00ffffff) == 0x00ffffff) 390 391 typedef struct Method Method; 392 struct Method { 393 uint32_t uScalars; //no method index 394 int32_t primInSize; 395 int32_t primROutSize; 396 int maxArgs; 397 int numParams; 398 const Parameter * const *params; 399 uint8_t primInAlignment; 400 uint8_t primROutAlignment; 401 }; 402 403 typedef struct Interface Interface; 404 405 struct Interface { 406 int nMethods; 407 const Method * const *methodArray; 408 int nIIds; 409 const uint32_t *iids; 410 const uint16_t* methodStringArray; 411 const uint16_t* methodStrings; 412 const char* strings; 413 }; 414 415 416 #endif //SLIM_H 417 418 419 #ifndef _CHRE_SLPI_SLIM_H 420 #define _CHRE_SLPI_SLIM_H 421 #include "remote.h" 422 #include <stdint.h> 423 424 #ifndef __QAIC_SLIM 425 #define __QAIC_SLIM(ff) ff 426 #endif 427 #ifndef __QAIC_SLIM_EXPORT 428 #define __QAIC_SLIM_EXPORT 429 #endif 430 431 static const Type types[1]; 432 static const Type types[1] = {{0x1,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x1}}; 433 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)0}}, 2,0x4,3,0},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(types[0]),(const uintptr_t)0x0}}, 9,SLIM_IFPTR32(0x4,0x8),0,0}}; 434 static const Parameter* const parameterArrays[3] = {(&(parameters[0])),(&(parameters[1])),(&(parameters[2]))}; 435 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}}; 436 static const Method* const methodArrays[6] = {&(methods[0]),&(methods[0]),&(methods[0]),&(methods[0]),&(methods[1]),&(methods[2])}; 437 static const char strings[144] = "initialize_reverse_monitor\0deliver_message_from_host\0get_message_to_host\0wait_on_thread_exit\0start_thread\0stop_thread\0messageLen\0message\0buffer\0"; 438 static const uint16_t methodStrings[9] = {53,137,118,27,129,106,0,73,93}; 439 static const uint16_t methodStringsArrays[6] = {8,7,6,5,0,3}; 440 __QAIC_SLIM_EXPORT const Interface __QAIC_SLIM(chre_slpi_slim) = {6,&(methodArrays[0]),0,0,&(methodStringsArrays [0]),methodStrings,strings}; 441 #endif //_CHRE_SLPI_SLIM_H 442 #ifdef __cplusplus 443 extern "C" { 444 #endif 445 446 #ifndef _const_chre_slpi_handle 447 #define _const_chre_slpi_handle ((remote_handle)-1) 448 #endif //_const_chre_slpi_handle 449 450 static void _chre_slpi_pls_dtor(void* data) { 451 remote_handle* ph = (remote_handle*)data; 452 if(_const_chre_slpi_handle != *ph) { 453 (void)__QAIC_REMOTE(remote_handle_close)(*ph); 454 *ph = _const_chre_slpi_handle; 455 } 456 } 457 458 static int _chre_slpi_pls_ctor(void* ctx, void* data) { 459 remote_handle* ph = (remote_handle*)data; 460 *ph = _const_chre_slpi_handle; 461 if(*ph == (remote_handle)-1) { 462 return __QAIC_REMOTE(remote_handle_open)((const char*)ctx, ph); 463 } 464 return 0; 465 } 466 467 #if (defined __qdsp6__) || (defined __hexagon__) 468 #pragma weak adsp_pls_add_lookup 469 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); 470 #pragma weak HAP_pls_add_lookup 471 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); 472 473 __QAIC_STUB_EXPORT remote_handle _chre_slpi_handle(void) { 474 remote_handle* ph; 475 if(adsp_pls_add_lookup) { 476 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)) { 477 return *ph; 478 } 479 return (remote_handle)-1; 480 } else if(HAP_pls_add_lookup) { 481 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)) { 482 return *ph; 483 } 484 return (remote_handle)-1; 485 } 486 return(remote_handle)-1; 487 } 488 489 #else //__qdsp6__ || __hexagon__ 490 491 uint32_t _chre_slpi_atomic_CompareAndExchange(uint32_t * volatile puDest, uint32_t uExchange, uint32_t uCompare); 492 493 #ifdef _WIN32 494 #include "Windows.h" 495 uint32_t _chre_slpi_atomic_CompareAndExchange(uint32_t * volatile puDest, uint32_t uExchange, uint32_t uCompare) { 496 return (uint32_t)InterlockedCompareExchange((volatile LONG*)puDest, (LONG)uExchange, (LONG)uCompare); 497 } 498 #elif __GNUC__ 499 uint32_t _chre_slpi_atomic_CompareAndExchange(uint32_t * volatile puDest, uint32_t uExchange, uint32_t uCompare) { 500 return __sync_val_compare_and_swap(puDest, uCompare, uExchange); 501 } 502 #endif //_WIN32 503 504 505 __QAIC_STUB_EXPORT remote_handle _chre_slpi_handle(void) { 506 static remote_handle handle = _const_chre_slpi_handle; 507 if((remote_handle)-1 != handle) { 508 return handle; 509 } else { 510 remote_handle tmp; 511 int nErr = _chre_slpi_pls_ctor("chre_slpi", (void*)&tmp); 512 if(nErr) { 513 return (remote_handle)-1; 514 } 515 if(((remote_handle)-1 != handle) || ((remote_handle)-1 != (remote_handle)_chre_slpi_atomic_CompareAndExchange((uint32_t*)&handle, (uint32_t)tmp, (uint32_t)-1))) { 516 _chre_slpi_pls_dtor(&tmp); 517 } 518 return handle; 519 } 520 } 521 522 #endif //__qdsp6__ 523 524 __QAIC_STUB_EXPORT int __QAIC_STUB(chre_slpi_skel_invoke)(uint32_t _sc, remote_arg* _pra) __QAIC_STUB_ATTRIBUTE { 525 return __QAIC_REMOTE(remote_handle_invoke)(_chre_slpi_handle(), _sc, _pra); 526 } 527 528 #ifdef __cplusplus 529 } 530 #endif 531 532 533 #ifdef __cplusplus 534 extern "C" { 535 #endif 536 static __inline int _stub_method(remote_handle _handle, uint32_t _mid) { 537 remote_arg* _pra = 0; 538 int _nErr = 0; 539 _TRY(_nErr, __QAIC_REMOTE(remote_handle_invoke)(_handle, REMOTE_SCALARS_MAKEX(0, _mid, 0, 0, 0, 0), _pra)); 540 _CATCH(_nErr) {} 541 return _nErr; 542 } 543 __QAIC_STUB_EXPORT int __QAIC_STUB(chre_slpi_start_thread)(void) __QAIC_STUB_ATTRIBUTE { 544 uint32_t _mid = 0; 545 return _stub_method(_chre_slpi_handle(), _mid); 546 } 547 __QAIC_STUB_EXPORT int __QAIC_STUB(chre_slpi_wait_on_thread_exit)(void) __QAIC_STUB_ATTRIBUTE { 548 uint32_t _mid = 1; 549 return _stub_method(_chre_slpi_handle(), _mid); 550 } 551 __QAIC_STUB_EXPORT int __QAIC_STUB(chre_slpi_initialize_reverse_monitor)(void) __QAIC_STUB_ATTRIBUTE { 552 uint32_t _mid = 2; 553 return _stub_method(_chre_slpi_handle(), _mid); 554 } 555 __QAIC_STUB_EXPORT int __QAIC_STUB(chre_slpi_stop_thread)(void) __QAIC_STUB_ATTRIBUTE { 556 uint32_t _mid = 3; 557 return _stub_method(_chre_slpi_handle(), _mid); 558 } 559 static __inline int _stub_method_1(remote_handle _handle, uint32_t _mid, char* _rout0[1], uint32_t _rout0Len[1], uint32_t _rout1[1]) { 560 int _numIn[1]; 561 remote_arg _pra[3]; 562 uint32_t _primIn[1]; 563 uint32_t _primROut[1]; 564 remote_arg* _praIn; 565 remote_arg* _praROut; 566 int _nErr = 0; 567 _numIn[0] = 0; 568 _pra[0].buf.pv = (void*)_primIn; 569 _pra[0].buf.nLen = sizeof(_primIn); 570 _pra[(_numIn[0] + 1)].buf.pv = (void*)_primROut; 571 _pra[(_numIn[0] + 1)].buf.nLen = sizeof(_primROut); 572 _COPY(_primIn, 0, _rout0Len, 0, 4); 573 _praIn = (_pra + 1); 574 _praROut = (_praIn + _numIn[0] + 1); 575 _praROut[0].buf.pv = _rout0[0]; 576 _praROut[0].buf.nLen = (1 * _rout0Len[0]); 577 _TRY(_nErr, __QAIC_REMOTE(remote_handle_invoke)(_handle, REMOTE_SCALARS_MAKEX(0, _mid, 1, 2, 0, 0), _pra)); 578 _COPY(_rout1, 0, _primROut, 0, 4); 579 _CATCH(_nErr) {} 580 return _nErr; 581 } 582 __QAIC_STUB_EXPORT int __QAIC_STUB(chre_slpi_get_message_to_host)(unsigned char* buffer, int bufferLen, unsigned int* messageLen) __QAIC_STUB_ATTRIBUTE { 583 uint32_t _mid = 4; 584 return _stub_method_1(_chre_slpi_handle(), _mid, (char**)&buffer, (uint32_t*)&bufferLen, (uint32_t*)messageLen); 585 } 586 static __inline int _stub_method_2(remote_handle _handle, uint32_t _mid, char* _in0[1], uint32_t _in0Len[1]) { 587 remote_arg _pra[2]; 588 uint32_t _primIn[1]; 589 remote_arg* _praIn; 590 int _nErr = 0; 591 _pra[0].buf.pv = (void*)_primIn; 592 _pra[0].buf.nLen = sizeof(_primIn); 593 _COPY(_primIn, 0, _in0Len, 0, 4); 594 _praIn = (_pra + 1); 595 _praIn[0].buf.pv = _in0[0]; 596 _praIn[0].buf.nLen = (1 * _in0Len[0]); 597 _TRY(_nErr, __QAIC_REMOTE(remote_handle_invoke)(_handle, REMOTE_SCALARS_MAKEX(0, _mid, 2, 0, 0, 0), _pra)); 598 _CATCH(_nErr) {} 599 return _nErr; 600 } 601 __QAIC_STUB_EXPORT int __QAIC_STUB(chre_slpi_deliver_message_from_host)(const unsigned char* message, int messageLen) __QAIC_STUB_ATTRIBUTE { 602 uint32_t _mid = 5; 603 return _stub_method_2(_chre_slpi_handle(), _mid, (char**)&message, (uint32_t*)&messageLen); 604 } 605 #ifdef __cplusplus 606 } 607 #endif 608 #endif //_CHRE_SLPI_STUB_H 609