OpenCores
URL https://opencores.org/ocsvn/usb_nand_reader/usb_nand_reader/trunk

Subversion Repositories usb_nand_reader

[/] [usb_nand_reader/] [trunk/] [mini32/] [CMD_ReadID.asm] - Rev 7

Compare with Previous | Blame | View Log

_cmd_chip_read_id:
;CMD_ReadID.c,5 ::              void cmd_chip_read_id(unsigned char* outBuffer, int addr)
ADDIU   SP, SP, -20
SW      RA, 0(SP)
SW      R26, 4(SP)
SH      R26, 16(SP)
;CMD_ReadID.c,7 ::              nand_send_command(NC_READ_ID);
SW      R25, 8(SP)
ORI     R25, R0, 144
JAL     _nand_send_command+0
NOP     
;CMD_ReadID.c,8 ::              nand_send_address(&addr, 1);
ADDIU   R2, SP, 16
ORI     R26, R0, 1
MOVZ    R25, R2, R0
JAL     _nand_send_address+0
NOP     
;CMD_ReadID.c,9 ::              do_delay(10);
ORI     R25, R0, 10
JAL     _do_delay+0
NOP     
LW      R25, 8(SP)
;CMD_ReadID.c,10 ::             while(!nand_is_ready());
L_cmd_chip_read_id0:
SH      R26, 8(SP)
SW      R25, 12(SP)
JAL     _nand_is_ready+0
NOP     
LW      R25, 12(SP)
LH      R26, 8(SP)
BEQ     R2, R0, L__cmd_chip_read_id7
NOP     
J       L_cmd_chip_read_id1
NOP     
L__cmd_chip_read_id7:
J       L_cmd_chip_read_id0
NOP     
L_cmd_chip_read_id1:
;CMD_ReadID.c,11 ::             do_delay(2500);
SH      R26, 8(SP)
SW      R25, 12(SP)
ORI     R25, R0, 2500
JAL     _do_delay+0
NOP     
LW      R25, 12(SP)
LH      R26, 8(SP)
;CMD_ReadID.c,12 ::             if(0 == addr)
LH      R2, 16(SP)
BEQ     R2, R0, L__cmd_chip_read_id8
NOP     
J       L_cmd_chip_read_id2
NOP     
L__cmd_chip_read_id8:
;CMD_ReadID.c,13 ::             nand_read(outBuffer, 5);
SH      R26, 8(SP)
SW      R25, 12(SP)
ORI     R26, R0, 5
JAL     _nand_read+0
NOP     
LW      R25, 12(SP)
LH      R26, 8(SP)
J       L_cmd_chip_read_id3
NOP     
L_cmd_chip_read_id2:
;CMD_ReadID.c,15 ::             nand_read(outBuffer, 4);
SH      R26, 8(SP)
SW      R25, 12(SP)
ORI     R26, R0, 4
JAL     _nand_read+0
NOP     
LW      R25, 12(SP)
LH      R26, 8(SP)
L_cmd_chip_read_id3:
;CMD_ReadID.c,16 ::             }
L_end_cmd_chip_read_id:
LW      R26, 4(SP)
LW      RA, 0(SP)
ADDIU   SP, SP, 20
JR      RA
NOP     
; end of _cmd_chip_read_id
_cmd_chip_read_unique_id:
;CMD_ReadID.c,18 ::             void cmd_chip_read_unique_id(unsigned char* outBuffer)
ADDIU   SP, SP, -12
SW      RA, 0(SP)
;CMD_ReadID.c,20 ::             nand_send_command(NC_READ_UNIQUE_ID);
SW      R26, 4(SP)
SW      R25, 8(SP)
ORI     R25, R0, 237
JAL     _nand_send_command+0
NOP     
;CMD_ReadID.c,21 ::             nand_send_address(0, 1);
ORI     R26, R0, 1
MOVZ    R25, R0, R0
JAL     _nand_send_address+0
NOP     
;CMD_ReadID.c,22 ::             do_delay(10);
ORI     R25, R0, 10
JAL     _do_delay+0
NOP     
;CMD_ReadID.c,23 ::             nand_wait_ready();
JAL     _nand_wait_ready+0
NOP     
;CMD_ReadID.c,24 ::             do_delay(2500);
ORI     R25, R0, 2500
JAL     _do_delay+0
NOP     
LW      R25, 8(SP)
;CMD_ReadID.c,25 ::             while(0 != (cmd_chip_read_status() & 0x0f));
L_cmd_chip_read_unique_id4:
SW      R25, 8(SP)
JAL     _cmd_chip_read_status+0
NOP     
LW      R25, 8(SP)
ANDI    R2, R2, 15
ANDI    R2, R2, 255
BNE     R2, R0, L__cmd_chip_read_unique_id11
NOP     
J       L_cmd_chip_read_unique_id5
NOP     
L__cmd_chip_read_unique_id11:
J       L_cmd_chip_read_unique_id4
NOP     
L_cmd_chip_read_unique_id5:
;CMD_ReadID.c,26 ::             nand_send_command(NC_READ_MODE);
SW      R25, 8(SP)
MOVZ    R25, R0, R0
JAL     _nand_send_command+0
NOP     
LW      R25, 8(SP)
;CMD_ReadID.c,27 ::             nand_read(outBuffer, 64);
SW      R25, 8(SP)
ORI     R26, R0, 64
JAL     _nand_read+0
NOP     
LW      R25, 8(SP)
;CMD_ReadID.c,28 ::             }
L_end_cmd_chip_read_unique_id:
LW      R26, 4(SP)
LW      RA, 0(SP)
ADDIU   SP, SP, 12
JR      RA
NOP     
; end of _cmd_chip_read_unique_id

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.