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

📄 callout_debug_800.s

📁 qnx powerpc MPC8245的 BSP源文件
💻 S
字号:
#  # Copyright 2007, QNX Software Systems. #  # Licensed under the Apache License, Version 2.0 (the "License"). You # may not reproduce, modify or distribute this software except in # compliance with the License. You may obtain a copy of the License # at: http://www.apache.org/licenses/LICENSE-2.0 #  # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTIES OF ANY KIND, either express or implied.# # This file may contain contributions from others, either as # contributors under the License or as licensors under other terms.  # Please review this entire file for other proprietary rights or license # notices, as well as the QNX Development Suite License Guide at # http://licensing.qnx.com/license-guide/ for other information.# # An entry point for a hardware kernel callout.# It may be called by an interrupt handler.# This code MUST be position independant.#	.include "callout.ah"	.include "ppc/util.ah"			.extern ptrTxBD 	.extern ptrRxBD 	.extern patch_channel	p_txbdtbl:	.long	8p_rxbdtbl:	.long	8patch_debug_tx:	# get chanel no. 	lis		%r9,patch_channel@ha	lwz		%r9,patch_channel@l(%r9)	# get device base	lwz		%r8,DDI_BASE(%r7)	mulli	%r8,%r8,4	# chanel index	mulli	%r9,%r9,4	add		%r6,%r6,%r9 	# save TxBDtbl address	add		%r7,%r3,%r6	lis		%r9,ptrTxBD@ha		la		%r9,ptrTxBD@l(%r9)	add		%r9,%r9,%r8	lwz		%r8,0(%r9)	stw		%r8,0(%r7)			# patch the routine to use the correct base 	add		%r3,%r3,%r5	sth		%r6,2(%r3)	blrpatch_debug_rx:	# get chanel no. 	lis		%r9,patch_channel@ha	lwz		%r9,patch_channel@l(%r9)	# get device base	lwz		%r8,DDI_BASE(%r7)	mulli	%r8,%r8,4	# chanel index	mulli	%r9,%r9,4	add		%r6,%r6,%r9 	# save RxBDtbl address	add		%r7,%r3,%r6	lis		%r9,ptrRxBD@ha		la		%r9,ptrRxBD@l(%r9)	add		%r9,%r9,%r8	lwz		%r8,0(%r9)	stw		%r8,0(%r7)			# patch the routine to use the correct base 	add		%r3,%r3,%r5	sth		%r6,2(%r3)	blr## void display_output(struct syspage_entry *sysp, char c)## Display debug messages from kdebug or the kernel.#CALLOUT_START	display_char_800cpm, p_txbdtbl, patch_debug_tx	addi	%r3,%r3,0x1234		# get p_txbd address (patched)	#disable interrupt	mfmsr	%r8	bitclr	%r9,%r8,PPC_MSR_EE	mtmsr	%r9		lwz		%r11,0(%r3)			# ptrBDHead	lwz		%r7,0(%r11)			# ptrBD	mfspr	%r9,PPC800_SPR_IMMR	# add immr + DPRAM	rlwinm	%r9,%r9,0,0,15	addi	%r9,%r9,PPC800_IMMR_DPRAM	add		%r7,%r7,%r9		#wait for the TxBuff ready1:	lhz		%r6,0(%r7)	andi.	%r5,%r6,PPC8CPM_TXBD_R	bne		1b	#transmit	lwz		%r5,PPC8CPM_BD_POINTER(%r7)	stb		%r4,0(%r5)		li		%r4,1	sth		%r4,PPC8CPM_BD_COUNT(%r7)	ori		%r6,%r6,PPC8CPM_TXBD_R	sth		%r6,0(%r7)		#change BD counter	andi.	%r6,%r6,PPC8CPM_TXBD_W	beq		1f	addi	%r7,%r11,PPC8CPM_BD_SIZE						b		2f1:	addi	%r7,%r7,PPC8CPM_BD_SIZE					2:		sub		%r7,%r7,%r9					#relative	stw		%r7,0(%r11)		mtmsr	%r8	blr		CALLOUT_END		display_char_800cpm		## int poll_key( volatile struct syspage_entry *)## return a key value, or -1 if no key is available (for kdebug use)#CALLOUT_START	poll_key_800cpm, p_rxbdtbl, patch_debug_rx	addi	%r3,%r3,0x1234		# get p_rxbd address (patched)		#disable interrupt	mfmsr	%r8	bitclr	%r9,%r8,PPC_MSR_EE	mtmsr	%r9		lwz		%r11,0(%r3)			# ptrBDHead	lwz		%r7,0(%r11)			# ptrBD	mfspr	%r9,PPC800_SPR_IMMR	# add immr + DPRAM	rlwinm	%r9,%r9,0,0,15	addi	%r9,%r9,PPC800_IMMR_DPRAM	add		%r7,%r7,%r9		#anything available?	lhz		%r6,0(%r7)	andi.	%r5,%r6,PPC8CPM_RXBD_E	beq		1f	#empty		li		%r3,-1	mtmsr	%r8	blr1:			#receive	lwz		%r5,PPC8CPM_BD_POINTER(%r7)	lbz		%r4,0(%r5)			ori		%r6,%r6,PPC8CPM_RXBD_E	sth		%r6,0(%r7)		#change BD counter	andi.	%r6,%r6,PPC8CPM_RXBD_W	beq		1f	addi	%r7,%r11,PPC8CPM_BD_SIZE						b		2f1:	addi	%r7,%r7,PPC8CPM_BD_SIZE					2:		sub		%r7,%r7,%r9					#relative	stw		%r7,0(%r11)	mr		%r3,%r4	mtmsr	%r8	blr		CALLOUT_END		poll_key_800cpm		## int break_detect(volatile struct syspage_entry *)## return 1 if a break condition is detected, 0 otherwise#CALLOUT_START	break_detect_800cpm, p_rxbdtbl, patch_debug_rx#li %r3,0#blr		addi	%r3,%r3,0x1234		# get p_rxbd address (patched)		#disable interrupt	mfmsr	%r8	bitclr	%r9,%r8,PPC_MSR_EE	mtmsr	%r9		lwz		%r11,0(%r3)			# ptrBDHead	lwz		%r7,0(%r11)			# ptrBD	mfspr	%r9,PPC800_SPR_IMMR	# add immr + DPRAM	rlwinm	%r9,%r9,0,0,15	addi	%r9,%r9,PPC800_IMMR_DPRAM	add		%r7,%r7,%r9		#break ?	lhz		%r6,0(%r7)	andi.	%r5,%r6,PPC8CPM_RXBD_BR							bne		1f	# no break	li		%r3,0	mtmsr	%r8	blr1:	# clear the break bit	andi. 	%r5,%r6,PPC8CPM_RXBD_W	sth		%r5,0(%r7)			#change BD counter	andi.	%r6,%r6,PPC8CPM_RXBD_W	beq		1f	addi	%r7,%r11,PPC8CPM_BD_SIZE						b		2f1:	addi	%r7,%r7,PPC8CPM_BD_SIZE					2:	sub		%r7,%r7,%r9					#relative	stw		%r7,0(%r11)	li		%r3,1	mtmsr	%r8	blr		CALLOUT_END		break_detect_800cpm 

⌨️ 快捷键说明

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