42 #define HWCONF_PIN(name, port, bit) \
43 static CC_INLINE void name##_SELECT() {P##port##SEL &= ~(1 << bit);} \
44 static CC_INLINE void name##_SELECT_IO() {P##port##SEL &= ~(1 << bit);} \
45 static CC_INLINE void name##_SELECT_PM() {P##port##SEL |= 1 << bit;} \
46 static CC_INLINE void name##_SET() {P##port##_##bit = 1; } \
47 static CC_INLINE void name##_CLEAR() {P##port##_##bit = 0; } \
48 static CC_INLINE unsigned char name##_READ() {return P##port##_##bit; } \
49 static CC_INLINE void name##_MAKE_OUTPUT() {P##port##DIR |= 1 << bit;} \
50 static CC_INLINE void name##_MAKE_INPUT() {P##port##DIR &= ~(1 << bit); }
52 #define HWCONF_IRQ_XXX(name, port, bit) \
53 static CC_INLINE void name##_ENABLE_IRQ() { \
54 if ( port == 2 ) { PICTL |= P2IEN; p2ien |= 1<<bit; } \
55 if (( port == 0) && ( bit <4)) { PICTL |= P0IENL; p0ien |= 1<<bit; } \
56 if ((port == 0) && ( bit >=4)) { PICTL |= P0IENH; p0ien |= 1<<bit; } \
57 if ( port == 1) { P##port##IEN |= 1 << bit; } \
59 static CC_INLINE void name##_DISABLE_IRQ() { \
62 if (p2ien==0) PICTL &= ~P2IEN; \
64 if (( port == 0) && ( bit <4)) { \
66 if ((p0ien&0xf)==0) PICTL &= ~P0IENL; \
68 if (( port == 0) && ( bit >=4)) { \
70 if ((p0ien&0xf0)==0) PICTL &= ~P0IENH; \
72 if ( port == 1) { P##port##IEN &= ~(1 << bit); } \
74 static CC_INLINE int name##_IRQ_ENABLED() {return P##port##IEN & (1 << bit);} \
75 static CC_INLINE int name##_CHECK_IRQ() {return P##port##IFG & (1 << bit);} \
76 static CC_INLINE int name##_IRQ_PORT() {return IRQ_PORT##port;}
78 #define HWCONF_IRQ(name, port, bit) \
79 static CC_INLINE void name##_ENABLE_IRQ() { \
80 if ( port == 1) { P##port##IEN |= 1 << bit; } \
82 static CC_INLINE void name##_DISABLE_IRQ() { \
83 if ( port == 1) { P##port##IEN &= ~(1 << bit); } \
85 static CC_INLINE int name##_IRQ_ENABLED() {return P##port##IEN & (1 << bit);} \
86 static CC_INLINE int name##_CHECK_IRQ() {return P##port##IFG & (1 << bit);} \
87 static CC_INLINE int name##_IRQ_PORT() {return IRQ_PORT##port;}