Help Mla Driver
Help Mla Driver
Table of Contents
1 MLA Drivers 6
1.1 Legal Information 7
2
MLA - Drivers Help
3
MLA - Drivers Help
4
MLA - Drivers Help
Index 81
5
1 MLA - Drivers Help
Drivers
1 MLA Drivers
This section covers the drivers interfaces used across various libraries in MLA.
Modules
Name Description
UART Driver This library provides an interface to manage the UART module on the
Microchip family of microcontrollers in different modes of operation.
SPI Driver This library provides an interface to manage the Serial Peripheral
Interface (SPI) module on the Microchip family of microcontrollers in
different modes of operation.
Description
The various drivers described in this section are used in either the libraries or applications provided with the MLA. These
drivers can also be used by the application developers to accelerate development time.
6
1.1 Legal Information MLA - Drivers Help
7
1.2 UART Driver MLA - Drivers Help Using Driver
Description
Overview of UART
The Universal Asynchronous Receiver/Transmitter (UART) controller is the key component of the serial communications
subsystem of many embedded systems.
The UART driver can support the following modes of operation (refer to the specific device data sheet to determine which
modes are supported on the device in use).
RS-232
RS-232 is an asynchronous full duplex serial communication protocol. It uses separate lines for transmitting and receiving
data, point-to-point, between a Data Terminal Equipment (DTE) item and a Data Communication Equipment (DCE) item at a
maximum speed of 20 kbps with a maximum cable length of 50 feet.
Description
This topic describes the basic architecture of the UART Driver Library and provides information and examples on how to use
it.
The interface to the UART library is defined in the drv_uart1.h, drv_uart2.h, drv_uart3.h, drv_uart4.h header file
The table below lists the interface section and its brief description.
8
1.2 UART Driver MLA - Drivers Help Using Driver
Both transmitter and receiver provide a buffer in the driver which transmits and receives data to/from the hardware. The
UART driver provides a set of interfaces to perform the read and the write.
The diagrams below illustrates the model used by the UART driver for transmitter and receiver.
1.2.1.2 Initialization
The system performs the initialization of the device driver with settings that affect only the instance of the device that is being
initialized. During system initialization each instance of the UART will be initialized with the configuration settings.
1. Baud rate
2. Stop bits
3. Size of the RX buffer
4. Size of TX buffer
Application using the UART transmitter functionality, needs to perform the following:
1. The system should have completed necessary initialization and the DRV_UART_Initialize
2. Write a byte using DRV_UART_WriteByte or write a buffer using DRV_UART_Write
9
1.2 UART Driver MLA - Drivers Help Configuring the Driver
Example :
// Pre-initialize myBuffer with MY_BUFFER_SIZE bytes of valid data.
DRV_UART1_WriteByte(myBuffer[numBytes++]);
// Do something else...
Receiver Functionality
Application using the UART receiver functionality, needs to perform the following:
Name Description
DRV_UART1_CONFIG_8E1 Macro defines the line control mode to 8-E-1 configuration
DRV_UART1_CONFIG_8E2 Macro defines the line control mode to 8-E-2 configuration
DRV_UART1_CONFIG_8N1 Macro defines the line control mode to 8-N-1 configuration
DRV_UART1_CONFIG_8N2 Macro defines the line control mode to 8-N-2 configuration
DRV_UART1_CONFIG_8O1 Macro defines the line control mode to 8-O-1 configuration
DRV_UART1_CONFIG_8O2 Macro defines the line control mode to 8-O-2 configuration
DRV_UART1_CONFIG_9N1 Macro defines the line control mode to 9-N-1 configuration
DRV_UART1_CONFIG_9N2 Macro defines the line control mode to 9-N-2 configuration
DRV_UART1_CONFIG_BAUD_RATE Macro controls operation of the driver for Baud rate configuration
DRV_UART1_CONFIG_RX_BYTEQ_LENGTH Macro controls operation of the driver for defining the size of the RX buffer
DRV_UART1_CONFIG_TX_BYTEQ_LENGTH Macro controls operation of the driver for defining the size of the TX buffer
DRV_UART2_CONFIG_8E1 Macro defines the line control mode to 8-E-1 configuration
DRV_UART2_CONFIG_8E2 Macro defines the line control mode to 8-E-2 configuration
DRV_UART2_CONFIG_8N1 Macro defines the line control mode to 8-N-1 configuration
DRV_UART2_CONFIG_8N2 Macro defines the line control mode to 8-N-2 configuration
DRV_UART2_CONFIG_8O1 Macro defines the line control mode to 8-O-1 configuration
DRV_UART2_CONFIG_8O2 Macro defines the line control mode to 8-O-2 configuration
DRV_UART2_CONFIG_9N1 Macro defines the line control mode to 9-N-1 configuration
DRV_UART2_CONFIG_9N2 Macro defines the line control mode to 9-N-2 configuration
DRV_UART2_CONFIG_BAUD_RATE Macro controls operation of the driver for Baud rate configuration
DRV_UART2_CONFIG_RX_BYTEQ_LENGTH Macro controls operation of the driver for defining the size of the RX buffer
DRV_UART2_CONFIG_TX_BYTEQ_LENGTH Macro controls operation of the driver for defining the size of the TX buffer
DRV_UART3_CONFIG_8E1 Macro defines the line control mode to 8-E-1 configuration
DRV_UART3_CONFIG_8E2 Macro defines the line control mode to 8-E-2 configuration
DRV_UART3_CONFIG_8N1 Macro defines the line control mode to 8-N-1 configuration
DRV_UART3_CONFIG_8N2 Macro defines the line control mode to 8-N-2 configuration
DRV_UART3_CONFIG_8O1 Macro defines the line control mode to 8-O-1 configuration
DRV_UART3_CONFIG_8O2 Macro defines the line control mode to 8-O-2 configuration
DRV_UART3_CONFIG_9N1 Macro defines the line control mode to 9-N-1 configuration
DRV_UART3_CONFIG_9N2 Macro defines the line control mode to 9-N-2 configuration
10
1.2 UART Driver MLA - Drivers Help Configuring the Driver
DRV_UART3_CONFIG_BAUD_RATE Macro controls operation of the driver for Baud rate configuration
DRV_UART3_CONFIG_RX_BYTEQ_LENGTH Macro controls operation of the driver for defining the size of the RX buffer
DRV_UART3_CONFIG_TX_BYTEQ_LENGTH Macro controls operation of the driver for defining the size of the TX buffer
DRV_UART4_CONFIG_8E1 Macro defines the line control mode to 8-E-1 configuration
DRV_UART4_CONFIG_8E2 Macro defines the line control mode to 8-E-2 configuration
DRV_UART4_CONFIG_8N1 Macro defines the line control mode to 8-N-1 configuration
DRV_UART4_CONFIG_8N2 Macro defines the line control mode to 8-N-2 configuration
DRV_UART4_CONFIG_8O1 Macro defines the line control mode to 8-O-1 configuration
DRV_UART4_CONFIG_8O2 Macro defines the line control mode to 8-O-2 configuration
DRV_UART4_CONFIG_9N1 Macro defines the line control mode to 9-N-1 configuration
DRV_UART4_CONFIG_9N2 Macro defines the line control mode to 9-N-2 configuration
DRV_UART4_CONFIG_BAUD_RATE Macro controls operation of the driver for Baud rate configuration
DRV_UART4_CONFIG_RX_BYTEQ_LENGTH Macro controls operation of the driver for defining the size of the RX buffer
DRV_UART4_CONFIG_TX_BYTEQ_LENGTH Macro controls operation of the driver for defining the size of the TX buffer
Module
UART Driver
Description
File
drv_uart_config_template.h
Syntax
#define DRV_UART1_CONFIG_8E1
Description
Sets the UART for 8-E-1 configuration
This macro defines the line control mode as 8 data bits, even parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART1_CONFIG_8E2
Description
Sets the UART for 8-E-2 configuration
This macro defines the line control mode as 8 data bits, even parity and 2 stop bit.
11
1.2 UART Driver MLA - Drivers Help Configuring the Driver
File
drv_uart_config_template.h
Syntax
#define DRV_UART1_CONFIG_8N1
Description
Sets the UART for 8-N-1 configuration
This macro defines the line control mode as 8 data bits, none parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART1_CONFIG_8N2
Description
Sets the UART for 8-N-2 configuration
This macro defines the line control mode as 8 data bits, none parity and 2 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART1_CONFIG_8O1
Description
Sets the UART for 8-O-1 configuration
This macro defines the line control mode as 8 data bits, odd parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART1_CONFIG_8O2
12
1.2 UART Driver MLA - Drivers Help Configuring the Driver
Description
Sets the UART for 8-O-2 configuration
This macro defines the line control mode as 8 data bits, odd parity and 2 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART1_CONFIG_9N1
Description
Sets the UART for 9-N-1 configuration
This macro defines the line control mode as 9 data bits, none parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART1_CONFIG_9N2
Description
Sets the UART for 9-N-2 configuration
This macro defines the line control mode as 9 data bits, none parity and 2 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART1_CONFIG_BAUD_RATE
Description
UART Baud Rate configuration
This macro controls the operation of the driver for Baud rate.
13
1.2 UART Driver MLA - Drivers Help Configuring the Driver
File
drv_uart_config_template.h
Syntax
#define DRV_UART1_CONFIG_RX_BYTEQ_LENGTH 4
Description
UART Byte mode internal buffer RX size configuration
This macro controls the operation of the driver for defining the size of the RX buffer
File
drv_uart_config_template.h
Syntax
#define DRV_UART1_CONFIG_TX_BYTEQ_LENGTH 4
Description
UART Byte mode internal buffer TX size configuration
This macro controls the operation of the driver for defining the size of the TX buffer
File
drv_uart_config_template.h
Syntax
#define DRV_UART2_CONFIG_8E1
Description
Sets the UART for 8-E-1 configuration
This macro defines the line control mode as 8 data bits, even parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART2_CONFIG_8E2
Description
Sets the UART for 8-E-2 configuration
This macro defines the line control mode as 8 data bits, even parity and 2 stop bit.
14
1.2 UART Driver MLA - Drivers Help Configuring the Driver
File
drv_uart_config_template.h
Syntax
#define DRV_UART2_CONFIG_8N1
Description
Sets the UART for 8-N-1 configuration
This macro defines the line control mode as 8 data bits, none parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART2_CONFIG_8N2
Description
Sets the UART for 8-N-2 configuration
This macro defines the line control mode as 8 data bits, none parity and 2 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART2_CONFIG_8O1
Description
Sets the UART for 8-O-1 configuration
This macro defines the line control mode as 8 data bits, odd parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART2_CONFIG_8O2
15
1.2 UART Driver MLA - Drivers Help Configuring the Driver
Description
Sets the UART for 8-O-2 configuration
This macro defines the line control mode as 8 data bits, odd parity and 2 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART2_CONFIG_9N1
Description
Sets the UART for 9-N-1 configuration
This macro defines the line control mode as 9 data bits, none parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART2_CONFIG_9N2
Description
Sets the UART for 9-N-2 configuration
This macro defines the line control mode as 9 data bits, none parity and 2 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART2_CONFIG_BAUD_RATE
Description
UART Baud Rate configuration
This macro controls the operation of the driver for Baud rate.
16
1.2 UART Driver MLA - Drivers Help Configuring the Driver
File
drv_uart_config_template.h
Syntax
#define DRV_UART2_CONFIG_RX_BYTEQ_LENGTH 4
Description
UART Byte mode internal buffer RX size configuration
This macro controls the operation of the driver for defining the size of the RX buffer
File
drv_uart_config_template.h
Syntax
#define DRV_UART2_CONFIG_TX_BYTEQ_LENGTH 4
Description
UART Byte mode internal buffer TX size configuration
This macro controls the operation of the driver for defining the size of the TX buffer
File
drv_uart_config_template.h
Syntax
#define DRV_UART3_CONFIG_8E1
Description
Sets the UART for 8-E-1 configuration
This macro defines the line control mode as 8 data bits, even parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART3_CONFIG_8E2
Description
Sets the UART for 8-E-2 configuration
This macro defines the line control mode as 8 data bits, even parity and 2 stop bit.
17
1.2 UART Driver MLA - Drivers Help Configuring the Driver
File
drv_uart_config_template.h
Syntax
#define DRV_UART3_CONFIG_8N1
Description
Sets the UART for 8-N-1 configuration
This macro defines the line control mode as 8 data bits, none parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART3_CONFIG_8N2
Description
Sets the UART for 8-N-2 configuration
This macro defines the line control mode as 8 data bits, none parity and 2 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART3_CONFIG_8O1
Description
Sets the UART for 8-O-1 configuration
This macro defines the line control mode as 8 data bits, odd parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART3_CONFIG_8O2
18
1.2 UART Driver MLA - Drivers Help Configuring the Driver
Description
Sets the UART for 8-O-2 configuration
This macro defines the line control mode as 8 data bits, odd parity and 2 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART3_CONFIG_9N1
Description
Sets the UART for 9-N-1 configuration
This macro defines the line control mode as 9 data bits, none parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART3_CONFIG_9N2
Description
Sets the UART for 9-N-2 configuration
This macro defines the line control mode as 9 data bits, none parity and 2 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART3_CONFIG_BAUD_RATE
Description
UART Baud Rate configuration
This macro controls the operation of the driver for Baud rate.
19
1.2 UART Driver MLA - Drivers Help Configuring the Driver
File
drv_uart_config_template.h
Syntax
#define DRV_UART3_CONFIG_RX_BYTEQ_LENGTH 4
Description
UART Byte mode internal buffer RX size configuration
This macro controls the operation of the driver for defining the size of the RX buffer
File
drv_uart_config_template.h
Syntax
#define DRV_UART3_CONFIG_TX_BYTEQ_LENGTH 4
Description
UART Byte mode internal buffer TX size configuration
This macro controls the operation of the driver for defining the size of the TX buffer
File
drv_uart_config_template.h
Syntax
#define DRV_UART4_CONFIG_8E1
Description
Sets the UART for 8-E-1 configuration
This macro defines the line control mode as 8 data bits, even parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART4_CONFIG_8E2
Description
Sets the UART for 8-E-2 configuration
This macro defines the line control mode as 8 data bits, even parity and 2 stop bit.
20
1.2 UART Driver MLA - Drivers Help Configuring the Driver
File
drv_uart_config_template.h
Syntax
#define DRV_UART4_CONFIG_8N1
Description
Sets the UART for 8-N-1 configuration
This macro defines the line control mode as 8 data bits, none parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART4_CONFIG_8N2
Description
Sets the UART for 8-N-2 configuration
This macro defines the line control mode as 8 data bits, none parity and 2 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART4_CONFIG_8O1
Description
Sets the UART for 8-O-1 configuration
This macro defines the line control mode as 8 data bits, odd parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART4_CONFIG_8O2
21
1.2 UART Driver MLA - Drivers Help Configuring the Driver
Description
Sets the UART for 8-O-2 configuration
This macro defines the line control mode as 8 data bits, odd parity and 2 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART4_CONFIG_9N1
Description
Sets the UART for 9-N-1 configuration
This macro defines the line control mode as 9 data bits, none parity and 1 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART4_CONFIG_9N2
Description
Sets the UART for 9-N-2 configuration
This macro defines the line control mode as 9 data bits, none parity and 2 stop bit.
File
drv_uart_config_template.h
Syntax
#define DRV_UART4_CONFIG_BAUD_RATE
Description
UART Baud Rate configuration
This macro controls the operation of the driver for Baud rate.
22
1.2 UART Driver MLA - Drivers Help Driver Interface
File
drv_uart_config_template.h
Syntax
#define DRV_UART4_CONFIG_RX_BYTEQ_LENGTH 4
Description
UART Byte mode internal buffer RX size configuration
This macro controls the operation of the driver for defining the size of the RX buffer
File
drv_uart_config_template.h
Syntax
#define DRV_UART4_CONFIG_TX_BYTEQ_LENGTH 4
Description
UART Byte mode internal buffer TX size configuration
This macro controls the operation of the driver for defining the size of the TX buffer
Description
Name Description
DRV_UART1_Peek Returns the character in the read sequence at the offset provided,
without extracting it
DRV_UART1_Read Returns the number of bytes read by the UART1 peripheral
DRV_UART1_ReadByte Reads a byte of data from the UART1
DRV_UART1_Write Returns the number of bytes written into the internal buffer
DRV_UART1_WriteByte Writes a byte of data to the UART1
DRV_UART2_Peek Returns the character in the read sequence at the offset provided,
without extracting it
DRV_UART2_Read Returns the number of bytes read by the UART2 peripheral
DRV_UART2_ReadByte Reads a byte of data from the UART2
DRV_UART2_Write Returns the number of bytes written into the internal buffer
DRV_UART2_WriteByte Writes a byte of data to the UART2
23
1.2 UART Driver MLA - Drivers Help Driver Interface
DRV_UART3_Peek Returns the character in the read sequence at the offset provided,
without extracting it
DRV_UART3_Read Returns the number of bytes read by the UART3 peripheral
DRV_UART3_ReadByte Reads a byte of data from the UART3
DRV_UART3_Write Returns the number of bytes written into the internal buffer
DRV_UART3_WriteByte Writes a byte of data to the UART3
DRV_UART4_Peek Returns the character in the read sequence at the offset provided,
without extracting it
DRV_UART4_Read Returns the number of bytes read by the UART4 peripheral
DRV_UART4_ReadByte Reads a byte of data from the UART4
DRV_UART4_Write Returns the number of bytes written into the internal buffer
DRV_UART4_WriteByte Writes a byte of data to the UART4
Description
File
drv_uart1.h
Syntax
uint8_t DRV_UART1_Peek(uint16_t offset);
Description
This routine returns the character in the read sequence at the offset provided, without extracting it
Example
const uint8_t readBuffer[5];
unsigned int data, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART1_InitializerDefault();
24
1.2 UART Driver MLA - Drivers Help Driver Interface
File
drv_uart1.h
Syntax
unsigned int DRV_UART1_Read(uint8_t * buffer, const unsigned int numbytes);
Returns
Number of bytes actually copied into the caller's buffer or -1 if there is an error.
Description
This routine returns the number of bytes read by the Peripheral and fills the application read buffer with the read data.
Preconditions
DRV_UART1_InitializerDefault function should have been called before calling this function
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
DRV_UART1_TRANSFER_STATUS status ;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
status = DRV_UART1_TransferStatus ( ) ;
if (status & DRV_UART1_TRANSFER_STATUS_RX_FULL)
{
numBytes += DRV_UART1_Read( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ;
if(numBytes < readbufferLen)
{
continue;
}
else
{
break;
}
}
else
{
continue;
}
// Do something else...
}
Parameters
Parameters Description
uint8_t * buffer Buffer into which the data read from the UART1
const unsigned int numbytes Total number of bytes that need to be read from the UART1
(must be equal to or less than the size of the buffer)
Function
unsigned int DRV_UART1_Read(uint8_t *buffer, const unsigned int numbytes )
File
drv_uart1.h
25
1.2 UART Driver MLA - Drivers Help Driver Interface
Syntax
uint8_t DRV_UART1_ReadByte();
Returns
A data byte received by the driver.
Description
This routine reads a byte of data from the UART1.
Preconditions
DRV_UART1_InitializerDefault function should have been called before calling this function. The transfer status should be
checked to see if the receiver is not empty before calling this function.
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
numBytes = 0;
do
{
if( DRV_UART1_TRANSFER_STATUS_RX_DATA_PRESENT & DRV_UART1_TransferStatus() )
{
myBuffer[numBytes++] = DRV_UART1_ReadByte();
}
// Do something else...
File
drv_uart1.h
Syntax
unsigned int DRV_UART1_Write(const uint8_t * buffer, const unsigned int numbytes);
Description
This API transfers the data from application buffer to internal buffer and returns the number of bytes added in that queue
Remarks
None
Preconditions
DRV_UART1_InitializerDefault function should have been called before calling this function
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
DRV_UART1_TRANSFER_STATUS status ;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
status = DRV_UART1_TransferStatus ( ) ;
26
1.2 UART Driver MLA - Drivers Help Driver Interface
// Do something else...
}
Function
unsigned int DRV_UART1_Write( uint8_t *buffer, const unsigned int numbytes )
File
drv_uart1.h
Syntax
void DRV_UART1_WriteByte(const uint8_t byte);
Returns
None.
Description
This routine writes a byte of data to the UART1.
Preconditions
DRV_UART1_InitializerDefault function should have been called before calling this function. The transfer status should be
checked to see if transmitter is not full before calling this function.
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
if( !(DRV_UART1_TRANSFER_STATUS_TX_FULL & DRV_UART1_TransferStatus()) )
{
DRV_UART1_WriteByte(handle, myBuffer[numBytes++]);
}
// Do something else...
}
Parameters
Parameters Description
const uint8_t byte Data byte to write to the UART1
27
1.2 UART Driver MLA - Drivers Help Driver Interface
Function
void DRV_UART1_WriteByte( const uint8_t byte)
File
drv_uart2.h
Syntax
uint8_t DRV_UART2_Peek(uint16_t offset);
Description
This routine returns the character in the read sequence at the offset provided, without extracting it
Example
const uint8_t readBuffer[5];
unsigned int data, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART2_InitializerDefault();
File
drv_uart2.h
Syntax
unsigned int DRV_UART2_Read(uint8_t * buffer, const unsigned int numbytes);
Returns
Number of bytes actually copied into the caller's buffer or -1 if there is an error.
Description
This routine returns the number of bytes read by the Peripheral and fills the application read buffer with the read data.
Preconditions
DRV_UART2_InitializerDefault function should have been called before calling this function
28
1.2 UART Driver MLA - Drivers Help Driver Interface
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
DRV_UART2_TRANSFER_STATUS status ;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
status = DRV_UART2_TransferStatus ( ) ;
if (status & DRV_UART2_TRANSFER_STATUS_RX_FULL)
{
numBytes += DRV_UART2_Read( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ;
if(numBytes < readbufferLen)
{
continue;
}
else
{
break;
}
}
else
{
continue;
}
// Do something else...
}
Parameters
Parameters Description
uint8_t * buffer Buffer into which the data read from the UART2
const unsigned int numbytes Total number of bytes that need to be read from the UART2
(must be equal to or less than the size of the buffer)
Function
unsigned int DRV_UART2_Read(uint8_t *buffer, const unsigned int numbytes )
File
drv_uart2.h
Syntax
uint8_t DRV_UART2_ReadByte();
Returns
A data byte received by the driver.
Description
This routine reads a byte of data from the UART2.
Preconditions
DRV_UART2_InitializerDefault function should have been called before calling this function. The transfer status should be
checked to see if the receiver is not empty before calling this function.
Example
char myBuffer[MY_BUFFER_SIZE];
29
1.2 UART Driver MLA - Drivers Help Driver Interface
numBytes = 0;
do
{
if( DRV_UART2_TRANSFER_STATUS_RX_DATA_PRESENT & DRV_UART2_TransferStatus() )
{
myBuffer[numBytes++] = DRV_UART2_ReadByte();
}
// Do something else...
File
drv_uart2.h
Syntax
unsigned int DRV_UART2_Write(const uint8_t * buffer, const unsigned int numbytes);
Description
This API transfers the data from application buffer to internal buffer and returns the number of bytes added in that queue
Remarks
None
Preconditions
DRV_UART2_InitializerDefault function should have been called before calling this function
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
DRV_UART2_TRANSFER_STATUS status ;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
status = DRV_UART2_TransferStatus ( ) ;
if (status & DRV_UART2_TRANSFER_STATUS_TX_EMPTY)
{
numBytes += DRV_UART2_Write ( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ;
if(numBytes < writebufferLen)
{
continue;
}
else
{
break;
}
}
else
{
continue;
}
// Do something else...
}
30
1.2 UART Driver MLA - Drivers Help Driver Interface
Function
unsigned int DRV_UART2_Write( uint8_t *buffer, const unsigned int numbytes )
File
drv_uart2.h
Syntax
void DRV_UART2_WriteByte(const uint8_t byte);
Returns
None.
Description
This routine writes a byte of data to the UART2.
Preconditions
DRV_UART2_InitializerDefault function should have been called before calling this function. The transfer status should be
checked to see if transmitter is not full before calling this function.
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
if( !(DRV_UART2_TRANSFER_STATUS_TX_FULL & DRV_UART2_TransferStatus()) )
{
DRV_UART2_WriteByte(handle, myBuffer[numBytes++]);
}
// Do something else...
}
Parameters
Parameters Description
const uint8_t byte Data byte to write to the UART2
Function
void DRV_UART2_WriteByte( const uint8_t byte)
File
drv_uart3.h
Syntax
uint8_t DRV_UART3_Peek(uint16_t offset);
Description
This routine returns the character in the read sequence at the offset provided, without extracting it
31
1.2 UART Driver MLA - Drivers Help Driver Interface
Example
const uint8_t readBuffer[5];
unsigned int data, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART3_InitializerDefault();
File
drv_uart3.h
Syntax
unsigned int DRV_UART3_Read(uint8_t * buffer, const unsigned int numbytes);
Returns
Number of bytes actually copied into the caller's buffer or -1 if there is an error.
Description
This routine returns the number of bytes read by the Peripheral and fills the application read buffer with the read data.
Preconditions
DRV_UART3_InitializerDefault function should have been called before calling this function
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
DRV_UART3_TRANSFER_STATUS status ;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
status = DRV_UART3_TransferStatus ( ) ;
if (status & DRV_UART3_TRANSFER_STATUS_RX_FULL)
{
numBytes += DRV_UART3_Read( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ;
if(numBytes < readbufferLen)
{
continue;
}
else
{
32
1.2 UART Driver MLA - Drivers Help Driver Interface
break;
}
}
else
{
continue;
}
// Do something else...
}
Parameters
Parameters Description
uint8_t * buffer Buffer into which the data read from the UART3
const unsigned int numbytes Total number of bytes that need to be read from the UART3
(must be equal to or less than the size of the buffer)
Function
unsigned int DRV_UART3_Read(uint8_t *buffer, const unsigned int numbytes )
File
drv_uart3.h
Syntax
uint8_t DRV_UART3_ReadByte();
Returns
A data byte received by the driver.
Description
This routine reads a byte of data from the UART3.
Preconditions
DRV_UART3_InitializerDefault function should have been called before calling this function. The transfer status should be
checked to see if the receiver is not empty before calling this function.
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
numBytes = 0;
do
{
if( DRV_UART3_TRANSFER_STATUS_RX_DATA_PRESENT & DRV_UART3_TransferStatus() )
{
myBuffer[numBytes++] = DRV_UART3_ReadByte();
}
// Do something else...
33
1.2 UART Driver MLA - Drivers Help Driver Interface
File
drv_uart3.h
Syntax
unsigned int DRV_UART3_Write(const uint8_t * buffer, const unsigned int numbytes);
Description
This API transfers the data from application buffer to internal buffer and returns the number of bytes added in that queue
Remarks
None
Preconditions
DRV_UART3_InitializerDefault function should have been called before calling this function
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
DRV_UART3_TRANSFER_STATUS status ;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
status = DRV_UART3_TransferStatus ( ) ;
if (status & DRV_UART3_TRANSFER_STATUS_TX_EMPTY)
{
numBytes += DRV_UART3_Write ( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ;
if(numBytes < writebufferLen)
{
continue;
}
else
{
break;
}
}
else
{
continue;
}
// Do something else...
}
Function
unsigned int DRV_UART3_Write( uint8_t *buffer, const unsigned int numbytes )
File
drv_uart3.h
Syntax
void DRV_UART3_WriteByte(const uint8_t byte);
Returns
None.
34
1.2 UART Driver MLA - Drivers Help Driver Interface
Description
This routine writes a byte of data to the UART3.
Preconditions
DRV_UART3_InitializerDefault function should have been called before calling this function. The transfer status should be
checked to see if transmitter is not full before calling this function.
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
if( !(DRV_UART3_TRANSFER_STATUS_TX_FULL & DRV_UART3_TransferStatus()) )
{
DRV_UART3_WriteByte(handle, myBuffer[numBytes++]);
}
// Do something else...
}
Parameters
Parameters Description
const uint8_t byte Data byte to write to the UART3
Function
void DRV_UART3_WriteByte( const uint8_t byte)
File
drv_uart4.h
Syntax
uint8_t DRV_UART4_Peek(uint16_t offset);
Description
This routine returns the character in the read sequence at the offset provided, without extracting it
Example
const uint8_t readBuffer[5];
unsigned int data, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART4_InitializerDefault();
35
1.2 UART Driver MLA - Drivers Help Driver Interface
break;
}
}
Function
uint8_t DRV_UART4_Peek(uint16_t offset)
File
drv_uart4.h
Syntax
unsigned int DRV_UART4_Read(uint8_t * buffer, const unsigned int numbytes);
Returns
Number of bytes actually copied into the caller's buffer or -1 if there is an error.
Description
This routine returns the number of bytes read by the Peripheral and fills the application read buffer with the read data.
Preconditions
DRV_UART4_InitializerDefault function should have been called before calling this function
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
DRV_UART4_TRANSFER_STATUS status ;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
status = DRV_UART4_TransferStatus ( ) ;
if (status & DRV_UART4_TRANSFER_STATUS_RX_FULL)
{
numBytes += DRV_UART4_Read( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ;
if(numBytes < readbufferLen)
{
continue;
}
else
{
break;
}
}
else
{
continue;
}
// Do something else...
}
Parameters
Parameters Description
uint8_t * buffer Buffer into which the data read from the UART4
const unsigned int numbytes Total number of bytes that need to be read from the UART4
(must be equal to or less than the size of the buffer)
36
1.2 UART Driver MLA - Drivers Help Driver Interface
Function
unsigned int DRV_UART4_Read(uint8_t *buffer, const unsigned int numbytes )
File
drv_uart4.h
Syntax
uint8_t DRV_UART4_ReadByte();
Returns
A data byte received by the driver.
Description
This routine reads a byte of data from the UART4.
Preconditions
DRV_UART4_InitializerDefault function should have been called before calling this function. The transfer status should be
checked to see if the receiver is not empty before calling this function.
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
numBytes = 0;
do
{
if( DRV_UART4_TRANSFER_STATUS_RX_DATA_PRESENT & DRV_UART4_TransferStatus() )
{
myBuffer[numBytes++] = DRV_UART4_ReadByte();
}
// Do something else...
File
drv_uart4.h
Syntax
unsigned int DRV_UART4_Write(const uint8_t * buffer, const unsigned int numbytes);
Description
This API transfers the data from application buffer to internal buffer and returns the number of bytes added in that queue
Remarks
None
Preconditions
DRV_UART4_InitializerDefault function should have been called before calling this function
37
1.2 UART Driver MLA - Drivers Help Driver Interface
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
DRV_UART4_TRANSFER_STATUS status ;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
status = DRV_UART4_TransferStatus ( ) ;
if (status & DRV_UART4_TRANSFER_STATUS_TX_EMPTY)
{
numBytes += DRV_UART4_Write ( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ;
if(numBytes < writebufferLen)
{
continue;
}
else
{
break;
}
}
else
{
continue;
}
// Do something else...
}
Function
unsigned int DRV_UART4_Write( uint8_t *buffer, const unsigned int numbytes )
File
drv_uart4.h
Syntax
void DRV_UART4_WriteByte(const uint8_t byte);
Returns
None.
Description
This routine writes a byte of data to the UART4.
Preconditions
DRV_UART4_InitializerDefault function should have been called before calling this function. The transfer status should be
checked to see if transmitter is not full before calling this function.
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
if( !(DRV_UART4_TRANSFER_STATUS_TX_FULL & DRV_UART4_TransferStatus()) )
38
1.2 UART Driver MLA - Drivers Help Driver Interface
{
DRV_UART4_WriteByte(handle, myBuffer[numBytes++]);
}
// Do something else...
}
Parameters
Parameters Description
const uint8_t byte Data byte to write to the UART4
Function
void DRV_UART4_WriteByte( const uint8_t byte)
Name Description
DRV_UART1_STATUS Specifies the status of the hardware receive or transmit
DRV_UART1_TRANSFER_STATUS Specifies the status of the receive or transmit
DRV_UART2_STATUS Specifies the status of the hardware receive or transmit
DRV_UART2_TRANSFER_STATUS Specifies the status of the receive or transmit
DRV_UART3_STATUS Specifies the status of the hardware receive or transmit
DRV_UART3_TRANSFER_STATUS Specifies the status of the receive or transmit
DRV_UART4_STATUS Specifies the status of the hardware receive or transmit
DRV_UART4_TRANSFER_STATUS Specifies the status of the receive or transmit
Description
File
drv_uart1.h
Syntax
typedef enum {
DRV_UART1_RX_DATA_AVAILABLE,
DRV_UART1_RX_OVERRUN_ERROR,
DRV_UART1_FRAMING_ERROR,
DRV_UART1_PARITY_ERROR,
DRV_UART1_RECEIVER_IDLE,
DRV_UART1_TX_COMPLETE,
DRV_UART1_TX_FULL
} DRV_UART1_STATUS;
Members
Members Description
DRV_UART1_RX_DATA_AVAILABLE Indicates that Receive buffer has data, at least one more
character can be read
DRV_UART1_RX_OVERRUN_ERROR Indicates that Receive buffer has overflowed
DRV_UART1_FRAMING_ERROR Indicates that Framing error has been detected for the
current character
39
1.2 UART Driver MLA - Drivers Help Driver Interface
DRV_UART1_PARITY_ERROR Indicates that Parity error has been detected for the current
character
DRV_UART1_RECEIVER_IDLE Indicates that Receiver is Idle
DRV_UART1_TX_COMPLETE Indicates that the last transmission has completed
DRV_UART1_TX_FULL Indicates that Transmit buffer is full
Description
UART1 Driver Hardware Flags
Remarks
More than one of these values may be OR'd together to create a complete status value. To test a value of this type, the bit of
interest must be AND'ed with value and checked to see if the result is non-zero.
File
drv_uart1.h
Syntax
typedef enum {
DRV_UART1_TRANSFER_STATUS_RX_FULL,
DRV_UART1_TRANSFER_STATUS_RX_DATA_PRESENT,
DRV_UART1_TRANSFER_STATUS_RX_EMPTY,
DRV_UART1_TRANSFER_STATUS_TX_FULL,
DRV_UART1_TRANSFER_STATUS_TX_EMPTY
} DRV_UART1_TRANSFER_STATUS;
Members
Members Description
DRV_UART1_TRANSFER_STATUS_RX_FULL Indicates that the core driver buffer is full
DRV_UART1_TRANSFER_STATUS_RX_DATA_PRESENT Indicates that at least one byte of Data has been received
DRV_UART1_TRANSFER_STATUS_RX_EMPTY Indicates that the core driver receiver buffer is empty
DRV_UART1_TRANSFER_STATUS_TX_FULL Indicates that the core driver transmitter buffer is full
DRV_UART1_TRANSFER_STATUS_TX_EMPTY Indicates that the core driver transmitter buffer is empty
Description
UART1 Driver Transfer Flags
Remarks
More than one of these values may be OR'd together to create a complete status value. To test a value of this type, the bit of
interest must be AND'ed with value and checked to see if the result is non-zero.
File
drv_uart2.h
Syntax
typedef enum {
DRV_UART2_RX_DATA_AVAILABLE,
40
1.2 UART Driver MLA - Drivers Help Driver Interface
DRV_UART2_RX_OVERRUN_ERROR,
DRV_UART2_FRAMING_ERROR,
DRV_UART2_PARITY_ERROR,
DRV_UART2_RECEIVER_IDLE,
DRV_UART2_TX_COMPLETE,
DRV_UART2_TX_FULL
} DRV_UART2_STATUS;
Members
Members Description
DRV_UART2_RX_DATA_AVAILABLE Indicates that Receive buffer has data, at least one more
character can be read
DRV_UART2_RX_OVERRUN_ERROR Indicates that Receive buffer has overflowed
DRV_UART2_FRAMING_ERROR Indicates that Framing error has been detected for the
current character
DRV_UART2_PARITY_ERROR Indicates that Parity error has been detected for the current
character
DRV_UART2_RECEIVER_IDLE Indicates that Receiver is Idle
DRV_UART2_TX_COMPLETE Indicates that the last transmission has completed
DRV_UART2_TX_FULL Indicates that Transmit buffer is full
Description
UART2 Driver Hardware Flags
Remarks
More than one of these values may be OR'd together to create a complete status value. To test a value of this type, the bit of
interest must be AND'ed with value and checked to see if the result is non-zero.
File
drv_uart2.h
Syntax
typedef enum {
DRV_UART2_TRANSFER_STATUS_RX_FULL,
DRV_UART2_TRANSFER_STATUS_RX_DATA_PRESENT,
DRV_UART2_TRANSFER_STATUS_RX_EMPTY,
DRV_UART2_TRANSFER_STATUS_TX_FULL,
DRV_UART2_TRANSFER_STATUS_TX_EMPTY
} DRV_UART2_TRANSFER_STATUS;
Members
Members Description
DRV_UART2_TRANSFER_STATUS_RX_FULL Indicates that the core driver buffer is full
DRV_UART2_TRANSFER_STATUS_RX_DATA_PRESENT Indicates that at least one byte of Data has been received
DRV_UART2_TRANSFER_STATUS_RX_EMPTY Indicates that the core driver receiver buffer is empty
DRV_UART2_TRANSFER_STATUS_TX_FULL Indicates that the core driver transmitter buffer is full
DRV_UART2_TRANSFER_STATUS_TX_EMPTY Indicates that the core driver transmitter buffer is empty
Description
UART2 Driver Transfer Flags
41
1.2 UART Driver MLA - Drivers Help Driver Interface
Remarks
More than one of these values may be OR'd together to create a complete status value. To test a value of this type, the bit of
interest must be AND'ed with value and checked to see if the result is non-zero.
File
drv_uart3.h
Syntax
typedef enum {
DRV_UART3_RX_DATA_AVAILABLE,
DRV_UART3_RX_OVERRUN_ERROR,
DRV_UART3_FRAMING_ERROR,
DRV_UART3_PARITY_ERROR,
DRV_UART3_RECEIVER_IDLE,
DRV_UART3_TX_COMPLETE,
DRV_UART3_TX_FULL
} DRV_UART3_STATUS;
Members
Members Description
DRV_UART3_RX_DATA_AVAILABLE Indicates that Receive buffer has data, at least one more
character can be read
DRV_UART3_RX_OVERRUN_ERROR Indicates that Receive buffer has overflowed
DRV_UART3_FRAMING_ERROR Indicates that Framing error has been detected for the
current character
DRV_UART3_PARITY_ERROR Indicates that Parity error has been detected for the current
character
DRV_UART3_RECEIVER_IDLE Indicates that Receiver is Idle
DRV_UART3_TX_COMPLETE Indicates that the last transmission has completed
DRV_UART3_TX_FULL Indicates that Transmit buffer is full
Description
UART3 Driver Hardware Flags
Remarks
More than one of these values may be OR'd together to create a complete status value. To test a value of this type, the bit of
interest must be AND'ed with value and checked to see if the result is non-zero.
File
drv_uart3.h
Syntax
typedef enum {
DRV_UART3_TRANSFER_STATUS_RX_FULL,
DRV_UART3_TRANSFER_STATUS_RX_DATA_PRESENT,
DRV_UART3_TRANSFER_STATUS_RX_EMPTY,
DRV_UART3_TRANSFER_STATUS_TX_FULL,
DRV_UART3_TRANSFER_STATUS_TX_EMPTY
42
1.2 UART Driver MLA - Drivers Help Driver Interface
} DRV_UART3_TRANSFER_STATUS;
Members
Members Description
DRV_UART3_TRANSFER_STATUS_RX_FULL Indicates that the core driver buffer is full
DRV_UART3_TRANSFER_STATUS_RX_DATA_PRESENT Indicates that at least one byte of Data has been received
DRV_UART3_TRANSFER_STATUS_RX_EMPTY Indicates that the core driver receiver buffer is empty
DRV_UART3_TRANSFER_STATUS_TX_FULL Indicates that the core driver transmitter buffer is full
DRV_UART3_TRANSFER_STATUS_TX_EMPTY Indicates that the core driver transmitter buffer is empty
Description
UART3 Driver Transfer Flags
Remarks
More than one of these values may be OR'd together to create a complete status value. To test a value of this type, the bit of
interest must be AND'ed with value and checked to see if the result is non-zero.
File
drv_uart4.h
Syntax
typedef enum {
DRV_UART4_RX_DATA_AVAILABLE,
DRV_UART4_RX_OVERRUN_ERROR,
DRV_UART4_FRAMING_ERROR,
DRV_UART4_PARITY_ERROR,
DRV_UART4_RECEIVER_IDLE,
DRV_UART4_TX_COMPLETE,
DRV_UART4_TX_FULL
} DRV_UART4_STATUS;
Members
Members Description
DRV_UART4_RX_DATA_AVAILABLE Indicates that Receive buffer has data, at least one more
character can be read
DRV_UART4_RX_OVERRUN_ERROR Indicates that Receive buffer has overflowed
DRV_UART4_FRAMING_ERROR Indicates that Framing error has been detected for the
current character
DRV_UART4_PARITY_ERROR Indicates that Parity error has been detected for the current
character
DRV_UART4_RECEIVER_IDLE Indicates that Receiver is Idle
DRV_UART4_TX_COMPLETE Indicates that the last transmission has completed
DRV_UART4_TX_FULL Indicates that Transmit buffer is full
Description
UART4 Driver Hardware Flags
Remarks
More than one of these values may be OR'd together to create a complete status value. To test a value of this type, the bit of
interest must be AND'ed with value and checked to see if the result is non-zero.
43
1.2 UART Driver MLA - Drivers Help Driver Interface
File
drv_uart4.h
Syntax
typedef enum {
DRV_UART4_TRANSFER_STATUS_RX_FULL,
DRV_UART4_TRANSFER_STATUS_RX_DATA_PRESENT,
DRV_UART4_TRANSFER_STATUS_RX_EMPTY,
DRV_UART4_TRANSFER_STATUS_TX_FULL,
DRV_UART4_TRANSFER_STATUS_TX_EMPTY
} DRV_UART4_TRANSFER_STATUS;
Members
Members Description
DRV_UART4_TRANSFER_STATUS_RX_FULL Indicates that the core driver buffer is full
DRV_UART4_TRANSFER_STATUS_RX_DATA_PRESENT Indicates that at least one byte of Data has been received
DRV_UART4_TRANSFER_STATUS_RX_EMPTY Indicates that the core driver receiver buffer is empty
DRV_UART4_TRANSFER_STATUS_TX_FULL Indicates that the core driver transmitter buffer is full
DRV_UART4_TRANSFER_STATUS_TX_EMPTY Indicates that the core driver transmitter buffer is empty
Description
UART4 Driver Transfer Flags
Remarks
More than one of these values may be OR'd together to create a complete status value. To test a value of this type, the bit of
interest must be AND'ed with value and checked to see if the result is non-zero.
Name Description
DRV_UART1_InitializerDefault Initializes the UART instance : 1
DRV_UART1_TasksError Maintains the driver's error-handling state machine in a polled manner.
DRV_UART1_TasksRX Maintains the driver's receiver state machine in a polled manner.
DRV_UART1_TasksTX Maintains the driver's transmitter state machine in a polled manner
DRV_UART2_InitializerDefault Initializes the UART instance : 2
DRV_UART2_TasksError Maintains the driver's error-handling state machine in a polled manner.
DRV_UART2_TasksRX Maintains the driver's receiver state machine in a polled manner.
DRV_UART2_TasksTX Maintains the driver's transmitter state machine in a polled manner
DRV_UART3_InitializerDefault Initializes the UART instance : 3
DRV_UART3_TasksError Maintains the driver's error-handling state machine in a polled manner.
DRV_UART3_TasksRX Maintains the driver's receiver state machine in a polled manner.
DRV_UART3_TasksTX Maintains the driver's transmitter state machine in a polled manner
DRV_UART4_InitializerDefault Initializes the UART instance : 4
DRV_UART4_TasksError Maintains the driver's error-handling state machine in a polled manner.
DRV_UART4_TasksRX Maintains the driver's receiver state machine in a polled manner.
DRV_UART4_TasksTX Maintains the driver's transmitter state machine in a polled manner
44
1.2 UART Driver MLA - Drivers Help Driver Interface
Description
File
drv_uart1.h
Syntax
void DRV_UART1_InitializerDefault();
Returns
None.
Description
This routine initializes the UART driver instance for : 1 index, making it ready for clients to open and use it.
Remarks
This routine must be called before any other UART routine is called.
Preconditions
None.
Example
const uint8_t writeBuffer[35] = "1234567890ABCDEFGHIJKLMNOPn" ;
unsigned int numBytes = 0;
int writebufferLen = strlen((char *)writeBuffer);
DRV_UART1_InitializerDefault();
while(numBytes < writebufferLen)
{
int bytesToWrite = DRV_UART1_TXBufferSizeGet();
numBytes = DRV_UART1_Write ( writeBuffer+numBytes, bytesToWrite) ;
DRV_UART1_TasksTX ( );
if (!DRV_UART1_TXBufferisFull())
{
//continue other operation
}
}
Function
void DRV_UART1_InitializerDefault(void)
File
drv_uart1.h
Syntax
void DRV_UART1_TasksError();
Returns
None.
Description
This routine is used to maintain the driver's internal error-handling state machine.This routine is called when the state of the
errors needs to be maintained in a polled manner.
45
1.2 UART Driver MLA - Drivers Help Driver Interface
Preconditions
DRV_UART1_InitializerDefault function should have been called before calling this function in a polled loop.
Example
while (true)
{
DRV_UART1_TasksError ();
// Do other tasks
}
Function
void DRV_UART1_TasksError ( void );
File
drv_uart1.h
Syntax
void DRV_UART1_TasksRX();
Returns
None.
Description
This routine is used to maintain the driver's internal receiver state machine. This routine is called when the state of the
receiver needs to be maintained in a polled manner.
Preconditions
DRV_UART1_InitializerDefault function should have been called before calling this function in a polled loop.
Example
const uint8_t readBuffer[35];
unsigned int size, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART1__InitializerDefault();
File
drv_uart1.h
46
1.2 UART Driver MLA - Drivers Help Driver Interface
Syntax
void DRV_UART1_TasksTX();
Returns
None.
Description
This routine is used to maintain the driver's internal transmitter state machine.This routine is called when the state of the
transmitter needs to be maintained in a polled manner.
Preconditions
DRV_UART1_InitializerDefault function should have been called before calling this function in a polled loop.
Example
Refer to DRV_UART1_InitializerDefault() for an example
Function
void DRV_UART1_TasksTX ( void );
File
drv_uart2.h
Syntax
void DRV_UART2_InitializerDefault();
Returns
None.
Description
This routine initializes the UART driver instance for : 2 index, making it ready for clients to open and use it.
Remarks
This routine must be called before any other UART routine is called.
Preconditions
None.
Example
const uint8_t writeBuffer[35] = "1234567890ABCDEFGHIJKLMNOPn" ;
unsigned int numBytes = 0;
int writebufferLen = strlen((char *)writeBuffer);
DRV_UART2_InitializerDefault();
while(numBytes < writebufferLen)
{
int bytesToWrite = DRV_UART2_TXBufferSizeGet();
numBytes = DRV_UART2_Write ( writeBuffer+numBytes, bytesToWrite) ;
DRV_UART2_TasksTX ( );
if (!DRV_UART2_TXBufferisFull())
{
//continue other operation
}
}
Function
void DRV_UART2_InitializerDefault(void)
47
1.2 UART Driver MLA - Drivers Help Driver Interface
File
drv_uart2.h
Syntax
void DRV_UART2_TasksError();
Returns
None.
Description
This routine is used to maintain the driver's internal error-handling state machine.This routine is called when the state of the
errors needs to be maintained in a polled manner.
Preconditions
DRV_UART2_InitializerDefault function should have been called before calling this function in a polled loop.
Example
while (true)
{
DRV_UART2_TasksError ();
// Do other tasks
}
Function
void DRV_UART2_TasksError ( void );
File
drv_uart2.h
Syntax
void DRV_UART2_TasksRX();
Returns
None.
Description
This routine is used to maintain the driver's internal receiver state machine. This routine is called when the state of the
receiver needs to be maintained in a polled manner.
Preconditions
DRV_UART2_InitializerDefault function should have been called before calling this function in a polled loop.
Example
const uint8_t readBuffer[35];
unsigned int size, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART2__InitializerDefault();
48
1.2 UART Driver MLA - Drivers Help Driver Interface
File
drv_uart2.h
Syntax
void DRV_UART2_TasksTX();
Returns
None.
Description
This routine is used to maintain the driver's internal transmitter state machine.This routine is called when the state of the
transmitter needs to be maintained in a polled manner.
Preconditions
DRV_UART2_InitializerDefault function should have been called before calling this function in a polled loop.
Example
Refer to DRV_UART2_InitializerDefault() for an example
Function
void DRV_UART2_TasksTX ( void );
File
drv_uart3.h
Syntax
void DRV_UART3_InitializerDefault();
Returns
None.
Description
This routine initializes the UART driver instance for : 3 index, making it ready for clients to open and use it.
Remarks
This routine must be called before any other UART routine is called.
49
1.2 UART Driver MLA - Drivers Help Driver Interface
Preconditions
None.
Example
const uint8_t writeBuffer[35] = "1234567890ABCDEFGHIJKLMNOPn" ;
unsigned int numBytes = 0;
int writebufferLen = strlen((char *)writeBuffer);
DRV_UART3_InitializerDefault();
while(numBytes < writebufferLen)
{
int bytesToWrite = DRV_UART3_TXBufferSizeGet();
numBytes = DRV_UART3_Write ( writeBuffer+numBytes, bytesToWrite) ;
DRV_UART3_TasksTX ( );
if (!DRV_UART3_TXBufferisFull())
{
//continue other operation
}
}
Function
void DRV_UART3_InitializerDefault(void)
File
drv_uart3.h
Syntax
void DRV_UART3_TasksError();
Returns
None.
Description
This routine is used to maintain the driver's internal error-handling state machine.This routine is called when the state of the
errors needs to be maintained in a polled manner.
Preconditions
DRV_UART3_InitializerDefault function should have been called before calling this function in a polled loop.
Example
while (true)
{
DRV_UART3_TasksError ();
// Do other tasks
}
Function
void DRV_UART3_TasksError ( void );
File
drv_uart3.h
50
1.2 UART Driver MLA - Drivers Help Driver Interface
Syntax
void DRV_UART3_TasksRX();
Returns
None.
Description
This routine is used to maintain the driver's internal receiver state machine. This routine is called when the state of the
receiver needs to be maintained in a polled manner.
Preconditions
DRV_UART3_InitializerDefault function should have been called before calling this function in a polled loop.
Example
const uint8_t readBuffer[35];
unsigned int size, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART3__InitializerDefault();
File
drv_uart3.h
Syntax
void DRV_UART3_TasksTX();
Returns
None.
Description
This routine is used to maintain the driver's internal transmitter state machine.This routine is called when the state of the
transmitter needs to be maintained in a polled manner.
Preconditions
DRV_UART3_InitializerDefault function should have been called before calling this function in a polled loop.
Example
Refer to DRV_UART3_InitializerDefault() for an example
Function
void DRV_UART3_TasksTX ( void );
51
1.2 UART Driver MLA - Drivers Help Driver Interface
File
drv_uart4.h
Syntax
void DRV_UART4_InitializerDefault();
Returns
None.
Description
This routine initializes the UART driver instance for : 4 index, making it ready for clients to open and use it.
Remarks
This routine must be called before any other UART routine is called.
Preconditions
None.
Example
const uint8_t writeBuffer[35] = "1234567890ABCDEFGHIJKLMNOPn" ;
unsigned int numBytes = 0;
int writebufferLen = strlen((char *)writeBuffer);
DRV_UART4_InitializerDefault();
while(numBytes < writebufferLen)
{
int bytesToWrite = DRV_UART4_TXBufferSizeGet();
numBytes = DRV_UART4_Write ( writeBuffer+numBytes, bytesToWrite) ;
DRV_UART4_TasksTX ( );
if (!DRV_UART4_TXBufferisFull())
{
//continue other operation
}
}
Function
void DRV_UART4_InitializerDefault(void)
File
drv_uart4.h
Syntax
void DRV_UART4_TasksError();
Returns
None.
Description
This routine is used to maintain the driver's internal error-handling state machine.This routine is called when the state of the
errors needs to be maintained in a polled manner.
Preconditions
DRV_UART4_InitializerDefault function should have been called before calling this function in a polled loop.
52
1.2 UART Driver MLA - Drivers Help Driver Interface
Example
while (true)
{
DRV_UART4_TasksError ();
// Do other tasks
}
Function
void DRV_UART4_TasksError ( void );
File
drv_uart4.h
Syntax
void DRV_UART4_TasksRX();
Returns
None.
Description
This routine is used to maintain the driver's internal receiver state machine. This routine is called when the state of the
receiver needs to be maintained in a polled manner.
Preconditions
DRV_UART4_InitializerDefault function should have been called before calling this function in a polled loop.
Example
const uint8_t readBuffer[35];
unsigned int size, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART4__InitializerDefault();
File
drv_uart4.h
Syntax
void DRV_UART4_TasksTX();
53
1.2 UART Driver MLA - Drivers Help Driver Interface
Returns
None.
Description
This routine is used to maintain the driver's internal transmitter state machine.This routine is called when the state of the
transmitter needs to be maintained in a polled manner.
Preconditions
DRV_UART4_InitializerDefault function should have been called before calling this function in a polled loop.
Example
Refer to DRV_UART4_InitializerDefault() for an example
Function
void DRV_UART4_TasksTX ( void );
Name Description
DRV_UART1_RXBufferIsEmpty Returns the status of the receive buffer
DRV_UART1_RXBufferSizeGet Returns the size of the receive buffer
DRV_UART1_Status Returns the transmitter and receiver status
DRV_UART1_TransferStatus Returns the transmitter and receiver transfer status
DRV_UART1_TXBufferIsFull Returns the status of the transmit buffer
DRV_UART1_TXBufferSizeGet Returns the size of the transmit buffer
DRV_UART2_RXBufferIsEmpty Returns the status of the receive buffer
DRV_UART2_RXBufferSizeGet Returns the size of the receive buffer
DRV_UART2_Status Returns the transmitter and receiver status
DRV_UART2_TransferStatus Returns the transmitter and receiver transfer status
DRV_UART2_TXBufferIsFull Returns the status of the transmit buffer
DRV_UART2_TXBufferSizeGet Returns the size of the transmit buffer
DRV_UART3_RXBufferIsEmpty Returns the status of the receive buffer
DRV_UART3_RXBufferSizeGet Returns the size of the receive buffer
DRV_UART3_Status Returns the transmitter and receiver status
DRV_UART3_TransferStatus Returns the transmitter and receiver transfer status
DRV_UART3_TXBufferIsFull Returns the status of the transmit buffer
DRV_UART3_TXBufferSizeGet Returns the size of the transmit buffer
DRV_UART4_RXBufferIsEmpty Returns the status of the receive buffer
DRV_UART4_RXBufferSizeGet Returns the size of the receive buffer
DRV_UART4_Status Returns the transmitter and receiver status
DRV_UART4_TransferStatus Returns the transmitter and receiver transfer status
DRV_UART4_TXBufferIsFull Returns the status of the transmit buffer
DRV_UART4_TXBufferSizeGet Returns the size of the transmit buffer
Description
54
1.2 UART Driver MLA - Drivers Help Driver Interface
File
drv_uart1.h
Syntax
bool DRV_UART1_RXBufferIsEmpty();
Returns
True if the receive buffer is empty False if the receive buffer is not empty
Description
This routine returns if the receive buffer is empty or not.
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
DRV_UART1_TRANSFER_STATUS status ;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
status = DRV_UART1_TransferStatus ( ) ;
if (!DRV_UART1_RXBufferIsEmpty())
{
numBytes += DRV_UART1_Read( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ;
if(numBytes < readbufferLen)
{
continue;
}
else
{
break;
}
}
else
{
continue;
}
// Do something else...
}
Function
bool DRV_UART1_RXBufferIsEmpty (void)
File
drv_uart1.h
Syntax
unsigned int DRV_UART1_RXBufferSizeGet();
Returns
Size of receive buffer.
55
1.2 UART Driver MLA - Drivers Help Driver Interface
Description
This routine returns the size of the receive buffer.
Example
const uint8_t readBuffer[5];
unsigned int size, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART1__InitializerDefault();
File
drv_uart1.h
Syntax
DRV_UART1_STATUS DRV_UART1_Status();
Returns
A DRV_UART1_STATUS value describing the current status of the transfer.
Description
This returns the transmitter and receiver status.
Remarks
The returned status may contain a value with more than one of the bits specified in the DRV_UART1_STATUS enumeration
set. The caller should perform an "AND" with the bit of interest and verify if the result is non-zero (as shown in the example)
to verify the desired status bit.
Preconditions
DRV_UART1_InitializerDefault function should have been called before calling this function
Example
while(!(DRV_UART1_Status() & DRV_UART1_TX_COMPLETE ))
{
// Wait for the tranmission to complete
}
Function
DRV_UART1_STATUS DRV_UART1_Status (void)
File
drv_uart1.h
56
1.2 UART Driver MLA - Drivers Help Driver Interface
Syntax
DRV_UART1_TRANSFER_STATUS DRV_UART1_TransferStatus();
Returns
A DRV_UART1_TRANSFER_STATUS value describing the current status of the transfer.
Description
This returns the transmitter and receiver transfer status.
Remarks
The returned status may contain a value with more than one of the bits specified in the DRV_UART1_TRANSFER_STATUS
enumeration set. The caller should perform an "AND" with the bit of interest and verify if the result is non-zero (as shown in
the example) to verify the desired status bit.
Preconditions
DRV_UART1_InitializerDefault function should have been called before calling this function
Example
Refer to DRV_UART1_Read and DRV_UART1_Write for example
Function
DRV_UART1_TRANSFER_STATUS DRV_UART1_TransferStatus (void)
File
drv_uart1.h
Syntax
bool DRV_UART1_TXBufferIsFull();
Returns
True if the transmit buffer is full False if the transmit buffer is not full
Description
This routine returns if the transmit buffer is full or not.
Example
Refer to DRV_UART1_InitializerDefault() for example.
Function
bool DRV_UART1_TXBufferIsFull (void)
File
drv_uart1.h
Syntax
unsigned int DRV_UART1_TXBufferSizeGet();
Returns
Size of transmit buffer.
57
1.2 UART Driver MLA - Drivers Help Driver Interface
Description
This routine returns the size of the transmit buffer.
Example
Refer to DRV_UART1_InitializerDefault(); for example.
Function
unsigned int DRV_UART1_TXBufferSizeGet (void)
File
drv_uart2.h
Syntax
bool DRV_UART2_RXBufferIsEmpty();
Returns
True if the receive buffer is empty False if the receive buffer is not empty
Description
This routine returns if the receive buffer is empty or not.
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
DRV_UART2_TRANSFER_STATUS status ;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
status = DRV_UART2_TransferStatus ( ) ;
if (!DRV_UART2_RXBufferIsEmpty())
{
numBytes += DRV_UART2_Read( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ;
if(numBytes < readbufferLen)
{
continue;
}
else
{
break;
}
}
else
{
continue;
}
// Do something else...
}
Function
bool DRV_UART2_RXBufferIsEmpty (void)
58
1.2 UART Driver MLA - Drivers Help Driver Interface
File
drv_uart2.h
Syntax
unsigned int DRV_UART2_RXBufferSizeGet();
Returns
Size of receive buffer.
Description
This routine returns the size of the receive buffer.
Example
const uint8_t readBuffer[5];
unsigned int size, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART2__InitializerDefault();
File
drv_uart2.h
Syntax
DRV_UART2_STATUS DRV_UART2_Status();
Returns
A DRV_UART2_STATUS value describing the current status of the transfer.
Description
This returns the transmitter and receiver status.
Remarks
The returned status may contain a value with more than one of the bits specified in the DRV_UART2_STATUS enumeration
set. The caller should perform an "AND" with the bit of interest and verify if the result is non-zero (as shown in the example)
to verify the desired status bit.
Preconditions
DRV_UART2_InitializerDefault function should have been called before calling this function
Example
while(!(DRV_UART2_Status() & DRV_UART2_TX_COMPLETE ))
{
// Wait for the tranmission to complete
}
Function
DRV_UART2_STATUS DRV_UART2_Status (void)
59
1.2 UART Driver MLA - Drivers Help Driver Interface
File
drv_uart2.h
Syntax
DRV_UART2_TRANSFER_STATUS DRV_UART2_TransferStatus();
Returns
A DRV_UART2_TRANSFER_STATUS value describing the current status of the transfer.
Description
This returns the transmitter and receiver transfer status.
Remarks
The returned status may contain a value with more than one of the bits specified in the DRV_UART2_TRANSFER_STATUS
enumeration set. The caller should perform an "AND" with the bit of interest and verify if the result is non-zero (as shown in
the example) to verify the desired status bit.
Preconditions
DRV_UART2_InitializerDefault function should have been called before calling this function
Example
Refer to DRV_UART2_Read and DRV_UART2_Write for example
Function
DRV_UART2_TRANSFER_STATUS DRV_UART2_TransferStatus (void)
File
drv_uart2.h
Syntax
bool DRV_UART2_TXBufferIsFull();
Returns
True if the transmit buffer is full False if the transmit buffer is not full
Description
This routine returns if the transmit buffer is full or not.
Example
Refer to DRV_UART2_InitializerDefault() for example.
Function
bool DRV_UART2_TXBufferIsFull (void)
60
1.2 UART Driver MLA - Drivers Help Driver Interface
File
drv_uart2.h
Syntax
unsigned int DRV_UART2_TXBufferSizeGet();
Returns
Size of transmit buffer.
Description
This routine returns the size of the transmit buffer.
Example
Refer to DRV_UART2_InitializerDefault(); for example.
Function
unsigned int DRV_UART2_TXBufferSizeGet (void)
File
drv_uart3.h
Syntax
bool DRV_UART3_RXBufferIsEmpty();
Returns
True if the receive buffer is empty False if the receive buffer is not empty
Description
This routine returns if the receive buffer is empty or not.
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
DRV_UART3_TRANSFER_STATUS status ;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
status = DRV_UART3_TransferStatus ( ) ;
if (!DRV_UART3_RXBufferIsEmpty())
{
numBytes += DRV_UART3_Read( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ;
if(numBytes < readbufferLen)
{
continue;
}
else
{
break;
}
}
else
{
continue;
}
// Do something else...
61
1.2 UART Driver MLA - Drivers Help Driver Interface
}
Function
bool DRV_UART3_RXBufferIsEmpty (void)
File
drv_uart3.h
Syntax
unsigned int DRV_UART3_RXBufferSizeGet();
Returns
Size of receive buffer.
Description
This routine returns the size of the receive buffer.
Example
const uint8_t readBuffer[5];
unsigned int size, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART3__InitializerDefault();
File
drv_uart3.h
Syntax
DRV_UART3_STATUS DRV_UART3_Status();
Returns
A DRV_UART3_STATUS value describing the current status of the transfer.
Description
This returns the transmitter and receiver status.
Remarks
The returned status may contain a value with more than one of the bits specified in the DRV_UART3_STATUS enumeration
set. The caller should perform an "AND" with the bit of interest and verify if the result is non-zero (as shown in the example)
to verify the desired status bit.
Preconditions
DRV_UART3_InitializerDefault function should have been called before calling this function
62
1.2 UART Driver MLA - Drivers Help Driver Interface
Example
while(!(DRV_UART3_Status() & DRV_UART3_TX_COMPLETE ))
{
// Wait for the tranmission to complete
}
Function
DRV_UART3_STATUS DRV_UART3_Status (void)
File
drv_uart3.h
Syntax
DRV_UART3_TRANSFER_STATUS DRV_UART3_TransferStatus();
Returns
A DRV_UART3_TRANSFER_STATUS value describing the current status of the transfer.
Description
This returns the transmitter and receiver transfer status.
Remarks
The returned status may contain a value with more than one of the bits specified in the DRV_UART3_TRANSFER_STATUS
enumeration set. The caller should perform an "AND" with the bit of interest and verify if the result is non-zero (as shown in
the example) to verify the desired status bit.
Preconditions
DRV_UART3_InitializerDefault function should have been called before calling this function
Example
Refer to DRV_UART3_Read and DRV_UART3_Write for example
Function
DRV_UART3_TRANSFER_STATUS DRV_UART3_TransferStatus (void)
File
drv_uart3.h
Syntax
bool DRV_UART3_TXBufferIsFull();
Returns
True if the transmit buffer is full False if the transmit buffer is not full
Description
This routine returns if the transmit buffer is full or not.
Example
Refer to DRV_UART3_InitializerDefault() for example.
63
1.2 UART Driver MLA - Drivers Help Driver Interface
Function
bool DRV_UART3_TXBufferIsFull (void)
File
drv_uart3.h
Syntax
unsigned int DRV_UART3_TXBufferSizeGet();
Returns
Size of transmit buffer.
Description
This routine returns the size of the transmit buffer.
Example
Refer to DRV_UART3_InitializerDefault(); for example.
Function
unsigned int DRV_UART3_TXBufferSizeGet (void)
File
drv_uart4.h
Syntax
bool DRV_UART4_RXBufferIsEmpty();
Returns
True if the receive buffer is empty False if the receive buffer is not empty
Description
This routine returns if the receive buffer is empty or not.
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
DRV_UART4_TRANSFER_STATUS status ;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE);
{
status = DRV_UART4_TransferStatus ( ) ;
if (!DRV_UART4_RXBufferIsEmpty())
{
numBytes += DRV_UART4_Read( myBuffer + numBytes, MY_BUFFER_SIZE - numBytes ) ;
if(numBytes < readbufferLen)
{
continue;
}
else
64
1.2 UART Driver MLA - Drivers Help Driver Interface
{
break;
}
}
else
{
continue;
}
// Do something else...
}
Function
bool DRV_UART4_RXBufferIsEmpty (void)
File
drv_uart4.h
Syntax
unsigned int DRV_UART4_RXBufferSizeGet();
Returns
Size of receive buffer.
Description
This routine returns the size of the receive buffer.
Example
const uint8_t readBuffer[5];
unsigned int size, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART4__InitializerDefault();
File
drv_uart4.h
Syntax
DRV_UART4_STATUS DRV_UART4_Status();
Returns
A DRV_UART4_STATUS value describing the current status of the transfer.
Description
This returns the transmitter and receiver status.
65
1.2 UART Driver MLA - Drivers Help Driver Interface
Remarks
The returned status may contain a value with more than one of the bits specified in the DRV_UART4_STATUS enumeration
set. The caller should perform an "AND" with the bit of interest and verify if the result is non-zero (as shown in the example)
to verify the desired status bit.
Preconditions
DRV_UART4_InitializerDefault function should have been called before calling this function
Example
while(!(DRV_UART4_Status() & DRV_UART4_TX_COMPLETE ))
{
// Wait for the tranmission to complete
}
Function
DRV_UART4_STATUS DRV_UART4_Status (void)
File
drv_uart4.h
Syntax
DRV_UART4_TRANSFER_STATUS DRV_UART4_TransferStatus();
Returns
A DRV_UART4_TRANSFER_STATUS value describing the current status of the transfer.
Description
This returns the transmitter and receiver transfer status.
Remarks
The returned status may contain a value with more than one of the bits specified in the DRV_UART4_TRANSFER_STATUS
enumeration set. The caller should perform an "AND" with the bit of interest and verify if the result is non-zero (as shown in
the example) to verify the desired status bit.
Preconditions
DRV_UART4_InitializerDefault function should have been called before calling this function
Example
Refer to DRV_UART4_Read and DRV_UART4_Write for example
Function
DRV_UART4_TRANSFER_STATUS DRV_UART4_TransferStatus (void)
File
drv_uart4.h
Syntax
bool DRV_UART4_TXBufferIsFull();
66
1.2 UART Driver MLA - Drivers Help Driver Interface
Returns
True if the transmit buffer is full False if the transmit buffer is not full
Description
This routine returns if the transmit buffer is full or not.
Example
Refer to DRV_UART4_InitializerDefault() for example.
Function
bool DRV_UART4_TXBufferIsFull (void)
File
drv_uart4.h
Syntax
unsigned int DRV_UART4_TXBufferSizeGet();
Returns
Size of transmit buffer.
Description
This routine returns the size of the transmit buffer.
Example
Refer to DRV_UART4_InitializerDefault(); for example.
Function
unsigned int DRV_UART4_TXBufferSizeGet (void)
67
1.3 SPI Driver MLA - Drivers Help Using Driver
Enumerations
Name Description
SPI_TRANSFER_MODE Defines the Transfer Mode enumeration for SPI.
Functions
Name Description
SPI_DummyDataSet Sets the dummy data when calling exchange functions
Description
Overview
The SPI module is a full duplex synchronous serial interface useful for communicating with other peripherals or
microcontrollers in master/slave relationship and it can transfer data over short distances at high speeds. The peripheral
devices may be serial EEPROMs, shift registers, display drivers, analog-to-digital converters, etc. The SPI module is
compatible with Motorola’s SPI and SIOP interfaces.
During data transfer devices can work either in master or in Slave mode. The source of synchronization is the system clock,
which is generated by the master. The SPI module allows to connect one or more slave devices to a single master device
via the same bus.
The SPI serial interface consists of four pins, which are further sub-divided into data and control lines:
Data lines:
Control lines:
68
1.3 SPI Driver MLA - Drivers Help Using Driver
Description
This topic describes the basic architecture of the SPI Driver Library and provides information and examples on how to use it.
The interface to the SPI Driver library is defined in the "drv_spi.h" header file. Any C language source (.c) file that uses the
SPI Driver library should include this header.
The library interface routines are divided into various subsections, each of the sub section addresses one of the blocks or
the overall operation of the SPI module.
Both transmitter and receiver provides a buffer in the driver which transmits and receives data to/from the hardware. The SPI
driver provides a set of interfaces to perform the read and the write.
The diagrams below illustrates the model used by the SPI driver for transmitter and receiver.
69
1.3 SPI Driver MLA - Drivers Help Configuring the Driver
Name Description
DRV_SPI_CONFIG_CHANNEL_1_ENABLE Enable SPI channel 1
DRV_SPI_CONFIG_CHANNEL_2_ENABLE Enable SPI channel 2
DRV_SPI_CONFIG_CHANNEL_3_ENABLE Enable SPI channel 3
DRV_SPI_CONFIG_CHANNEL_4_ENABLE Enable SPI channel 4
DRV_SPI_CONFIG_ENHANCED_BUFFER_DISABLE Disable the SPI Enhanced Buffer Mode if the specific driver
implementation supports it.
Module
SPI Driver
Description
Syntax
#define DRV_SPI_CONFIG_CHANNEL_1_ENABLE
Description
Enable SPI channel 1
Syntax
#define DRV_SPI_CONFIG_CHANNEL_2_ENABLE
Description
Enable SPI channel 2
70
1.3 SPI Driver MLA - Drivers Help Driver Interface
Syntax
#define DRV_SPI_CONFIG_CHANNEL_3_ENABLE
Description
Enable SPI channel 3
Syntax
#define DRV_SPI_CONFIG_CHANNEL_4_ENABLE
Description
Enable SPI channel 4
Syntax
#define DRV_SPI_CONFIG_ENHANCED_BUFFER_DISABLE
Description
Disable the SPI Enhanced Buffer Mode if the specific driver implementation supports it.
Description
Name Description
DRV_SPI_Deinitialize Deinitializes the SPI instance specified by the channel parameter
DRV_SPI_Initialize Initializes the SPI instance specified by the channel of the initialization
structure.
71
1.3 SPI Driver MLA - Drivers Help Driver Interface
DRV_SPI_Lock Locks the SPI instance specified using the channel parameter
DRV_SPI_Unlock Unlocks the SPI instance specified by channel parameter
Description
File
drv_spi.h
Syntax
void DRV_SPI_Deinitialize(uint8_t channel);
Returns
None.
Description
This routine deinitializes the spi driver instance specified by the channel parameter.
Remarks
None.
Preconditions
None.
Example
uint8_t myChannel = 2;
DRV_SPI_Deinitialize(myChannel);
Parameters
Parameters Description
uint8_t channel SPI instance which needs to be deinitialized.
Function
void DRV_SPI_Deinitialize (uint8_t channel)
File
drv_spi.h
Syntax
void DRV_SPI_Initialize(DRV_SPI_INIT_DATA * pData);
Returns
None.
Description
This routine initializes the spi driver instance specified by the channel of the initialization structure making it ready for clients
to lock and use it.
72
1.3 SPI Driver MLA - Drivers Help Driver Interface
Remarks
This routine must be called before any other SPI routine is called. This routine should only be called once during system
initialization. Current implementation supports 8-bit transfer mode only.
Preconditions
None.
Example
uint16_t myBuffer[MY_BUFFER_SIZE];
unsigned int total;
uint8_t myChannel = 2;
DRV_SPI_INIT_DATA spiInitData = {2, 3, 7, 0, SPI_BUS_MODE_3, 0};
DRV_SPI_Initialize(&spiInitData);
DRV_SPI_Lock(myChannel);
total = 0;
do
{
total += DRV_SPI_PutBuffer( myChannel, &myBuffer[total], MY_BUFFER_SIZE - total );
// Do something else...
Parameters Description
DRV_SPI_INIT_DATA * pData SPI initialization structure.
Function
void DRV_SPI_Initialize( DRV_SPI_INIT_DATA *pData)
File
drv_spi.h
Syntax
int DRV_SPI_Lock(uint8_t channel);
Returns
Returns the status of the driver usage.
Description
This routine locks the SPI driver instance specified using the channel parameter
Remarks
None.
Preconditions
None.
Example
Refer to DRV_SPI_Initialize() for an example
73
1.3 SPI Driver MLA - Drivers Help Driver Interface
Parameters
Parameters Description
uint8_t channel SPI instance through which the communication needs to
happen
Function
int DRV_SPI_Lock(uint8_t channel)
File
drv_spi.h
Syntax
void DRV_SPI_Unlock(uint8_t channel);
Returns
None.
Description
This routine unlocks the SPI driver instance specified by channel parameter making it ready for other clients to lock and use
it.
Remarks
None.
Preconditions
None.
Example
uint8_t myChannel = 2;
DRV_SPI_Unlock(myChannel);
Parameters
Parameters Description
uint8_t channel SPI instance through which the communication needs to
happen
Function
void DRV_SPI_Unlock(uint8_t channel)
Name Description
DRV_SPI_Get Reads a byte of data from SPI from the specified channel
DRV_SPI_GetBuffer Reads a buffered data from SPI
DRV_SPI_Put Writes a byte of data to the SPI to the specified channel
DRV_SPI_PutBuffer Writes a data buffer to SPI
Description
74
1.3 SPI Driver MLA - Drivers Help Driver Interface
File
drv_spi.h
Syntax
uint8_t DRV_SPI_Get(uint8_t channel);
Returns
A data byte received by the driver.
Description
This routine reads a byte of data from SPI from the specified channel
Remarks
This is blocking routine.
Preconditions
The DRV_SPI_Initialize routine must have been called for the specified SPI driver instance.
Example
char myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
uint8_t myChannel = 2;
numBytes = 0;
do
{
myBuffer[numBytes++] = DRV_SPI_Get(myChannel);
// Do something else...
Parameters Description
uint8_t channel SPI instance through which the communication needs to
happen
Function
uint8_t DRV_SPI_Get(uint8_t channel)
File
drv_spi.h
Syntax
void DRV_SPI_GetBuffer(uint8_t channel, uint8_t * data, uint16_t count);
Returns
None.
Description
This routine reads a buffered data from the SPI.
75
1.3 SPI Driver MLA - Drivers Help Driver Interface
Remarks
This is a blocking routine.
Preconditions
The DRV_SPI_Initialize routine must have been called.
Parameters
Parameters Description
uint8_t channel SPI instance through which the communication needs to
happen
uint8_t * data Pointer to buffer into which the data read from the SPI
instance will be placed.
uint16_t count Total number of bytes that need to be read from the module
instance (must be equal to or less than the size of the buffer)
Function
void DRV_SPI_GetBuffer (uint8_t channel, uint8_t * data, uint16_t count)
File
drv_spi.h
Syntax
void DRV_SPI_Put(uint8_t channel, uint8_t data);
Returns
None.
Description
This routine writes a byte of data to the SPI to the specified channel
Remarks
This is a blocking routine.
Preconditions
The DRV_SPI_Initialize routine must have been called for the specified SPI driver instance.
Example
uint16_t myBuffer[MY_BUFFER_SIZE];
unsigned int numBytes;
uint8_t myChannel = 2;
numBytes = 0;
while( numBytes < MY_BUFFER_SIZE )
{
// DRV_SPI_Put API returns data in any case, upto the user to use it
DRV_SPI_Put( myChannel, myBuffer[numBytes++] );
// Do something else...
}
76
1.3 SPI Driver MLA - Drivers Help Driver Interface
Parameters
Parameters Description
uint8_t channel SPI instance through which the communication needs to
happen
uint8_t data Data byte to write to the SPI
Function
void DRV_SPI_Put(uint8_t channel, uint8_t data)
File
drv_spi.h
Syntax
void DRV_SPI_PutBuffer(uint8_t channel, uint8_t * data, uint16_t count);
Returns
None.
Description
This routine writes a buffered data to SPI.
Remarks
This is a blocking routine.
Preconditions
The DRV_SPI_Initialize routine must have been called for the specified SPI driver instance.
Example
Refer to DRV_SPI_Initialize() for an example
Parameters
Parameters Description
uint8_t channel SPI instance through which the communication needs to
happen
uint8_t * data Pointer to buffer containing the data write to the SPI instance
uint16_t count Total number of bytes that to write to the SPI instance (must
be equal to or less than the size of the buffer)
Function
void DRV_SPI_PutBuffer (uint8_t channel, uint8_t * data, uint16_t count)
Name Description
SPI_BUS_MODES Specifies the SPI modes which can be used in the initialization structure
to initialize the SPI for operation.
77
1.3 SPI Driver MLA - Drivers Help Driver Interface
Structures
Name Description
DRV_SPI_INIT_DATA The structure that defines the SPI channel's operation.
Description
File
drv_spi.h
Syntax
typedef struct {
uint16_t channel;
uint16_t baudRate;
uint16_t dummy;
uint16_t primaryPrescale;
uint16_t secondaryPrescale;
uint8_t divider;
uint8_t cke;
SPI_BUS_MODES spibus_mode;
SPI_TRANSFER_MODE mode;
} DRV_SPI_INIT_DATA;
Members
Members Description
uint16_t channel; Channel for the SPI communication
uint16_t baudRate; Baud rate for the SPI communication
uint16_t primaryPrescale; Primary and Secondary prescalers control the SPI frequency
uint8_t cke; Clock Edge Selection Bits
SPI_BUS_MODES spibus_mode; One of SPI Bus mode as specified SPI_BUS_MODES
SPI_TRANSFER_MODE mode; Select between 8 and 16 bit communication
Description
SPI Initialization structure
Specifies the members which can be adjusted to allow the SPI to be initialized for each instance of SPI.
File
drv_spi.h
Syntax
typedef enum {
SPI_BUS_MODE_0 = 0x0050,
SPI_BUS_MODE_1,
SPI_BUS_MODE_2,
SPI_BUS_MODE_3
} SPI_BUS_MODES;
78
1.3 SPI Driver MLA - Drivers Help SPI_TRANSFER_MODE Enumeration
Members
Members Description
SPI_BUS_MODE_0 = 0x0050 smp = 0, ckp = 0
SPI_BUS_MODE_1 smp = 1, ckp = 0
SPI_BUS_MODE_2 smp = 0, ckp = 1
SPI_BUS_MODE_3 smp = 1, ckp = 1
Description
SPI Modes Enumeration
Specifies the SPI bus modes enumeration for which an SPI channel can operate on. The SPI channel bus mode can be set
in the SPI channel initialization routine parameter.
File
drv_spi.h
Syntax
void SPI_DummyDataSet(uint8_t channel, uint8_t dummyData);
Module
SPI Driver
Returns
None.
Description
This function sets the dummy data used when performing a an SPI get call. When get is used, the exchange functions will
still need to send data for proper SPI operation.
Remarks
This is a blocking routine.
Preconditions
The DRV_SPI_Initialize routine must have been called.
Parameters
Parameters Description
uint8_t channel SPI instance through which the communication needs to
happen
uint8_t dummyData Dummy data to be used.
Function
void SPI_DummyDataSet(
uint8_t channel,
uint8_t dummyData)
79
1.3 SPI Driver MLA - Drivers Help SPI_TRANSFER_MODE Enumeration
File
drv_spi.h
Syntax
typedef enum {
SPI_TRANSFER_MODE_32BIT = 2,
SPI_TRANSFER_MODE_16BIT = 1,
SPI_TRANSFER_MODE_8BIT = 0
} SPI_TRANSFER_MODE;
Module
SPI Driver
Description
SPI Transfer Mode Enumeration
80
2 MLA - Drivers Help
DRV_SPI_Unlock function 74
Index DRV_UART1_CONFIG_8E1 11
DRV_UART1_CONFIG_8E1 macro 11
A DRV_UART1_CONFIG_8E2 11
C DRV_UART1_CONFIG_8N1 macro 12
DRV_UART1_CONFIG_8N2 12
Configuring the Driver 10, 70
DRV_UART1_CONFIG_8N2 macro 12
DRV_UART1_CONFIG_8O1 12
D DRV_UART1_CONFIG_8O1 macro 12
Data Transfer 9
DRV_UART1_CONFIG_8O2 12
Data Transfer Functions 23, 74
DRV_UART1_CONFIG_8O2 macro 12
Data Types and Constants 39, 77
DRV_UART1_CONFIG_9N1 13
Driver Interface 23, 71
DRV_UART1_CONFIG_9N1 macro 13
DRV_SPI_CONFIG_CHANNEL_1_ENABLE 70
DRV_UART1_CONFIG_9N2 13
DRV_SPI_CONFIG_CHANNEL_1_ENABLE macro 70
DRV_UART1_CONFIG_9N2 macro 13
DRV_SPI_CONFIG_CHANNEL_2_ENABLE 70
DRV_UART1_CONFIG_BAUD_RATE 13
DRV_SPI_CONFIG_CHANNEL_2_ENABLE macro 70
DRV_UART1_CONFIG_BAUD_RATE macro 13
DRV_SPI_CONFIG_CHANNEL_3_ENABLE 71
DRV_UART1_CONFIG_RX_BYTEQ_LENGTH 13
DRV_SPI_CONFIG_CHANNEL_3_ENABLE macro 71
DRV_UART1_CONFIG_RX_BYTEQ_LENGTH macro 13
DRV_SPI_CONFIG_CHANNEL_4_ENABLE 71
DRV_UART1_CONFIG_TX_BYTEQ_LENGTH 14
DRV_SPI_CONFIG_CHANNEL_4_ENABLE macro 71
DRV_UART1_CONFIG_TX_BYTEQ_LENGTH macro 14
DRV_SPI_CONFIG_ENHANCED_BUFFER_DISABLE 71
DRV_UART1_InitializerDefault 45
DRV_SPI_CONFIG_ENHANCED_BUFFER_DISABLE macro
71 DRV_UART1_InitializerDefault function 45
DRV_SPI_Deinitialize 72 DRV_UART1_Peek 24
DRV_SPI_Get 75 DRV_UART1_Read 24
DRV_SPI_GetBuffer 75 DRV_UART1_ReadByte 25
DRV_SPI_INIT_DATA 78 DRV_UART1_RXBufferIsEmpty 55
DRV_SPI_Initialize 72 DRV_UART1_RXBufferSizeGet 55
DRV_SPI_Lock 73 DRV_UART1_Status 56
DRV_SPI_PutBuffer 77 DRV_UART1_TasksError 45
DRV_SPI_Unlock 74 DRV_UART1_TasksRX 46
81
2 MLA - Drivers Help
82
2 MLA - Drivers Help
83
2 MLA - Drivers Help
DRV_UART4_TasksRX function 53
DRV_UART4_TasksTX 53
DRV_UART4_TasksTX function 53
DRV_UART4_TRANSFER_STATUS 44
DRV_UART4_TRANSFER_STATUS enumeration 44
DRV_UART4_TransferStatus 66
DRV_UART4_TransferStatus function 66
DRV_UART4_TXBufferIsFull 66
DRV_UART4_TXBufferIsFull function 66
DRV_UART4_TXBufferSizeGet 67
DRV_UART4_TXBufferSizeGet function 67
DRV_UART4_Write 37
DRV_UART4_Write function 37
DRV_UART4_WriteByte 38
DRV_UART4_WriteByte function 38
I
Initialization 9
Initialization and Setup Functions 44, 71
L
Legal Information 7
M
MLA Drivers 6
S
SPI Driver 68
SPI_BUS_MODES 78
SPI_BUS_MODES enumeration 78
SPI_DummyDataSet 79
SPI_DummyDataSet function 79
SPI_TRANSFER_MODE 80
SPI_TRANSFER_MODE enumeration 80
Status Functions 54
U
UART Driver 8
Using Driver 8, 69
84