File QnnSignal.h

Parent directory (include/QNN)

Signal component API.

Definition (include/QNN/QnnSignal.h)

Detailed Description

Requires Backend to be initialized. Provides means to manage Signal objects. Signal objects are used to control execution of other components.

Includes

Included By

Full File Listing

Signal component API.

    Requires Backend to be initialized.
    Provides means to manage Signal objects.
    Signal objects are used to control execution of other components.

Defines

QNN_SIGNAL_CONFIG_INIT   {                                         \     QNN_SIGNAL_CONFIG_UNDEFINED

, /*option*/ \

{                                       \

NULL /*customConfig*/                 \

}                                       \

}


QnnSignal_Config_t initializer macro.

Typedefs

typedef void *QnnSignal_CustomConfig_t

Custom configuration for Signal object.

Please refer to documentation provided by the backend for usage information

Enums

enum QnnSignal_Error_t

QNN Signal API result / error codes.

Values:

enumerator QNN_SIGNAL_MIN_ERROR = 9000
enumerator QNN_SIGNAL_NO_ERROR = 0
enumerator QNN_SIGNAL_ERROR_UNSUPPORTED = QNN_COMMON_ERROR_NOT_SUPPORTED

Backend does not support the requested functionality.

enumerator QNN_SIGNAL_ERROR_SIGNAL_IN_USE = 9000 + 0

Attempt to reconfigure, free, or supply to a second QNN function call a signal object that is already in use.

enumerator QNN_SIGNAL_ERROR_SIGNAL_IDLE = 9000 + 1

Signal object is idle and not being used by an outstanding function call.

enumerator QNN_SIGNAL_ERROR_INVALID_ARGUMENT = 9000 + 2

Invalid configuration error.

enumerator QNN_SIGNAL_ERROR_INVALID_HANDLE = 9000 + 3

NULL or unrecognized signal handle error.

enumerator QNN_SIGNAL_ERROR_TIMEOUT = 9000 + 4

Timeout error.

enumerator QNN_SIGNAL_ERROR_INCOMPATIBLE_SIGNAL_TYPE = 9000 + 5

API supplied with incompatible signal type.

enumerator QNN_SIGNAL_ERROR_MEM_ALLOC = QNN_COMMON_ERROR_MEM_ALLOC
enumerator QNN_SIGNAL_MAX_ERROR = 9999
enumerator QNN_SIGNAL_ERROR_UNDEFINED = 0x7FFFFFFF
enum QnnSignal_ConfigOption_t

This enum defines signal config options.

Values:

enumerator QNN_SIGNAL_CONFIG_OPTION_CUSTOM = 0

Sets signal custom options via QnnSignal_CustomConfig_t.

enumerator QNN_SIGNAL_CONFIG_OPTION_ABORT = 1

Sets abort on API calls invoked with a signal object. Abort and Timeout signals are mutually exclusive and cannot be used together.

enumerator QNN_SIGNAL_CONFIG_OPTION_TIMEOUT = 2

Sets timeout interval on API calls invoked with a signal object. Timeout and Abort signals are mutually exclusive and cannot be used together.

enumerator QNN_SIGNAL_CONFIG_UNDEFINED = 0x7FFFFFFF

Functions

Qnn_ErrorHandle_t QnnSignal_create(Qnn_BackendHandle_t backend, const QnnSignal_Config_t **config, Qnn_SignalHandle_t *signal)

Create a new signal object. The object will be configured with desired behavior and is idle and available for usage.

Parameters
  • backend[in] A backend handle

  • config[in] Pointer to a NULL terminated array of config option pointers. NULL is allowed, indicates no config options are provided, and signal will not be configured to do anything. All config options have default value, in case not provided. If same config option type is provided multiple times, the last option value will be used.

  • signal[out] Handle to newly created signal object.

Returns

Error code:

  • QNN_SUCCESS: if the signal is created successfully

  • QNN_SIGNAL_ERROR_INVALID_ARGUMENT: at least one argument or config option invalid

  • QNN_SIGNAL_ERROR_INVALID_HANDLE: backend is not a valid handle

  • QNN_SIGNAL_ERROR_UNSUPPORTED: if QnnSignal API is not supported on the backend

  • QNN_COMMON_ERROR_SYSTEM_COMMUNICATION: SSR occurence (successful recovery)

  • QNN_COMMON_ERROR_SYSTEM_COMMUNICATION_FATAL: SSR occurence (unsuccessful recovery)

Qnn_ErrorHandle_t QnnSignal_setConfig(Qnn_SignalHandle_t signal, const QnnSignal_Config_t **config)

Set/change a configuration on an existing signal.

Parameters
  • signal[in] Signal object whose configuration needs to be set

  • config[in] Pointer to a NULL terminated array of config option pointers. NULL is allowed and may be used to reset any previously set configuration. No default values are assumed for config options that are not set. If same config option type is provided multiple times, the last option value will be used. If a backend cannot support all provided configs it will fail.

Returns

Error Code:

  • QNN_SUCCESS: if the config is set successfully

  • QNN_SIGNAL_ERROR_INVALID_HANDLE: signal handle is null or invalid

  • QNN_SIGNAL_ERROR_INVALID_ARGUMENT: one or more config values is invalid

  • QNN_SIGNAL_ERROR_SIGNAL_IN_USE: when attempting to reconfigure a signal that is active and in-use.

  • QNN_SIGNAL_ERROR_UNSUPPORTED: if QnnSignal API is not supported on the backend

Qnn_ErrorHandle_t QnnSignal_trigger(Qnn_SignalHandle_t signal)

Triggers the signal action during the associated API call. For abort config signals, it causes the associated API call to gracefully cease execution at the earliest opportunity. This function will block until the targeted call has released associated resources and is ready to return in it’s own calling context. When the associated API call is initiated, the signal object will be in-use and not available to another call. When the associated API call returns, the associated signal object will be available and can safely be passed to another call.

Parameters

signal[in] Signal handle used by the associated API call

Returns

Error code:

  • QNN_SUCCESS: if the trigger is successful.

  • QNN_SIGNAL_ERROR_INVALID_HANDLE: signal handle is null or invalid

  • QNN_SIGNAL_ERROR_INCOMPATIBLE_SIGNAL_TYPE: API does not support the signal type

  • QNN_SIGNAL_ERROR_TRIGGER_SIGNAL_IDLE: if the signal is not currently in-use, and hence can not be triggered.

  • QNN_SIGNAL_ERROR_UNSUPPORTED: if QnnSignal API is not supported on the backend

  • QNN_COMMON_ERROR_SYSTEM_COMMUNICATION: SSR occurence (successful recovery)

  • QNN_COMMON_ERROR_SYSTEM_COMMUNICATION_FATAL: SSR occurence (unsuccessful recovery)

Qnn_ErrorHandle_t QnnSignal_free(Qnn_SignalHandle_t signal)

Free memory and resources associated with an available signal object.

Parameters

signal[in] The signal object to free.

Returns

Error code:

  • QNN_SUCCESS: if the signal object is successfully freed

  • QNN_SIGNAL_ERROR_INVALID_HANDLE: signal handle is null or invalid

  • QNN_SIGNAL_ERROR_SIGNAL_IN_USE: if the signal object is currently in-use

  • QNN_SIGNAL_ERROR_MEM_ALLOC: an error is encountered with de-allocation of associated memory

  • QNN_SIGNAL_ERROR_UNSUPPORTED: if QnnSignal API is not supported on the backend

struct QnnSignal_Config_t
#include <QnnSignal.h>

This struct provides signal configuration.

Public Members

QnnSignal_ConfigOption_t option

Type of config object used to configure the signal.

union unnamed
#include <QnnSignal.h>

Union of mutually exclusive config values based on the type specified by ‘option’.

Public Members

QnnSignal_CustomConfig_t customConfig
uint64_t timeoutDurationUs

Timeout interval is represented in microseconds. Tolerance for the Timeout is platform dependent and cannot be guaranteed.