comparison src/comm.asm @ 273:12ee30cbced9

CHANGE: Automatically abort connection fail after 2mins (Bluetooth only)
author heinrichsweikamp
date Mon, 04 May 2015 12:56:07 +0200
parents 1207cf9a9408
children 653a3ab08062
comparison
equal deleted inserted replaced
272:98133a799947 273:12ee30cbced9
217 WIN_LEFT comm_warning_column 217 WIN_LEFT comm_warning_column
218 TFT_WRITE_PROM_IMAGE dive_warning2_block ; Show Warning icon 218 TFT_WRITE_PROM_IMAGE dive_warning2_block ; Show Warning icon
219 goto 0x1FF0C 219 goto 0x1FF0C
220 220
221 ;----------------------------------------------------------------------------- 221 ;-----------------------------------------------------------------------------
222 ; Sends external flash from 0x3E0000 to 0x3FD000 (118784bytes) via comm 222 ; send firmware to bootloader
223 ; 223 ;
224 comm_send_firmware: 224 comm_send_firmware:
225 movlw 0x50 ; send echo 225 movlw 0x50 ; send echo
226 movwf TXREG1 226 movwf TXREG1
227 call rs232_wait_tx ; Wait for UART 227 call rs232_wait_tx ; Wait for UART
369 bra comm_download_mode0 ; No, Done. 369 bra comm_download_mode0 ; No, Done.
370 370
371 call rs232_get_byte 371 call rs232_get_byte
372 btfsc rs232_recieve_overflow ; Got byte? 372 btfsc rs232_recieve_overflow ; Got byte?
373 bra comm_download_mode0 ; No, Done. 373 bra comm_download_mode0 ; No, Done.
374 movff RCREG1,up 374 movff RCREG1,up
375 call rs232_get_byte 375 call rs232_get_byte
376 btfsc rs232_recieve_overflow ; Got byte? 376 btfsc rs232_recieve_overflow ; Got byte?
377 bra comm_download_mode0 ; No, Done. 377 bra comm_download_mode0 ; No, Done.
378 movff RCREG1,hi 378 movff RCREG1,hi
379 call rs232_get_byte 379 call rs232_get_byte
384 ; If lo==0, we must precondition hi because there is to many bytes send ! 384 ; If lo==0, we must precondition hi because there is to many bytes send !
385 movf lo,W 385 movf lo,W
386 bnz $+4 386 bnz $+4
387 decf hi,F 387 decf hi,F
388 388
389 ; 6bytes received, send data 389 movlw 0x40
390 comm_send_range2: ; needs ext_flash_address:3 start address and up:hi:lo amount 390 cpfslt up ; Abort when up > 0x3F
391 bra comm_download_mode0 ; Abort
392
393 ; 6bytes received, send data
394 ; needs ext_flash_address:3 start address and up:hi:lo amount
395
391 call ext_flash_read_block_start 396 call ext_flash_read_block_start
392 movwf TXREG1 397 movwf TXREG1
393 398
394 bra comm_send_range24 ; counter 24bit 399 bra comm_send_range24 ; counter 24bit
395 comm_send_range24_loop: 400 comm_send_range24_loop:
545 bra $+4 550 bra $+4
546 bra comm_erase_range4kb ; erases range in 4kB steps (Get 3 bytes address and 1byte amount of 4kB blocks) 551 bra comm_erase_range4kb ; erases range in 4kB steps (Get 3 bytes address and 1byte amount of 4kB blocks)
547 movlw 0x50 552 movlw 0x50
548 cpfseq RCREG1 553 cpfseq RCREG1
549 bra $+4 554 bra $+4
550 bra comm_send_firmware ; sends firmware from external flash from 0x3E0000 to 0x3FD000 (118784bytes) via comm 555 bra comm_send_firmware ; send firmware to bootloader
551 ; movlw "t" 556 ; movlw "t"
552 ; cpfseq RCREG1 557 ; cpfseq RCREG1
553 ; bra $+4 558 ; bra $+4
554 ; goto testloop ; Start raw-data testloop 559 ; goto testloop ; Start raw-data testloop
555 movlw 0xC1 560 movlw 0xC1