espi.h
Go to the documentation of this file.
00001 #ifndef __MSP430WARE_EUSCI_SPI_H__
00002 #define __MSP430WARE_EUSCI_SPI_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 SPI_masterInit() API
00015 //as the selectClockSource parameter.
00016 //
00017 //*****************************************************************************
00018 #define eSPI_CLOCKSOURCE_ACLK    UCSSEL__ACLK
00019 #define eSPI_CLOCKSOURCE_SMCLK   UCSSEL__SMCLK
00020 
00021 //*****************************************************************************
00022 //
00023 //The following are values that can be passed to the eSPI_masterInit() ,
00024 //eSPI_slaveInit() API as the msbFirst parameter.
00025 //
00026 //*****************************************************************************
00027 #define eSPI_MSB_FIRST    UCMSB
00028 #define eSPI_LSB_FIRST    0x00
00029 
00030 //*****************************************************************************
00031 //
00032 //The following are values that can be returned by the eSPI_isBusy() API
00033 //
00034 //*****************************************************************************
00035 #define eSPI_BUSY        UCBUSY
00036 #define eSPI_NOT_BUSY    0x00
00037 
00038 //*****************************************************************************
00039 //
00040 //The following are values that can be passed to the eSPI_masterInit() ,
00041 //eSPI_slaveInit() API as the clockPhase parameter.
00042 //
00043 //*****************************************************************************
00044 #define eSPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT    0x00
00045 #define eSPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT    UCCKPH
00046 
00047 //*****************************************************************************
00048 //
00049 //The following are values that can be passed to the eSPI_masterInit() ,
00050 //as the spiMode parameter.
00051 //
00052 //*****************************************************************************
00053 #define eSPI_3PIN                      UCMODE_0
00054 #define eSPI_4PIN_UCxSTE_ACTIVE_HIGH   UCMODE_1
00055 #define eSPI_4PIN_UCxSTE_ACTIVE_LOW    UCMODE_2
00056 
00057 //*****************************************************************************
00058 //
00059 //The following are values that can be passed to the eSPI_masterInit() ,
00060 //eSPI_slaveInit() API as the clockPolarity parameter.
00061 //
00062 //*****************************************************************************
00063 #define eSPI_CLOCKPOLARITY_INACTIVITY_HIGH    UCCKPL
00064 #define eSPI_CLOCKPOLARITY_INACTIVITY_LOW     0x00
00065 
00066 //*****************************************************************************
00067 //
00068 //The following are values that can be passed to the eSPI_enableInterrupt() ,
00069 //eSPI_disableInterrupt(), eSPI_getInterruptStatus(),  API as the mask parameter.
00070 //
00071 //*****************************************************************************
00072 #define eSPI_TRANSMIT_INTERRUPT    UCTXIE
00073 #define eSPI_RECEIVE_INTERRUPT     UCRXIE
00074 
00075 //*****************************************************************************
00076 //
00077 //The following are values that can be passed to the 
00078 //eSPI_select4PinFunctionality() API as the select4PinFunctionality parameter.
00079 //
00080 //*****************************************************************************
00081 #define eSPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE                      UCSTEM
00082 #define eSPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS       0x00
00083 
00084 //*****************************************************************************
00085 //
00086 //Prototypes for the APIs.
00087 //
00088 //*****************************************************************************
00089 extern unsigned short eSPI_masterInit (unsigned int baseAddress,
00090     unsigned char selectClockSource,
00091     unsigned long clockSourceFrequency,
00092     unsigned long desiredSpiClock,
00093     unsigned int msbFirst,
00094     unsigned int clockPhase,
00095     unsigned int clockPolarity,
00096     unsigned char spiMode
00097     );
00098 extern void eSPI_select4PinFunctionality (unsigned int baseAddress,
00099     unsigned char select4PinFunctionality
00100     );
00101 extern void eSPI_masterChangeClock (unsigned int baseAddress,
00102     unsigned long clockSourceFrequency,
00103     unsigned long desiredSpiClock
00104     );
00105 
00106 extern unsigned short eSPI_slaveInit (unsigned int baseAddress,
00107     unsigned int msbFirst,
00108     unsigned int clockPhase,
00109     unsigned int clockPolarity
00110     );
00111 extern void eSPI_changeClockPhasePolarity (unsigned int baseAddress,
00112     unsigned char clockPhase,
00113     unsigned char clockPolarity
00114     );
00115 extern void eSPI_transmitData ( unsigned int baseAddress,
00116     unsigned char transmitData
00117     );
00118 
00119 extern unsigned char eSPI_receiveData (unsigned int baseAddress);
00120 extern void eSPI_enableInterrupt (unsigned int baseAddress,
00121     unsigned char mask
00122     );
00123 extern void eSPI_disableInterrupt (unsigned int baseAddress,
00124     unsigned char mask
00125     );
00126 extern unsigned char eSPI_getInterruptStatus (unsigned int baseAddress,
00127     unsigned char mask
00128     );
00129 extern void eSPI_enable (unsigned int baseAddress);
00130 extern void eSPI_disable (unsigned int baseAddress);
00131 extern unsigned long eSPI_getReceiveBufferAddressForDMA
00132     (unsigned int baseAddress);
00133 extern unsigned long eSPI_getTransmitBufferAddressForDMA
00134     (unsigned int baseAddress);
00135 extern unsigned char eSPI_isBusy (unsigned int baseAddress);
00136 extern void eSPI_clearInterruptFlag (unsigned int baseAddress,
00137     unsigned char mask
00138     );
00139 #endif
00140 

Copyright 2012, Texas Instruments Incorporated