E:/Projects/AvrLib/dev/rs232.c File Reference

#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include "system.h"
#include "rs232.h"
#include "task.h"
#include "cio.h"

Include dependency graph for rs232.c:

Go to the source code of this file.

Functions

static void InitPort (SERIAL *pS, unsigned short nTSize, unsigned short nRSize, unsigned short nPort, long nBaudRate)
static int ROpen (IOCB *pIOCB)
static int RGetC (IOCB *pIOCB)
static int RPutC (IOCB *pIOCB, int c)
static int RWrite (IOCB *pIOCB, char *b, int l)
static int RStatus (IOCB *pIOCB, int m)
static unsigned short CalculateBaudRate (long nBR)
int RInit (void)
static void RxIsr (SERIAL *pI)
static void TxIsr (SERIAL *pI)
void USART0_RX_vect (void)
void USART0_UDRE_vect (void)
void USART1_RX_vect (void)
void USART1_UDRE_vect (void)

Variables

static SERIALgSerial [RS232_N_PORTS]
static H_JVEC RJump
static RREG SAdr [2]
static char * PNames [2]
static char * TNames [2]


Function Documentation

static unsigned short CalculateBaudRate ( long  nBR  )  [static]

Definition at line 130 of file rs232.c.

References SYSTEM_CLOCKRATE.

Referenced by InitPort().

static void InitPort ( SERIAL pS,
unsigned short  nTSize,
unsigned short  nRSize,
unsigned short  nPort,
long  nBaudRate 
) [static]

static int RGetC ( IOCB pIOCB  )  [static]

int RInit ( void   ) 

Definition at line 176 of file rs232.c.

References CioAddHandler().

static int ROpen ( IOCB pIOCB  )  [static]

static int RPutC ( IOCB pIOCB,
int  c 
) [static]

Definition at line 80 of file rs232.c.

References BIT, IOREC::buff, Disable(), Enable(), IOREC::head, IOREC::nChar, _iocb::p, RREG::pUCSRnB, SERIAL::regs, IOREC::size, and SERIAL::Tx.

Referenced by RWrite().

static int RStatus ( IOCB pIOCB,
int  m 
) [static]

Definition at line 112 of file rs232.c.

References IOREC::nChar, _iocb::p, RS232_STAT_NREC, RS232_STAT_TMT, SERIAL::Rx, and SERIAL::Tx.

static int RWrite ( IOCB pIOCB,
char *  b,
int  l 
) [static]

Definition at line 99 of file rs232.c.

References _iocb::p, PendSemaphore(), PostSemaphore(), IOREC::pSem, RPutC(), and SERIAL::Tx.

static void RxIsr ( SERIAL pI  )  [static]

static void TxIsr ( SERIAL pI  )  [static]

void USART0_RX_vect ( void   ) 

Definition at line 221 of file rs232.c.

References ExitInterrupt(), InterruptCount, RESTORE_IRQ, RxIsr(), and SAVE_IRQ.

void USART0_UDRE_vect ( void   ) 

Definition at line 231 of file rs232.c.

References ExitInterrupt(), InterruptCount, RESTORE_IRQ, SAVE_IRQ, and TxIsr().

void USART1_RX_vect ( void   ) 

Definition at line 241 of file rs232.c.

References ExitInterrupt(), InterruptCount, RESTORE_IRQ, RxIsr(), and SAVE_IRQ.

void USART1_UDRE_vect ( void   ) 

Definition at line 251 of file rs232.c.

References ExitInterrupt(), InterruptCount, RESTORE_IRQ, SAVE_IRQ, and TxIsr().


Variable Documentation

SERIAL* gSerial[RS232_N_PORTS] [static]

Definition at line 26 of file rs232.c.

char* PNames[2] [static]

Initial value:

 {
        "RX0",
        "RX1"
}

Definition at line 135 of file rs232.c.

H_JVEC RJump [static]

Initial value:

 {
        ROpen,          
        0,                      
        RGetC,          
        0,                      
        RPutC,          
        RWrite,         
        RStatus,        
        0,                      
        RInit           
}

Definition at line 28 of file rs232.c.

RREG SAdr[2] [static]

Initial value:

 {
        {(unsigned char *)&UDR0,(unsigned char *)&UCSR0A,(unsigned char *)&UCSR0B,(unsigned char *)&UCSR0C,(unsigned short *)&UBRR0},
        {(unsigned char *)&UDR1,(unsigned char *)&UCSR1A,(unsigned char *)&UCSR1B,(unsigned char *)&UCSR1C,(unsigned short *)&UBRR1},
}

Definition at line 41 of file rs232.c.

char* TNames[2] [static]

Initial value:

 {
        "TX0",
        "TX1"
}

Definition at line 140 of file rs232.c.


Generated on Sun Aug 31 13:30:07 2008 for FrankenRTOS by  doxygen 1.5.6