euart.h
Go to the documentation of this file.
00001 #ifndef __MSP430WARE_EUART_H__
00002 #define __MSP430WARE_EUART_H__
00003 
00004 //*****************************************************************************
00005 //
00006 //The following are the defines to include the required modules for this
00007 //peripheral in msp430xgeneric.h file
00008 //
00009 //*****************************************************************************
00010 #define __MSP430_HAS_EUSCI_Ax__
00011 
00012 //*****************************************************************************
00013 //
00014 //The following are values that can be passed to the eUART_init() API
00015 //as the parity parameter.
00016 //
00017 //*****************************************************************************
00018 #define eUART_NO_PARITY   0x00
00019 #define eUART_ODD_PARITY  0x01
00020 #define eUART_EVEN_PARITY 0x02
00021 
00022 //*****************************************************************************
00023 //
00024 //The following are values that can be passed to the eUART_init() API
00025 //as the selectClockSource parameter.
00026 //
00027 //*****************************************************************************
00028 #define eUART_CLOCKSOURCE_ACLK    UCSSEL__ACLK
00029 #define eUART_CLOCKSOURCE_SMCLK   UCSSEL__SMCLK
00030 
00031 //*****************************************************************************
00032 
00033 //*****************************************************************************
00034 //
00035 //The following are values that can be passed to the eUART_init() API
00036 //as the numberofStopBits parameter.
00037 //
00038 //*****************************************************************************
00039 #define eUART_ONE_STOP_BIT    0x00
00040 #define eUART_TWO_STOP_BITS   UCSPB
00041 
00042 
00043 //*****************************************************************************
00044 //
00045 //The following are values that can be passed to the eUART_init() API
00046 //as the msborLsbFirst parameter.
00047 //
00048 //*****************************************************************************
00049 #define eUART_MSB_FIRST    UCMSB
00050 #define eUART_LSB_FIRST    0x00
00051 
00052 //*****************************************************************************
00053 //
00054 //The following are values that can be passed to the eUART_getInterruptStatus(),
00055 //as the mask parameter.
00056 //
00057 //*****************************************************************************
00058 #define eUART_RECEIVE_INTERRUPT_FLAG            UCRXIFG
00059 #define eUART_TRANSMIT_INTERRUPT_FLAG           UCTXIFG
00060 
00061 //*****************************************************************************
00062 //
00063 //The following are values that can be passed to the eUART_enableInterrupt(),
00064 //eUART_disableInterrupt() API as the mask parameter.
00065 //
00066 //*****************************************************************************
00067 #define eUART_RECEIVE_INTERRUPT                  UCRXIE
00068 #define eUART_TRANSMIT_INTERRUPT                 UCTXIE
00069 #define eUART_RECEIVE_ERRONEOUSCHAR_INTERRUPT    UCRXEIE
00070 #define eUART_BREAKCHAR_INTERRUPT                UCBRKIE
00071 
00072 //*****************************************************************************
00073 //
00074 //The following are values that can be passed to the eUART_selectDeglitchTime()
00075 //API as the deglitchTime parameter.
00076 //
00077 //*****************************************************************************
00078 #define eUART_DEGLITCH_TIME_2ns         0x00
00079 #define eUART_DEGLITCH_TIME_50ns        UCGLIT0
00080 #define eUART_DEGLITCH_TIME_100ns       UCGLIT1
00081 #define eUART_DEGLITCH_TIME_200ns       (UCGLIT0 + UCGLIT1)
00082 
00083 //*****************************************************************************
00084 //
00085 //The following are values that can be passed to the eUART_queryStatusFlags()
00086 //API as the mask parameter.
00087 //
00088 //*****************************************************************************
00089 #define eUART_LISTEN_ENABLE      UCLISTEN
00090 #define eUART_FRAMING_ERROR      UCFE
00091 #define eUART_OVERRUN_ERROR      UCOE
00092 #define eUART_PARITY_ERROR       UCPE
00093 #define eUARTBREAK_DETECT        UCBRK
00094 #define eUART_RECEIVE_ERROR      UCRXERR
00095 #define eUART_ADDRESS_RECEIVED   UCADDR
00096 #define eUART_IDLELINE           UCIDLE
00097 #define eUART_BUSY               UCBUSY
00098 
00099 //*****************************************************************************
00100 //
00101 //The following are values that can be passed to the eUART_init()
00102 //API as the mode parameter.
00103 //
00104 //*****************************************************************************
00105 #define eUART_MODE                              UCMODE_0
00106 #define eUART_IDLE_LINE_MULTI_PROCESSOR_MODE    UCMODE_1
00107 #define eUART_ADDRESS_BIT_MULTI_PROCESSOR_MODE  UCMODE_2
00108 #define eUART_AUTOMATIC_BAUDRATE_DETECTION_MODE UCMODE_3
00109 
00110 //*****************************************************************************
00111 //
00112 //The following are values that can be passed to the eUART_init()
00113 //API as the overSampling parameter.
00114 //
00115 //*****************************************************************************
00116 #define eUART_OVERSAMPLING_BAUDRATE_GENERATION     0x01
00117 #define eUART_LOW_FREQUENCY_BAUDRATE_GENERATION    0x00
00118 
00119 
00120 //*****************************************************************************
00121 //
00122 //The following are values are the sync characters possible
00123 //
00124 //*****************************************************************************
00125 #define DEFAULT_SYNC 0x00
00126 #define eUART_AUTOMATICBAUDRATE_SYNC 0x55
00127 
00128 //*****************************************************************************
00129 //
00130 //Prototypes for the APIs.
00131 //
00132 //*****************************************************************************
00133 extern
00134 unsigned short eUART_init ( unsigned int baseAddress,
00135     unsigned char selectClockSource,
00136     unsigned long clockSourceFrequency,
00137     unsigned long desiredUartBaudRate,
00138     unsigned char parity,
00139     unsigned char msborLsbFirst,
00140     unsigned char numberofStopBits,
00141     unsigned char uartMode,
00142     unsigned short overSampling
00143     );
00144 extern
00145 unsigned short eUART_initAdvance ( unsigned int baseAddress,
00146     unsigned char selectClockSource,
00147     unsigned int clockPrescalar,
00148     unsigned char firstModReg,
00149     unsigned char secondModReg,
00150     unsigned char parity,
00151     unsigned char msborLsbFirst,
00152     unsigned char numberofStopBits,
00153     unsigned char uartMode,
00154     unsigned short overSampling
00155     );
00156 extern
00157 void eUART_transmitData ( unsigned int baseAddress,
00158     unsigned char transmitData
00159     );
00160 extern
00161 unsigned char eUART_receiveData (unsigned int baseAddress);
00162 extern
00163 void eUART_enableInterrupt (unsigned int baseAddress,
00164     unsigned char mask
00165     );
00166 extern
00167 void eUART_disableInterrupt (unsigned int baseAddress,
00168     unsigned char mask
00169     );
00170 extern
00171 unsigned char eUART_getInterruptStatus (unsigned int baseAddress,
00172     unsigned char mask
00173     );
00174 extern
00175 void eUART_clearInterruptFlag (unsigned int baseAddress,
00176     unsigned char mask
00177     );
00178 extern
00179 void eUART_enable (unsigned int baseAddress);
00180 extern
00181 void eUART_disable (unsigned int baseAddress);
00182 extern
00183 unsigned char eUART_queryStatusFlags (unsigned int baseAddress,
00184     unsigned char mask);
00185 extern
00186 void eUART_setDormant (unsigned int baseAddress);
00187 extern
00188 void eUART_resetDormant (unsigned int baseAddress);
00189 extern
00190 void eUART_transmitAddress (unsigned int baseAddress,
00191     unsigned char transmitAddress);
00192 extern
00193 void eUART_transmitBreak (unsigned int baseAddress);
00194 extern
00195 unsigned long eUART_getReceiveBufferAddressForDMA (unsigned int baseAddress);
00196 extern
00197 unsigned long eUART_getTransmitBufferAddressForDMA (unsigned int baseAddress);
00198 extern
00199 void eUART_selectDeglitchTime(unsigned int baseAddress,
00200                         unsigned long deglitchTime
00201                         );
00202 #endif

Copyright 2012, Texas Instruments Incorporated