#include "inc/hw_types.h"
#include "driverlib/5xx_6xx/debug.h"
#include "driverlib/5xx_6xx/euart.h"
#include "driverlib/5xx_6xx/euart_baudrate.h"
#include "deprecated/CCS/msp430xgeneric.h"
Functions | |
unsigned short | eUART_init (unsigned int baseAddress, unsigned char selectClockSource, unsigned long clockSourceFrequency, unsigned long desiredUartBaudRate, unsigned char parity, unsigned char msborLsbFirst, unsigned char numberofStopBits, unsigned char uartMode, unsigned short overSampling) |
unsigned short | eUART_initAdvance (unsigned int baseAddress, unsigned char selectClockSource, unsigned int clockPrescalar, unsigned char firstModReg, unsigned char secondModReg, unsigned char parity, unsigned char msborLsbFirst, unsigned char numberofStopBits, unsigned char uartMode, unsigned short overSampling) |
void | eUART_transmitData (unsigned int baseAddress, unsigned char transmitData) |
unsigned char | eUART_receiveData (unsigned int baseAddress) |
void | eUART_enableInterrupt (unsigned int baseAddress, unsigned char mask) |
void | eUART_disableInterrupt (unsigned int baseAddress, unsigned char mask) |
unsigned char | eUART_getInterruptStatus (unsigned int baseAddress, unsigned char mask) |
void | eUART_clearInterruptFlag (unsigned int baseAddress, unsigned char mask) |
void | eUART_enable (unsigned int baseAddress) |
void | eUART_disable (unsigned int baseAddress) |
unsigned char | eUART_queryStatusFlags (unsigned int baseAddress, unsigned char mask) |
void | eUART_setDormant (unsigned int baseAddress) |
void | eUART_resetDormant (unsigned int baseAddress) |
void | eUART_transmitAddress (unsigned int baseAddress, unsigned char transmitAddress) |
void | eUART_transmitBreak (unsigned int baseAddress) |
unsigned long | eUART_getReceiveBufferAddressForDMA (unsigned int baseAddress) |
unsigned long | eUART_getTransmitBufferAddressForDMA (unsigned int baseAddress) |
void | eUART_selectDeglitchTime (unsigned int baseAddress, unsigned long deglitchTime) |
unsigned short eUART_init | ( | unsigned int | baseAddress, |
unsigned char | selectClockSource, | ||
unsigned long | clockSourceFrequency, | ||
unsigned long | desiredUartBaudRate, | ||
unsigned char | parity, | ||
unsigned char | msborLsbFirst, | ||
unsigned char | numberofStopBits, | ||
unsigned char | uartMode, | ||
unsigned short | overSampling | ||
) |
Initializes the UART block.
baseAddress | is the base address of the UART module. |
selectClockSource | selects Clock source. Valid values are eUART_CLOCKSOURCE_SMCLK eUART_CLOCKSOURCE_ACLK |
clockSourceFrequency | is the frequency of the slected clock source |
desiredUartClock | is the desired clock rate for UART communication |
parity | is the desired parity. Valid values are eUART_NO_PARITY [Default Value], eUART_ODD_PARITY, eUART_EVEN_PARITY |
msborLsbFirst | controls direction of receive and transmit shift register. Valid values are eUART_MSB_FIRST eUART_LSB_FIRST [Default Value] |
numberofStopBits | indicates one/two STOP bits Valid values are eUART_ONE_STOP_BIT [Default Value] eUART_TWO_STOP_BITS |
uartMode | selects the mode of operation Valid values are eUART_MODE [Default Value], eUART_IDLE_LINE_MULTI_PROCESSOR_MODE, eUART_ADDRESS_BIT_MULTI_PROCESSOR_MODE, eUART_AUTOMATIC_BAUDRATE_DETECTION_MODE |
overSampling | indicates low frequency or oversampling baud generation Valid values are eUART_OVERSAMPLING_BAUDRATE_GENERATION eUART_LOW_FREQUENCY_BAUDRATE_GENERATION |
Upon successful initialization of the UART block, this function will have initialized the module, but the UART block still remains disabled and must be enabled with eUART_enable()
Modified bits are UCPEN, UCPAR, UCMSB, UC7BIT, UCSPB, UCMODEx, UCSYNC bits of UCAxCTL0 and UCSSELx, UCSWRST bits of UCAxCTL1
References ASSERT, eUART_ADDRESS_BIT_MULTI_PROCESSOR_MODE, eUART_AUTOMATIC_BAUDRATE_DETECTION_MODE, eUART_CLOCKSOURCE_ACLK, eUART_CLOCKSOURCE_SMCLK, eUART_EVEN_PARITY, eUART_IDLE_LINE_MULTI_PROCESSOR_MODE, eUART_LSB_FIRST, eUART_MODE, eUART_MSB_FIRST, eUART_NO_PARITY, eUART_ODD_PARITY, eUART_ONE_STOP_BIT, eUART_TWO_STOP_BITS, eUARTBAUDRATE_calculateBaudDividers(), HWREG, STATUS_FAIL, and STATUS_SUCCESS.
unsigned short eUART_initAdvance | ( | unsigned int | baseAddress, |
unsigned char | selectClockSource, | ||
unsigned int | clockPrescalar, | ||
unsigned char | firstModReg, | ||
unsigned char | secondModReg, | ||
unsigned char | parity, | ||
unsigned char | msborLsbFirst, | ||
unsigned char | numberofStopBits, | ||
unsigned char | uartMode, | ||
unsigned short | overSampling | ||
) |
Advanced initialization routine for the UART block. The values to be written into the UCAxBRW and UCAxMCTLW registers should be pre-computed and passed into the initialization function
baseAddress | is the base address of the UART module. |
selectClockSource | selects Clock source. Valid values are eUART_CLOCKSOURCE_SMCLK eUART_CLOCKSOURCE_ACLK |
clockPrescalar | is the value to be written into UCBRx bits |
firstModReg | is First modulation stage register setting. This value is a pre-calculated value which can be obtained from the Device User’s Guide.This value is written into UCBRFx bits of UCAxMCTLW. |
secondModReg | is Second modulation stage register setting. This value is a pre-calculated value which can be obtained from the Device User’s Guide. This value is written into UCBRSx bits of UCAxMCTLW. |
parity | is the desired parity. Valid values are eUART_NO_PARITY [Default Value], eUART_ODD_PARITY, eUART_EVEN_PARITY |
msborLsbFirst | controls direction of receive and transmit shift register. Valid values are eUART_MSB_FIRST eUART_LSB_FIRST [Default Value] |
numberofStopBits | indicates one/two STOP bits Valid values are eUART_ONE_STOP_BIT [Default Value] eUART_TWO_STOP_BITS |
uartMode | selects the mode of operation Valid values are eUART_MODE [Default Value], eUART_IDLE_LINE_MULTI_PROCESSOR_MODE, eUART_ADDRESS_BIT_MULTI_PROCESSOR_MODE, eUART_AUTOMATIC_BAUDRATE_DETECTION_MODE |
overSampling | indicates low frequency or oversampling baud generation Valid values are eUART_OVERSAMPLING_BAUDRATE_GENERATION eUART_LOW_FREQUENCY_BAUDRATE_GENERATION |
Upon successful initialization of the UART block, this function will have initialized the module, but the UART block still remains disabled and must be enabled with eUART_enable()
Modified bits are UCPEN, UCPAR, UCMSB, UC7BIT, UCSPB, UCMODEx, UCSYNC bits of UCAxCTL0 and UCSSELx, UCSWRST bits of UCAxCTL1
References ASSERT, eUART_ADDRESS_BIT_MULTI_PROCESSOR_MODE, eUART_AUTOMATIC_BAUDRATE_DETECTION_MODE, eUART_CLOCKSOURCE_ACLK, eUART_CLOCKSOURCE_SMCLK, eUART_EVEN_PARITY, eUART_IDLE_LINE_MULTI_PROCESSOR_MODE, eUART_LSB_FIRST, eUART_MODE, eUART_MSB_FIRST, eUART_NO_PARITY, eUART_ODD_PARITY, eUART_ONE_STOP_BIT, eUART_TWO_STOP_BITS, HWREG, and STATUS_SUCCESS.
void eUART_transmitData | ( | unsigned int | baseAddress, |
unsigned char | transmitData | ||
) |
Transmits a byte from the UART Module.
baseAddress | is the base address of the UART module. |
transmitData | data to be transmitted from the UART module |
This function will place the supplied data into UART trasmit data register to start transmission
Modified register is UCAxTXBUF
References HWREG.
unsigned char eUART_receiveData | ( | unsigned int | baseAddress | ) |
Receives a byte that has been sent to the UART Module.
baseAddress | is the base address of the UART module. |
This function reads a byte of data from the UART receive data Register.
Modified register is UCAxRXBUF
References HWREG.
void eUART_enableInterrupt | ( | unsigned int | baseAddress, |
unsigned char | mask | ||
) |
Enables individual UART interrupt sources.
baseAddress | is the base address of the UART module. |
mask | is the bit mask of the interrupt sources to be enabled. |
Enables the indicated UART interrupt sources. The interrupt flag is first and then the corresponfing interrupt is enabled. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
The mask parameter is the logical OR of any of the following:
Modified register is UCAxIFG, UCAxIE and UCAxCTL1
References ASSERT, eUART_BREAKCHAR_INTERRUPT, eUART_RECEIVE_ERRONEOUSCHAR_INTERRUPT, eUART_RECEIVE_INTERRUPT, eUART_TRANSMIT_INTERRUPT, and HWREG.
void eUART_disableInterrupt | ( | unsigned int | baseAddress, |
unsigned char | mask | ||
) |
Disables individual UART interrupt sources.
baseAddress | is the base address of the UART module. |
mask | is the bit mask of the interrupt sources to be disabled. |
Disables the indicated UART interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
The mask parameter is the logical OR of any of the following:
Modified register is UCAxIFG, UCAxIE and UCAxCTL1
References ASSERT, eUART_BREAKCHAR_INTERRUPT, eUART_RECEIVE_ERRONEOUSCHAR_INTERRUPT, eUART_RECEIVE_INTERRUPT, eUART_TRANSMIT_INTERRUPT, and HWREG.
unsigned char eUART_getInterruptStatus | ( | unsigned int | baseAddress, |
unsigned char | mask | ||
) |
Gets the current UART interrupt status.
baseAddress | is the base address of the UART module. |
mask | is the masked interrupt flag status to be returned. |
This returns the interrupt status for the UART module based on which flag is passed. mask parameter can be either any of the following selection.
Modified register is UCAxIFG.
References ASSERT, eUART_RECEIVE_INTERRUPT_FLAG, eUART_TRANSMIT_INTERRUPT_FLAG, and HWREG.
Referenced by eUART_transmitBreak().
void eUART_clearInterruptFlag | ( | unsigned int | baseAddress, |
unsigned char | mask | ||
) |
Clears UART interrupt sources.
baseAddress | is the base address of the UART module. |
mask | is a bit mask of the interrupt sources to be cleared. |
The UART interrupt source is cleared, so that it no longer asserts. The highest interrupt flag is automatically cleared when an interrupt vector generator is used.
The mask parameter has the same definition as the mask parameter to eUART_enableInterrupt().
Modified register is UCAxIFG
References HWREG.
void eUART_enable | ( | unsigned int | baseAddress | ) |
Enables the UART block.
baseAddress | is the base address of the USCI UART module. |
This will enable operation of the UART block.
Modified register is UCAxCTL1
References HWREG.
void eUART_disable | ( | unsigned int | baseAddress | ) |
Disables the UART block.
baseAddress | is the base address of the USCI UART module. |
This will disable operation of the UART block.
Modified register is UCAxCTL1
References HWREG.
unsigned char eUART_queryStatusFlags | ( | unsigned int | baseAddress, |
unsigned char | mask | ||
) |
Gets the current UART status flags.
baseAddress | is the base address of the UART module. |
mask | is the masked interrupt flag status to be returned. |
This returns the status for the UART module based on which flag is passed. mask parameter can be either any of the following selection.
Modified register is UCAxSTAT
References ASSERT, eUART_ADDRESS_RECEIVED, eUART_BUSY, eUART_FRAMING_ERROR, eUART_IDLELINE, eUART_LISTEN_ENABLE, eUART_OVERRUN_ERROR, eUART_PARITY_ERROR, eUART_RECEIVE_ERROR, HWREG, and UARTBREAK_DETECT.
void eUART_setDormant | ( | unsigned int | baseAddress | ) |
Sets the UART module in dormant mode
baseAddress | is the base address of the UART module. |
Puts USCI in sleep mode Only characters that are preceded by an idle-line or with address bit set UCRXIFG. In UART mode with automatic baud-rate detection, only the combination of a break and synch field sets UCRXIFG.
Modified register is UCAxCTL1
References HWREG.
void eUART_resetDormant | ( | unsigned int | baseAddress | ) |
Re-enables UART module from dormant mode
baseAddress | is the base address of the UART module. |
Not dormant. All received characters set UCRXIFG.
Modified bits are UCDORM of UCAxCTL1 register.
References HWREG.
void eUART_transmitAddress | ( | unsigned int | baseAddress, |
unsigned char | transmitAddress | ||
) |
Transmits the next byte to be transmitted marked as address depending on selected multiprocessor mode
baseAddress | is the base address of the UART module. |
transmitAddress | is the next byte to be transmitted |
Modified register is UCAxCTL1, UCAxTXBUF
References HWREG.
void eUART_transmitBreak | ( | unsigned int | baseAddress | ) |
Transmit break. Transmits a break with the next write to the transmit buffer. In UART mode with automatic baud-rate detection, eUART_AUTOMATICBAUDRATE_SYNC(0x55) must be written into UCAxTXBUF to generate the required break/synch fields. Otherwise, DEFAULT_SYNC(0x00) must be written into the transmit buffer. Also ensures module is ready for transmitting the next data
baseAddress | is the base address of the UART module. |
Modified register is UCAxCTL1, UCAxTXBUF
References DEFAULT_SYNC, eUART_AUTOMATIC_BAUDRATE_DETECTION_MODE, eUART_AUTOMATICBAUDRATE_SYNC, eUART_getInterruptStatus(), and HWREG.
unsigned long eUART_getReceiveBufferAddressForDMA | ( | unsigned int | baseAddress | ) |
Returns the address of the RX Buffer of the UART for the DMA module.
baseAddress | is the base address of the UART module. |
Returns the address of the UART RX Buffer. This can be used in conjunction with the DMA to store the received data directly to memory.
unsigned long eUART_getTransmitBufferAddressForDMA | ( | unsigned int | baseAddress | ) |
Returns the address of the TX Buffer of the UART for the DMA module.
baseAddress | is the base address of the UART module. |
Returns the address of the UART TX Buffer. This can be used in conjunction with the DMA to obtain transmitted data directly from memory.
void eUART_selectDeglitchTime | ( | unsigned int | baseAddress, |
unsigned long | deglitchTime | ||
) |
Sets the deglitch time
baseAddress | is the base address of the UART module. |
deglitchTime | is the selected deglitch time Valid values are
|
Returns the address of the UART TX Buffer. This can be used in conjunction with the DMA to obtain transmitted data directly from memory.
References ASSERT, eUART_DEGLITCH_TIME_100ns, eUART_DEGLITCH_TIME_200ns, eUART_DEGLITCH_TIME_2ns, eUART_DEGLITCH_TIME_50ns, and HWREG.