[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] How to pass a struct in Interrupt
From: |
Eric Fu |
Subject: |
[avr-gcc-list] How to pass a struct in Interrupt |
Date: |
Fri, 16 Jan 2004 21:22:36 +1100 |
Hi,
I'm trying to write a simple Interrupt driven UART.
I defined a struct in UART.c like:
typedef struct UART
{
byte RxBuf[RX_BUFFER_SIZE];
volatile byte RxHead;
volatile byte RxTail;
.
.
}UART;
UART uart0;
And in isr.c, I declare and define:
extern UART uart0;
SIGNAL(SIG_UART_RECV) //USART RX complete INT
{
byte data;
byte tmphead;
/* Read the received data */
data = UDR;
/* Calculate buffer index */
tmphead = ( uart0.RxHead + 1 ) & RX_BUFFER_MASK;
uart0.RxHead = tmphead; /* Store new index */
.
.
}
I have the following compile error:
Compiling: isr.c
avr-gcc -c -mmcu=atmega16 -I. -g -Os -funsigned-char -funsigned-bitfields
-fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=isr.lst
-Ic:/pjt2/avr/PJT_inc -std=gnu99 isr.c -o isr.o
isr.c:17: error: parse error before "uart0"
isr.c:17: warning: type defaults to `int' in declaration of `uart0'
isr.c:17: warning: data definition has no type or storage class
isr.c: In function `__vector_11':
isr.c:84: error: request for member `RxHead' in something not a structure or
union
isr.c:85: error: request for member `RxHead' in something not a structure or
union
isr.c:87: error: request for member `RxTail' in something not a structure or
union
isr.c:92: error: request for member `RxBuf' in something not a structure or
union
isr.c: In function `__vector_12':
isr.c:104: error: request for member `TxHead' in something not a structure or
union
isr.c:104: error: request for member `TxTail' in something not a structure or
union
isr.c:107: error: request for member `TxTail' in something not a structure or
union
isr.c:108: error: request for member `TxTail' in something not a structure or
union
isr.c:110: error: request for member `TxBuf' in something not a structure or
union
make: *** [isr.o] Error 1
It seems the compiler doesn't recognise an external struct definition. Could
anyone give me a hint to get around this?
Thanks.
Eric Fu
- [avr-gcc-list] How to pass a struct in Interrupt,
Eric Fu <=