USART Devices
[Serial]

Collaboration diagram for USART Devices:


Detailed Description

AVR USART hardware dependant implementation.

A pointer to devUsartAvr0 or devUsartAvr1 must be passed to NutRegisterDevice() to bind the corresponding device driver to the Nut/OS kernel.

 NutRegisterDevice(&devUsartAvr0, 0, 0);
 fp = fopen("uart0", "r+");
 fprintf(fp, "Hello world!\n");

The AVR USART devices make use of the hardware independant USART Device Driver


AVR USART0 Device

NUTDEVICE devUsartAvr0
 USART0 device information structure.

AVR USART1 Device

NUTDEVICE devUsartAvr1
 USART1 device information structure.

UART0 CTS Handshake Sense

UART0_CTS_IRQ must be defined in arch/avr.h

#define UART_CTS_PORT   UART0_CTS_PORT
#define UART_CTS_PIN   UART0_CTS_PIN
#define UART_CTS_DDR   UART0_CTS_DDR

UART1 CTS Handshake Sense

UART1_CTS_IRQ must be defined in arch/avr.h

#define UART_CTS_PORT   UART1_CTS_PORT
#define UART_CTS_PIN   UART1_CTS_PIN
#define UART_CTS_DDR   UART1_CTS_DDR

Defines

#define UDRn   UDR0
#define UCSRnA   UCSR0A
#define UCSRnB   UCSR0B
#define UCSRnC   UCSR0C
#define UBRRnL   UBRR0L
#define UBRRnH   UBRR0H
#define sig_UART_RECV   sig_UART0_RECV
#define sig_UART_DATA   sig_UART0_DATA
#define sig_UART_TRANS   sig_UART0_TRANS
#define SIG_UART_RECV   SIG_UART0_RECV
#define SIG_UART_DATA   SIG_UART0_DATA
#define SIG_UART_TRANS   SIG_UART0_TRANS
#define dcb_usart   dcb_usart0
#define ASCII_XON   0x11
#define ASCII_XOFF   0x13
#define XON_PENDING   0x10
#define XOFF_PENDING   0x20
#define XOFF_SENT   0x40
#define XOFF_RCVD   0x80


Define Documentation

#define UART_CTS_PORT   UART0_CTS_PORT

Definition at line 319 of file usart0avr.c.

#define UART_CTS_PIN   UART0_CTS_PIN

Definition at line 320 of file usart0avr.c.

#define UART_CTS_DDR   UART0_CTS_DDR

Definition at line 321 of file usart0avr.c.

#define UDRn   UDR0

Definition at line 336 of file usart0avr.c.

#define UCSRnA   UCSR0A

Definition at line 337 of file usart0avr.c.

#define UCSRnB   UCSR0B

Definition at line 338 of file usart0avr.c.

#define UCSRnC   UCSR0C

Definition at line 339 of file usart0avr.c.

#define UBRRnL   UBRR0L

Definition at line 340 of file usart0avr.c.

#define UBRRnH   UBRR0H

Definition at line 341 of file usart0avr.c.

#define sig_UART_RECV   sig_UART0_RECV

Definition at line 372 of file usart0avr.c.

#define sig_UART_DATA   sig_UART0_DATA

Definition at line 373 of file usart0avr.c.

#define sig_UART_TRANS   sig_UART0_TRANS

Definition at line 374 of file usart0avr.c.

#define SIG_UART_RECV   SIG_UART0_RECV

Definition at line 377 of file usart0avr.c.

#define SIG_UART_DATA   SIG_UART0_DATA

Definition at line 380 of file usart0avr.c.

#define SIG_UART_TRANS   SIG_UART0_TRANS

Definition at line 383 of file usart0avr.c.

#define dcb_usart   dcb_usart0

Definition at line 386 of file usart0avr.c.

#define UART_CTS_PORT   UART1_CTS_PORT

Definition at line 323 of file usart1avr.c.

#define UART_CTS_PIN   UART1_CTS_PIN

Definition at line 324 of file usart1avr.c.

#define UART_CTS_DDR   UART1_CTS_DDR

Definition at line 325 of file usart1avr.c.

#define ASCII_XON   0x11

Definition at line 101 of file usartavr.c.

#define ASCII_XOFF   0x13

Definition at line 103 of file usartavr.c.

#define XON_PENDING   0x10

Definition at line 106 of file usartavr.c.

#define XOFF_PENDING   0x20

Definition at line 108 of file usartavr.c.

#define XOFF_SENT   0x40

Definition at line 110 of file usartavr.c.

#define XOFF_RCVD   0x80

Definition at line 112 of file usartavr.c.


Variable Documentation

NUTDEVICE devUsartAvr0

Initial value:

 {
    0,                          
    {'u', 'a', 'r', 't', '0', 0, 0, 0, 0},    
    IFTYP_CHAR,                 
    0,                          
    0,                          
    0,                          
    &dcb_usart0,                
    UsartInit,                  
    UsartIOCtl,                 
    UsartRead,                  
    UsartWrite,                 
    UsartWrite_P,               
    UsartOpen,                  
    UsartClose,                 
    UsartSize                   
}
USART0 device information structure.

An application must pass a pointer to this structure to NutRegisterDevice() before using the serial communication driver of the AVR's on-chip USART0.

The device is named uart0.

Definition at line 229 of file usart0avr.c.

NUTDEVICE devUsartAvr1

Initial value:

 {
    0,                          
    {'u', 'a', 'r', 't', '1', 0, 0, 0, 0},    
    IFTYP_CHAR,                 
    1,                          
    0,                          
    0,                          
    &dcb_usart1,                
    UsartInit,                  
    UsartIOCtl,                 
    UsartRead,                  
    UsartWrite,                 
    UsartWrite_P,               
    UsartOpen,                  
    UsartClose,                 
    UsartSize                   
}
USART1 device information structure.

An application must pass a pointer to this structure to NutRegisterDevice() before using the serial communication driver of the AVR's on-chip USART1.

The device is named uart1.

Definition at line 234 of file usart1avr.c.


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/