📄 ch375.s
字号:
.module ch375.c
.area text(rom, con, rel)
.dbfile C:\AVR\OK\ch375.c
.dbfunc e m_nop _m_nop fV
; m -> R20
.even
_m_nop::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 9
; #include "ch375.h"
;
; unsigned char usb_rec_buff[64];
; unsigned char usb_rec_buflen;
; unsigned char diskbuff[512*2];
;
;
; void m_nop(unsigned char m)
; {
xjmp L3
L2:
.dbline 11
xcall __NOP
L3:
.dbline 10
; while(m--)
mov R2,R20
clr R3
subi R20,1
tst R2
brne L2
.dbline 12
; _NOP();
; _NOP();
xcall __NOP
.dbline -2
L1:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r m 20 c
.dbend
.dbfunc e set_usb_mode _set_usb_mode fc
; RD_Data -> R20
; i -> R22
; mode -> R20
.even
_set_usb_mode::
xcall push_gset2
mov R20,R16
.dbline -1
.dbline 16
; }
; /* 设置CH37X的工作模式 */
; unsigned char set_usb_mode( unsigned char mode )
; {
.dbline 20
; unsigned char i;
; unsigned char RD_Data;
;
; usb_cmd=CMD_SET_USB_MODE;
ldi R24,21
sts 40961,R24
.dbline 21
; nop();
xcall _nop
.dbline 22
; nop();
xcall _nop
.dbline 23
; nop();
xcall _nop
.dbline 24
; nop();
xcall _nop
.dbline 25
; usb_data=mode;
sts 40960,R20
.dbline 26
; nop();
xcall _nop
.dbline 27
; for( i=100; i!=0; i-- ) /* 等待设置模式操作完成,不超过30uS */
ldi R22,100
xjmp L9
L6:
.dbline 28
; {
.dbline 29
; RD_Data=usb_data;
lds R20,40960
.dbline 30
; if( RD_Data == CMD_RET_SUCCESS )
cpi R20,81
brne L10
.dbline 31
; return 1;
ldi R16,1
xjmp L5
L10:
.dbline 32
L7:
.dbline 27
dec R22
L9:
.dbline 27
tst R22
brne L6
.dbline 33
; } /* 成功 */
; return 0;
clr R16
.dbline -2
L5:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r RD_Data 20 c
.dbsym r i 22 c
.dbsym r mode 20 c
.dbend
.dbfunc e ch375_init _ch375_init fc
; mode -> R0
.even
_ch375_init::
.dbline 0 ; func end
ret
.dbsym l mode 0 c
.dbend
.dbfunc e get_ver _get_ver fc
.even
_get_ver::
.dbline 0 ; func end
ret
.dbend
.dbfunc e _usb_send __usb_send fV
; len -> R1
; pbuff -> R0,R1
.even
__usb_send::
.dbline 0 ; func end
ret
.dbsym l len 2 c
.dbsym l pbuff 0 pc
.dbend
.dbfunc e usb_send_data _usb_send_data fV
; len -> R1,R2
; pbuff -> R0,R1
.even
_usb_send_data::
.dbline 0 ; func end
ret
.dbsym l len 2 i
.dbsym l pbuff 0 pc
.dbend
.dbfunc e waitint _waitint fc
.even
_waitint::
.dbline 0 ; func end
ret
.dbend
.dbfunc e InitDisk _InitDisk fc
.even
_InitDisk::
.dbline 0 ; func end
ret
.dbend
.dbfunc e ReadSector _ReadSector fc
; oDataBuffer -> R1,R2
; iSectorCount -> R0
; iLbaStart -> y+2
.even
_ReadSector::
.dbline 0 ; func end
ret
.dbsym l oDataBuffer 6 pc
.dbsym l iSectorCount 4 c
.dbsym l iLbaStart 0 l
.dbend
.dbfunc e WriteSector _WriteSector fc
; oDataBuffer -> R1,R2
; iSectorCount -> R0
; iLbaStart -> y+2
.even
_WriteSector::
.dbline 0 ; func end
ret
.dbsym l oDataBuffer 6 pc
.dbsym l iSectorCount 4 c
.dbsym l iLbaStart 0 l
.dbend
.dbfunc e WordSwap _WordSwap fi
; input -> R0,R1
.even
_WordSwap::
.dbline 0 ; func end
ret
.dbsym l input 0 i
.dbend
.dbfunc e LSwapINT16 _LSwapINT16 fi
; dData2 -> R1,R2
; dData1 -> R0,R1
.even
_LSwapINT16::
.dbline 0 ; func end
ret
.dbsym l dData2 2 s
.dbsym l dData1 0 s
.dbend
.dbfunc e LSwapINT32 _LSwapINT32 fl
; dData4 -> y+14
; dData3 -> y+10
; dData2 -> y+6
; dData1 -> y+2
.even
_LSwapINT32::
.dbline 0 ; func end
ret
.dbsym l dData4 12 l
.dbsym l dData3 8 l
.dbsym l dData2 4 l
.dbsym l dData1 0 l
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -