Wifly Driver  V1.0
Macros | Functions | Variables
uart.c File Reference
#include "LPC17xx.h"
#include "type.h"
#include "uart.h"
#include "Config.h"
#include "FreeRTOS.h"
#include <task.h>
#include <string.h>
Include dependency graph for uart.c:

Go to the source code of this file.

Macros

#define BUFSIZE   (BUFSIZE_WIFLY)
 

Functions

void UART0_IRQHandler (void)
 
void UART1_IRQHandler (void)
 
void UART2_IRQHandler (void)
 
void UART3_IRQHandler (void)
 
uint32_t UARTInit (uint32_t PortNum, uint32_t baudRate)
 
uint32_t UARTClose (uint8_t PortNum)
 
void UARTSend (uint32_t portNum, uint8_t *BufferPtr, uint32_t Length)
 
int UARTReceive (uint8_t portNum, char *string, uint32_t timeout)
 
 __attribute__ ((optimize("O0")))
 
void clearBuffUart (uint8_t portNum)
 

Variables

volatile uint32_t UART0Status
 
volatile uint32_t UART1Status
 
volatile uint32_t UART2Status
 
volatile uint32_t UART3Status
 
volatile uint8_t UART0TxEmpty = 1
 
volatile uint8_t UART1TxEmpty = 1
 
volatile uint8_t UART2TxEmpty = 1
 
volatile uint8_t UART3TxEmpty =1
 
volatile uint8_t UART0Buffer [BUFSIZE]
 
volatile uint8_t UART1Buffer [BUFSIZE]
 
volatile uint8_t UART2Buffer [BUFSIZE]
 
volatile uint8_t UART3Buffer [BUFSIZE]
 
volatile uint32_t UART0Count = 0
 
volatile uint32_t UART1Count = 0
 
volatile uint32_t UART2Count = 0
 
volatile uint32_t UART3Count = 0
 

Macro Definition Documentation

#define BUFSIZE   (BUFSIZE_WIFLY)

Function Documentation

__attribute__ ( (optimize("O0"))  )

Definition at line 661 of file uart.c.

void clearBuffUart ( uint8_t  portNum)

Initializes the UART port buffer chosen.

Parameters
portNum- UART port number (0,1,2,3).

Definition at line 680 of file uart.c.

References BUFSIZE, UART0Buffer, UART0Count, UART1Buffer, UART1Count, UART2Buffer, UART2Count, UART3Buffer, and UART3Count.

Referenced by PrintF_ClBuffUart(), and UARTReceive().

void UART0_IRQHandler ( void  )

UART0 interrupt handler.

Definition at line 57 of file uart.c.

References BUFSIZE, IIR_CTI, IIR_RDA, IIR_RLS, IIR_THRE, LSR_BI, LSR_FE, LSR_OE, LSR_PE, LSR_RDR, LSR_RXFE, LSR_THRE, UART0Buffer, UART0Count, UART0Status, and UART0TxEmpty.

void UART1_IRQHandler ( void  )

UART1 interrupt handler.

Definition at line 131 of file uart.c.

References BUFSIZE, IIR_CTI, IIR_RDA, IIR_RLS, IIR_THRE, LSR_BI, LSR_FE, LSR_OE, LSR_PE, LSR_RDR, LSR_RXFE, LSR_THRE, UART1Buffer, UART1Count, UART1Status, and UART1TxEmpty.

void UART2_IRQHandler ( void  )

UART2 interrupt handler.

Definition at line 205 of file uart.c.

References BUFSIZE, IIR_CTI, IIR_RDA, IIR_RLS, IIR_THRE, LSR_BI, LSR_FE, LSR_OE, LSR_PE, LSR_RDR, LSR_RXFE, LSR_THRE, UART2Buffer, UART2Count, UART2Status, and UART2TxEmpty.

void UART3_IRQHandler ( void  )

UART3 interrupt handler.

Definition at line 272 of file uart.c.

References BUFSIZE, IIR_CTI, IIR_RDA, IIR_RLS, IIR_THRE, LSR_BI, LSR_FE, LSR_OE, LSR_PE, LSR_RDR, LSR_RXFE, LSR_THRE, UART3Buffer, UART3Count, UART3Status, and UART3TxEmpty.

uint32_t UARTClose ( uint8_t  PortNum)

Close UART port

Parameters
PortNumUART port number (0,1,2,3).
Returns

Definition at line 498 of file uart.c.

References FALSE, and TRUE.

Referenced by PrintF_stop().

uint32_t UARTInit ( uint32_t  portNum,
uint32_t  baudRate 
)

Initialize UART port, setup pin select, clock, parity, stop bits, FIFO, etc.

Parameters
portNumUART port number (0,1,2,3).
baudRateUART port Baud rate.
Returns

Definition at line 339 of file uart.c.

References FALSE, IER_RBR, IER_RLS, IER_THRE, and TRUE.

Referenced by PrintF_start().

int UARTReceive ( uint8_t  portNum,
char *  buffer,
uint32_t  timeout 
)

Receive a block of data to the UART 0 port based on the data length.

Parameters
portNum- UART port number (0,1,2,3).
buffer- buffer where store a Block of data.
timeout- delay in milliseconds for receiving a data block.
Returns

Definition at line 592 of file uart.c.

References clearBuffUart(), DELAY_MODE, delayMs(), IER_RBR, IER_RLS, IER_THRE, UART0Buffer, UART0Count, UART1Buffer, UART1Count, UART2Buffer, UART2Count, UART3Buffer, and UART3Count.

Referenced by PrintF_scan().

Here is the call graph for this function:

void UARTSend ( uint32_t  portNum,
uint8_t *  BufferPtr,
uint32_t  Length 
)

Send a block of data to the UART 0 port based on the data length.

Parameters
portNumUART port number (0,1,2,3).
BufferPtrBuffer pointer.
Lengthdata length to send.

Definition at line 538 of file uart.c.

References UART0TxEmpty, UART1TxEmpty, UART2TxEmpty, and UART3TxEmpty.

Referenced by PrintF_print().

Variable Documentation

volatile uint8_t UART0Buffer[BUFSIZE]

Definition at line 45 of file uart.c.

Referenced by clearBuffUart(), UART0_IRQHandler(), and UARTReceive().

volatile uint32_t UART0Count = 0

Definition at line 46 of file uart.c.

Referenced by clearBuffUart(), UART0_IRQHandler(), and UARTReceive().

volatile uint32_t UART0Status

Definition at line 43 of file uart.c.

Referenced by UART0_IRQHandler().

volatile uint8_t UART0TxEmpty = 1

Definition at line 44 of file uart.c.

Referenced by UART0_IRQHandler(), and UARTSend().

volatile uint8_t UART1Buffer[BUFSIZE]

Definition at line 45 of file uart.c.

Referenced by clearBuffUart(), UART1_IRQHandler(), and UARTReceive().

volatile uint32_t UART1Count = 0

Definition at line 46 of file uart.c.

Referenced by clearBuffUart(), UART1_IRQHandler(), and UARTReceive().

volatile uint32_t UART1Status

Definition at line 43 of file uart.c.

Referenced by UART1_IRQHandler().

volatile uint8_t UART1TxEmpty = 1

Definition at line 44 of file uart.c.

Referenced by UART1_IRQHandler(), and UARTSend().

volatile uint8_t UART2Buffer[BUFSIZE]

Definition at line 45 of file uart.c.

Referenced by clearBuffUart(), UART2_IRQHandler(), and UARTReceive().

volatile uint32_t UART2Count = 0

Definition at line 46 of file uart.c.

Referenced by clearBuffUart(), UART2_IRQHandler(), and UARTReceive().

volatile uint32_t UART2Status

Definition at line 43 of file uart.c.

Referenced by UART2_IRQHandler().

volatile uint8_t UART2TxEmpty = 1

Definition at line 44 of file uart.c.

Referenced by UART2_IRQHandler(), and UARTSend().

volatile uint8_t UART3Buffer[BUFSIZE]

Definition at line 45 of file uart.c.

Referenced by clearBuffUart(), UART3_IRQHandler(), and UARTReceive().

volatile uint32_t UART3Count = 0

Definition at line 46 of file uart.c.

Referenced by clearBuffUart(), UART3_IRQHandler(), and UARTReceive().

volatile uint32_t UART3Status

Definition at line 43 of file uart.c.

Referenced by UART3_IRQHandler().

volatile uint8_t UART3TxEmpty =1

Definition at line 44 of file uart.c.

Referenced by UART3_IRQHandler(), and UARTSend().