📄 esl_external_read_data.asm
字号:
.IFNDEF @_LIB_EXTERNAL_READ_DATA_ASM
@_LIB_EXTERNAL_READ_DATA_ASM .EQU 1
.DATA
.CODE
;*****************************************************************************************
; SUBROUTINE: EXTERNAL_READ_WORD
; DESCRIPTION: Read one word data from external memory(Mode: Byte Mode).
;
; We support 3 types external memory playing Speech(supprt SPI,NOR,NAND)
;
; If user want to use the external memory access method,
; such as "Melody" application, you should remove the "//" from
; // CALL @_LIB_F_SPI_RX_2BYTE
;
; and such as "Speech" application, you should remove "//" and "/*** ***/" from
; 1. /*** Play External Memory 1, Play External Memory 1 ***/
; 2. /*** Play External Memory 2, Play External Memory 2 ***/
; 3. //CALL Mapping_Nand_Add_Check (if user want to play NAND external memory,please remark "//")
;
; If user wants to use other type of external memory,
; the subroutine of manipulating external memory remains to be designed by user for their specific applications.
;
;
; The external memory read subroutine must follow four rules:
; 1. The input address will be stored in R1(high address) and R0(low address) by speech decoder,
; so external memory subroutine must get address from R1 and R0.
; 2. The external memory must be set as byte mode.
; 3. In external memory subroutine, two consecutive bytes must be combined as one word.
; 4. The output data(word) of external memory subroutine must be put in R0.
;
;*****************************************************************************************
/*** Play External Memory 1
.EXTERN @_LIB_F_SPI_RX_2BYTE
.EXTERN Mapping_Nand_Add_Check
.EXTERN S1_Read_NOR_Word
.EXTERN S2_Read_NOR_Word
Play External Memory 1 ***/
Mapping_Nand_Add:
//CALL Mapping_Nand_Add_Check
RET
.GLOBAL S1_EXTERNAL_READ_WORD
S1_EXTERNAL_READ_WORD:
;********************************
;user can program code from here
;********************************
/*** Play External Memory 1
PUSH R0 //FOR ADDRESS LOW
PUSH R1 //FOR ADDRESS HIGH
GET_S1_DEVICEID
R1 = #SPI_DEVICE
CMP R0,R1
IF EQ JMP @_LIB_S1_SPI_DEVICE
R1 = #NOR_DEVICE
CMP R0,R1
IF EQ JMP @_LIB_S1_NOR_DEVICE
R1 = #NAND_DEVICE
CMP R0,R1
IF EQ JMP @_LIB_S1_NAND_DEVICE
@_LIB_S1_NAND_DEVICE:
POP R1
POP R0
CALL Read_Nand_Word
JMP @_LIB_S1_EXT_END
@_LIB_S1_NOR_DEVICE:
POP R1
POP R0
CALL S1_Read_NOR_Word
JMP @_LIB_S1_EXT_END
@_LIB_S1_SPI_DEVICE:
POP R1
POP R0
CALL @_LIB_F_SPI_RX_2BYTE
JMP @_LIB_S1_EXT_END
@_LIB_S1_EXT_END:
Play External Memory 1 ***/
RET
.GLOBAL S2_EXTERNAL_READ_WORD
.EXTERN Read_Nand_Word
S2_EXTERNAL_READ_WORD:
;********************************
;user can program code from here
;********************************
/*** Play External Memory 2
PUSH R0 //FOR ADDRESS LOW
PUSH R1 //FOR ADDRESS HIGH
GET_S2_DEVICEID
R1 = #SPI_DEVICE
CMP R0,R1
IF EQ JMP @_LIB_S2_SPI_DEVICE
R1 = #NOR_DEVICE
CMP R0,R1
IF EQ JMP @_LIB_S2_NOR_DEVICE
R1 = #NAND_DEVICE
CMP R0,R1
IF EQ JMP @_LIB_S2_NAND_DEVICE
@_LIB_S2_NAND_DEVICE:
POP R1
POP R0
CALL Read_Nand_Word
JMP @_LIB_S2_EXT_END
@_LIB_S2_NOR_DEVICE:
POP R1
POP R0
CALL S2_Read_NOR_Word
JMP @_LIB_S2_EXT_END
@_LIB_S2_SPI_DEVICE:
POP R1
POP R0
CALL @_LIB_F_SPI_RX_2BYTE
JMP @_LIB_S2_EXT_END
@_LIB_S2_EXT_END:
Play External Memory 2 ***/
RET
.GLOBAL M_EXTERNAL_READ_WORD
M_EXTERNAL_READ_WORD:
;********************************
;user can program code from here
;********************************
// CALL @_LIB_F_SPI_RX_2BYTE
RET
;*****************************************************************************************
; SUBROUTINE: EXTERNAL_WRITE_WORD
; DESCRIPTION: write one block of RAM to external memory(Mode: Byte Mode).
; SPI FLASH is the default external memory type.
;
; If user want to use SPI for the external memory access method, such as Melody/Speech spi application, you should remove the "//" from
; //.EXTERN @_LIB_F_SPI_PPGM_WORD
; //CALL @_LIB_F_SPI_PPGM_WORD
; If user wants to use other type of external memory,
; the subroutine of manipulating external memory remains to be designed by user for their specific applications,
; and user needs to replace the following code with designed code
; //.EXTERN @_LIB_F_SPI_PPGM_WORD
; //CALL @_LIB_F_SPI_PPGM_WORD
;
; The external memory read subroutine must follow five rules:
; R3 = #RAM_ADD (the start address of RAM)
; R2 = #SIZE (the size of RAM)
; R1 = #(SPI_ADD / 65536) (the high word of address of external memory)
; R0 = #(SPI_ADD % 65536) (the low word of address of external memory)
;After writing, the new start address must be updated and stored in R1(high word of address) R0(low word of ddress)
;*****************************************************************************************
.EXTERN @_LIB_F_SPI_PPGM_WORD
.GLOBAL EXTERNAL_WRITE_WORD
EXTERNAL_WRITE_WORD:
;********************************
;user can program code from here
;********************************
// CALL @_LIB_F_SPI_PPGM_WORD
RET
.ENDIF ;@_LIB_EXTERNAL_READ_DATA_ASM
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -