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

📄 write flash byte.asm

📁 ADI 公司的DSP ADSP21369 EZ-KIT LITE开发板的全部源代码
💻 ASM
字号:
/* This program writes data into parallel flash and polls whether
the data is written correctly
Input - Word_To_Write, External_Byte_Address
Output - None  */

#include <def21369.h>
.global WRITE_FLASH_BYTE,POLL_FLASH;
.extern  External_Byte_Address,Word_To_Write,Data_Byte,Word_Read_In;
.extern READ_FLASH_WORD;

.section/dm seg_dmda;
.var temp;

.section/pm seg_pmco;
WRITE_FLASH_BYTE:

// These are the command words for write for the AMD flash

    i5 = dm(External_Byte_Address);

    r0 = 0xaa;
    dm(0,i5) = r0;

    r0 = 0x55;
    dm(0,i5) = r0;

    r0 = 0xa0;
    dm(0,i5) = r0;

    r3 = dm(Data_Byte);
    r0 = 0xff;
    r0 = r0 and r3;
    dm(temp) = r0;
    dm(0,i5) = r0;

    nop;                                //the program command is completed by the flash. When data read back does not toggle
    call POLL_FLASH;                    //After issuing the program command and the data to be written, we cannot move on until
                                        //in 2 consecutive reads,the program command has completed successfully

    rts;
WRITE_FLASH_BYTE.END:


POLL_FLASH:                         //After issuing the program command and the data to be written, we cannot move on until
    r1 = 0;                         //the program command is completed by the flash. When data read back does not toggle
    r2 = 0;                         //in 2 consecutive reads,the program command has completed successfully

    call READ_FLASH_WORD;
    r0 = dm(Word_Read_In); nop;
    r1 = fext R0 BY 0:8;
    call READ_FLASH_WORD;
    r0 = dm(Word_Read_In); nop;
    r2 = r0;
    r2 = fext R0 BY 0:8;
    r1 = r1 - R2;              // compares whether the data toggles or not
    r3 = dm(temp);
    r3 = r3 - r0;              // compares the read data with written value

    if ne jump POLL_FLASH;
    nop;
    rts;
POLL_FLASH.END:

⌨️ 快捷键说明

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