#include "AEEStdDef.idl"

interface halide_hexagon_remote
{
    typedef sequence<octet> buffer;
    typedef unsigned long handle_t;
    typedef unsigned long long scalar_t;

    // Routine to initialize a module on the remote side. Returns a pointer to the module.
    long load_library(in sequence<char> soname, in buffer code, rout handle_t module_ptr);

    // Get a symbol from the module.
    // v2: return the result as an output parameter instead of a return value.
    long get_symbol_v4(in handle_t module_ptr, in sequence<char> name, rout handle_t sym_ptr);

    // If running many short-running pipelines will be executed, the
    // penalty for powering on HVX can be avoided by doing this
    // explicitly around a collection of pipeline invocations.
    long power_hvx_on();
    long power_hvx_off();

    // Routine to run a pipeline on the remote side.
    // v2: Pass all scalars in a single buffer as an array of scalar_t.
    long run_v2(in handle_t module_ptr, in handle_t symbol,
                in sequence<buffer> input_buffers,
                rout sequence<buffer> output_buffers,
                in sequence<scalar_t> scalars);

    // Routine to clean up a module on the remote side.
    long release_library(in handle_t module_ptr);

    // Retrive messages written by log_printf.
    long poll_log(rout sequence<char> log, rout long read_size);

    // Retrieve the current profiling Func ID
    long poll_profiler_state(rout long func, rout long threads);
    // Set the current_func being profiled
    long profiler_set_current_func(in long current_func);

    // Set a performance target.
    long set_performance_mode(in long mode);
    long set_performance(in long set_mips,
                         in unsigned long mipsPerThread,
                         in unsigned long mipsTotal,
                         in long set_bus_bw,
                         in unsigned long bwMegabytesPerSec,
                         in unsigned long busbwUsagePercentage,
                         in long set_latency,
                         in long latency);

    // Set thread priority
    long set_thread_priority(in long priority);
};
