# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# MLA -- Drivers

20 December, 2013

- 1
- 2
…
- 30
- 31
- 32
- 33
- 34
…
- 82
- 83

Example
const uint8_t readBuffer[5];
unsigned int data, numBytes = 0;
unsigned int readbufferLen = sizeof(readBuffer);
DRV_UART3_InitializerDefault();
while(numBytes < readbufferLen)
{
DRV_UART3_TasksRX ( );
//Check for data at a particular place in the buffer
data = DRV_UART3_Peek(3);
if(data == 5)
{
//discard all other data if byte that is wanted is received.
//continue other operation
numBytes += DRV_UART3_Read ( readBuffer + numBytes , readbufferLen ) ;
}
else
{
break;
}
}
Function
uint8_t DRV_UART3_Peek(uint16_t offset)
1.2.3.1.12 DRV_UART3_Read Function
Returns the number of bytes read by the UART3 peripheral
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 ;
// Pre-initialize myBuffer with MY_BUFFER_SIZE bytes of valid data.
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
{
1.2 UART Driver MLA - Drivers Help Driver Interface
32

- 1
- 2
…
- 30
- 31
- 32
- 33
- 34
…
- 82
- 83