[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Problems with ATMEGA8 USART
From: |
Dave Hylands |
Subject: |
Re: [avr-gcc-list] Problems with ATMEGA8 USART |
Date: |
Tue, 16 Aug 2005 19:06:00 -0700 |
Hi David,
> > The one clumsy part of code was in my_putchar() which had to reach
> > directly into the hardware for the specific port to restart the Tx
> > IRQ if the buffer had been empty, which causes my Tx IRQ routine to
> > shut itself off. Also there was a possible race condition.
Why not just store a copy of the UCSRxB register inside your Uart structure?
typedef struct
{
...other members...
volatile uint8_t *ucsrb;
} Uart;
Then initialize the member
fp->ucsrb = &UCSR0B;
and in your putc routine:
*fp->ucsrb |= ( 1 << UDRIE );
If the shifts for the interrupt enable are different you can store
those in the structure as well.
--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/