> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs-staging.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AR Osal Signal2

> Defines public APIs for signal2 used by DSP.

**Header:** `ar_osal/api/ar_osal_signal2.h`

## Functions

### `ar_osal_signal2_init`

Initializes a signal2 object.

Signal returns the initialized object. The signal object is initially cleared. signal object memory is allocated by the client.

@datatypes ar\_osal\_signal2\_t

```cpp theme={null}
int32_t ar_osal_signal2_init(ar_osal_signal2_t signal2)
```

**Parameters**

<ParamField path="signal2" type="ar_osal_signal2_t">
  Pointer to the initialized object.
</ParamField>

**Returns**

0  Success Nonzero  Failure

### `ar_osal_signal2_deinit`

De-initializes signal2 object.

@datatypes ar\_osal\_signal2\_t

```cpp theme={null}
int32_t ar_osal_signal2_deinit(ar_osal_signal2_t signal2)
```

**Parameters**

<ParamField path="signal2" type="ar_osal_signal2_t">
  Pointer to the initialized object.
</ParamField>

**Returns**

0  Success Nonzero  Failure

### `ar_osal_signal2_get_size`

Get signal object size for object memory allocation by client.

@datatypes ar\_osal\_signal2\_t

```cpp theme={null}
size_t ar_osal_signal2_get_size(void)
```

**Returns**

Size of signal object

### `ar_osal_signal2_create`

Signal object memory is allocated and initialized by this API.

osal\_signal2\_create() or osal\_signal2\_init() would be used, but not both.

@datatypes ar\_osal\_signal2\_t

```cpp theme={null}
int32_t ar_osal_signal2_create(ar_osal_signal2_t *signal2)
```

**Parameters**

<ParamField path="[Out]" type="">
  signal2: Pointer to the initialized object.
</ParamField>

**Returns**

0  Success Nonzero  Failure

### `ar_osal_signal2_destroy`

Destroys the specified signal object.

@note1cont Signal objects must not be destroyed while they are still in use. If this happens the behavior is undefined. @note1cont In general, application code should "destroy" a signal2 object prior to deallocating it; calling osal\_signal2\_destroy() before deallocating it ensures that all osal\_signal2\_set() calls have completed.

@datatypes ar\_osal\_signal2\_t

```cpp theme={null}
int32_t ar_osal_signal2_destroy(ar_osal_signal2_t signal2)
```

**Parameters**

<ParamField path="signal2" type="ar_osal_signal2_t">
  Pointer to the signal object to destroy.
</ParamField>

**Returns**

0  Success Nonzero  Failure

### `ar_osal_signal2_wait_any`

Suspends the current thread until any of the specified signals are set.

Signals are represented as bits 0-31 in the 32-bit mask value. A mask bit value of 1 indicates that a signal is to be waited on, and 0 that it is not to be waited on.

If a thread is waiting on a signal object for any of the specified set of signals to be set, and one or more of those signals is set in the signal object, then the thread is awakened.

At most one thread can wait on a signal object at any given time.

Signals must be explicitly cleared by a thread when it is awakened the wait operations do not automatically clear them.

@datatypes ar\_osal\_signal2\_t

```cpp theme={null}
uint32_t ar_osal_signal2_wait_any(ar_osal_signal2_t signal2, uint32_t signal2_mask)
```

**Parameters**

<ParamField path="signal2" type="ar_osal_signal2_t">
  Pointer to the signal object to wait on.
</ParamField>

<ParamField path="signal2_mask" type="uint32_t">
  Mask value identifying the individual signals in the signal object to be waited on.
</ParamField>

**Returns**

A 32 bit word with current signals.

### `ar_osal_signal2_wait_all`

Suspends the current thread until all of the specified signals are set.

Signals are represented as bits 0-31 in the 32-bit mask value. A mask bit value of 1 indicates that a signal is to be waited on, and 0 that it is not to be waited on.

If a thread is waiting on a signal object for all of the specified set of signals to be set, and all of those signals are set in the signal object, then the thread is awakened.

At most one thread can wait on a signal object at any given time.

Signals must be explicitly cleared by a thread when it is awakened the wait operations do not automatically clear them.

@datatypes ar\_osal\_signal2\_t

```cpp theme={null}
uint32_t ar_osal_signal2_wait_all(ar_osal_signal2_t signal2, uint32_t signal2_mask)
```

**Parameters**

<ParamField path="signal2" type="ar_osal_signal2_t">
  Pointer to the signal object to wait on.
</ParamField>

<ParamField path="signal2_mask" type="uint32_t">
  Mask value which identifies the individual signals in the signal object to be waited on.
</ParamField>

**Returns**

A 32 bit word with current signals.

### `ar_osal_signal2_set`

Sets signals in the specified signal object.

Signals are represented as bits 0-31 in the 32-bit mask value. A mask bit value of 1 indicates that a signal is to be set, and 0 that it is not to be set.

@datatypes ar\_osal\_signal2\_t

```cpp theme={null}
int32_t ar_osal_signal2_set(ar_osal_signal2_t signal2, uint32_t signal2_mask)
```

**Parameters**

<ParamField path="signal2" type="ar_osal_signal2_t">
  Pointer to the signal object to be modified.
</ParamField>

<ParamField path="signal2_mask" type="uint32_t">
  Mask value identifying the individual signals to be set in the signal object.
</ParamField>

**Returns**

0  Success Nonzero  Failure

### `ar_osal_signal2_get`

Gets a signal from a signal object.

Returns the current signal values of the specified signal object.

@datatypes ar\_osal\_signal2\_t

```cpp theme={null}
uint32_t ar_osal_signal2_get(ar_osal_signal2_t signal2)
```

**Parameters**

<ParamField path="signal2" type="ar_osal_signal2_t">
  Pointer to the signal object to access.
</ParamField>

**Returns**

A 32 bit word with current signals

### `ar_osal_signal2_clear`

Clear signals in the specified signal object.

Signals are represented as bits 0-31 in the 32-bit signal2\_mask value. A signal2\_mask bit value of 1 indicates that a signal is to be cleared, and 0 that it is not to be cleared.

Signals must be explicitly cleared by a thread when it is awakened the wait operations do not automatically clear them.

@datatypes ar\_osal\_signal2\_t

```cpp theme={null}
int32_t ar_osal_signal2_clear(ar_osal_signal2_t signal2, uint32_t signal2_mask)
```

**Parameters**

<ParamField path="signal" type="">
  Pointer to the signal object to modify.
</ParamField>

<ParamField path="signal2_mask" type="uint32_t">
  signal2\_mask value identifying the individual signals to be cleared in the signal object.
</ParamField>

**Returns**

0  Success Nonzero  Failure
