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

📄 copy.s

📁 一个可以驱动 onenand的代码,使用ADS编译
💻 S
字号:
 ;/*****************************************************************************/
 ;/*                                                                           */
 ;/* PROJECT : ANYSTORE II                                                     */
 ;/* MODULE  : ONBL1                                                            */
 ;/* NAME    : ONAND Bootloader stage1 for OneNAND                              */
 ;/* FILE    : ONBL1.s                                                          */
 ;/* PURPOSE : This file implements for NAND Bootloader stage1                 */
 ;/*                                                                           */
 ;/*---------------------------------------------------------------------------*/
 ;/*                                                                           */
 ;/*        COPYRIGHT 2000-2004, SAMSUNG ELECTRONICS CO., LTD.                 */
 ;/*                      ALL RIGHTS RESERVED                                  */
 ;/*                                                                           */
 ;/*   Permission is hereby granted to licensees of Samsung Electronics        */
 ;/*   Co., Ltd. products to use or abstract this computer program for the     */
 ;/*   sole purpose of implementing a product based on Samsung                 */
 ;/*   Electronics Co., Ltd. products. No other rights to reproduce, use,      */
 ;/*   or disseminate this computer program, whether in part or in whole,      */
 ;/*   are granted.                                                            */
 ;/*                                                                           */
 ;/*   Samsung Electronics Co., Ltd. makes no representation or warranties     */
 ;/*   with respect to the performance of this computer program, and           */
 ;/*   specifically disclaims any responsibility for any damages,              */
 ;/*   special or consequential, connected with the use of this program.       */
 ;/*                                                                           */
 ;/*---------------------------------------------------------------------------*/
 ;/*                                                                           */
 ;/* REVISION HISTORY                                                          */
 ;/*                                                                           */
 ;/* - 13/NOV/2003 [Janghwan Kim] : first writing                              */
 ;/*   05-JAN-2004 [SongHo Yoon]  : reorganization                             */
 ;/*                                                                           */ 
 ;/*****************************************************************************/

	AREA	read1, code, readonly
	EXPORT read


read
  


 ;=======================================================================;
 ;                                                                       ;
 ;   OneNand Copy                                                        ;
 ;                                                                       ;
 ;   - ONBL2 Shadowing                                                   ;
 ;     . ONBL2 Base Address of Reindeer+ is 0x30000000                   ;
 ;     . Copy image and Jump to ONBL2 Base address. Execute ONBL2        ;
 ;                                                                       ;
 ;   - Caution                                                           ;
 ;     . When OneNand Boot mode, Only DataRam1 can be used               ;
 ;       BootRam and DataRam0 are integrated in the same SRAM. And SRAM  ;
 ;       has a single port feature. If OneNand Operation is performed    ;
 ;       using DataRam0 during CPU fetches instructions from BootRam,    ;
 ;       access conflict occurs.                                         ;
 ;       Therefore CPU cannot fetche instructions from BootRam and       ;
 ;       system halt.                                                    ;
 ;                                                                       ;
 ;=======================================================================;
;SDRAM_BASE_ADDRESS EQU  0xA1f00000	

 ;-----------------------------------------------------------------------;
 ;   Register usage                                                      ;
 ;                                                                       ;
 ;   R0 - OneNand Register Address                                       ;
 ;   R3 - Temp                                                           ;
 ;   R4 - Temp                                                           ;
 ;   R5 - Psn counter                                                    ;
 ;   R6 - Source Address (OneNand buffer - currently DataRam1 used)      ;
 ;   R7 - Target Address (SDRAM address)                                 ;
 ;   R8 - Loop counter                                                   ;
 ;-----------------------------------------------------------------------;

	ldr	r7, =0xA1f00000

 ; Loop that copies the rest 124 Sectors from block #0 to SDRAM
        mov     r5, #4   ; Psn counter
        ldr     r9, =0xc0030800
OneNandDataTransfer
        
 ;/* Block Number Set */
        ldr     r0, =0x0001E200
        mov	r3, #0x0
        strh    r3, [r0]

 ;/* Sector Number Set */
        bic     r3, r5, #0xFF00
        strh    r3, [r0,#0x0E]

 ;/* Start Buffer and Number of Sectors Set */
        ldr     r0, =0x0001E400
        mov     r3, #0xC00       ; DataRAM1
        strh    r3, [r0]

 ;/* System Configuration Reg set (ECC Off)*/
        ldr     r3, [r0,#0x42]
        orr     r3, r3, #0x0100      
        strh    r3, [r0,#0x42]

 ;/* INT Stat Reg Clear */
        mov     r3, #0x0      
        strh    r3, [r0,#0x82]  
        
 ;/* Issue Page Read without ECC Cmd */
        strh    r3, [R0,#0x40]
        
 ;/* Poll interrupt status */
        ldr     r4, =0x8080
BusyChk
        ldrh    r3, [r0,#0x82]
        cmp     r3, r4
        bne     BusyChk

 ; Read page from OneNands internal Data RAM to SDRAM       
        ldr     r6, =0x00000C00  
        mov     r8, #64

 ;============== s/w memcpy ==================
 ;CopyLoop:
 ;        ldmia   r6!, {r0-r3, r9-r12}
 ;        stmia   r7!, {r0-r3, r9-r12}
 ;        subs    r8, r8, #1
 ;        bne     CopyLoop


 ;============= dma memcpy ===================

	mov 	r0, #0x40000000
	str 	r0, [r0]
	str 	r9, [r0, #0x20c]
	str 	r6, [r0, #0x204]
	str     r7, [r0, #0x208]
	mov     r1, #0xc0000000
	str     r1, [r0]
	add	r7, r7, #2048

DMAWAIT
	ldr     r1, [r0]
	ands	r1, r1, #0x8
	beq     DMAWAIT

	mov     r1, #0x40000004
	str     r1, [r0]    
        cmp     r5, #252
        addne   r5, r5, #4   ; Psn counter plus 4       
        bne     OneNandDataTransfer
 ;-----------------------------------------------------------------------;
 ;   Jump to ONBL2                                                        ;
 ;-----------------------------------------------------------------------;
 ; Jump to second boot
    
	ldr		r0, =0xA1f00000
	mov		pc, r0

	 END

⌨️ 快捷键说明

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