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

📄 udisk.s

📁 AVR单片机平台Atmega32+CH375A芯片读写U盘代码
💻 S
📖 第 1 页 / 共 5 页
字号:
	ldi R17,>L86
	xcall _puts
	.dbline 210
	ldi R18,1
	ldi R19,0
	ldi R16,<_nComBuff+2
	ldi R17,>_nComBuff+2
	xcall _put_bytes
	.dbline 211
	lds R24,_I2cComStatus
	andi R24,127
	sts _I2cComStatus,R24
	.dbline 212
	lds R24,_nComBuff+2
	cpi R24,143
	brne L88
	.dbline 213
	.dbline 214
	clr R2
	sts _nComBuff+2,R2
	.dbline 215
	xjmp L57
L88:
	.dbline 217
	xcall _RecieveFrameProcess
	.dbline 218
	ldi R24,255
	sts _DataPrepared,R24
	.dbline 219
L84:
	.dbline 220
	lds R2,_DataPrepared
	tst R2
	breq L92
	.dbline 221
	.dbline 222
	clr R2
	sts _DataPrepared,R2
	.dbline 223
	ldi R18,517
	ldi R19,2
	ldi R16,<_nComBuff
	ldi R17,>_nComBuff
	xcall _put_bytes
	.dbline 224
	in R24,0x36
	ori R24,64
	out 0x36,R24
	.dbline 225
	sbi 0x12,5
	.dbline 226
L92:
	.dbline 228
L82:
	.dbline 202
	xjmp L81
X0:
	.dbline -2
L56:
	.dbline 0 ; func end
	ret
	.dbsym r j 20 i
	.dbsym r i 20 c
	.dbend
	.dbfunc e mDelaymS _mDelaymS fV
;              i -> R20,R21
;             ms -> R16
	.even
_mDelaymS::
	xcall push_gset1
	.dbline -1
	.dbline 236
	xjmp L96
L95:
	.dbline 238
	ldi R20,1325
	ldi R21,5
	xjmp L101
L98:
	.dbline 238
L99:
	.dbline 238
	subi R20,1
	sbci R21,0
L101:
	.dbline 238
	cpi R20,0
	cpc R20,R21
	brne L98
X1:
L96:
	.dbline 238
	mov R2,R16
	clr R3
	subi R16,1
	tst R2
	brne L95
	.dbline -2
L94:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r i 20 s
	.dbsym r ms 16 c
	.dbend
	.dbfunc e delay_us _delay_us fV
;              j -> R16
	.even
_delay_us::
	.dbline -1
	.dbline 247
	.dbline 249
	inc R16
	.dbline -2
L102:
	.dbline 0 ; func end
	ret
	.dbsym r j 16 c
	.dbend
	.dbfunc e xDelay100uS _xDelay100uS fV
;          count -> R16,R17
	.even
_xDelay100uS::
	.dbline -1
	.dbline 255
	.dbline 257
	ldi R16,150
	ldi R17,0
	xjmp L107
L104:
	.dbline 257
L105:
	.dbline 257
	subi R16,1
	sbci R17,0
L107:
	.dbline 257
	cpi R16,0
	cpc R16,R17
	brne L104
X2:
	.dbline -2
L103:
	.dbline 0 ; func end
	ret
	.dbsym r count 16 s
	.dbend
	.dbfunc e xDelayAfterWrite _xDelayAfterWrite fV
;          count -> R16,R17
	.even
_xDelayAfterWrite::
	.dbline -1
	.dbline 263
	.dbline 265
	ldi R16,300
	ldi R17,1
	xjmp L112
L109:
	.dbline 265
L110:
	.dbline 265
	subi R16,1
	sbci R17,0
L112:
	.dbline 265
	cpi R16,0
	cpc R16,R17
	brne L109
X3:
	.dbline -2
L108:
	.dbline 0 ; func end
	ret
	.dbsym r count 16 s
	.dbend
	.dbfunc e xWriteCH375Cmd _xWriteCH375Cmd fV
;           mCmd -> R20
	.even
_xWriteCH375Cmd::
	xcall push_gset1
	mov R20,R16
	.dbline -1
	.dbline 272
	.dbline 273
	xcall _delay_us
	.dbline 274
	xcall _delay_us
	.dbline 275
	sbi 0x18,0
	.dbline 276
	ldi R24,255
	out 0x1a,R24
	.dbline 277
	out 0x1b,R20
	.dbline 278
	cbi 0x18,1
	.dbline 279
	cbi 0x15,7
	.dbline 280
	cbi 0x15,7
	.dbline 281
	in R24,0x15
	ori R24,192
	out 0x15,R24
	.dbline 282
	sbi 0x18,1
	.dbline 283
	xcall _delay_us
	.dbline 284
	xcall _delay_us
	.dbline -2
L113:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r mCmd 20 c
	.dbend
	.dbfunc e xWriteCH375Data _xWriteCH375Data fV
;          mData -> R20
	.even
_xWriteCH375Data::
	xcall push_gset1
	mov R20,R16
	.dbline -1
	.dbline 292
	.dbline 293
	cbi 0x18,0
	.dbline 294
	ldi R24,255
	out 0x1a,R24
	.dbline 295
	out 0x1b,R20
	.dbline 296
	cbi 0x18,1
	.dbline 297
	cbi 0x15,7
	.dbline 298
	cbi 0x15,7
	.dbline 299
	in R24,0x15
	ori R24,192
	out 0x15,R24
	.dbline 300
	sbi 0x18,1
	.dbline 301
	xcall _delay_us
	.dbline 302
	xcall _delay_us
	.dbline -2
L114:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r mData 20 c
	.dbend
	.dbfunc e xReadCH375Data _xReadCH375Data fc
;         inData -> R20
	.even
_xReadCH375Data::
	xcall push_gset1
	.dbline -1
	.dbline 310
	.dbline 312
	xcall _delay_us
	.dbline 313
	cbi 0x18,0
	.dbline 314
	clr R2
	out 0x1a,R2
	.dbline 315
	cbi 0x18,1
	.dbline 316
	cbi 0x15,6
	.dbline 317
	cbi 0x15,6
	.dbline 318
	in R20,0x19
	.dbline 319
	in R24,0x15
	ori R24,192
	out 0x15,R24
	.dbline 320
	sbi 0x18,1
	.dbline 321
	mov R16,R20
	.dbline -2
L115:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r inData 20 c
	.dbend
	.dbfunc e ReturnProResult _ReturnProResult fV
	.even
_ReturnProResult::
	.dbline -1
	.dbline 328
	.dbline 329
	lds R2,_OperReturn
	tst R2
	breq L117
	.dbline 330
	.dbline 331
	sts _nComBuff+2,R2
	.dbline 332
	xjmp L118
L117:
	.dbline 334
	.dbline 335
	ldi R24,64
	sts _nComBuff+2,R24
	.dbline 336
L118:
	.dbline -2
L116:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e ReturnErrorCode _ReturnErrorCode fV
;      ErrorCode -> R16
	.even
_ReturnErrorCode::
	.dbline -1
	.dbline 344
	.dbline 345
	ldi R24,255
	sts _DataPrepared,R24
	.dbline 346
	sts _nComBuff+2,R16
	.dbline 347
	ldi R24,3
	ldi R25,0
	sts _nComBuff+1,R25
	sts _nComBuff,R24
	.dbline -2
L121:
	.dbline 0 ; func end
	ret
	.dbsym r ErrorCode 16 c
	.dbend
	.dbfunc e CopyBytes _CopyBytes fV
;              i -> R20,R21
;         number -> R22,R23
;         source -> R18,R19
;    destination -> R16,R17
	.even
_CopyBytes::
	xcall push_gset2
	ldd R22,y+4
	ldd R23,y+5
	.dbline -1
	.dbline 357
	.dbline 359
	clr R20
	clr R21
	xjmp L127
L124:
	.dbline 360
	.dbline 361
	movw R30,R20
	add R30,R18
	adc R31,R19
	ldd R2,z+0
	movw R30,R20
	add R30,R16
	adc R31,R17
	std z+0,R2
	.dbline 362
L125:
	.dbline 359
	subi R20,255  ; offset = 1
	sbci R21,255
L127:
	.dbline 359
	cp R20,R22
	cpc R21,R23
	brlo L124
	.dbline -2
L123:
	xcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym r i 20 i
	.dbsym r number 22 i
	.dbsym r source 18 pc
	.dbsym r destination 16 pc
	.dbend
	.dbfunc e ModuleNewFile _ModuleNewFile fV
;      directory -> R10
	.even
_ModuleNewFile::
	xcall push_gset3
	mov R10,R16
	.dbline -1
	.dbline 370
	.dbline 371
	clr R2
	sts _nComBuff+3+29,R2
	.dbline 372
	ldi R18,<_nComBuff+3
	ldi R19,>_nComBuff+3
	ldi R16,<_mCmdParam
	ldi R17,>_mCmdParam
	xcall _strcpy
	.dbline 373
	xcall _CH375FileCreate
	sts _OperReturn,R16
	.dbline 375
	tst R16
	breq L132
	.dbline 376
	.dbline 377
	xcall _ReturnErrorCode
	.dbline 378
	ldi R24,2
	sts _B_status,R24
	.dbline 379
	xjmp L133
L132:
	.dbline 380
	tst R10
	breq L134
	.dbline 381
	.dbline 382
	ldi R24,16
	sts _mCmdParam+8,R24
	.dbline 383
	ldi R24,65535
	ldi R25,255
	sts _mCmdParam+4+1,R25
	sts _mCmdParam+4,R24
	.dbline 384
	ldi R20,255
	ldi R21,255
	ldi R22,255
	ldi R23,255
	sts _mCmdParam+1,R21
	sts _mCmdParam,R20
	sts _mCmdParam+2+1,R23
	sts _mCmdParam+2,R22
	.dbline 385
	sts _mCmdParam+6+1,R25
	sts _mCmdParam+6,R24
	.dbline 386
	xcall _CH375FileModify
	sts _OperReturn,R16
	.dbline 387
	clr R10
	.dbline 388
	tst R16
	breq L139
	.dbline 389
	.dbline 390
	xcall _ReturnErrorCode
	.dbline 391
	ldi R24,2
	sts _B_status,R24
	.dbline 392
	xjmp L135
L139:
	.dbline 394
	.dbline 395
	ldi R24,1
	sts _mCmdParam,R24
	.dbline 396
	xcall _CH375FileClose
	sts _OperReturn,R16
	.dbline 397
	tst R16
	breq L141
	.dbline 398
	.dbline 399
	xcall _ReturnErrorCode
	.dbline 400
	ldi R24,2
	sts _B_status,R24
	.dbline 401
	xjmp L135
L141:
	.dbline 403
	.dbline 404
	ldi R16,64
	xcall _ReturnErrorCode
	.dbline 405
	ldi R24,2
	sts _B_status,R24
	.dbline 406
	.dbline 408
	.dbline 409
	xjmp L135
L134:
	.dbline 411
	.dbline 413
	ldi R16,64
	xcall _ReturnErrorCode
	.dbline 414
	ldi R24,3
	sts _B_status,R24
	.dbline 415
L135:
L133:
	.dbline -2
L128:
	xcall pop_gset3
	.dbline 0 ; func end
	ret
	.dbsym r directory 10 c
	.dbend
	.dbfunc e StatusReady _StatusReady fV
	.even
_StatusReady::
	xcall push_gset1
	.dbline -1
	.dbline 423
	.dbline 424
	lds R20,_nComBuff+2
	clr R21
	cpi R20,129
	ldi R30,0
	cpc R21,R30
	breq L155
	cpi R20,131
	ldi R30,0
	cpc R21,R30
	breq L148
	cpi R20,129
	ldi R30,0
	cpc R21,R30
	brge X5
	xjmp L144
X5:
L160:
	cpi R20,137
	ldi R30,0
	cpc R21,R30
	breq L154
	cpi R20,140
	ldi R30,0
	cpc R21,R30
	breq L159
	xjmp L144
X4:
	.dbline 425
L148:
	.dbline 427
	clr R2
	sts _nComBuff+3+29,R2
	.dbline 428
	ldi R18,<_nComBuff+3
	ldi R19,>_nComBuff+3
	ldi R16,<_mCmdParam
	ldi R17,>_mCmdParam
	xcall _strcpy
	.dbline 429
	xcall _CH375FileOpen
	sts _OperReturn,R16
	.dbline 430
	tst R16
	breq L152
	.dbline 431
	.dbline 432
	xcall _ReturnErrorCode
	.dbline 433
	ldi R24,2
	sts _B_status,R24
	.dbline 434
	xjmp L145
L152:
	.dbline 436
	.dbline 437
	ldi R16,64
	xcall _ReturnErrorCode
	.dbline 438
	ldi R24,3
	sts _B_status,R24
	.dbline 439
	.dbline 441
	xjmp L145
L154:
	.dbline 443
	clr R16
	xcall _ModuleNewFile
	.dbline 444
	xjmp L145
L155:
	.dbline 446
	clr R2
	sts _nComBuff+3+29,R2
	.dbline 447

⌨️ 快捷键说明

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