📄 can.lst
字号:
###############################################################################
# #
# 25/May/2009 02:53:22 #
# IAR ANSI C/C++ Compiler V5.20.0.20892/W32 EVALUATION for ARM #
# Copyright 1999-2008 IAR Systems AB. #
# #
# Cpu mode = arm #
# Endian = little #
# Source file = F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91lib\peripherals\can\can.c #
# Command line = F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91lib\peripherals\can\can.c -D #
# at91sam7x256 -D flash -D TRACE_LEVEL=4 -lC #
# F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\at #
# 91sam7x256_flash\List\ --remarks --diag_suppress #
# Pe826,Pe1375 -o F:\Diplomovka\IARprojects\Diplomovka\25. #
# 4.2009\getting-started-project-at91sam7x-ek-iar\getting- #
# started-project-at91sam7x-ek\at91sam7x-ek\getting-starte #
# d-project\ewp\at91sam7x256_flash\Obj\ --no_cse #
# --no_unroll --no_inline --no_code_motion --no_tbaa #
# --no_clustering --no_scheduling --debug --endian=little #
# --cpu=ARM7TDMI -e --fpu=None --dlib_config "C:\Program #
# Files (x86)\IAR Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\DLib_Config_Full.h" -I #
# F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\.. #
# \..\..\at91lib/peripherals\ -I #
# F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\.. #
# \..\..\at91lib\ -I F:\Diplomovka\IARprojects\Diplomovka\ #
# 25.4.2009\getting-started-project-at91sam7x-ek-iar\getti #
# ng-started-project-at91sam7x-ek\at91sam7x-ek\getting-sta #
# rted-project\ewp\..\..\..\at91lib\memories\sdmmc\ -I #
# F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\.. #
# \..\..\at91lib/components\ -I #
# F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\.. #
# \..\..\at91lib/boards/at91sam7x-ek\ -I #
# F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\.. #
# \..\..\external_libs/crc\ -I "C:\Program Files #
# (x86)\IAR Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\" --interwork --cpu_mode arm -Oh #
# List file = F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\at #
# 91sam7x256_flash\List\can.lst #
# Object file = F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-s #
# tarted-project-at91sam7x-ek-iar\getting-started-project- #
# at91sam7x-ek\at91sam7x-ek\getting-started-project\ewp\at #
# 91sam7x256_flash\Obj\can.o #
# #
# #
###############################################################################
F:\Diplomovka\IARprojects\Diplomovka\25.4.2009\getting-started-project-at91sam7x-ek-iar\getting-started-project-at91sam7x-ek\at91lib\peripherals\can\can.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 //------------------------------------------------------------------------------
31 // Headers
32 //------------------------------------------------------------------------------
33
34 #include <board.h>
35 #include <pio/pio.h>
36 #include <utility/trace.h>
37 #include <aic/aic.h>
38 #include "can.h"
39
40 //------------------------------------------------------------------------------
41 // Local definitions
42 //------------------------------------------------------------------------------
43 // CAN state
44 #define CAN_DISABLED 0
45 #define CAN_HALTED 1
46 #define CAN_IDLE 2
47 #define CAN_SENDING 3
48 #define CAN_RECEIVING 4
49
50 // MOT: Mailbox Object Type
51 #define CAN_MOT_DISABLE 0 // Mailbox is disabled
52 #define CAN_MOT_RECEPT 1 // Reception Mailbox
53 #define CAN_MOT_RECEPT_OW 2 // Reception mailbox with overwrite
54 #define CAN_MOT_TRANSMIT 3 // Transmit mailbox
55 #define CAN_MOT_CONSUMER 4 // Consumer mailbox
56 #define CAN_MOT_PRODUCER 5 // Producer mailbox
57
58 //------------------------------------------------------------------------------
59 // Local variables
60 //------------------------------------------------------------------------------
61 #if defined (PINS_CAN_TRANSCEIVER_TXD)
\ In section .rodata, align 4
62 static const Pin pins_can_transceiver_txd[] = {PINS_CAN_TRANSCEIVER_TXD};
\ pins_can_transceiver_txd:
\ 00000000 0000100000F4 DC32 1048576, 0FFFFF400H
\ FFFF
\ 00000008 02000000 DC8 2, 0, 0, 0
63 #endif
64 #if defined (PINS_CAN_TRANSCEIVER_RXD)
\ In section .rodata, align 4
65 static const Pin pins_can_transceiver_rxd[] = {PINS_CAN_TRANSCEIVER_RXD};
\ pins_can_transceiver_rxd:
\ 00000000 0000080000F4 DC32 524288, 0FFFFF400H
\ FFFF
\ 00000008 02000000 DC8 2, 0, 0, 0
66 #endif
\ In section .rodata, align 4
67 static const Pin pin_can_transceiver_rs = PIN_CAN_TRANSCEIVER_RS;
\ pin_can_transceiver_rs:
\ 00000000 0400000000F4 DC32 4, 0FFFFF400H
\ FFFF
\ 00000008 02040000 DC8 2, 4, 0, 0
68 #if defined (PIN_CAN_TRANSCEIVER_RXEN)
69 static const Pin pin_can_transceiver_rxen = PIN_CAN_TRANSCEIVER_RXEN;
70 #endif
71
\ In section .bss, align 4
72 static CanTransfer *pCAN0Transfer=NULL;
\ pCAN0Transfer:
\ 00000000 DS8 4
73 #ifdef AT91C_BASE_CAN1
74 static CanTransfer *pCAN1Transfer=NULL;
75 #endif
76
77 //------------------------------------------------------------------------------
78 // Local functions
79 //------------------------------------------------------------------------------
80
81 //------------------------------------------------------------------------------
82 /// CAN Error Detection
83 /// \param status error type
84 /// \param can_number can nulber
85 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
86 static void CAN_ErrorHandling( unsigned int status, unsigned char can_number)
87 {
\ CAN_ErrorHandling:
\ 00000000 38402DE9 PUSH {R3-R5,LR}
\ 00000004 0040A0E1 MOV R4,R0
\ 00000008 0150A0E1 MOV R5,R1
88 if( (status&AT91C_CAN_ERRA) == AT91C_CAN_ERRA) {
\ 0000000C 400B14E3 TST R4,#0x10000
\ 00000010 0200000A BEQ ??CAN_ErrorHandling_0
89 TRACE_ERROR("(CAN) CAN is in active Error Active mode\n\r");
\ 00000014 A4009FE5 LDR R0,??CAN_ErrorHandling_1 ;; `?<Constant "-E- (CAN) CAN is in a...">`
\ ??CAN_ErrorHandling_2:
\ 00000018 ........ BL printf
\ 0000001C 150000EA B ??CAN_ErrorHandling_3
90 }
91 else if( (status&AT91C_CAN_ERRP) == AT91C_CAN_ERRP) {
\ ??CAN_ErrorHandling_0:
\ 00000020 400A14E3 TST R4,#0x40000
92 TRACE_ERROR("(CAN) CAN is in Error Passive mode\n\r");
\ 00000024 98009F15 LDRNE R0,??CAN_ErrorHandling_1+0x4 ;; `?<Constant "-E- (CAN) CAN is in E...">`
\ 00000028 FAFFFF1A BNE ??CAN_ErrorHandling_2
93 }
94 else if( (status&AT91C_CAN_BOFF) == AT91C_CAN_BOFF) {
\ 0000002C 800A14E3 TST R4,#0x80000
\ 00000030 1000000A BEQ ??CAN_ErrorHandling_3
95 TRACE_ERROR("(CAN) CAN is in Buff Off mode\n\r");
\ 00000034 8C009FE5 LDR R0,??CAN_ErrorHandling_1+0x8 ;; `?<Constant "-E- (CAN) CAN is in B...">`
\ 00000038 ........ BL printf
96 // CAN reset
97 TRACE_ERROR("(CAN) CAN%d reset\n\r", can_number);
\ 0000003C 0510A0E1 MOV R1,R5
\ 00000040 84009FE5 LDR R0,??CAN_ErrorHandling_1+0xC ;; `?<Constant "-E- (CAN) CAN%d reset\\n\\r">`
\ 00000044 ........ BL printf
98 // CAN Controller Disable
99 if (can_number == 0) {
\ 00000048 000055E3 CMP R5,#+0
\ 0000004C 0900001A BNE ??CAN_ErrorHandling_3
100 AT91C_BASE_CAN0->CAN_MR &= ~AT91C_CAN_CANEN;
\ 00000050 FF04A0E3 MOV R0,#-16777216
\ 00000054 FD0880E3 ORR R0,R0,#0xFD0000
\ 00000058 000090E5 LDR R0,[R0, #+0]
\ 0000005C 0100C0E3 BIC R0,R0,#0x1
\ 00000060 FF14A0E3 MOV R1,#-16777216
\ 00000064 FD1881E3 ORR R1,R1,#0xFD0000
\ 00000068 000081E5 STR R0,[R1, #+0]
101 // CAN Controller Enable
102 AT91C_BASE_CAN0->CAN_MR |= AT91C_CAN_CANEN;
\ 0000006C 000091E5 LDR R0,[R1, #+0]
\ 00000070 010080E3 ORR R0,R0,#0x1
\ 00000074 000081E5 STR R0,[R1, #+0]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -