Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: irqsteer: adjust CHn_MASK index computation #394

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions mcux/mcux-sdk/drivers/irqsteer/fsl_irqsteer.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,16 @@ uint32_t IRQSTEER_GetMasterIrqCount(IRQSTEER_Type *base, irqsteer_int_master_t i
return count;
}

static uint32_t IRQSTEER_GetRegIndex(irqsteer_int_master_t intMasterIndex, uint32_t slice)
static uint32_t IRQSTEER_GetRegIndex(irqsteer_int_master_t intMasterIndex,
uint32_t slice, uint32_t sliceNum)
{
uint32_t base = FSL_FEATURE_IRQSTEER_CHn_MASK_COUNT - 1 - intMasterIndex * 2;

if (FSL_FEATURE_IRQSTEER_CHn_MASK_COUNT % 2) {
return base + slice;
} else {
return base - slice;
base += sliceNum - 1;
}

return base - slice;
}

/*!
Expand Down Expand Up @@ -225,7 +226,7 @@ IRQn_Type IRQSTEER_GetMasterNextInterrupt(IRQSTEER_Type *base, irqsteer_int_mast
bitOffset = 0;

/* compute the index of the register to be queried */
regIndex = IRQSTEER_GetRegIndex(intMasterIndex, i);
regIndex = IRQSTEER_GetRegIndex(intMasterIndex, i, sliceNum + 1);

/* get register's value */
chanStatus = base->CHn_STATUS[regIndex];
Expand Down Expand Up @@ -255,7 +256,7 @@ uint64_t IRQSTEER_GetMasterInterruptsStatus(IRQSTEER_Type *base, irqsteer_int_ma
sliceNum = IRQSTEER_GetMasterIrqCount(base, intMasterIndex) / 32 - 1;

for (i = 0; i <= sliceNum; i++) {
regIndex = IRQSTEER_GetRegIndex(intMasterIndex, i);
regIndex = IRQSTEER_GetRegIndex(intMasterIndex, i, sliceNum + 1);

chanStatus = base->CHn_STATUS[regIndex];

Expand Down