// Copyright (c) 2005-2014 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//*****************************************************************************
//
//! Sets the type of parity.
//!
//! \param ui32Base is the base address of the UART port.
//! \param ui32Parity specifies the type of parity to use.
//!
//! This function configures the type of parity to use for transmitting and
//! expect when receiving. The \e ui32Parity parameter must be one of
//! \b UART_CONFIG_PAR_NONE, \b UART_CONFIG_PAR_EVEN, \b UART_CONFIG_PAR_ODD,
//! \b UART_CONFIG_PAR_ONE, or \b UART_CONFIG_PAR_ZERO. The last two
//! parameters allow direct control of the parity bit; it is always either one
//! or zero based on the mode.
//!
//! \return None.
//
//*****************************************************************************
void
UARTParityModeSet(uint32_t ui32Base, uint32_t ui32Parity)
{
//
// Check the arguments.
//
ASSERT(_UARTBaseValid(ui32Base));
ASSERT((ui32Parity == UART_CONFIG_PAR_NONE) ||
(ui32Parity == UART_CONFIG_PAR_EVEN) ||
(ui32Parity == UART_CONFIG_PAR_ODD) ||
(ui32Parity == UART_CONFIG_PAR_ONE) ||
(ui32Parity == UART_CONFIG_PAR_ZERO));
//
// Set the parity mode.
//
HWREG(ui32Base + UART_O_LCRH) = ((HWREG(ui32Base + UART_O_LCRH) &
~(UART_LCRH_SPS | UART_LCRH_EPS |
UART_LCRH_PEN)) | ui32Parity);
}