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

📄 bsp_a.s

📁 UC/OS 在SparcLite 上的移植范例
💻 S
字号:
/*
; -------------------------------------------------------------------------
; File: bsp_a.s - Fujitsu 832EK eval. board low level routines.
;
; uC/OS Real-time multitasking kernel for the Fujitsu SPARClite processor.
;
; Written by Brad Denniston (bradd@vpeng.com)
;
; Description:
;	_InitTimer - sets the timer to interupt every 55 msec.
; -------------------------------------------------------------------------
*/

#include "bsp.h"

	.text
	.global _InitTimer

/*
; -------------------------------------------------------------------------
; _InitTimer - set counter 2 of the 82C54 timer chip as Timer 2 Task Timer.
; Set count to 18 interrupts/sec. (55 msec). This kills the 1 second timer.
; Note that counters 0 and 1 are used to divide 10 Mhz to 20 Khz as input
; to counter 2 (timer 2).  The monitor program has already tested and set up
; counters 0 and 1. 
; -------------------------------------------------------------------------
*/
_InitTimer:
	
	/*   program Timer1 as a 20x/second timer.*/
	rd		%psr, %o3				/* get current psr */
	or		%o3, 0x0F00, %o0		/* disables interrupts */
	wr		%o0, %g0, %psr

	set		TIMER_BASE_ADDR,%o0
	set		(CTR_SELECT2|CTR_RWLOHI|CTR_MODE2|CTR_16BIT),%o2 /* rate generator */
	add		%o0, TREGCTL, %o1
	stba	%o2, [%o1] CC1_ASI		/* write to counter 2 control word */
	set		TIMER_TASK_TIME, %o2	/* 1000 => 20 ticks/sec */
	add		%o0, TREG2, %o1
	stba	%o2, [%o1] CC1_ASI		/* Store low 8 bits of count */
	srl		%o2, 8, %o2
	stba	%o2, [%o1] CC1_ASI		/* Store high 8 bits of count */

	wr		%o3, %g0, %psr			/* restore psr, may enable interrupts */
	retl							/* return to caller */
	nop

⌨️ 快捷键说明

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