/***********************************************************
 Copyright (c) 2019 Qualcomm Technologies, Inc.
 All Rights Reserved.
 Confidential and Proprietary - Qualcomm Technologies, Inc.
************************************************************/
/**
 * Example interface showcasing what SMCInvoke can do.
 */
/** @cond */
/** MINK IDL allows us to define structs which can be passed
    directly to function calls as parameters. Here we define
    a results struct; which we can use to return both the
    result of the current addition and the total sum from the
    context to the caller. */
#pragma once
// AUTOGENERATED FILE: DO NOT EDIT

#include <stdint.h>
#include "object.h"

typedef struct {
  uint32_t int1;
  uint32_t int2;
} additionStruct;

typedef struct {
  uint32_t total;
  uint32_t totalSaturated;
  uint32_t callCount;
  int32_t lastCall;
  uint32_t lastResult;
  uint32_t resultSaturated;
  uint32_t overflowFlag;
} statusStruct;

#define IAdder_OVERFLOW_TRUE UINT32_C(1)
#define IAdder_OVERFLOW_FALSE UINT32_C(0)

#define IAdder_OP_add 0
#define IAdder_OP_addArray 1
#define IAdder_OP_addStruct 2
#define IAdder_OP_getStatus 3

static inline int32_t
IAdder_release(Object self)
{
  return Object_invoke(self, Object_OP_release, 0, 0);
}

static inline int32_t
IAdder_retain(Object self)
{
  return Object_invoke(self, Object_OP_retain, 0, 0);
}

static inline int32_t
IAdder_add(Object self, uint32_t val1_val, int32_t val2_val, uint32_t *result_ptr)
{
  ObjectArg a[2]={{{0,0}}};
  struct {
    uint32_t m_val1;
    int32_t m_val2;
  } i = {0};
  a[0].b = (ObjectBuf) { &i, 8 };
  i.m_val1 = val1_val;
  i.m_val2 = val2_val;
  a[1].b = (ObjectBuf) { result_ptr, sizeof(uint32_t) };

  return Object_invoke(self, IAdder_OP_add, a, ObjectCounts_pack(1, 1, 0, 0));
}

static inline int32_t
IAdder_addArray(Object self, const uint32_t *intArray_ptr, size_t intArray_len, uint32_t *result_ptr)
{
  ObjectArg a[2]={{{0,0}}};
  a[0].bi = (ObjectBufIn) { intArray_ptr, intArray_len * sizeof(uint32_t) };
  a[1].b = (ObjectBuf) { result_ptr, sizeof(uint32_t) };

  return Object_invoke(self, IAdder_OP_addArray, a, ObjectCounts_pack(1, 1, 0, 0));
}

static inline int32_t
IAdder_addStruct(Object self, const additionStruct *inStruct_ptr, uint32_t *result_ptr)
{
  ObjectArg a[2]={{{0,0}}};
  a[0].bi = (ObjectBufIn) { inStruct_ptr, sizeof(additionStruct) };
  a[1].b = (ObjectBuf) { result_ptr, sizeof(uint32_t) };

  return Object_invoke(self, IAdder_OP_addStruct, a, ObjectCounts_pack(1, 1, 0, 0));
}

static inline int32_t
IAdder_getStatus(Object self, statusStruct *status_ptr)
{
  ObjectArg a[1]={{{0,0}}};
  a[0].b = (ObjectBuf) { status_ptr, sizeof(statusStruct) };

  return Object_invoke(self, IAdder_OP_getStatus, a, ObjectCounts_pack(0, 1, 0, 0));
}



