interp.h File Reference
#include "pico.h"
#include "hardware/structs/interp.h"
#include "hardware/regs/sio.h"
Include dependency graph for interp.h:

Go to the source code of this file.

Data Structures

struct  interp_config
 
struct  interp_hw_save_t
 

Macros

#define PARAM_ASSERTIONS_ENABLED_INTERP   0
 
#define interp0   interp0_hw
 
#define interp1   interp1_hw
 
#define interp_lane_claim   interp_claim_lane
 
#define interp_lane_unclaim   interp_unclaim_lane
 

Functions

static uint interp_index (interp_hw_t *interp)
 
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_config_set_shift (interp_config *c, uint shift)
 Set the interpolator shift valueSets the number of bits the accumulator is shifted before masking, on each iteration. More...
 
static void interp_config_set_mask (interp_config *c, uint mask_lsb, uint mask_msb)
 Set the interpolator mask rangeSets the range of bits (least to most) that are allowed to pass through the interpolator. More...
 
static void interp_config_set_cross_input (interp_config *c, bool cross_input)
 Enable cross inputAllows feeding of the accumulator content from the other lane back in to this lanes shift+mask hardware. This will take effect even if the interp_config_set_add_raw option is set as the cross input mux is before the shift+mask bypass. More...
 
static void interp_config_set_cross_result (interp_config *c, bool cross_result)
 Enable cross resultsAllows feeding of the other lane’s result into this lane’s accumulator on a POP operation. More...
 
static void interp_config_set_signed (interp_config *c, bool _signed)
 Set sign extensionEnables signed mode, where the shifted and masked accumulator value is sign-extended to 32 bits before adding to BASE1, and LANE1 PEEK/POP results appear extended to 32 bits when read by processor. More...
 
static void interp_config_set_add_raw (interp_config *c, bool add_raw)
 Set raw add optionWhen enabled, mask + shift is bypassed for LANE0 result. This does not affect the FULL result. More...
 
static void interp_config_set_blend (interp_config *c, bool blend)
 Set blend modeIf enabled, LANE1 result is a linear interpolation between BASE0 and BASE1, controlled by the 8 LSBs of lane 1 shift and mask value (a fractional number between 0 and 255/256ths) More...
 
static void interp_config_set_clamp (interp_config *c, bool clamp)
 Set interpolator clamp mode (Interpolator 1 only)Only present on INTERP1 on each core. If CLAMP mode is enabled: More...
 
static void interp_config_set_force_bits (interp_config *c, uint bits)
 Set interpolator Force bitsORed into bits 29:28 of the lane result presented to the processor on the bus. More...
 
static interp_config interp_default_config (void)
 Get a default configuration. More...
 
static void interp_set_config (interp_hw_t *interp, uint lane, interp_config *config)
 Send configuration to a laneIf an invalid configuration is specified (ie a lane specific item is set on wrong lane), depending on setup this function can panic. 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...