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

📄 mybootcode.asm

📁 dsp6416开发的底层驱动
💻 ASM
字号:
        .sect ".myBootCode"
        .global _myBootCode
        .ref _c_int00


; QDMA registers and values

QDMA_OPT 		.equ 	0x02000000 ;QDMA options register
QDMA_S_OPT 		.equ 	0x02000020 ;QDMA options register
QDMA_OPT_VAL 	.equ 	0x21200001 ;QDMA options
QDMA_SRC 		.equ 	0x02000004 ;QDMA source address register
QDMA_CNT 		.equ 	0x02000008 ;QDMA count register
QDMA_DST 		.equ 	0x0200000c ;QDMA destination address register
QDMA_IDX 		.equ 	0x02000010 ;QDMA index pseudo-register
QDMA_S_IDX 		.equ 	0x02000030 ;QDMA index pseudo-register

EMIFB_GBLCTL		.equ	0x01a80000 ;EMIFB GBLCTL register
EMIFB_GBLCTL_VAL	.equ	0x0009207c ;GBLCTL options 0x0001307c?
EMIFB_CE1CTL		.equ	0x01a80004 ;EMIFB CE1CTL register
EMIFB_CE1CTL_VAL	.equ	0xffffff03 ;CE1CTL options


;
; ======== myBootCode ========
;
_myBootCode:
; **************
; Configure EMIF
; **************
	mvkl EMIFB_GBLCTL,A5 ; set EMIFB GBLCTL options
	mvkl EMIFB_GBLCTL_VAL,B5
	mvkh EMIFB_GBLCTL,A5
	mvkh EMIFB_GBLCTL_VAL,B5
	stw B5,*A5

	mvkl EMIFB_CE1CTL,A5 ; set EMIFB CE1CTL options
	mvkl EMIFB_CE1CTL_VAL,B5
	mvkh EMIFB_CE1CTL,A5
	mvkh EMIFB_CE1CTL_VAL,B5
	stw B5,*A5

; *************
; Copy Sections
; *************
	mvkl copyTable, a3 ; load table pointer
	mvkh copyTable, a3
copySectionLoop:
	ldw *a3++, b0 ; byte count
	ldw *a3++, a4 ; load ram start address
	ldw *a3++, b4 ; load flash start address
	nop 5
	[!b0] b copyDone ; have we copied all sections?
	nop 5
; copy this section with QDMA
	mvkl QDMA_SRC,A5 ; load source address
	mvkh QDMA_SRC,A5
	stw B4,*A5
	nop 5
	mvkl QDMA_DST,A5 ; load destination address
	mvkh QDMA_DST,A5
	stw A4,*A5
	nop 5
	shr B0,2,B1 ; divide size by 4 (because we're in 32-bit mode)
	mvkl QDMA_CNT,A5 ; load word count
	mvkh QDMA_CNT,A5
	stw B1,*A5
	nop 5
	mvkl QDMA_IDX,A5 ; set index. writing to this register will
	mvkh QDMA_IDX,A5 ; also initiate the transfer.
	zero B5
	stw B5,*A5 ; go!
	nop 5
	mvkl QDMA_S_OPT,A5 ; set QDMA options
	mvkl QDMA_OPT_VAL,B5
	mvkh QDMA_S_OPT,A5
	mvkh QDMA_OPT_VAL,B5
	stw B5,*A5
	nop 5
; next section
	b copySectionLoop
	nop 5
copyDone: ; done with section copying.
; *************
; Start Program
; *************
	mvkl .S2 _c_int00, B0
	mvkh .S2 _c_int00, B0
	B .S2 B0 ; jump to _c_int00
	nop 5
	
	
; Table of sections to copy. Format is:
; word 0: byte count
; word 1: run address
; word 2: load address
copyTable:
	; .text
	.word 0x00030000
	.word 0x00060000
	.word 0x64000000
	
	; .bios
;	.word 0x000027e0
;	.word 0x00012b00
;	.word 0x64012b00
	
	; .hwi_vec
;	.word 0x200 ; hwi_vec is 0x200 bytes
;	.word 0x00000400
;	.word 0x64000400
	
	; end of table
	.word 0
	.word 0
	.word 0

⌨️ 快捷键说明

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