SAMV71 Xplained Ultra Software Package 1.3

main.c File Reference

#include "board.h"
#include "..\..\..\..\utils\utility.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "..\..\..\..\utils\md5\md5.h"

Go to the source code of this file.

Data Structures

struct  RignBuffer_t

Defines

#define FULL_DUPLEX
#define BUFFER_SIZE   128
#define PINS_USART   PIN_USART0_TXD, PIN_USART0_RXD, PIN_USART0_RTS, PIN_USART0_CTS
#define BASE_USART   USART0
#define BASE_USART_IRQ   USART0_IRQn
#define ID_USART   ID_USART0
#define USART_Interrupt   USART0_Handler
#define USART_TX_TIMEOUT   5000
#define USART_DMA_LLI   10
#define APP_BUFFER   ( 100*1024)
#define RX_BUFFER   ( BUFFER_SIZE * USART_DMA_LLI )
#define MIN_FREE_BYTES   ( BUFFER_SIZE * (USART_DMA_LLI-1) )
#define MAX_FREE_BYTES   ( BUFFER_SIZE * (USART_DMA_LLI-2) )
#define XDMA_NVIC_PRIO   1
#define USART_NVIC_PRIO   3
#define TC_NVIC_PRIO   4

Functions

__STATIC_INLINE void _UpdateTxConfig (uint32_t Source, uint32_t size)
__STATIC_INLINE void FlushTxBuffer (uint32_t TxBytesLeft)
 Send the rest of the data in buffer if it is less than 100KB.
__STATIC_INLINE void _UpdateCount (void)
 This function updates the Count variable of ring buffer.
void XDMAC_Handler (void)
 xDMA interrupt handler.
void USART_Interrupt (void)
 USART interrupt routine to serve Timeout interrupts from USART.
__STATIC_INLINE void _initCircularBuffer (RignBuffer_t *pBuff)
 Initialize circular buffer.
__STATIC_INLINE void _ConfigureUsart (uint32_t baudrate, uint32_t rxTimeout)
 USART hardware handshaking configuration.
int main (void)
 usart-hw-handshaking Application entry point..

Variables

const Pin pins [] = {PINS_USART}
volatile uint32_t mutexTimeout
volatile uint8_t semaphore = 0
volatile uint32_t dmaflush = 0
volatile uint32_t TimeOutTimer = 0
uint8_t pRxBuffer [RX_BUFFER]
uint8_t FirstAppBuff [APP_BUFFER]
uint8_t SecondAppBuff [APP_BUFFER]
COMPILER_WORD_ALIGNED
RignBuffer_t
pUsartBuffer

Detailed Description

This file contains all the specific code for the usart_hw_handshaking.

Definition in file main.c.


Define Documentation

#define BASE_USART   USART0

Register base for USART

Definition at line 138 of file main.c.

#define BASE_USART_IRQ   USART0_IRQn

Register base for USART

Definition at line 141 of file main.c.

#define BUFFER_SIZE   128

Size of the receive buffer used by the DMA, in bytes.

Definition at line 132 of file main.c.

#define ID_USART   ID_USART0

ID for USART

Definition at line 144 of file main.c.

#define PINS_USART   PIN_USART0_TXD, PIN_USART0_RXD, PIN_USART0_RTS, PIN_USART0_CTS

Pins for USART

Definition at line 135 of file main.c.


Function Documentation

__STATIC_INLINE void _ConfigureUsart ( uint32_t  baudrate,
uint32_t  rxTimeout 
)

USART hardware handshaking configuration.

Configures USART in hardware handshaking mode, asynchronous, 8 bits, 1 stop bit, no parity, 115200 baud rates and enables its transmitter and receiver.

Definition at line 336 of file main.c.

Here is the call graph for this function:

int main ( void   ) 

usart-hw-handshaking Application entry point..

Configures USART in hardware handshaking mode and Timer Counter 0 to generate an interrupt every second. Then, start the first transfer on the USART and wait in an endless loop.

Returns:
Unused (ANSI-C compatibility).

Definition at line 491 of file main.c.

Here is the call graph for this function:


Variable Documentation

uint8_t FirstAppBuff[APP_BUFFER]

Application Rx buffer.

Definition at line 212 of file main.c.

volatile uint32_t mutexTimeout

Number of bytes received between two timer ticks.

Definition at line 198 of file main.c.

const Pin pins[] = {PINS_USART}

Pins to configure for the application.

Definition at line 195 of file main.c.

uint8_t pRxBuffer[RX_BUFFER]

Ring buffer

Definition at line 209 of file main.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines