hwconf.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __HWCONF_H__
00034 #define __HWCONF_H__
00035
00036 #include "sys/cc.h"
00037
00038 #ifdef __GNUC__
00039 #include <io.h>
00040 #include <signal.h>
00041 #endif
00042
00043 #ifdef __IAR_SYSTEMS_ICC__
00044 #include <io430.h>
00045 #endif
00046
00047 #define HWCONF_PIN(name, port, bit) \
00048 static CC_INLINE void name##_SELECT() {P##port##SEL &= ~(1 << bit);} \
00049 static CC_INLINE void name##_SELECT_IO() {P##port##SEL &= ~(1 << bit);} \
00050 static CC_INLINE void name##_SELECT_PM() {P##port##SEL |= 1 << bit;} \
00051 static CC_INLINE void name##_SET() {P##port##OUT |= 1 << bit;} \
00052 static CC_INLINE void name##_CLEAR() {P##port##OUT &= ~(1 << bit);} \
00053 static CC_INLINE int name##_READ() {return (P##port##IN & (1 << bit));} \
00054 static CC_INLINE void name##_MAKE_OUTPUT() {P##port##DIR |= 1 << bit;} \
00055 static CC_INLINE void name##_MAKE_INPUT() {P##port##DIR &= ~(1 << bit);}
00056
00057 #define HWCONF_IRQ(name, port, bit) \
00058 static CC_INLINE void name##_ENABLE_IRQ() {P##port##IE |= 1 << bit;} \
00059 static CC_INLINE void name##_DISABLE_IRQ() {P##port##IE &= ~(1 << bit);} \
00060 static CC_INLINE int name##_IRQ_ENABLED() {return P##port##IE & (1 << bit);} \
00061 static CC_INLINE void name##_IRQ_EDGE_SELECTD() {P##port##IES |= 1 << bit;} \
00062 static CC_INLINE void name##_IRQ_EDGE_SELECTU() {P##port##IES &= ~(1 << bit);}\
00063 static CC_INLINE int name##_CHECK_IRQ() {return P##port##IFG & (1 << bit);} \
00064 static CC_INLINE int name##_IRQ_PORT() {return port;}
00065
00066 #endif