annotate src/external_flash.inc @ 282:7d9edd3b8c86

Make a more compact COMPASS calibration code (<7KB), and add more tests.
author jDG
date Fri, 22 May 2015 14:50:40 +0200
parents eb758a5b44eb
children 789230298511
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
heinrichsweikamp
parents:
diff changeset
3 ; File external_flash.inc
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ;
heinrichsweikamp
parents:
diff changeset
6 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
7 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
8 ; HISTORY
heinrichsweikamp
parents:
diff changeset
9 ; 2011-08-12 : [mH] creation
heinrichsweikamp
parents:
diff changeset
10
heinrichsweikamp
parents:
diff changeset
11 ; Misc
heinrichsweikamp
parents:
diff changeset
12 extern ext_flash_power_down ; Put Flash in Deep Power Down
heinrichsweikamp
parents:
diff changeset
13 extern incf_ext_flash_address_p1 ; +1 for the ext_flash_address:3
heinrichsweikamp
parents:
diff changeset
14 extern ext_flash_disable_protection; Disables write protection
heinrichsweikamp
parents:
diff changeset
15 extern ext_flash_enable_protection ; Enables write protection
281
eb758a5b44eb BUGFIX: Fix download issue for dives made with 1.80 firmware
heinrichsweikamp
parents: 279
diff changeset
16 extern fix_180_dives ; fix dives made with the 1.80
0
heinrichsweikamp
parents:
diff changeset
17
heinrichsweikamp
parents:
diff changeset
18 ; Writes
heinrichsweikamp
parents:
diff changeset
19 extern write_byte_ext_flash_plus ; Write from WREG and increase address after write with banking at 0x200000
279
62c7af4795b0 bugfix wrong profile length in header
heinrichsweikamp
parents: 278
diff changeset
20 extern write_byte_ext_flash_plus_nocnt ; No increase of ext_flash_dive_counter:3
278
dfac47ac2e1d BUGFIX: There was a 1:4096 chance that a portion of a dive was not stored correctly resulting in download issues
heinrichsweikamp
parents: 6
diff changeset
21 extern write_byte_ext_flash_plus_nodel ; Does NOT delete 4kB Page when required
0
heinrichsweikamp
parents:
diff changeset
22 extern write_byte_ext_flash_plus_header ; Write from WREG and increase address after write
heinrichsweikamp
parents:
diff changeset
23 extern ext_flash_byte_write ; Writes one byte from WREG @ext_flash_address:3
heinrichsweikamp
parents:
diff changeset
24 extern write_spi1 ; Just (dummy)write to read a byte
heinrichsweikamp
parents:
diff changeset
25
heinrichsweikamp
parents:
diff changeset
26 ; Delelte
heinrichsweikamp
parents:
diff changeset
27 extern ext_flash_erase_logbook ; erases logbook memory (000000h -> 2FFFFFh -> 3MByte)
heinrichsweikamp
parents:
diff changeset
28 extern ext_flash_erase4kB ; Erases 4kB sector @ext_flash_address:3
heinrichsweikamp
parents:
diff changeset
29
heinrichsweikamp
parents:
diff changeset
30 ; Reads
heinrichsweikamp
parents:
diff changeset
31 extern ext_flash_read_block_start ; Block read start and reads one byte@ext_flash_address:3 into WREG
heinrichsweikamp
parents:
diff changeset
32 extern ext_flash_read_block ; Read another byte into WREG
heinrichsweikamp
parents:
diff changeset
33 extern ext_flash_read_block_stop ; Stop block read
heinrichsweikamp
parents:
diff changeset
34 extern ext_flash_byte_read ; Reads one byte@ext_flash_address:3 into WREG and temp1
heinrichsweikamp
parents:
diff changeset
35 extern ext_flash_byte_read_plus ; Return data read in WREG and temp1 and increase address after read with banking at 0x200000
heinrichsweikamp
parents:
diff changeset
36 extern ext_flash_byte_read_plus_0x20; Return data read in WREG and temp1
heinrichsweikamp
parents:
diff changeset
37
heinrichsweikamp
parents:
diff changeset
38 ; Will decrease ext_flash_address:2 with the 8Bit value "ext_flash_temp1"
heinrichsweikamp
parents:
diff changeset
39 extern decf_ext_flash_address0
heinrichsweikamp
parents:
diff changeset
40 decf_ext_flash_address macro ext_flash_temp1
heinrichsweikamp
parents:
diff changeset
41 movlw ext_flash_temp1
heinrichsweikamp
parents:
diff changeset
42 call decf_ext_flash_address0
heinrichsweikamp
parents:
diff changeset
43 endm
heinrichsweikamp
parents:
diff changeset
44
heinrichsweikamp
parents:
diff changeset
45 extern incf_ext_flash_address0
heinrichsweikamp
parents:
diff changeset
46 ; Will increase ext_flash_address:2 with the 8Bit value "ext_flash_temp1"
heinrichsweikamp
parents:
diff changeset
47 incf_ext_flash_address macro ext_flash_temp1
heinrichsweikamp
parents:
diff changeset
48 movlw ext_flash_temp1
heinrichsweikamp
parents:
diff changeset
49 call incf_ext_flash_address0
heinrichsweikamp
parents:
diff changeset
50 endm
heinrichsweikamp
parents:
diff changeset
51
heinrichsweikamp
parents:
diff changeset
52 ; With banking at 0x200000
heinrichsweikamp
parents:
diff changeset
53 extern incf_ext_flash_address0_0x20
heinrichsweikamp
parents:
diff changeset
54 ; Will increase ext_flash_address:2 with the 8Bit value "ext_flash_temp1"
heinrichsweikamp
parents:
diff changeset
55 incf_ext_flash_address_0x20 macro ext_flash_temp1
heinrichsweikamp
parents:
diff changeset
56 movlw ext_flash_temp1
heinrichsweikamp
parents:
diff changeset
57 call incf_ext_flash_address0_0x20
heinrichsweikamp
parents:
diff changeset
58 endm
heinrichsweikamp
parents:
diff changeset
59
heinrichsweikamp
parents:
diff changeset
60