FIQ - LPC2138

Software e Hardware para linha ARM

Moderadores: 51, guest2003, Renie, gpenga

FIQ - LPC2138

Mensagempor lrfad2 » 27 Ago 2007 14:54

Boa tarde,
Preciso fazer uma fast interrupt mas eu não sei aonde estou errando.
Inclusive achei um código pronto e ele não acusa erro, mas quando faço a mesma coisa no meu, acusa: expected a "{". (logo depois da declaração __fiq)
Agora eu não sei se tem que alterar alguma coisa no startup.s ou modificar o modo Thumb ou Asm, etc...
Ps: estou utilizando o MDK-Arm

O código pronto que eu tenho segue abaixo:

#include <LPC21xx.H>
void fiqint (void) ; //declare FIQ ISR
void initFiq (void);

void main (void)
{

initFiq(); //Initilise the Fast interrupt source

while(1)
{
IOCLR1 = 0x00FF0000; //Loop here forever
}

}

void fiqint (void) __fiq
{
IOSET1 = 0x00FF0000; //Set the LED pins
EXTINT = 0x00000002; //Clear the peripheral interrupt flag

}

void initFiq(void)
{
IODIR1 = 0x00FF0000; //Set the LED pins as outputs
PINSEL0 = 0x20000000; //Enable the EXTINT1 interrupt
VICIntSelect = 0x00008000; //Enable a Vic Channel as FIQ
VICIntEnable = 0x00008000;
}

O meu código ficou assim (resumidamente):

#include <LPC213x.h> //Lpc2138 definitions
#include "Constantes.h"

void InitSystem(void);
void InitPorts (void);
void I2CISR (void); //I2C interrupt routine
.
.
.

void InitVectors(void)
{
INTWAKE = 0x00; //All external interrupts to wake up the processor are disable
EXTMODE = 0x00; //All external interrupts are level sensitive
EXTPOLAR = 0x00; //All external interrupts are low level active

VICVectAddr0 = (unsigned)T1isr; //Set the timer ISR vector address
VICVectCntl0 = 0x00000025; //Set channel

VICVectAddr1 = (unsigned)I2CISR; //pass the address of the IRQ into the VIC slot
VICVectCntl1 = 0x00000029; //select a priority slot for a given interrupt

VICVectAddr2 = (unsigned)MM_UART1_ISR; //Set the timer ISR vector address
VICVectCntl2 = 0x00000027; //Set channel

VICVectAddr3 = (unsigned)T0isr; //Set the timer ISR vector address
VICVectCntl3 = 0x00000024; //Set channel

VICVectAddr4 = (unsigned)MM_UART0_ISR; //Set the timer ISR vector address
VICVectCntl4 = 0x00000026; //Set channel

VICVectAddr5 = (unsigned int) &EINT2_ISR;
EXTINT = 0x04; // Clear the peripheral interrupt flag
VICVectCntl5 = 0x30; // Channel1 on Source#16 ... enabled

VICIntSelect = 0x00000200;

VICIntEnable = CteEnableAllInt; //Enable the interrupt
}//void InitVectors(void)
.
.
.
void I2CISR (void) __fiq<- acusa erro aqui
{

switch (CtrI2C)
{
case(0): //Controla o LM75A
switch (I2C0STAT) //Read result code and switch to next action
{
.
.
.

Por acaso alguem saberia o que pode ser?
Avatar do usuário
lrfad2
Byte
 
Mensagens: 152
Registrado em: 19 Out 2006 17:35
Localização: São Paulo

Mensagempor lrfad2 » 29 Ago 2007 10:31

No caso do compilador da Keil, não existe declaração de fiq, ou seja não pode fazer void fiqint (void) __fiq

Como consertar:
1. Declara-la como irq mesmo: void fiqint (void) __irq;

2. Eliminar vetoração IRQ, caso exista, exemplo:
//VICVectAddr1 = (unsigned)fiqint; //pass the address of the IRQ into the VIC slot
//VICVectCntl1 = 0x00000029; //select a priority slot for a given interrupt


3. Sinalizar no arquivo Startup.s, que a função fiqint é externa:
.
.
.
PRESERVE8

IMPORT fiqint ; importa a funcao de interrupcao do modulo C

; Area Definition and Entry Point
; Startup Code must be linked first at Address at which it expects to run.

AREA RESET, CODE, READONLY
ARM
.
.
.


4. Alterar o destino (no arquivo Startup.s) para onde a FIQ fará o desvio
.
.
.
PAbt_Addr DCD PAbt_Handler
DAbt_Addr DCD DAbt_Handler
DCD 0 ; Reserved Address
IRQ_Addr DCD IRQ_Handler
FIQ_Addr DCD FIQ_Handler ;FIQ_Handler

Undef_Handler B Undef_Handler
SWI_Handler B SWI_Handler
PAbt_Handler B PAbt_Handler
DAbt_Handler B DAbt_Handler
IRQ_Handler B IRQ_Handler
FIQ_Handler B fiqint
.
.
.


Pelo menos aqui resolveu...
Espero ter ajudado mais algum colega
Abraços
lrfad2
Avatar do usuário
lrfad2
Byte
 
Mensagens: 152
Registrado em: 19 Out 2006 17:35
Localização: São Paulo


Voltar para ARM

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado e 1 visitante

x