Wifly Driver  V1.0
Macros | Functions
uart.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IER_RBR   0x01
 
#define IER_THRE   0x02
 
#define IER_RLS   0x04
 
#define IIR_PEND   0x01
 
#define IIR_RLS   0x03
 
#define IIR_RDA   0x02
 
#define IIR_CTI   0x06
 
#define IIR_THRE   0x01
 
#define LSR_RDR   0x01
 
#define LSR_OE   0x02
 
#define LSR_PE   0x04
 
#define LSR_FE   0x08
 
#define LSR_BI   0x10
 
#define LSR_THRE   0x20
 
#define LSR_TEMT   0x40
 
#define LSR_RXFE   0x80
 
#define DELAY_MODE   0
 

Functions

uint32_t UARTInit (uint32_t portNum, uint32_t baudRate)
 
uint32_t UARTClose (uint8_t PortNum)
 
void UART0_IRQHandler (void)
 
void UART1_IRQHandler (void)
 
void UART2_IRQHandler (void)
 
void UART3_IRQHandler (void)
 
void UARTSend (uint32_t portNum, uint8_t *BufferPtr, uint32_t Length)
 
int UARTReceive (uint8_t portNum, char *buffer, uint32_t timeout)
 
void delayMs (uint32_t ms, uint8_t type)
 
void clearBuffUart (uint8_t portNum)
 

Macro Definition Documentation

#define DELAY_MODE   0

Definition at line 53 of file uart.h.

Referenced by UARTReceive().

#define IER_RBR   0x01

Definition at line 33 of file uart.h.

Referenced by UARTInit(), and UARTReceive().

#define IER_RLS   0x04

Definition at line 35 of file uart.h.

Referenced by UARTInit(), and UARTReceive().

#define IER_THRE   0x02

Definition at line 34 of file uart.h.

Referenced by UARTInit(), and UARTReceive().

#define IIR_CTI   0x06

Definition at line 40 of file uart.h.

Referenced by UART0_IRQHandler(), UART1_IRQHandler(), UART2_IRQHandler(), and UART3_IRQHandler().

#define IIR_PEND   0x01

Definition at line 37 of file uart.h.

#define IIR_RDA   0x02

Definition at line 39 of file uart.h.

Referenced by UART0_IRQHandler(), UART1_IRQHandler(), UART2_IRQHandler(), and UART3_IRQHandler().

#define IIR_RLS   0x03

Definition at line 38 of file uart.h.

Referenced by UART0_IRQHandler(), UART1_IRQHandler(), UART2_IRQHandler(), and UART3_IRQHandler().

#define IIR_THRE   0x01

Definition at line 41 of file uart.h.

Referenced by UART0_IRQHandler(), UART1_IRQHandler(), UART2_IRQHandler(), and UART3_IRQHandler().

#define LSR_BI   0x10

Definition at line 47 of file uart.h.

Referenced by UART0_IRQHandler(), UART1_IRQHandler(), UART2_IRQHandler(), and UART3_IRQHandler().

#define LSR_FE   0x08

Definition at line 46 of file uart.h.

Referenced by UART0_IRQHandler(), UART1_IRQHandler(), UART2_IRQHandler(), and UART3_IRQHandler().

#define LSR_OE   0x02

Definition at line 44 of file uart.h.

Referenced by UART0_IRQHandler(), UART1_IRQHandler(), UART2_IRQHandler(), and UART3_IRQHandler().

#define LSR_PE   0x04

Definition at line 45 of file uart.h.

Referenced by UART0_IRQHandler(), UART1_IRQHandler(), UART2_IRQHandler(), and UART3_IRQHandler().

#define LSR_RDR   0x01

Definition at line 43 of file uart.h.

Referenced by UART0_IRQHandler(), UART1_IRQHandler(), UART2_IRQHandler(), and UART3_IRQHandler().

#define LSR_RXFE   0x80

Definition at line 50 of file uart.h.

Referenced by UART0_IRQHandler(), UART1_IRQHandler(), UART2_IRQHandler(), and UART3_IRQHandler().

#define LSR_TEMT   0x40

Definition at line 49 of file uart.h.

#define LSR_THRE   0x20

Definition at line 48 of file uart.h.

Referenced by UART0_IRQHandler(), UART1_IRQHandler(), UART2_IRQHandler(), and UART3_IRQHandler().

Function Documentation

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 delayMs ( uint32_t  ms,
uint8_t  type 
)

Causes a time delay in milliseconds . If the type value is zero, the delay will be active, else the delay will be passive.

Parameters
ms- Delay value in milliseconds.
type- Delay type. 0 = Active mode, >0 = Passive mode.

Referenced by PrintF_delayMs(), 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().