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

📄 era_alg.asm

📁 TMS320C2000Flash操作
💻 ASM
📖 第 1 页 / 共 3 页
字号:
;--------------------------------------------------------------------------------------------------
CMPCTVER:
        BLDD    #flashAlgoVars.FL_SECST,flashAlgoVars.ADDR  ;Init ADDR to first location in sector.
        SPLK    #0deadh,flashAlgoVars.LASTVER               ;Sets the LASTVERIFY flag to indicate
                                                            ;that compaction verify is the last 
                                                            ;verification operation.    
;G1
       SPLK    #MX_CMPCT,flashAlgoVars.PLS_CNT             ;Initialize compaction pulse count.
;--------------------------------------------------------------------------------------------------
CMPCTVER1:
        LACC    #WADDR                                      ;Setup WADDR to the address to be 
        CALL    WADDR_SET                                   ;checked for compaction
;--------------------------------------------------------------------------------------------------
        LACC    #CTRL                                       ;Setup the compaction verify mode.
        SPLK    #0006,flashAlgoVars.PAD                     ; 
        TBLW    flashAlgoVars.PAD
;--------------------------------------------------------------------------------------------------
        SDELAY    #T_cva_cm                                 ;Algorithm Delay ~ 50ns(25ns MIN)     
                                                            ;T_cva(CM)
;--------------------------------------------------------------------------------------------------
        CALL    READWORD                                    ;Read out the word in compaction 
                                                            ;verify mode.
;--------------------------------------------------------------------------------------------------
        LACL    flashAlgoVars.READ                          ;Get the value read out.
        BCND    PROCEED_TO_CMPCT,NEQ                        ;If this is non-zero there are depleted
                                                            ;bits, and proceed to apply compaction 
                                                            ;pulses
;--------------------------------------------------------------------------------------------------
        LACC    flashAlgoVars.ADDR                          ;Increment the current address 
        ADD     #1                                          ;and store it back.
        SACL    flashAlgoVars.ADDR                          ;
;--------------------------------------------------------------------------------------------------
        SPLK    #MX_CMPCT,flashAlgoVars.PLS_CNT             ;Initialize compaction pulse count.
;--------------------------------------------------------------------------------------------------
        SUB     #STICKS                                     ;Subtract the stick count.
        SUB     flashAlgoVars.FL_SECST
        BCND    CMPCTVER1,NEQ                               ; CURRENT ADDR - FL_SECST is the
                                                            ; number of sticks checked.
                                                            ; SO CURRENT (ADDR-FL_SECST)-STICKS = 0
                                                            ; on the last stick to be checked.

                                                            ; If here done compaction check has 
                                                            ; passed. So exit compaction mode

;--------------------------------------------------------------------------------------------------
        LACC    #CTRL                                       ;Exit the compaction verify mode.
        SPLK    #0000,flashAlgoVars.PAD
        TBLW    flashAlgoVars.PAD
;--------------------------------------------------------------------------------------------------
        SDELAY  #Tcvh_CM                                    ; Wait in normal mode
;--------------------------------------------------------------------------------------------------
        B       ERVER
;--------------------------------------------------------------------------------------------------
PROCEED_TO_CMPCT:
;--------------------------------------------------------------------------------------------------

        LACC    #CTRL                                       ;Exit the compaction verify mode.
        SPLK    #0000,flashAlgoVars.PAD
        TBLW    flashAlgoVars.PAD


        SDELAY  #Tcvh_CM                                    ; Wait in normal mode

;--------------------------------------------------------------------------------------------------
        B       CMPCT
;--------------------------------------------------------------------------------------------------
; CMPCT: Implementation of the compaction routine, 
;--------------------------------------------------------------------------------------------------
; This code applies compaction pulses to the column addressed by flashAlgoVars.ADDR.
; It applies compaction pulses to the columns which read out as having depleted
; bits. 
;--------------------------------------------------------------------------------------------------
CMPCT:
;--------------------------------------------------------------------------------------------------
; DO NOT *EVER* REMOVE COMPACTION - THIS CAN DESTROY THE DEVICE. THIS IS VERY VERY STRICTLY
; FOR TESTING ROUTINES 
;;;;    B    DONE                                           ;To REMOVE COMPACTION uncomment this.
;--------------------------------------------------------------------------------------------------
        LACL    flashAlgoVars.PLS_CNT                       ;Get the number of pulses left.
        BCND    ERROR,EQ                                    ;If pulse count == 0 then commence 
                                                            ;error handling.

;       LACC    #WADDR                                      ;COLUMN ADDRESS => WADDR REG  
;       TBLW    flashAlgoVars.ADDR

        LACL    flashAlgoVars.READ                          ;Get the Data Read during compaction 
                                                            ;verify.
        XOR     #0FFFFh                                     ;Invert the bitmask.
        SACL    flashAlgoVars.READ                          ;Store the inverted bitmask.

        LACC    #WDATA                                      ;Write bitmask to the WDATA register.
        TBLW    flashAlgoVars.READ                    

        LACC    #CTRL                                       ;Initialize the compaction mode.
        SPLK    #0005,flashAlgoVars.PAD
        TBLW    flashAlgoVars.PAD

        SDELAY    #T_csu_cm                                 ;Wait T_csu(CM)

        LACC    #PMPC                                       ;Activate the compaction mode.
        SPLK    #0005h,flashAlgoVars.PAD
        TBLW    flashAlgoVars.PAD

CPW     LAR     AR2,#CMPCT_PULSE                            ;CMPCT PULSE WIDTH T_cmpct(E)
        CALL    DELAY,AR2                                   ;Generate a delay to define 
                                                            ;the compaction pulse width.

        SPLK    #0000h,flashAlgoVars.PAD1                   ;De-activate the compaction mode.
        CALL    CLRCMD

        SDELAY  #T_ch_cm                                    ;Wait T_ch(CM) 

        SPLK    #0001h,flashAlgoVars.PAD1                   ;Clear the control registers.
        CALL    CLRCMD

        SDELAY  #T_ch_C                                     ;Wait in normal read mode.


        LACC    flashAlgoVars.PLS_CNT                       ;Decrement the puse counter.
        SUB     #1h
        SACL    flashAlgoVars.PLS_CNT

        B       CMPCTVER1                                   ;Resume the compaction verify routine.
;--------------------------------------------------------------------------------------------------
DONE:    SPLK    #6,flashAlgoVars.PAD1                       ;Clear all control registers and
        CALL    CLRCMD                                      ;return to the caller, in ARRAY mode.
        ACCESS_ARRAY
        RET                                                 ;PASSED CMPCTVER AND ERVER    
;--------------------------------------------------------------------------------------------------


;--------------------------------------------------------------------------------------------------
; CLRCMD
;--------------------------------------------------------------------------------------------------
;     This routine performs the following operations
;   1.     Places the flash in normal read mode by writing 0000 to two control 
;        registers PMPC,CNTL=>0000)
;    2.  Returns to the caller in Register Mode.
;--------------------------------------------------------------------------------------------------
CLRCMD  ACCESS_REGS
        SPLK     #0,flashAlgoVars.PAD
        LACC     flashAlgoVars.FL_SECST
        RPT     flashAlgoVars.PAD1
        TBLW     flashAlgoVars.PAD
        RET
    

            
;--------------------------------------------------------------------------------------------------
;  SUBROUTINE: Delay
;
; DESCRIPTION:
;  This routine executes a delay approximately
;    (DLOOP + 8) + AR2 * (DLOOP + 6) * 1/freq = nsec
;    if AR2  = 0  Delay = 108 cycles
;    if AR2 != 0  Delay = 108 + AR6 * 106 cycles
;
;  A typical call to this subroutine is as follow:
;
;     lar     AR2,delay_param         1 cycles reg/#k, 2 cycles if #lk
;     call    Delay,*,AR2             4 cycles
;
;       minimum delay is when delay_parm=0
;       minimum delay = 113 cycles ( 108 + 5 )
;       for a cycle time of 50 nsec,
;         minimum delay = 5.65 usec   ( 113 cycles * 50 nsec)
;         delay time    = 5.65 usec + AR2 * 106 * 50 nsec
;                       = 5.65 usec + AR2 * 5.3 usec
;
; INPUTS:
;   AR2 = Passed on to this routine to set delay time as required
;   ARP => AR2    
; OUTPUTS:
;       none
;--------------------------------------------------------------------------------------------------
DELAY
        RPT     #DLOOP                  ;1 cycles
        NOP                             ;1+DLOOP = 101 CYCLES (FOR DLOOP = 100)
        BANZ    DELAY,*-,AR2            ;   4/2 (True/False)
        RET                             ;   4 cycles
                                        ; for delay_parm = 0
                                        ;   (1+101+2+4 = 108) cycles
                                        ; for delay_parm != 0
                                        ;   108 + AR2 * (1+101+4 = 106) cycles

        .label  EraseAlgoEndMain

;--------------------------------------------------------------------------------------------------
    .sect   "ESPL_text"
    
SETWADDR:

    .label  EraseAlgoStartSpl

    TBLW    flashAlgoVars.FL_SECST
    RET

    .loop 6
    nop
    .endloop
;--------------------------------------------------------------------------------------------------
WADDR_SET:
    TBLW    flashAlgoVars.ADDR
    RET

    .label  EraseAlgoEndSpl

⌨️ 快捷键说明

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