@web-font-path: "roboto-debian.css";
v2.2.0 (RP2040)
Loading...
Searching...
No Matches
hardware_interp

Hardware Interpolator API. More...

## Topics

| interp_config
| Interpolator configuration.

## Functions

void | interp_claim_lane (interp_hw_t *interp, uint lane)
| Claim the interpolator lane specified.
void | interp_claim_lane_mask (interp_hw_t *interp, uint lane_mask)
| Claim the interpolator lanes specified in the mask.
void | interp_unclaim_lane (interp_hw_t *interp, uint lane)
| Release a previously claimed interpolator lane.
bool | interp_lane_is_claimed (interp_hw_t *interp, uint lane)
| Determine if an interpolator lane is claimed.
void | interp_unclaim_lane_mask (interp_hw_t *interp, uint lane_mask)
| Release previously claimed interpolator lanes, see interp_claim_lane_mask.
static void | interp_set_force_bits (interp_hw_t *interp, uint lane, uint bits)
| Directly set the force bits on a specified lane.
void | interp_save (interp_hw_t *interp, interp_hw_save_t *saver)
| Save the specified interpolator state.
void | interp_restore (interp_hw_t *interp, interp_hw_save_t *saver)
| Restore an interpolator state.
static void | interp_set_base (interp_hw_t *interp, uint lane, uint32_t val)
| Sets the interpolator base register by lane.
static uint32_t | interp_get_base (interp_hw_t *interp, uint lane)
| Gets the content of interpolator base register by lane.
static void | interp_set_base_both (interp_hw_t *interp, uint32_t val)
| Sets the interpolator base registers simultaneously.
static void | interp_set_accumulator (interp_hw_t *interp, uint lane, uint32_t val)
| Sets the interpolator accumulator register by lane.
static uint32_t | interp_get_accumulator (interp_hw_t *interp, uint lane)
| Gets the content of the interpolator accumulator register by lane.
static uint32_t | interp_pop_lane_result (interp_hw_t *interp, uint lane)
| Read lane result, and write lane results to both accumulators to update the interpolator.
static uint32_t | interp_peek_lane_result (interp_hw_t *interp, uint lane)
| Read lane result.
static uint32_t | interp_pop_full_result (interp_hw_t *interp)
| Read lane result, and write lane results to both accumulators to update the interpolator.
static uint32_t | interp_peek_full_result (interp_hw_t *interp)
| Read lane result.
static void | interp_add_accumulator (interp_hw_t *interp, uint lane, uint32_t val)
| Add to accumulator.
static uint32_t | interp_get_raw (interp_hw_t *interp, uint lane)
| Get raw lane value.

## Detailed Description

Hardware Interpolator API.

Each core is equipped with two interpolators (INTERP0 and INTERP1) which can be used to accelerate tasks by combining certain pre-configured simple operations into a single processor cycle. Intended for cases where the pre-configured operation is repeated a large number of times, this results in code which uses both fewer CPU cycles and fewer CPU registers in the time critical sections of the code.

The interpolators are used heavily to accelerate audio operations within the SDK, but their flexible configuration make it possible to optimise many other tasks such as quantization and dithering, table lookup address generation, affine texture mapping, decompression and linear feedback.

Please refer to the appropriate RP-series microcontroller datasheet for more information on the HW interpolators and how they work.

## Function Documentation

## interp_add_accumulator()

void interp_add_accumulator | ( | interp_hw_t * | interp,
|  | uint | lane,
|  | uint32_t | val )

inline static

Add to accumulator.

Atomically add the specified value to the accumulator on the specified lane

Parameters

  interp | Interpolator instance, interp0 or interp1.
  lane | The lane number, 0 or 1
  val | Value to add

## interp_claim_lane()

void interp_claim_lane | ( | interp_hw_t * | interp,
|  | uint | lane )

Claim the interpolator lane specified.

Use this function to claim exclusive access to the specified interpolator lane.

This function will panic if the lane is already claimed.

Parameters

  interp | Interpolator on which to claim a lane. interp0 or interp1
  lane | The lane number, 0 or 1.

## interp_claim_lane_mask()

void interp_claim_lane_mask | ( | interp_hw_t * | interp,
|  | uint | lane_mask )

Claim the interpolator lanes specified in the mask.

Parameters

  interp | Interpolator on which to claim lanes. interp0 or interp1
  lane_mask | Bit pattern of lanes to claim (only bits 0 and 1 are valid)

## interp_get_accumulator()

uint32_t interp_get_accumulator | ( | interp_hw_t * | interp,
|  | uint | lane )

inline static

Gets the content of the interpolator accumulator register by lane.

Parameters

  interp | Interpolator instance, interp0 or interp1.
  lane | The lane number, 0 or 1

Returns
  The current content of the register

## interp_get_base()

uint32_t interp_get_base | ( | interp_hw_t * | interp,
|  | uint | lane )

inline static

Gets the content of interpolator base register by lane.

Parameters

  interp | Interpolator instance, interp0 or interp1.
  lane | The lane number, 0 or 1 or 2

Returns
  The current content of the lane base register

## interp_get_raw()

uint32_t interp_get_raw | ( | interp_hw_t * | interp,
|  | uint | lane )

inline static

Get raw lane value.

Returns the raw shift and mask value from the specified lane, BASE0 is NOT added

Parameters

  interp | Interpolator instance, interp0 or interp1.
  lane | The lane number, 0 or 1

Returns
  The raw shift/mask value

## interp_lane_is_claimed()

bool interp_lane_is_claimed | ( | interp_hw_t * | interp,
|  | uint | lane )

Determine if an interpolator lane is claimed.

Parameters

  interp | Interpolator whose lane to check
  lane | The lane number, 0 or 1

Returns
  true if claimed, false otherwise

See also
  interp_claim_lane
  interp_claim_lane_mask

## interp_peek_full_result()

uint32_t interp_peek_full_result | ( | interp_hw_t * | interp | ) |

inline static

Read lane result.

Parameters

  interp | Interpolator instance, interp0 or interp1.

Returns
  The content of the FULL register

## interp_peek_lane_result()

uint32_t interp_peek_lane_result | ( | interp_hw_t * | interp,
|  | uint | lane )

inline static

Read lane result.

Parameters

  interp | Interpolator instance, interp0 or interp1.
  lane | The lane number, 0 or 1

Returns
  The content of the lane result register

## interp_pop_full_result()

uint32_t interp_pop_full_result | ( | interp_hw_t * | interp | ) |

inline static

Read lane result, and write lane results to both accumulators to update the interpolator.

Parameters

  interp | Interpolator instance, interp0 or interp1.

Returns
  The content of the FULL register

## interp_pop_lane_result()

uint32_t interp_pop_lane_result | ( | interp_hw_t * | interp,
|  | uint | lane )

inline static

Read lane result, and write lane results to both accumulators to update the interpolator.

Parameters

  interp | Interpolator instance, interp0 or interp1.
  lane | The lane number, 0 or 1

Returns
  The content of the lane result register

## interp_restore()

void interp_restore | ( | interp_hw_t * | interp,
|  | interp_hw_save_t * | saver )

Restore an interpolator state.

Parameters

  interp | Interpolator instance, interp0 or interp1.
  saver | Pointer to save structure to reapply to the specified interpolator

## interp_save()

void interp_save | ( | interp_hw_t * | interp,
|  | interp_hw_save_t * | saver )

Save the specified interpolator state.

Can be used to save state if you need an interpolator for another purpose, state can then be recovered afterwards and continue from that point

Parameters

  interp | Interpolator instance, interp0 or interp1.
  saver | Pointer to the save structure to fill in

## interp_set_accumulator()

void interp_set_accumulator | ( | interp_hw_t * | interp,
|  | uint | lane,
|  | uint32_t | val )

inline static

Sets the interpolator accumulator register by lane.

Parameters

  interp | Interpolator instance, interp0 or interp1.
  lane | The lane number, 0 or 1
  val | The value to apply to the register

## interp_set_base()

void interp_set_base | ( | interp_hw_t * | interp,
|  | uint | lane,
|  | uint32_t | val )

inline static

Sets the interpolator base register by lane.

Parameters

  interp | Interpolator instance, interp0 or interp1.
  lane | The lane number, 0 or 1 or 2
  val | The value to apply to the register

## interp_set_base_both()

void interp_set_base_both | ( | interp_hw_t * | interp,
|  | uint32_t | val )

inline static

Sets the interpolator base registers simultaneously.

The lower 16 bits go to BASE0, upper bits to BASE1 simultaneously. Each half is sign-extended to 32 bits if that lane’s SIGNED flag is set.

Parameters

  interp | Interpolator instance, interp0 or interp1.
  val | The value to apply to the register

## interp_set_force_bits()

void interp_set_force_bits | ( | interp_hw_t * | interp,
|  | uint | lane,
|  | uint | bits )

inline static

Directly set the force bits on a specified lane.

These bits are ORed into bits 29:28 of the lane result presented to the processor on the bus. There is no effect on the internal 32-bit datapath.

Useful for using a lane to generate sequence of pointers into flash or SRAM, saving a subsequent OR or add operation.

Parameters

  interp | Interpolator instance, interp0 or interp1.
  lane | The lane to set
  bits | The bits to set (bits 0 and 1, value range 0-3)

## interp_unclaim_lane()

void interp_unclaim_lane | ( | interp_hw_t * | interp,
|  | uint | lane )

Release a previously claimed interpolator lane.

Parameters

  interp | Interpolator on which to release a lane. interp0 or interp1
  lane | The lane number, 0 or 1

## interp_unclaim_lane_mask()

void interp_unclaim_lane_mask | ( | interp_hw_t * | interp,
|  | uint | lane_mask )

Release previously claimed interpolator lanes, see interp_claim_lane_mask.

Parameters

  interp | Interpolator on which to release lanes. interp0 or interp1
  lane_mask | Bit pattern of lanes to unclaim (only bits 0 and 1 are valid)