2022-02-26 02:04 AM
I use STM32F1 Value Line Discovery Kit.
I would like to have a common interrupt handler and call the corresponding handler from that common handler.
I am assuming the following.
Specifically, I am trying to get the IPSR number from its common handler and call the corresponding function pointer.
-------------------------------------------
vec_common: // Set this as a common handler for all vector tables.
push {r4,r5,r6,r7,r8,r9,r11,LR}
MRS r0 , IPSR
bl interrput // Call interrput() with the first argument being the value of IPSR.
pop {r4-r11, PC}
-------------------------------------------
-------------------------------------------
typedef void (handler)(void);
handler int_hdlr[61];
void interrput(int int_no){
handler hdlr = int_hdlr[int_no];
if(handler){
handler(); // Call the handler for the corresponding interrupt
}
}
-------------------------------------------
I generated the UART3 interrupt and looked at the into_no (IPSR) in the interrupt function and found it to be 0x37 (55d).
The manual says the UART3 interrupt position is 0x27(39d), I thought the IPSR value and the interrupt position in the manual would match, do you want to tell me about the relationship between them? Is there any offset?
Solved! Go to Solution.
2022-02-26 04:54 AM
There is an offset of 16 between ISR_NUMBER and the interrupt "position". So if ISR_NUMBER=55, that corresponds to interrupt 55 - 16 = 39 (USART3).
2022-02-26 04:54 AM
There is an offset of 16 between ISR_NUMBER and the interrupt "position". So if ISR_NUMBER=55, that corresponds to interrupt 55 - 16 = 39 (USART3).
2022-02-26 05:12 AM
@TDK
Thank you for quick reply!!
Thank you for even posting the link to the document.