| AVR Z-LINKŪ |

# ftdi.h File Reference

## Detailed Description

Header file for the FTDI USB fifo.

Application note:
  AVR414: User's Guide - ATAVRRZ502 - Accessory Kit

Documentation
  For comprehensive code documentation, supported compilers, compiler settings and supported devices see readme.html

Author:
  Atmel Corporation: http://www.atmel.com
  Support email: avr@atmel.com

Name

Revision
  1.2

RCSfile
  serialInterface.h,v

Date
  2006/09/15 17:02:44

Definition in file ftdi.h.

`#include <stdint.h>`
`#include "compiler.h"`

Include dependency graph for ftdi.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
#define | FTDI_CONFIGURE_PIN_CHANGE_INTERRUPT() ( EICRB &= ~( ( 1 << ISC71 ) | ( 1 << ISC70 ) ) )
#define | FTDI_DDR DDRE
#define | FTDI_DISABLE_RECEIVER() (EIMSK &= ~( 1 << FTDI_RX_PIN ) )
#define | FTDI_ENABLE_RECEIVER() ( EIMSK |= ( 1 << FTDI_RX_PIN ) )
#define | FTDI_ENABLE_TX() ( FTDI_DDR &= ~( 1 << FTDI_TX_PIN ) )
#define | FTDI_Fifo ( ( volatile uint8_t * )FTDI_FIFO_ADDRESS )
#define | FTDI_FIFO_ADDRESS 0xF000
#define | FTDI_PIN PINE
#define | FTDI_PORT PORTE
#define | FTDI_RX_PIN PINE7
#define | FTDI_TX_MASK ( 1 << FTDI_TX_PIN )
#define | FTDI_TX_PIN PINE6
#define | LOW 0x00
#define | XRAM_DISABLE() XMCRA &= ~( 1 << SRE )
#define | XRAM_ENABLE() XMCRA |= ( 1 << SRE ); XMCRB |= ( 1 << XMBK )
## Functions
void | ftdiInitialization (void)
| Initialize the USB FIFO.
void | ftdiSendSymbol (const uint8_t symbol)
| Send one symbol to the USB FIFO.

## Define Documentation

#define FTDI_CONFIGURE_PIN_CHANGE_INTERRUPT | ( |  | ) | ( EICRB &= ~( ( 1 << ISC71 ) | ( 1 << ISC70 ) ) )

Definition at line 45 of file ftdi.h.

Referenced by ftdiInitialization().

#define FTDI_DDR DDRE

Definition at line 36 of file ftdi.h.

#define FTDI_DISABLE_RECEIVER | ( |  | ) | (EIMSK &= ~( 1 << FTDI_RX_PIN ) )

Definition at line 47 of file ftdi.h.

#define FTDI_ENABLE_RECEIVER | ( |  | ) | ( EIMSK |= ( 1 << FTDI_RX_PIN ) )

Definition at line 46 of file ftdi.h.

Referenced by ftdiInitialization().

#define FTDI_ENABLE_TX | ( |  | ) | ( FTDI_DDR &= ~( 1 << FTDI_TX_PIN ) )

Definition at line 44 of file ftdi.h.

Referenced by ftdiInitialization().

#define FTDI_Fifo ( ( volatile uint8_t * )FTDI_FIFO_ADDRESS )

Definition at line 42 of file ftdi.h.

Referenced by ftdiSendSymbol(), and ISR().

#define FTDI_FIFO_ADDRESS 0xF000

Definition at line 41 of file ftdi.h.

#define FTDI_PIN PINE

Definition at line 37 of file ftdi.h.

Referenced by ftdiSendSymbol().

#define FTDI_PORT PORTE

Definition at line 35 of file ftdi.h.

#define FTDI_RX_PIN PINE7

Definition at line 40 of file ftdi.h.

#define FTDI_TX_MASK ( 1 << FTDI_TX_PIN )

Definition at line 39 of file ftdi.h.

Referenced by ftdiSendSymbol().

#define FTDI_TX_PIN PINE6

Definition at line 38 of file ftdi.h.

#define LOW 0x00

Definition at line 30 of file ftdi.h.

Referenced by ftdiSendSymbol().

#define XRAM_DISABLE | ( |  | ) | XMCRA &= ~( 1 << SRE )

Definition at line 33 of file ftdi.h.

#define XRAM_ENABLE | ( |  | ) | XMCRA |= ( 1 << SRE ); XMCRB |= ( 1 << XMBK )

Definition at line 32 of file ftdi.h.

Referenced by ftdiInitialization().

## Function Documentation

void ftdiInitialization | ( | void |  | ) |

Initialize the USB FIFO.

Note:
  This function uses the external memory interface.

Definition at line 36 of file ftdi.c.

References FTDI_CONFIGURE_PIN_CHANGE_INTERRUPT, FTDI_ENABLE_RECEIVER, FTDI_ENABLE_TX, and XRAM_ENABLE.

Referenced by serialInterfaceInitialization().

    00036                                {
    00037
    00038         XRAM_ENABLE( );
    00039
    00040         /* make sure USB_RXF and USB_TXE are inputs */
    00041         FTDI_ENABLE_TX( );
    00042
    00043         //Enable external interrupt on FTDI_RX pin.
    00044         FTDI_CONFIGURE_PIN_CHANGE_INTERRUPT( );
    00045         FTDI_ENABLE_RECEIVER( );
    00046 }

void ftdiSendSymbol | ( | const uint8_t | symbol | ) |

Send one symbol to the USB FIFO.

This function passes one symbol (8 bits) to the FTDI USB FIFO chip.

Note:
  ftdiInitialization() must be called first.

Parameters:

  | symbol | Symbol to be sent.

Definition at line 57 of file ftdi.c.

References FTDI_Fifo, FTDI_PIN, FTDI_TX_MASK, and LOW.

Referenced by sendSymbol().

    00057                                            {
    00058
    00059         //Wait until the fifo is ready.
    00060         while( ( FTDI_TX_MASK & FTDI_PIN ) != LOW ){
    00061                 ;
    00062         }
    00063
    00064         //Write symbol to memory address.
    00065         *FTDI_Fifo = ( symbol );
    00066 }

@DOC_TITLE@