cancel
Showing results for 
Search instead for 
Did you mean: 

About IPSR

Myasu.1
Senior

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?

This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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).

https://developer.arm.com/documentation/dui0552/a/the-cortex-m3-processor/programmers-model/core-registers?lang=en

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

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).

https://developer.arm.com/documentation/dui0552/a/the-cortex-m3-processor/programmers-model/core-registers?lang=en

If you feel a post has answered your question, please click "Accept as Solution".
Myasu.1
Senior

@TDK​ 

Thank you for quick reply!!

Thank you for even posting the link to the document.​