Modules | |
interp_config | |
Interpolator configurationEach interpolator needs to be configured, these functions provide handy helpers to set up configuration structures. | |
Functions | |
void | interp_claim_lane (interp_hw_t *interp, uint lane) |
Claim the interpolator lane specifiedUse this function to claim exclusive access to the specified interpolator lane. More... | |
void | interp_claim_lane_mask (interp_hw_t *interp, uint lane_mask) |
Claim the interpolator lanes specified in the mask. More... | |
void | interp_unclaim_lane (interp_hw_t *interp, uint lane) |
Release a previously claimed interpolator lane. More... | |
bool | interp_lane_is_claimed (interp_hw_t *interp, uint lane) |
Determine if an interpolator lane is claimed. More... | |
void | interp_unclaim_lane_mask (interp_hw_t *interp, uint lane_mask) |
Release previously claimed interpolator lanes. More... | |
static void | interp_set_force_bits (interp_hw_t *interp, uint lane, uint bits) |
Directly set the force bits on a specified laneThese 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. More... | |
void | interp_save (interp_hw_t *interp, interp_hw_save_t *saver) |
Save the specified interpolator stateCan be used to save state if you need an interpolator for another purpose, state can then be recovered afterwards and continue from that point. More... | |
void | interp_restore (interp_hw_t *interp, interp_hw_save_t *saver) |
Restore an interpolator state. More... | |
static void | interp_set_base (interp_hw_t *interp, uint lane, uint32_t val) |
Sets the interpolator base register by lane. More... | |
static uint32_t | interp_get_base (interp_hw_t *interp, uint lane) |
Gets the content of interpolator base register by lane. More... | |
static void | interp_set_base_both (interp_hw_t *interp, uint32_t val) |
Sets the interpolator base registers simultaneouslyThe 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. More... | |
static void | interp_set_accumulator (interp_hw_t *interp, uint lane, uint32_t val) |
Sets the interpolator accumulator register by lane. More... | |
static uint32_t | interp_get_accumulator (interp_hw_t *interp, uint lane) |
Gets the content of the interpolator accumulator register by lane. More... | |
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. More... | |
static uint32_t | interp_peek_lane_result (interp_hw_t *interp, uint lane) |
Read lane result. More... | |
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. More... | |
static uint32_t | interp_peek_full_result (interp_hw_t *interp) |
Read lane result. More... | |
static void | interp_add_accumulater (interp_hw_t *interp, uint lane, uint32_t val) |
Add to accumulatorAtomically add the specified value to the accumulator on the specified lane. More... | |
static uint32_t | interp_get_raw (interp_hw_t *interp, uint lane) |
Get raw lane valueReturns the raw shift and mask value from the specified lane, BASE0 is NOT added. More... | |
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 RP2040 datasheet for more information on the HW interpolators and how they work.
|
inlinestatic |
Add to accumulatorAtomically add the specified value to the accumulator on the specified lane.
interp | Interpolator instance, interp0 or interp1. |
lane | The lane number, 0 or 1 |
val | Value to add |
void interp_claim_lane | ( | interp_hw_t * | interp, |
uint | lane | ||
) |
Claim the interpolator lane specifiedUse this function to claim exclusive access to the specified interpolator lane.
This function will panic if the lane is already claimed.
interp | Interpolator on which to claim a lane. interp0 or interp1 |
lane | The lane number, 0 or 1. |
void interp_claim_lane_mask | ( | interp_hw_t * | interp, |
uint | lane_mask | ||
) |
Claim the interpolator lanes specified in the mask.
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) |
|
inlinestatic |
Gets the content of the interpolator accumulator register by lane.
interp | Interpolator instance, interp0 or interp1. |
lane | The lane number, 0 or 1 |
|
inlinestatic |
Gets the content of interpolator base register by lane.
interp | Interpolator instance, interp0 or interp1. |
lane | The lane number, 0 or 1 or 2 |
|
inlinestatic |
Get raw lane valueReturns the raw shift and mask value from the specified lane, BASE0 is NOT added.
interp | Interpolator instance, interp0 or interp1. |
lane | The lane number, 0 or 1 |
bool interp_lane_is_claimed | ( | interp_hw_t * | interp, |
uint | lane | ||
) |
Determine if an interpolator lane is claimed.
interp | Interpolator whose lane to check |
lane | The lane number, 0 or 1 |
|
inlinestatic |
Read lane result.
interp | Interpolator instance, interp0 or interp1. |
|
inlinestatic |
Read lane result.
interp | Interpolator instance, interp0 or interp1. |
lane | The lane number, 0 or 1 |
|
inlinestatic |
Read lane result, and write lane results to both accumulators to update the interpolator.
interp | Interpolator instance, interp0 or interp1. |
|
inlinestatic |
Read lane result, and write lane results to both accumulators to update the interpolator.
interp | Interpolator instance, interp0 or interp1. |
lane | The lane number, 0 or 1 |
void interp_restore | ( | interp_hw_t * | interp, |
interp_hw_save_t * | saver | ||
) |
Restore an interpolator state.
interp | Interpolator instance, interp0 or interp1. |
saver | Pointer to save structure to reapply to the specified interpolator |
void interp_save | ( | interp_hw_t * | interp, |
interp_hw_save_t * | saver | ||
) |
Save the specified interpolator stateCan be used to save state if you need an interpolator for another purpose, state can then be recovered afterwards and continue from that point.
interp | Interpolator instance, interp0 or interp1. |
saver | Pointer to the save structure to fill in |
|
inlinestatic |
Sets the interpolator accumulator register by lane.
interp | Interpolator instance, interp0 or interp1. |
lane | The lane number, 0 or 1 |
val | The value to apply to the register |
|
inlinestatic |
Sets the interpolator base register by lane.
interp | Interpolator instance, interp0 or interp1. |
lane | The lane number, 0 or 1 or 2 |
val | The value to apply to the register |
|
inlinestatic |
Sets the interpolator base registers simultaneouslyThe 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.
interp | Interpolator instance, interp0 or interp1. |
val | The value to apply to the register |
|
inlinestatic |
Directly set the force bits on a specified laneThese 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.
interp | Interpolator instance, interp0 or interp1. |
lane | The lane to set |
bits | The bits to set (bits 0 and 1, value range 0-3) |
void interp_unclaim_lane | ( | interp_hw_t * | interp, |
uint | lane | ||
) |
Release a previously claimed interpolator lane.
interp | Interpolator on which to release a lane. interp0 or interp1 |
lane | The lane number, 0 or 1 |
void interp_unclaim_lane_mask | ( | interp_hw_t * | interp, |
uint | lane_mask | ||
) |
Release previously claimed interpolator lanes.
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) |