- interp_ fixes (#428)

* - fix interp_claim_lane (in case of interp1 and lane==1 bit was 0b11 instead of 0b1000)
- added missing function interp_unclaim_lane_mask

* - interp_hw_save_t are not I/O registers
This commit is contained in:
Rene 2021-05-24 23:56:11 +02:00 committed by GitHub
parent b8dc054eba
commit 2eb76bb058
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 6 deletions

View File

@ -87,6 +87,14 @@ void interp_claim_lane_mask(interp_hw_t *interp, uint lane_mask);
*/
void interp_unclaim_lane(interp_hw_t *interp, uint lane);
/*! \brief Release previously claimed interpolator lanes \see interp_claim_lane_mask
* \ingroup hardware_interp
*
* \param interp Interpolator on which to release lanes. interp0 or interp1
* \param lane_mask Bit pattern of lanes to unclaim (only bits 0 and 1 are valid)
*/
void interp_unclaim_lane_mask(interp_hw_t *interp, uint lane_mask);
/*! \brief Set the interpolator shift value
* \ingroup interp_config
*
@ -277,9 +285,9 @@ static inline void interp_set_force_bits(interp_hw_t *interp, uint lane, uint bi
}
typedef struct {
io_rw_32 accum[2];
io_rw_32 base[3];
io_rw_32 ctrl[2];
uint32_t accum[2];
uint32_t base[3];
uint32_t ctrl[2];
} interp_hw_save_t;
/*! \brief Save the specified interpolator state

View File

@ -16,9 +16,13 @@ static_assert(NUM_DMA_CHANNELS <= 16, "");
static uint8_t _claimed;
static inline uint interp_get_bit(interp_hw_t *interp, uint lane) {
return 1u << ((interp_index(interp) << 1u) | lane);
}
void interp_claim_lane(interp_hw_t *interp, uint lane) {
valid_params_if(INTERP, lane < 2);
uint bit = (interp_index(interp) << 1u) | lane;
uint bit = interp_get_bit(interp, lane);
hw_claim_or_assert((uint8_t *) &_claimed, bit, "Lane is already claimed");
}
@ -30,8 +34,14 @@ void interp_claim_lane_mask(interp_hw_t *interp, uint lane_mask) {
void interp_unclaim_lane(interp_hw_t *interp, uint lane) {
valid_params_if(INTERP, lane < 2);
uint bit = (interp_index(interp) << 1u) | lane;
hw_claim_clear((uint8_t *) &_claimed, bit);
uint bit = interp_get_bit(interp, lane);
hw_claim_clear(&_claimed, bit);
}
void interp_unclaim_lane_mask(interp_hw_t *interp, uint lane_mask) {
valid_params_if(INTERP, lane_mask && lane_mask <= 0x3);
if (lane_mask & 1u) interp_unclaim_lane(interp, 0);
if (lane_mask & 2u) interp_unclaim_lane(interp, 1);
}
void interp_save(interp_hw_t *interp, interp_hw_save_t *saver) {