[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-commit] [2486] patch #8718: Enable EEPROM memory map only for
From: |
Pitchumani |
Subject: |
[avr-libc-commit] [2486] patch #8718: Enable EEPROM memory map only for devices with EEPROM Data Memory Mapping Enable bit (EEMAPEN) |
Date: |
Thu, 20 Aug 2015 06:56:43 +0000 |
Revision: 2486
http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2486
Author: pitchumani
Date: 2015-08-20 06:56:42 +0000 (Thu, 20 Aug 2015)
Log Message:
-----------
patch #8718: Enable EEPROM memory map only for devices with EEPROM Data Memory
Mapping Enable bit (EEMAPEN)
Ticket Links:
------------
http://savannah.gnu.org/patch/?8718
Modified Paths:
--------------
trunk/avr-libc/ChangeLog
trunk/avr-libc/NEWS
trunk/avr-libc/libc/misc/eerd_block.S
trunk/avr-libc/libc/misc/eerd_byte.S
trunk/avr-libc/libc/misc/eewr_byte.S
trunk/avr-libc/libc/misc/readme_eeprom.txt
Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog 2015-08-17 06:54:42 UTC (rev 2485)
+++ trunk/avr-libc/ChangeLog 2015-08-20 06:56:42 UTC (rev 2486)
@@ -1,3 +1,13 @@
+2015-08-20 Pitchumani Sivanupandi <address@hidden>
+
+ patch #8718: Enable EEPROM memory map only for devices with
+ EEPROM Data Memory Mapping Enable bit (EEMAPEN)
+ * libc/misc/eerd_byte.S (eeprom_read_byte): Enable EEPROM map
+ only when NVM_EEMAPEN_bm is defined.
+ * libc/misc/eerd_block.S (eeprom_read_block): Likewise.
+ * libc/misc/eewr_byte.S (eeprom_write_byte): Likewise.
+ * libc/misc/readme_eeprom.txt: Update comments for default EEPROM map.
+
2015-08-17 Praveen Kumar Kaushik
Pitchumani Sivanupandi <address@hidden>
Modified: trunk/avr-libc/NEWS
===================================================================
--- trunk/avr-libc/NEWS 2015-08-17 06:54:42 UTC (rev 2485)
+++ trunk/avr-libc/NEWS 2015-08-20 06:56:42 UTC (rev 2486)
@@ -36,6 +36,8 @@
[#8590] WDT enable/disable for devices with CCP
[#8610] Remove eeprom function name mangling
[#8716] Enable setjmp/longjmp functions for AVR_TINY architecture
+ [#8718] Enable EEPROM memory map only for devices with EEPROM Data Memory
+ Mapping Enable bit (EEMAPEN)
* Other changes:
Modified: trunk/avr-libc/libc/misc/eerd_block.S
===================================================================
--- trunk/avr-libc/libc/misc/eerd_block.S 2015-08-17 06:54:42 UTC (rev
2485)
+++ trunk/avr-libc/libc/misc/eerd_block.S 2015-08-20 06:56:42 UTC (rev
2486)
@@ -61,7 +61,16 @@
ENTRY eeprom_read_block
#if __AVR_XMEGA__ /* -------------------------------------------- */
-
+
+ ; It has to be noted that for some Xmega parts (Eg. Xmega E family) EEPROM
+ ; is always memory mapped. So it is not required to enable EEPROM mapping
+ ; explicitly.
+ ; The presence of NVM_EEMAPEN_bm macro (from the part header file) can be
+ ; checked to find out whether the device supports enabling/disabling of
+ ; EEPROM mapping. Absence of NVM_EEMAPEN_bm could be interpreted safely as
+ ; EEPROM always memory mapped and explicit memory mapping of EEPROM is not
+ ; required/invalid.
+#if defined (NVM_EEMAPEN_bm)
; Load base address of NVM.
ldi ZL, lo8(NVM_BASE)
ldi ZH, hi8(NVM_BASE)
@@ -75,6 +84,7 @@
ldd XL, Z + NVM_CTRLB - NVM_BASE
ori XL, NVM_EEMAPEN_bm
std Z + NVM_CTRLB - NVM_BASE, XL
+#endif
; Correct EEPROM address to read from data space.
subi eepr_lo, lo8(-MAPPED_EEPROM_START)
Modified: trunk/avr-libc/libc/misc/eerd_byte.S
===================================================================
--- trunk/avr-libc/libc/misc/eerd_byte.S 2015-08-17 06:54:42 UTC (rev
2485)
+++ trunk/avr-libc/libc/misc/eerd_byte.S 2015-08-20 06:56:42 UTC (rev
2486)
@@ -55,6 +55,15 @@
ENTRY eeprom_mapen
+ ; It has to be noted that for some Xmega parts (Eg. Xmega E family) EEPROM
+ ; is always memory mapped. So it is not required to enable EEPROM mapping
+ ; explicitly.
+ ; The presence of NVM_EEMAPEN_bm macro (from the part header file) can be
+ ; checked to find out whether the device supports enabling/disabling of
+ ; EEPROM mapping. Absence of NVM_EEMAPEN_bm could be interpreted safely as
+ ; EEPROM always memory mapped and explicit memory mapping of EEPROM is not
+ ; required/invalid.
+#if defined (NVM_EEMAPEN_bm)
; Load base address of NVM.
ldi ZL, lo8(NVM_BASE)
ldi ZH, hi8(NVM_BASE)
@@ -68,6 +77,7 @@
ldd r19, Z + NVM_CTRLB - NVM_BASE
ori r19, NVM_EEMAPEN_bm
std Z + NVM_CTRLB - NVM_BASE, r19
+#endif
; Load Z with correct EEPROM address to read from data space.
movw ZL, addr_lo
Modified: trunk/avr-libc/libc/misc/eewr_byte.S
===================================================================
--- trunk/avr-libc/libc/misc/eewr_byte.S 2015-08-17 06:54:42 UTC (rev
2485)
+++ trunk/avr-libc/libc/misc/eewr_byte.S 2015-08-20 06:56:42 UTC (rev
2486)
@@ -70,6 +70,15 @@
sbrc r19, NVM_NVMBUSY_bp
rjmp 1b
+ ; It has to be noted that for some Xmega parts (Eg. Xmega E family) EEPROM
+ ; is always memory mapped. So it is not possible to disable EEPROM mapping
+ ; explicitly.
+ ; The presence of NVM_EEMAPEN_bm macro (from the part header file) can be
+ ; checked to find out whether the device supports enabling/disabling of
+ ; EEPROM mapping. Absence of NVM_EEMAPEN_bm could be interpreted safely as
+ ; EEPROM always memory mapped and explicit memory mapping of EEPROM is not
+ ; required/invalid.
+#if defined (NVM_EEMAPEN_bm)
; Disable EEPROM mapping into data space.
ldd r19, Z + NVM_CTRLB - NVM_BASE
andi r19, ~NVM_EEMAPEN_bm
@@ -103,10 +112,18 @@
; Issue EEPROM Buffer Load command.
3: ldi r19, NVM_CMD_LOAD_EEPROM_BUFFER_gc
std Z + NVM_CMD - NVM_BASE, r19
+#endif
std Z + NVM_ADDR0 - NVM_BASE, addr_lo
std Z + NVM_ADDR1 - NVM_BASE, addr_hi
std Z + NVM_ADDR2 - NVM_BASE, __zero_reg__
+#if defined (NVM_EEMAPEN_bm)
std Z + NVM_DATA0 - NVM_BASE, r18
+#else
+ movw XL, addr_lo
+ subi XL, lo8(-MAPPED_EEPROM_START)
+ sbci XH, hi8(-MAPPED_EEPROM_START)
+ st X, r18
+#endif
; Issue EEPROM Erase & Write command.
ldi r18, NVM_CMD_ERASE_WRITE_EEPROM_PAGE_gc
Modified: trunk/avr-libc/libc/misc/readme_eeprom.txt
===================================================================
--- trunk/avr-libc/libc/misc/readme_eeprom.txt 2015-08-17 06:54:42 UTC (rev
2485)
+++ trunk/avr-libc/libc/misc/readme_eeprom.txt 2015-08-20 06:56:42 UTC (rev
2486)
@@ -121,4 +121,5 @@
Output:
r25,r24 - incremented EEPROM address
Scratch:
- r31,r30,r19,r18
+ r31,r30,r27,r26,r19,r18
+ Only r27,r26 is used when EEPROM is always memory mapped
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-commit] [2486] patch #8718: Enable EEPROM memory map only for devices with EEPROM Data Memory Mapping Enable bit (EEMAPEN),
Pitchumani <=