From: Abdoulaye Walsimou Gaye <walsi...@walsimou.com>

This patch defines bits for PORT{A,B,C,D,E} and corresponding TRISx 
configuration bits.
To disable bits definition, -DNO_BIT_DEFINES needs to be add at compile time.

Signed-off-by: Abdoulaye Walsimou Gaye <walsi...@walsimou.com>
---
 sdcc/device/include/pic16/pic18f452.h |   98 +++++++++++++++++++++++++++++++++
 1 files changed, 98 insertions(+), 0 deletions(-)

diff --git a/sdcc/device/include/pic16/pic18f452.h 
b/sdcc/device/include/pic16/pic18f452.h
index dd2b7ef..c63d5a8 100644
--- a/sdcc/device/include/pic16/pic18f452.h
+++ b/sdcc/device/include/pic16/pic18f452.h
@@ -64,6 +64,16 @@ typedef union {
 
 extern volatile __PORTAbits_t __at (0xf80) PORTAbits;
 
+#ifndef NO_BIT_DEFINES
+#define RA0 PORTAbits.RA0
+#define RA1 PORTAbits.RA1
+#define RA2 PORTAbits.RA2
+#define RA3 PORTAbits.RA3
+#define RA4 PORTAbits.RA4
+#define RA5 PORTAbits.RA5
+#define RA6 PORTAbits.RA6
+#endif /* NO_BIT_DEFINES */
+
 extern __sfr __at (0xf81) PORTB;
 typedef union {
        struct {
@@ -91,6 +101,17 @@ typedef union {
 
 extern volatile __PORTBbits_t __at (0xf81) PORTBbits;
 
+#ifndef NO_BIT_DEFINES
+#define RB0 PORTBbits.RB0
+#define RB1 PORTBbits.RB1
+#define RB2 PORTBbits.RB2
+#define RB3 PORTBbits.RB3
+#define RB4 PORTBbits.RB4
+#define RB5 PORTBbits.RB5
+#define RB6 PORTBbits.RB6
+#define RB7 PORTBbits.RB7
+#endif /* NO_BIT_DEFINES */
+
 extern __sfr __at (0xf82) PORTC;
 typedef union {
        struct {
@@ -129,6 +150,17 @@ typedef union {
 
 extern volatile __PORTCbits_t __at (0xf82) PORTCbits;
 
+#ifndef NO_BIT_DEFINES
+#define RC0 PORTCbits.RC0
+#define RC1 PORTCbits.RC1
+#define RC2 PORTCbits.RC2
+#define RC3 PORTCbits.RC3
+#define RC4 PORTCbits.RC4
+#define RC5 PORTCbits.RC5
+#define RC6 PORTCbits.RC6
+#define RC7 PORTCbits.RC7
+#endif /* NO_BIT_DEFINES */
+
 extern __sfr __at (0xf83) PORTD;
 typedef union {
        struct {
@@ -156,6 +188,17 @@ typedef union {
 
 extern volatile __PORTDbits_t __at (0xf83) PORTDbits;
 
+#ifndef NO_BIT_DEFINES
+#define RD0 PORTDbits.RD0
+#define RD1 PORTDbits.RD1
+#define RD2 PORTDbits.RD2
+#define RD3 PORTDbits.RD3
+#define RD4 PORTDbits.RD4
+#define RD5 PORTDbits.RD5
+#define RD6 PORTDbits.RD6
+#define RD7 PORTDbits.RD7
+#endif /* NO_BIT_DEFINES */
+
 extern __sfr __at (0xf84) PORTE;
 typedef union {
        struct {
@@ -194,6 +237,12 @@ typedef union {
 
 extern volatile __PORTEbits_t __at (0xf84) PORTEbits;
 
+#ifndef NO_BIT_DEFINES
+#define RE0 PORTEbits.RE0
+#define RE1 PORTEbits.RE1
+#define RE2 PORTEbits.RE2
+#endif /* NO_BIT_DEFINES */
+
 extern __sfr __at (0xf89) LATA;
 typedef union {
        struct {
@@ -290,6 +339,16 @@ typedef union {
 
 extern volatile __TRISAbits_t __at (0xf92) TRISAbits;
 
+#ifndef NO_BIT_DEFINES
+#define TRISA0 TRISAbits.TRISA0
+#define TRISA1 TRISAbits.TRISA1
+#define TRISA2 TRISAbits.TRISA2
+#define TRISA3 TRISAbits.TRISA3
+#define TRISA4 TRISAbits.TRISA4
+#define TRISA5 TRISAbits.TRISA5
+#define TRISA6 TRISAbits.TRISA6
+#endif /* NO_BIT_DEFINES */
+
 extern __sfr __at (0xf93) TRISB;
 typedef union {
        struct {
@@ -306,6 +365,17 @@ typedef union {
 
 extern volatile __TRISBbits_t __at (0xf93) TRISBbits;
 
+#ifndef NO_BIT_DEFINES
+#define TRISB0 TRISBbits.TRISB0
+#define TRISB1 TRISBbits.TRISB1
+#define TRISB2 TRISBbits.TRISB2
+#define TRISB3 TRISBbits.TRISB3
+#define TRISB4 TRISBbits.TRISB4
+#define TRISB5 TRISBbits.TRISB5
+#define TRISB6 TRISBbits.TRISB6
+#define TRISB7 TRISBbits.TRISB7
+#endif /* NO_BIT_DEFINES */
+
 extern __sfr __at (0xf94) TRISC;
 typedef union {
        struct {
@@ -322,6 +392,17 @@ typedef union {
 
 extern volatile __TRISCbits_t __at (0xf94) TRISCbits;
 
+#ifndef NO_BIT_DEFINES
+#define TRISC0 TRISCbits.TRISC0
+#define TRISC1 TRISCbits.TRISC1
+#define TRISC2 TRISCbits.TRISC2
+#define TRISC3 TRISCbits.TRISC3
+#define TRISC4 TRISCbits.TRISC4
+#define TRISC5 TRISCbits.TRISC5
+#define TRISC6 TRISCbits.TRISC6
+#define TRISC7 TRISCbits.TRISC7
+#endif /* NO_BIT_DEFINES */
+
 extern __sfr __at (0xf95) TRISD;
 typedef union {
        struct {
@@ -338,6 +419,17 @@ typedef union {
 
 extern volatile __TRISDbits_t __at (0xf95) TRISDbits;
 
+#ifndef NO_BIT_DEFINES
+#define TRISD0 TRISDbits.TRISD0
+#define TRISD1 TRISDbits.TRISD1
+#define TRISD2 TRISDbits.TRISD2
+#define TRISD3 TRISDbits.TRISD3
+#define TRISD4 TRISDbits.TRISD4
+#define TRISD5 TRISDbits.TRISD5
+#define TRISD6 TRISDbits.TRISD6
+#define TRISD7 TRISDbits.TRISD7
+#endif /* NO_BIT_DEFINES */
+
 extern __sfr __at (0xf96) TRISE;
 typedef union {
        struct {
@@ -354,6 +446,12 @@ typedef union {
 
 extern volatile __TRISEbits_t __at (0xf96) TRISEbits;
 
+#ifndef NO_BIT_DEFINES
+#define TRISE0 TRISEbits.TRISE0
+#define TRISE1 TRISEbits.TRISE1
+#define TRISE2 TRISEbits.TRISE2
+#endif /* NO_BIT_DEFINES */
+
 extern __sfr __at (0xf9d) PIE1;
 typedef union {
        struct {
-- 
1.5.6.3


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to