#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include "system.h"
#include "rs232.h"
#include "task.h"
#include "cio.h"
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 SERIAL * | gSerial [RS232_N_PORTS] |
static H_JVEC | RJump |
static RREG | SAdr [2] |
static char * | PNames [2] |
static char * | TNames [2] |
static unsigned short CalculateBaudRate | ( | long | nBR | ) | [static] |
static void InitPort | ( | SERIAL * | pS, | |
unsigned short | nTSize, | |||
unsigned short | nRSize, | |||
unsigned short | nPort, | |||
long | nBaudRate | |||
) | [static] |
Definition at line 145 of file rs232.c.
References BIT, IOREC::buff, CalculateBaudRate(), IOREC::head, malloc, IOREC::nChar, NewSemaphore(), IOREC::pSem, RREG::pUBRR, RREG::pUCSRnA, RREG::pUCSRnB, RREG::pUCSRnC, SERIAL::regs, SERIAL::Rx, SEMAPHORE_MODE_BLOCKING, IOREC::size, IOREC::tail, and SERIAL::Tx.
Referenced by ROpen().
static int RGetC | ( | IOCB * | pIOCB | ) | [static] |
Definition at line 59 of file rs232.c.
References IOREC::buff, Disable(), Enable(), IOREC::nChar, _iocb::p, PendSemaphore(), IOREC::pSem, SERIAL::Rx, IOREC::size, and IOREC::tail.
int RInit | ( | void | ) |
static int ROpen | ( | IOCB * | pIOCB | ) | [static] |
Definition at line 47 of file rs232.c.
References _iocb::devnum, InitPort(), malloc, _iocb::p, RS232_DEF_BAUDRATE, RS232_DEF_R_BUFF_SIZE, RS232_DEF_T_BUFF_SIZE, and RS232_N_PORTS.
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] |
Definition at line 189 of file rs232.c.
References BIT, IOREC::buff, IOREC::head, IOREC::nChar, PostSemaphore(), IOREC::pSem, RREG::pUCSRnA, RREG::pUDR, SERIAL::regs, SERIAL::Rx, and IOREC::size.
Referenced by USART0_RX_vect(), and USART1_RX_vect().
static void TxIsr | ( | SERIAL * | pI | ) | [static] |
Definition at line 200 of file rs232.c.
References BIT, IOREC::buff, IOREC::nChar, RREG::pUCSRnA, RREG::pUCSRnB, RREG::pUDR, SERIAL::regs, IOREC::size, IOREC::tail, and SERIAL::Tx.
Referenced by USART0_UDRE_vect(), and USART1_UDRE_vect().
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().
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}, }