📄 pio_it.lst
字号:
###############################################################################
# #
# 08/Mar/2009 17:38:37 #
# IAR ANSI C/C++ Compiler V5.20.2.21007/W32 EVALUATION for ARM #
# Copyright 1999-2008 IAR Systems AB. #
# #
# Cpu mode = arm #
# Endian = little #
# Source file = E:\IAR\at91lib\peripherals\pio\pio_it.c #
# Command line = E:\IAR\at91lib\peripherals\pio\pio_it.c -D at91sam9260 #
# -D sdram -lC E:\IAR\at91sam9260-ek\basic-twi-eeprom-proj #
# ect\ewp\at91sam9260_sdram\List\ --remarks #
# --diag_suppress Pe826,Pe1375 -o #
# E:\IAR\at91sam9260-ek\basic-twi-eeprom-project\ewp\at91s #
# am9260_sdram\Obj\ --no_cse --no_unroll --no_inline #
# --no_code_motion --no_tbaa --no_clustering #
# --no_scheduling --debug --endian=little #
# --cpu=ARM926EJ-S -e --fpu=None --dlib_config #
# "D:\Program Files\IAR Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\DLib_Config_Full.h" -I #
# E:\IAR\at91sam9260-ek\basic-twi-eeprom-project\ewp\..\.. #
# \..\at91lib\ -I E:\IAR\at91sam9260-ek\basic-twi-eeprom-p #
# roject\ewp\..\..\..\at91lib\boards\at91sam9260-ek\ -I #
# E:\IAR\at91sam9260-ek\basic-twi-eeprom-project\ewp\..\.. #
# \..\at91lib\peripherals\ -I #
# E:\IAR\at91sam9260-ek\basic-twi-eeprom-project\ewp\..\.. #
# \..\at91lib\components\ -I E:\IAR\at91sam9260-ek\basic-t #
# wi-eeprom-project\ewp\..\..\..\at91lib\usb\ -I #
# "D:\Program Files\IAR Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\" --interwork --cpu_mode arm -On #
# List file = E:\IAR\at91sam9260-ek\basic-twi-eeprom-project\ewp\at91s #
# am9260_sdram\List\pio_it.lst #
# Object file = E:\IAR\at91sam9260-ek\basic-twi-eeprom-project\ewp\at91s #
# am9260_sdram\Obj\pio_it.o #
# #
# #
###############################################################################
E:\IAR\at91lib\peripherals\pio\pio_it.c
1 /* ----------------------------------------------------------------------------
2 * ATMEL Microcontroller Software Support
3 * ----------------------------------------------------------------------------
4 * Copyright (c) 2008, Atmel Corporation
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * - Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the disclaimer below.
13 *
14 * Atmel's name may not be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * ----------------------------------------------------------------------------
28 */
29
30 /// Disable traces for this file
31 #ifndef NOTRACE
32 #define NOTRACE
33 #endif
34
35 //------------------------------------------------------------------------------
36 // Headers
37 //------------------------------------------------------------------------------
38
39 #include "pio_it.h"
40 #include "pio.h"
41 #include <aic/aic.h>
42 #include <board.h>
43 #include <utility/assert.h>
44 #include <utility/trace.h>
45
46 //------------------------------------------------------------------------------
47 // Local definitions
48 //------------------------------------------------------------------------------
49
50 /// Returns the current value of a register.
51 #define READ(peripheral, register) (peripheral->register)
52 /// Modifies the current value of a register.
53 #define WRITE(peripheral, register, value) (peripheral->register = value)
54
55 /// Maximum number of interrupt sources that can be defined.
56 #define MAX_INTERRUPT_SOURCES 7
57
58 //------------------------------------------------------------------------------
59 // Local types
60 //------------------------------------------------------------------------------
61
62 /// Describes a PIO interrupt source, including the PIO instance triggering the
63 /// interrupt and the associated interrupt handler.
64 typedef struct _InterruptSource {
65
66 /// Interrupt source pin.
67 const Pin *pPin;
68
69 /// Interrupt handler.
70 void (*handler)(const Pin *);
71
72 } InterruptSource;
73
74 //------------------------------------------------------------------------------
75 // Local variables
76 //------------------------------------------------------------------------------
77
78 /// List of interrupt sources.
\ In section .bss, align 4
79 static InterruptSource pSources[MAX_INTERRUPT_SOURCES];
\ pSources:
\ 00000000 DS8 56
80
81 /// Number of currently defined interrupt sources.
\ In section .bss, align 4
82 static unsigned int numSources;
\ numSources:
\ 00000000 DS8 4
83
84 //------------------------------------------------------------------------------
85 // Local functions
86 //------------------------------------------------------------------------------
87
88 //------------------------------------------------------------------------------
89 /// Handles all interrupts on the given PIO controller.
90 /// \param id PIO controller ID.
91 /// \param pBase PIO controller base address.
92 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
93 void PioInterruptHandler(unsigned int id, AT91S_PIO *pBase)
94 {
\ PioInterruptHandler:
\ 00000000 F8402DE9 PUSH {R3-R7,LR}
\ 00000004 0050B0E1 MOVS R5,R0
\ 00000008 0140B0E1 MOVS R4,R1
95 unsigned int status;
96 unsigned int i;
97
98 // Check PIO controller status
99 status = pBase->PIO_ISR;
\ 0000000C 4C0094E5 LDR R0,[R4, #+76]
\ 00000010 0070B0E1 MOVS R7,R0
100 status &= pBase->PIO_IMR;
\ 00000014 480094E5 LDR R0,[R4, #+72]
\ 00000018 077010E0 ANDS R7,R0,R7
101 if (status != 0) {
\ 0000001C 000057E3 CMP R7,#+0
\ 00000020 2200000A BEQ ??PioInterruptHandler_0
102
103 trace_LOG(trace_DEBUG, "-D- PIO interrupt on PIO controller #%d\n\r", id);
104
105 // Check all sources
106 i = 0;
\ 00000024 0000A0E3 MOV R0,#+0
\ 00000028 0060B0E1 MOVS R6,R0
107 while (status != 0) {
\ ??PioInterruptHandler_1:
\ 0000002C 000057E3 CMP R7,#+0
\ 00000030 1E00000A BEQ ??PioInterruptHandler_0
108
109 // There cannot be an unconfigured source enabled.
110 SANITY_CHECK(i < numSources);
111
112 // Source if configured on PIOA
113 if (pSources[i].pPin->id == id) {
\ 00000034 0800A0E3 MOV R0,#+8
\ 00000038 ........ LDR R1,??DataTable11 ;; pSources
\ 0000003C 901621E0 MLA R1,R0,R6,R1
\ 00000040 000091E5 LDR R0,[R1, #+0]
\ 00000044 0800D0E5 LDRB R0,[R0, #+8]
\ 00000048 050050E1 CMP R0,R5
\ 0000004C 1500001A BNE ??PioInterruptHandler_2
114
115 // Source has PIOs which have changed
116 if ((status & pSources[i].pPin->mask) != 0) {
\ 00000050 0800A0E3 MOV R0,#+8
\ 00000054 ........ LDR R1,??DataTable11 ;; pSources
\ 00000058 901621E0 MLA R1,R0,R6,R1
\ 0000005C 000091E5 LDR R0,[R1, #+0]
\ 00000060 000090E5 LDR R0,[R0, #+0]
\ 00000064 070010E1 TST R0,R7
\ 00000068 0E00000A BEQ ??PioInterruptHandler_2
117
118 trace_LOG(trace_DEBUG, "-D- Interrupt source #%d triggered\n\r", i);
119
120 pSources[i].handler(pSources[i].pPin);
\ 0000006C 0800A0E3 MOV R0,#+8
\ 00000070 ........ LDR R1,??DataTable11 ;; pSources
\ 00000074 901621E0 MLA R1,R0,R6,R1
\ 00000078 000091E5 LDR R0,[R1, #+0]
\ 0000007C 0810A0E3 MOV R1,#+8
\ 00000080 ........ LDR R2,??DataTable11 ;; pSources
\ 00000084 912622E0 MLA R2,R1,R6,R2
\ 00000088 041092E5 LDR R1,[R2, #+4]
\ 0000008C 31FF2FE1 BLX R1
121 status &= ~(pSources[i].pPin->mask);
\ 00000090 0800A0E3 MOV R0,#+8
\ 00000094 ........ LDR R1,??DataTable11 ;; pSources
\ 00000098 901621E0 MLA R1,R0,R6,R1
\ 0000009C 000091E5 LDR R0,[R1, #+0]
\ 000000A0 000090E5 LDR R0,[R0, #+0]
\ 000000A4 0070D7E1 BICS R7,R7,R0
122 }
123 }
124 i++;
\ ??PioInterruptHandler_2:
\ 000000A8 016096E2 ADDS R6,R6,#+1
\ 000000AC DEFFFFEA B ??PioInterruptHandler_1
125 }
126 }
127 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -