Forums

RE: fopen() problem

Started by Art Johnson November 18, 2002
What is happening is that the fopen() call is generating an interrupt, and there
is no interrupt vector defined for that interrupt. If you are using the
Motorola SDK, you need to add the following #define to the file "appconfig.h" (I
have attached a sample appconfig.h file):

#define INCLUDE_FILEIO /* File I/O support */

If you are not using the Motorola SDK, you will have to find out which interrupt
is causing the problem, write the Interrupt Service Routine (ISR), and add the
#define for the Interrupt Priority and Interrupt Vector to the file
"appconfig.h", here's an example from one of our appconfig.h files:

// Definitions for the SCI #0 Transmitter Ready interrupt,
// which is vector number 51, and the SCI #0 Receiver
// Full interrupt, which is vector number 53.
//
// These definitions are required so the interrupt vector
// and priority are set by the standard files "vector.c",
// "config.c", and "const.c"
//
#define GPR_INT_PRIORITY_53 6
#define INTERRUPT_VECTOR_ADDR_53 Sci0_Task_Rx_Interrupt
#define GPR_INT_PRIORITY_51 5
#define INTERRUPT_VECTOR_ADDR_51 Sci0_Task_Tx_Interrupt

The above ISRs are "Super Fast" interrupts, which bypass the SDK Interrupt
Dispatcher. You may prefer to use "Normal" interrupts instead, because they are
much easier to write and use. How to do this is explained extremely well in the
SDK on-line documentation, please look there for any further details.

I am posting this message to the motoroladsp discussion group, as it contains
information that may be useful to other members of the group.

Regards,

Art Johnson
Senior Systems Analyst
PMC Prime Mover Controls Inc.
3600 Gilmore Way
Burnaby, B.C., Canada
V5G 4R8
Phone: 604 433-4644
FAX: 604 433-5570
Email:
http://www.pmc-controls.com

-----Original Message-----
From: raghava unadi [mailto:]
Sent: Monday, November 18, 2002 2:49 AM
To: Art Johnson
Subject: Dear art
you may help me to solve my problem. i am simulating one algorithm.
in that i am reading the elements from the file to array from the
code warrior IDE. in that i am facing the problem that the execution
is in loop that in debuhlt.
i am ataching my c code and where the execution is going to be in
loop.

****************************************************************
This is my c code
#include "stdio.h"
#include "port.h"
#include"mfr16.h"
#include"mfr32.h"
#include<stdlib.h>
#include"bsp.h"
#include"structneed.h" Frac16 Far[CorrLen+WinLen],Near[WinLen];
Frac32 Energy[CorrLen], Corr[CorrLen];

extern void IniterDTDetect(DTD_Struct *);
extern void dtdfun2(DTD_Struct *,int *,int *);

DTD_Struct DTD_data={0,0,Far,Near,Energy,Corr,1,10 };
int nearin[16], farin[16]; /*main()
{
int Detect,i;
Frac32 M,k;

dtdfun2(&DTD_data,nearin,farin);

}*/
main()
{
int i;
long M,k; FILE *fp1,*fp2,*fp3,*fp4,*fp5; /* Open Far end Speech file */

fp1=fopen("farin.txt","r");
if(fp1==NULL)
{ printf("Input file not found\n");
exit(1);
}
/* read total number of samples*/
fscanf(fp1,"%d",&M); /* Open N end Speech file */ fp2=fopen("nearin.txt","r");
if(fp2==NULL)
{
printf("Input file not found i\n");
exit(1);
}
fscanf(fp2,"%d",&M);

/*********** Open file Fp3, Fp4, Fp5 ******************/

fp3=fopen("nenergy.dat","w");
fp4=fopen("detect.dat","w");
fp5=fopen("fenergy.dat","w");

/* Initialize DTD structure */
DTD_data.PtrNear = Near ;
DTD_data.PtrFar = Far ;
DTD_data.PtrEnergy = Energy;
DTD_data.PtrCorr = Corr ;
DTD_data.DTThr = 10;

/* Call initialization routine ti initialize all buffers */

IniterDTDetect(&DTD_data);

/* Loop to process whole file */
for(k=0;k<(M/16);k++)
{
/* update near end and far end signal buffers */
for(i=0;i<16;i++)
{
fscanf(fp1,"%d",&farin[i]); /* Far End */
fscanf(fp2,"%d",&nearin[i]); /* Near End */
}

/* Call Double talk detection routine */
// Detect = DTDetect(&DTD_data,farin,nearin);
dtdfun2(&DTD_data,farin,nearin);

/* Print the result into file */
// fprintf(fp4,"%d\n",Detect);
fprintf(fp5,"%ld\n",DTD_data.E_near);
fprintf(fp3,"%ld\n", DTD_data.E_far);

} fclose(fp1);
fclose(fp2);
fclose(fp3);
fclose(fp4);
fclose(fp5);

}
******************************************************************
when i running this program
this is struck in to this program, this is in the fopen( ) statement
itself.

asm void archUnhandledInterruptISR (void)
{
/*
No interrupt handler had been specified for the interrupt vector,
so the interrupt vector defaulted to this routine which is
a wait forever loop.
*/
UnhandledInt:
debughlt
bra
UnhandledInt
}

*********************************************************************
*
i am waiting for your reply.
regards
raghava.


Attachment (not stored)
appconfig.h
Type: application/octet-stream