📄 led.lst
字号:
###############################################################################
# #
# 18/Jul/2008 11:38:00 #
# IAR ARM ANSI C/C++ Compiler V5.11.0.20622/W32 EVALUATION #
# Copyright 1999-2007 IAR Systems. All rights reserved. #
# #
# Cpu mode = arm #
# Endian = little #
# Source file = D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91lib\utility\led.c #
# Command line = D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91lib\utility\led.c -D #
# at91sam7se512 -lC D:\rock\atarm\at91sam7se\software\usb- #
# device-core-project-1.3-iar5-at91sam7se-ek\at91sam7se-ek #
# \usb-device-core-project\ewp\at91sam7se512_sdram\List\ #
# --remarks -o D:\rock\atarm\at91sam7se\software\usb-devic #
# e-core-project-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb- #
# device-core-project\ewp\at91sam7se512_sdram\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 "D:\Program Files\IAR Systems\Embedded #
# Workbench 5.0 Evaluation\ARM\INC\DLib_Config_Full.h" -I #
# D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\..\..\..\at91lib\ -I #
# D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\..\..\..\at91lib\boards\at91sam7se-ek\ -I #
# D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\..\..\..\at91lib\peripherals\ -I #
# D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\..\..\..\at91lib\components\ -I #
# D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\..\..\..\at91lib\usb\ -I "D:\Program #
# Files\IAR Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\" --interwork --cpu_mode arm -On #
# List file = D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\at91sam7se512_sdram\List\led.lst #
# Object file = D:\rock\atarm\at91sam7se\software\usb-device-core-projec #
# t-1.3-iar5-at91sam7se-ek\at91sam7se-ek\usb-device-core-p #
# roject\ewp\at91sam7se512_sdram\Obj\led.o #
# #
# #
###############################################################################
D:\rock\atarm\at91sam7se\software\usb-device-core-project-1.3-iar5-at91sam7se-ek\at91lib\utility\led.c
1 /* ----------------------------------------------------------------------------
2 * ATMEL Microcontroller Software Support - ROUSSET -
3 * ----------------------------------------------------------------------------
4 * Copyright (c) 2006, 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 disclaiimer below.
13 *
14 * - Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the disclaimer below in the documentation and/or
16 * other materials provided with the distribution.
17 *
18 * Atmel's name may not be used to endorse or promote products derived from
19 * this software without specific prior written permission.
20 *
21 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
24 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
27 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * ----------------------------------------------------------------------------
32 */
33
34 /*
35 Title: LED implementation
36
37 About: Purpose
38 Implementation of LED-related functionalities.
39 */
40
41 //------------------------------------------------------------------------------
42 // Headers
43 //------------------------------------------------------------------------------
44
45 #include "led.h"
46 #include <board.h>
47 #include <pio/pio.h>
48
49 //------------------------------------------------------------------------------
50 // Internal variables
51 //------------------------------------------------------------------------------
52
\ In section .rodata, align 4
53 static const Pin pinsLeds[] = {PINS_LEDS};
\ pinsLeds:
\ 00000000 0100000000F4 DC32 1, 0FFFFF400H
\ FFFF
\ 00000008 02030000 DC8 2, 3, 0, 0
\ 0000000C 0200000000F4 DC32 2, 0FFFFF400H
\ FFFF
\ 00000014 02040000 DC8 2, 4, 0, 0
\ 00000018 0400000000F4 DC32 4, 0FFFFF400H
\ FFFF
\ 00000020 02040000 DC8 2, 4, 0, 0
\ In section .rodata, align 4
54 static const unsigned int numLeds = sizeof(pinsLeds) / sizeof(Pin);
\ numLeds:
\ 00000000 03000000 DC32 3
55
56 //------------------------------------------------------------------------------
57 // Exported functions
58 //------------------------------------------------------------------------------
59 /*
60 Function: LED_Configure
61 Configures the pin associated with the given LED number.
62
63 Parameters:
64 led - Number of the LED to configure.
65
66 Returns:
67 1 if the LED exists and has been configured; otherwise 0.
68 */
\ In section .text, align 4, keep-with-next
69 unsigned char LED_Configure(unsigned int led)
70 {
\ LED_Configure:
\ 00000000 10402DE9 PUSH {R4,LR}
\ 00000004 0040B0E1 MOVS R4,R0
71 // Check that LED exists
72 if (led >= numLeds) {
\ 00000008 ........ LDR R0,??DataTable10 ;; numLeds
\ 0000000C 000090E5 LDR R0,[R0, #+0]
\ 00000010 000054E1 CMP R4,R0
\ 00000014 0100003A BCC ??LED_Configure_0
73
74 return 0;
\ 00000018 0000A0E3 MOV R0,#+0
\ 0000001C 040000EA B ??LED_Configure_1
75 }
76
77 // Configure LED
78 return (PIO_Configure(&pinsLeds[led], 1));
\ ??LED_Configure_0:
\ 00000020 0110A0E3 MOV R1,#+1
\ 00000024 0C20A0E3 MOV R2,#+12
\ 00000028 ........ LDR R0,??DataTable13 ;; pinsLeds
\ 0000002C 920420E0 MLA R0,R2,R4,R0
\ 00000030 ........ BL PIO_Configure
\ ??LED_Configure_1:
\ 00000034 1040BDE8 POP {R4,LR}
\ 00000038 1EFF2FE1 BX LR ;; return
79 }
80
81 /*
82 Function: LED_Set
83 Turns a LED on.
84
85 Parameters:
86 led - Number of the LED to turn on.
87
88 Returns:
89 1 if the LED has been turned on; 0 otherwise.
90 */
\ In section .text, align 4, keep-with-next
91 unsigned char LED_Set(unsigned int led)
92 {
\ LED_Set:
\ 00000000 10402DE9 PUSH {R4,LR}
\ 00000004 0040B0E1 MOVS R4,R0
93 // Check if LED exists
94 if (led >= numLeds) {
\ 00000008 ........ LDR R0,??DataTable10 ;; numLeds
\ 0000000C 000090E5 LDR R0,[R0, #+0]
\ 00000010 000054E1 CMP R4,R0
\ 00000014 0100003A BCC ??LED_Set_0
95
96 return 0;
\ 00000018 0000A0E3 MOV R0,#+0
\ 0000001C 0F0000EA B ??LED_Set_1
97 }
98
99 // Turn LED on
100 if (pinsLeds[led].type == PIO_OUTPUT_0) {
\ ??LED_Set_0:
\ 00000020 0C00A0E3 MOV R0,#+12
\ 00000024 ........ LDR R1,??DataTable13 ;; pinsLeds
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -