⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ledasm.s

📁 UBOOT源码,希望能给大家一点帮助,费了好大心思弄来的.
💻 S
字号:
/* * ledasm.S: simple LED control code * * Copyright (C) 2001  Erik Mouw (J.A.K.Mouw@its.tudelft.nl) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * *//* * Documentation: * [1] Intel Corporation, "Intel StrongARM SA-1100 Microprocessor *     Developer's Manual", April 1999 * [2] Intel Corporation, "Intel StrongARM SA-1110 Microprocessor *     Advanced Developer's manual, December 1999 */.ident "$Id: ledasm.S,v 1.3 2001/10/28 20:29:05 erikm Exp $"#ifdef HAVE_CONFIG_H# include <blob/config.h>#endif#include <blob/arch.h>.textLED:		.long LED_GPIOGPIO_BASE:	.long 0x90040000#define	GPDR	0x00000004#define GPSR	0x00000008#define GPCR	0x0000000c.globl ledinit	/* initialise LED GPIO and turn LED on.	 * clobbers r0 and r1	 */ledinit:	ldr	r0, GPIO_BASE	ldr	r1, LED	str	r1, [r0, #GPDR]		/* LED GPIO is output */	str	r1, [r0, #GPSR]		/* turn LED on */	mov	pc, lr.globl led_on	/* turn LED on. clobbers r0 and r1 */led_on:	ldr	r0, GPIO_BASE	ldr	r1, LED	str	r1, [r0, #GPSR]	mov	pc, lr.globl led_off	/* turn LED off. clobbers r0 - r2 */led_off:	ldr	r0, GPIO_BASE	ldr	r1, LED	str	r1, [r0, #GPCR]	mov	pc, lr	/* busy wait loop. clobbers r0 */wait_loop:	mov	r0, #0x400000wait_loop1:	subs	r0, r0, #1	bne	wait_loop1	mov	pc, lrblinky:	/* blink LED. clobbers r0 and r1 */	mov	r2, lr	bl	led_on	bl	wait_loop	bl	led_off	bl	wait_loop	mov	pc, r2	.globl led_blink	/* blinks LED r0 times */	/* clobbers r0 - r4 */led_blink:	mov	r4, lr	mov	r3, r0	/* switch LED off if it wasn't already off */	bl	led_off	bl	wait_loop	blink0:	bl	blinky	subs	r3, r3, #1	bne	blink0	mov	pc, r4

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -