/***********************************************************
 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. */

struct additionStruct
{
  uint32 int1;
  uint32 int2;
};

struct statusStruct
{
  uint32 total;           ///< The total sum of all calls to this IAdder object
  uint32 totalSaturated;  ///< Whether the total was saturated or not
  uint32  callCount;       ///< The number of calls made to this IAdder object
  int32  lastCall;        ///< The last call made to this IAdder object
  uint32 lastResult;      ///< The last addition result
  uint32 resultSaturated; ///< Whether the last result was saturated or not
  uint32 overflowFlag;    ///< Whether the previous operation overflowed or not
};

interface IAdder
{
  /** @endcond */

  /**
   * @addtogroup IAdder
   * @{
   */

  /** @cond */

  /* Mink IDL doesn't support bools, so we define two true/false constants
   * for addition overflow. */
  const uint32 OVERFLOW_TRUE = 1;
  const uint32 OVERFLOW_FALSE = 0;

  /** @endcond */

  /**
      Add two integers and return the result to the CA.

      @param[in]  int1    first number to add
      @param[in]  int2    second number to add
      @param[out] result  addition result

      @return
      Object_OK on success.
  */

  method add(in uint32 val1, in int32 val2, out uint32 result);

  /**
    Add an array of integers and return result to the caller.

    @param[in]  intArray   an array of int32_ts
    @param[out] result     addition result

    @return
    Object_OK on success.
  */

  method addArray(in uint32[] intArray, out uint32 result);

  /**
    Sum the contents of a struct and give the result back to the CA.

    @param[in]  inStruct   a struct containing two int32_ts to add
    @param[out] result     addition result

    @return
    Object_OK on success.
   */

  method addStruct(in additionStruct inStruct, out uint32 result);

  /**
    Return the IAdder object's current status to the caller.

    @param[out] status  a struct containing information about the current
                        status of the IAdder object.

    @return
    Object_OK on success.
   */

  method getStatus(out statusStruct status);


  /* @} */ /* end_addtogroup IAdder */
};
