Where can i find the default interrupt priority for the dspi, i2c, and gpio drivers for the freedom k22f board.
Hi
Kinetis K22 product using ARM Cortex-M4 core. The interrupt priority setting at NVIC_IPRx register.
Please refer below code to set interrupt priority:
/*ARM Cortex M4 implementation for interrupt priority shift*/
#define ARM_INTERRUPT_LEVEL_BITS 4
/***********************************************************************/
/*
* Initialize the NVIC to set specified IRQ priority.
*
* NOTE: The function only initializes the NVIC to set a single IRQ priority.
* Interrupts will also need to be enabled in the ARM core. This can be
* done using the EnableInterrupts macro.
*
* Parameters:
* irq irq number to be enabled (the irq number NOT the vector number)
* prio irq priority. 0-15 levels. 0 max priority
*/
void set_irq_priority (int irq, int prio)
{
/*irq priority pointer*/
uint8 *prio_reg;
/* Make sure that the IRQ is an allowable number. Right now up to 105 is
* used.
*/
if (irq > 105)
printf("\nERR! Invalid IRQ value passed to priority irq function!\n");
if (prio > 15)
printf("\nERR! Invalid priority value passed to priority irq function!\n");
/* Determine which of the NVICIPx corresponds to the irq */
prio_reg = (uint8 *)(((uint32)&NVICIP0) + irq);
/* Assign priority to IRQ */
*prio_reg = ( (prio&0xF) << (8 - ARM_INTERRUPT_LEVEL_BITS) );
}
/***********************************************************************/
Wish it helps.
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------