[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] SPMEN vs SELFPRGEN
From: |
Ivan Shmakov |
Subject: |
[avr-libc-dev] SPMEN vs SELFPRGEN |
Date: |
Thu, 03 Jan 2008 22:35:35 +0600 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
>>>>> Ivan Shmakov <address@hidden> writes:
[...]
> BTW, since SPMEN seems to be frequent alias to SELFPRGEN, why not to
> define one of them in a common file (`io.h'?) instead of defining
> both in each of the part-specific headers (where applicable)? E. g.:
> #if defined (SPMEN) && ! defined (SELFPRGEN)
> # define SELFPRGEN SPMEN
> #endif
As of a recent CVS HEAD, both macros are provided by the
following files:
$ grep -lF SPMEN io*.h | xargs -r -- grep -lE 'SELFPRGEN[^~]*$' --
=> iomx8.h iotn13.h iotn2313.h
These ones are providing `SPMEN' only:
$ grep -lF SPMEN io*.h | grep -xvFf both.list
=> io90pwm1.h io90pwm216.h io90pwm2b.h io90pwm316.h io90pwm3b.h
io90pwmx.h iocanxx.h iom1284p.h iom128.h iom161.h iom162.h iom163.h
iom165.h iom165p.h iom169.h iom169p.h iom16.h iom323.h iom3250.h
iom325.h iom3290.h iom329.h iom32.h iom32hvb.h iom406.h iom6450.h
iom645.h iom6490.h iom649.h iom64.h iom8515.h iom8535.h iom8.h
iomxx0_1.h iomxx4.h iomxxhva.h iotnx4.h iotnx5.h iotnx61.h iousbxx2.h
iousbxx6_7.h
While these are providing `SELFPRGEN' only:
$ grep -E 'SELFPRGEN[^~]*$' io*.h | grep -xvFf both.list
=> iom168p.h iom328p.h iom48p.h iom88p.h iotn48.h iotn88.h
There's a file that provides `SELFPRGE' as well:
$ grep -lE SELFPRGE\[^N\] *.h
=> iotn2313.h
May I suggest removing the duplicate definitions and putting
something like this bit into `avr/common.h' instead:
#if defined (SPMEN) && ! defined (SELFPRGEN)
# define SELFPRGEN SPMEN
#endif
Or are there any issues I'm missing?
Since `SPMEN' seems to be used more widely in the AVR Libc
includes as the name for the bit, I suggest replacing
`SELFPRGEN' with `SPMEN' in the macro definitions in the
individual io*.h files, like the following. (Though it could
easily done the other way around.)
diff --git a/include/avr/common.h b/include/avr/common.h
index 9d614e2..e690b60 100755
--- a/include/avr/common.h
+++ b/include/avr/common.h
@@ -231,5 +231,9 @@ and families.
# define AVR_EXTENDED_INDIRECT_ADDR _SFR_IO_ADDR(EIND)
#endif
+/* SELFPRGEN is the name used in datasheets */
+#if defined (SPMEN) && ! defined (SELFPRGEN)
+# define SELFPRGEN SPMEN
+#endif
#endif /* _AVR_COMMON_H */
diff --git a/include/avr/iom168p.h b/include/avr/iom168p.h
old mode 100755
new mode 100644
index bddfaad..1a926b1
--- a/include/avr/iom168p.h
+++ b/include/avr/iom168p.h
@@ -330,7 +330,7 @@
#define BODS 6
#define SPMCSR _SFR_IO8(0x37)
-#define SELFPRGEN 0
+#define SPMEN 0
#define PGERS 1
#define PGWRT 2
#define BLBSET 3
diff --git a/include/avr/iom328p.h b/include/avr/iom328p.h
old mode 100755
new mode 100644
index 85370cf..e9215b3
--- a/include/avr/iom328p.h
+++ b/include/avr/iom328p.h
@@ -331,7 +331,7 @@
#define BODS 6
#define SPMCSR _SFR_IO8(0x37)
-#define SELFPRGEN 0
+#define SPMEN 0
#define PGERS 1
#define PGWRT 2
#define BLBSET 3
diff --git a/include/avr/iom48p.h b/include/avr/iom48p.h
old mode 100755
new mode 100644
index 2597fa4..6a4616c
--- a/include/avr/iom48p.h
+++ b/include/avr/iom48p.h
@@ -328,7 +328,7 @@
#define BODS 6
#define SPMCSR _SFR_IO8(0x37)
-#define SELFPRGEN 0
+#define SPMEN 0
#define PGERS 1
#define PGWRT 2
#define BLBSET 3
diff --git a/include/avr/iom88p.h b/include/avr/iom88p.h
old mode 100755
new mode 100644
index 77dfc83..4572b3d
--- a/include/avr/iom88p.h
+++ b/include/avr/iom88p.h
@@ -330,7 +330,7 @@
#define BODS 6
#define SPMCSR _SFR_IO8(0x37)
-#define SELFPRGEN 0
+#define SPMEN 0
#define PGERS 1
#define PGWRT 2
#define BLBSET 3
diff --git a/include/avr/iomx8.h b/include/avr/iomx8.h
index cdbb843..6945f62 100644
--- a/include/avr/iomx8.h
+++ b/include/avr/iomx8.h
@@ -312,7 +312,6 @@ must be defined for the mega48.
#define BLBSET 3
#define PGWRT 2
#define PGERS 1
-#define SELFPRGEN 0
#define SPMEN 0
/* 0x3D..0x3E SP [defined in <avr/io.h>] */
diff --git a/include/avr/iotn13.h b/include/avr/iotn13.h
index e6078d7..5cdd802 100644
--- a/include/avr/iotn13.h
+++ b/include/avr/iotn13.h
@@ -243,7 +243,6 @@
# define PGWRT 2
# define PGERS 1
# define SPMEN 0
-# define SELFPRGEN 0
/* Timer/Counter 0 Interrupt Flag Register */
#define TIFR0 _SFR_IO8(0x38)
diff --git a/include/avr/iotn2313.h b/include/avr/iotn2313.h
index 95a9fef..f58c4bf 100644
--- a/include/avr/iotn2313.h
+++ b/include/avr/iotn2313.h
@@ -454,7 +454,6 @@
#define PGWRT 2
#define PGERS 1
#define SPMEN 0 /* The name is used in ATtiny2313.xml file. */
-#define SELFPRGEN 0 /* The name is used in datasheet. */
#define SELFPRGE 0 /* The name is left for compatibility. */
/* ATtiny Timer/Counter Interrupt Flag register TIFR */
diff --git a/include/avr/iotn48.h b/include/avr/iotn48.h
index 3d1e909..d5a6139 100644
--- a/include/avr/iotn48.h
+++ b/include/avr/iotn48.h
@@ -354,7 +354,7 @@
#define PUD 4
#define SPMCSR _SFR_IO8(0x37)
-#define SELFPRGEN 0
+#define SPMEN 0
#define PGERS 1
#define PGWRT 2
#define BLBSET 3
diff --git a/include/avr/iotn88.h b/include/avr/iotn88.h
index 2b6f3f8..24a8f14 100644
--- a/include/avr/iotn88.h
+++ b/include/avr/iotn88.h
@@ -345,7 +345,7 @@
#define BODS 6
#define SPMCSR _SFR_IO8(0x37)
-#define SELFPRGEN 0
+#define SPMEN 0
#define PGERS 1
#define PGWRT 2
#define RFLB 3
- [avr-libc-dev] SPMEN vs SELFPRGEN,
Ivan Shmakov <=
- RE: [avr-libc-dev] SPMEN vs SELFPRGEN, Weddington, Eric, 2008/01/03
- [avr-libc-dev] Re: SPMEN vs SELFPRGEN, Ivan Shmakov, 2008/01/03
- RE: [avr-libc-dev] Re: SPMEN vs SELFPRGEN, Weddington, Eric, 2008/01/03
- [avr-libc-dev] Re: SPMEN vs SELFPRGEN, Ivan Shmakov, 2008/01/03
- Re: [avr-libc-dev] Re: SPMEN vs SELFPRGEN, Joerg Wunsch, 2008/01/03
- RE: [avr-libc-dev] Re: SPMEN vs SELFPRGEN, Weddington, Eric, 2008/01/03
- [avr-libc-dev] Re: SPMEN vs SELFPRGEN, Ivan Shmakov, 2008/01/04