DSPRelated.com
Forums

Monitoring the state of the GIE Register

Started by William C Bonner September 23, 2006
I am having a problem with a program running and having interrupts get
disabled. The hardware I'm using has a sequence of thigns happening
that are fired off by timer interrupts and then by EDMA completion
interrupts, and then I also have a UART handler runnign related to
interrupts.

Intermittently the processor stops sending all interrupts, and when I
halt the processor in the debugger, I can see that the GIE register 0. I would like to know if there is a way in code compser studio
3.1.23 to monitor the state of a register, and break when it changes?

There are several points in my code that I temporarily disable
interrupts (without first stopping timers or making sure that there
are no DMA transfers in progress) but I don't think that this should
cause a problem.

Early on in my program, I enable interrupts using the following command.

IRQ_globalEnable();

I use the following commands to temporarily disable and re-enable
interrupts. Does this sound correct?

Uint32 gie = IRQ_globalDisable();
IRQ_globalRestore(gie);

I never explicitly disable interrupts in my code except with the pair
of commands I just listed, so I don't know what is causing the GIE
register to be set to zero.

My thought is that if a timer was supposed to geneate an interrupt
while they are disabled, it will simply miss that interrupt, and
restart counting, generating an interrupt the next time. IS that correct?

Similarly, the EDMA interrupt would simply be missed, and if another
EDMA transfer is started later, and interrupts are enabled again, it
will generate a single interrupt for the completed transfer.

Any help is appreciated. Thanks.

Wim.
The GIE is not a register, but I think LSB of a 32-bit register CSR.
So when you call IRQ_save and IRQ_restore you are saving off CSR, not just
GIE.

Regds
JS

-----Original Message-----
From: William C Bonner [mailto:w...@wimsworld.com]
Sent: Sunday, September 24, 2006 12:10 AM
To: sankaran
Cc: c...
Subject: Re: [c6x] Monitoring the state of the GIE Register

I'm not sure what the CSR register is used for.

sankaran wrote:
> This problem is tough, and looks like the CSR is not being saved and
> restored correctly, which is why GIE is being missed. One way of tracking
> this, is to create a large array in external memory.
>
> For each ISR, say ISR0....ISRn, you can store CSR before you disable the
> interrupts, and after restoring the interrupts and these two values should
> match.
>
> One other way is to write the interrupts using the interrupt support and
let
> the C ccompiler manage the save and restore of the registers. I am not
sure
> of a method to monitor a change of a specific register, there are ways to
> track memory for specific values, not sure about registers.
>
> Regds
> JS
>
> -----Original Message-----
> From: c... [mailto:c...] On Behalf Of
William
> C Bonner
> Sent: Friday, September 22, 2006 4:04 PM
> To: c...
> Subject: [c6x] Monitoring the state of the GIE Register
>
> I am having a problem with a program running and having interrupts get
> disabled. The hardware I'm using has a sequence of thigns happening
> that are fired off by timer interrupts and then by EDMA completion
> interrupts, and then I also have a UART handler runnign related to
> interrupts.
>
> Intermittently the processor stops sending all interrupts, and when I
> halt the processor in the debugger, I can see that the GIE register > 0. I would like to know if there is a way in code compser studio
> 3.1.23 to monitor the state of a register, and break when it changes?
>
> There are several points in my code that I temporarily disable
> interrupts (without first stopping timers or making sure that there
> are no DMA transfers in progress) but I don't think that this should
> cause a problem.
>
> Early on in my program, I enable interrupts using the following command.
>
> IRQ_globalEnable();
>
> I use the following commands to temporarily disable and re-enable
> interrupts. Does this sound correct?
>
> Uint32 gie = IRQ_globalDisable();
> IRQ_globalRestore(gie);
>
> I never explicitly disable interrupts in my code except with the pair
> of commands I just listed, so I don't know what is causing the GIE
> register to be set to zero.
>
> My thought is that if a timer was supposed to geneate an interrupt
> while they are disabled, it will simply miss that interrupt, and
> restart counting, generating an interrupt the next time. IS that correct?
>
> Similarly, the EDMA interrupt would simply be missed, and if another
> EDMA transfer is started later, and interrupts are enabled again, it
> will generate a single interrupt for the completed transfer.
>
> Any help is appreciated. Thanks.
>
> Wim.
>
This problem is tough, and looks like the CSR is not being saved and
restored correctly, which is why GIE is being missed. One way of tracking
this, is to create a large array in external memory.

For each ISR, say ISR0....ISRn, you can store CSR before you disable the
interrupts, and after restoring the interrupts and these two values should
match.

One other way is to write the interrupts using the interrupt support and let
the C ccompiler manage the save and restore of the registers. I am not sure
of a method to monitor a change of a specific register, there are ways to
track memory for specific values, not sure about registers.

Regds
JS

-----Original Message-----
From: c... [mailto:c...] On Behalf Of William
C Bonner
Sent: Friday, September 22, 2006 4:04 PM
To: c...
Subject: [c6x] Monitoring the state of the GIE Register

I am having a problem with a program running and having interrupts get
disabled. The hardware I'm using has a sequence of thigns happening
that are fired off by timer interrupts and then by EDMA completion
interrupts, and then I also have a UART handler runnign related to
interrupts.

Intermittently the processor stops sending all interrupts, and when I
halt the processor in the debugger, I can see that the GIE register 0. I would like to know if there is a way in code compser studio
3.1.23 to monitor the state of a register, and break when it changes?

There are several points in my code that I temporarily disable
interrupts (without first stopping timers or making sure that there
are no DMA transfers in progress) but I don't think that this should
cause a problem.

Early on in my program, I enable interrupts using the following command.

IRQ_globalEnable();

I use the following commands to temporarily disable and re-enable
interrupts. Does this sound correct?

Uint32 gie = IRQ_globalDisable();
IRQ_globalRestore(gie);

I never explicitly disable interrupts in my code except with the pair
of commands I just listed, so I don't know what is causing the GIE
register to be set to zero.

My thought is that if a timer was supposed to geneate an interrupt
while they are disabled, it will simply miss that interrupt, and
restart counting, generating an interrupt the next time. IS that correct?

Similarly, the EDMA interrupt would simply be missed, and if another
EDMA transfer is started later, and interrupts are enabled again, it
will generate a single interrupt for the completed transfer.

Any help is appreciated. Thanks.

Wim.
I'm not sure what the CSR register is used for.

sankaran wrote:
> This problem is tough, and looks like the CSR is not being saved and
> restored correctly, which is why GIE is being missed. One way of tracking
> this, is to create a large array in external memory.
>
> For each ISR, say ISR0....ISRn, you can store CSR before you disable the
> interrupts, and after restoring the interrupts and these two values should
> match.
>
> One other way is to write the interrupts using the interrupt support and let
> the C ccompiler manage the save and restore of the registers. I am not sure
> of a method to monitor a change of a specific register, there are ways to
> track memory for specific values, not sure about registers.
>
> Regds
> JS
>
> -----Original Message-----
> From: c... [mailto:c...] On Behalf Of William
> C Bonner
> Sent: Friday, September 22, 2006 4:04 PM
> To: c...
> Subject: [c6x] Monitoring the state of the GIE Register
>
> I am having a problem with a program running and having interrupts get
> disabled. The hardware I'm using has a sequence of thigns happening
> that are fired off by timer interrupts and then by EDMA completion
> interrupts, and then I also have a UART handler runnign related to
> interrupts.
>
> Intermittently the processor stops sending all interrupts, and when I
> halt the processor in the debugger, I can see that the GIE register > 0. I would like to know if there is a way in code compser studio
> 3.1.23 to monitor the state of a register, and break when it changes?
>
> There are several points in my code that I temporarily disable
> interrupts (without first stopping timers or making sure that there
> are no DMA transfers in progress) but I don't think that this should
> cause a problem.
>
> Early on in my program, I enable interrupts using the following command.
>
> IRQ_globalEnable();
>
> I use the following commands to temporarily disable and re-enable
> interrupts. Does this sound correct?
>
> Uint32 gie = IRQ_globalDisable();
> IRQ_globalRestore(gie);
>
> I never explicitly disable interrupts in my code except with the pair
> of commands I just listed, so I don't know what is causing the GIE
> register to be set to zero.
>
> My thought is that if a timer was supposed to geneate an interrupt
> while they are disabled, it will simply miss that interrupt, and
> restart counting, generating an interrupt the next time. IS that correct?
>
> Similarly, the EDMA interrupt would simply be missed, and if another
> EDMA transfer is started later, and interrupts are enabled again, it
> will generate a single interrupt for the completed transfer.
>
> Any help is appreciated. Thanks.
>
> Wim.
>
This is not quite correct. Assuming you use IRQ_globalDisable(), the GIE
bit value is extracted and saved. See the following code from csl_irq.h.
IDEF Uint32 IRQ_globalDisable() {
Uint32 gie = CHIP_FGET(CSR,GIE);
CHIP_FSET(CSR,GIE,0);
return gie;
}
IDEF void IRQ_globalRestore(Uint32 gie) {
CHIP_FSET(CSR,GIE,gie);
}
sankaran wrote:

>The GIE is not a register, but I think LSB of a 32-bit register CSR.
>So when you call IRQ_save and IRQ_restore you are saving off CSR, not just
>GIE.
>
>Regds
>JS
>
>-----Original Message-----
>From: William C Bonner [mailto:w...@wimsworld.com]
>Sent: Sunday, September 24, 2006 12:10 AM
>To: sankaran
>Cc: c...
>Subject: Re: [c6x] Monitoring the state of the GIE Register
>
>I'm not sure what the CSR register is used for.
>
>sankaran wrote:
>
>
>>This problem is tough, and looks like the CSR is not being saved and
>>restored correctly, which is why GIE is being missed. One way of tracking
>>this, is to create a large array in external memory.
>>
>>For each ISR, say ISR0....ISRn, you can store CSR before you disable the
>>interrupts, and after restoring the interrupts and these two values should
>>match.
>>
>>One other way is to write the interrupts using the interrupt support and
>>
>>
>let
>
>
>>the C ccompiler manage the save and restore of the registers. I am not
>>
>>
>sure
>
>
>>of a method to monitor a change of a specific register, there are ways to
>>track memory for specific values, not sure about registers.
>>
>>Regds
>>JS
>>
>>-----Original Message-----
>>From: c... [mailto:c...] On Behalf Of
>>
>>
>William
>
>
>>C Bonner
>>Sent: Friday, September 22, 2006 4:04 PM
>>To: c...
>>Subject: [c6x] Monitoring the state of the GIE Register
>>
>>I am having a problem with a program running and having interrupts get
>>disabled. The hardware I'm using has a sequence of thigns happening
>>that are fired off by timer interrupts and then by EDMA completion
>>interrupts, and then I also have a UART handler runnign related to
>>interrupts.
>>
>>Intermittently the processor stops sending all interrupts, and when I
>>halt the processor in the debugger, I can see that the GIE register >>0. I would like to know if there is a way in code compser studio
>>3.1.23 to monitor the state of a register, and break when it changes?
>>
>>There are several points in my code that I temporarily disable
>>interrupts (without first stopping timers or making sure that there
>>are no DMA transfers in progress) but I don't think that this should
>>cause a problem.
>>
>>Early on in my program, I enable interrupts using the following command.
>>
>>IRQ_globalEnable();
>>
>>I use the following commands to temporarily disable and re-enable
>>interrupts. Does this sound correct?
>>
>>Uint32 gie = IRQ_globalDisable();
>>IRQ_globalRestore(gie);
>>
>>I never explicitly disable interrupts in my code except with the pair
>>of commands I just listed, so I don't know what is causing the GIE
>>register to be set to zero.
>>
>>My thought is that if a timer was supposed to geneate an interrupt
>>while they are disabled, it will simply miss that interrupt, and
>>restart counting, generating an interrupt the next time. IS that correct?
>>
>>Similarly, the EDMA interrupt would simply be missed, and if another
>>EDMA transfer is started later, and interrupts are enabled again, it
>>will generate a single interrupt for the completed transfer.
>>
>>Any help is appreciated. Thanks.
>>
>>Wim.
>>
>>
>>
>
Hi William,
I didnot investigate this problem deeply, but I see comment from TI's help:

When you call HWI_disable, interrupts are globally disabled in your application. HWI_disable clears the GIE bit in the control status register (CSR) on the 'C6000. This prevents the CPU from taking any maskable hardware interrupt. Hardware interrupts, therefore, operate on a global basis, affecting all interrupts, as opposed to affecting individual bits in the interrupt enable register. To reenable interrupts, call HWI_enable or HWI_restore. HWI_enable always enables the GIE bit, while HWI_restore restores the value to the state that existed before HWI_disable was called.

#include hwi.h

Uns oldmask;

oldmask = HWI_disable();
"do some critical operation;"
"do not call TSK_sleep(), SEM_post, etc."
HWI_restore(oldmask);
..
Looking like you right- previous valuemust be restored if u use "restore",
not enable..

regards
Oleg
I am having a problem with a program running and having interrupts get
>disabled. The hardware I'm using has a sequence of thigns happening
>that are fired off by timer interrupts and then by EDMA completion
>interrupts, and then I also have a UART handler runnign related to
>interrupts.
>
>Intermittently the processor stops sending all interrupts, and when I
>halt the processor in the debugger, I can see that the GIE register >0. I would like to know if there is a way in code compser studio
>3.1.23 to monitor the state of a register, and break when it changes?
>
>There are several points in my code that I temporarily disable
>interrupts (without first stopping timers or making sure that there
>are no DMA transfers in progress) but I don't think that this should
>cause a problem.
>
>Early on in my program, I enable interrupts using the following command.
>
>IRQ_globalEnable();
>
>I use the following commands to temporarily disable and re-enable
>interrupts. Does this sound correct?
>
>Uint32 gie = IRQ_globalDisable();
>IRQ_globalRestore(gie);
>
>I never explicitly disable interrupts in my code except with the pair
>of commands I just listed, so I don't know what is causing the GIE
>register to be set to zero.
>
>My thought is that if a timer was supposed to geneate an interrupt
>while they are disabled, it will simply miss that interrupt, and
>restart counting, generating an interrupt the next time. IS that correct?
>
>Similarly, the EDMA interrupt would simply be missed, and if another
>EDMA transfer is started later, and interrupts are enabled again, it
>will generate a single interrupt for the completed transfer.
>
>Any help is appreciated. Thanks.
>
>Wim.
JS had answered neatly. those are the methods to be
used carefully for IER register rather than GIE bit of
CSR register.

Please save and restore the contents of IER properly.

Regards
Harish
--- sankaran wrote:

> The GIE is not a register, but I think LSB of a
> 32-bit register CSR.
> So when you call IRQ_save and IRQ_restore you are
> saving off CSR, not just
> GIE.
>
> Regds
> JS
>
> -----Original Message-----
> From: William C Bonner
> [mailto:w...@wimsworld.com]
> Sent: Sunday, September 24, 2006 12:10 AM
> To: sankaran
> Cc: c...
> Subject: Re: [c6x] Monitoring the state of the GIE
> Register
>
> I'm not sure what the CSR register is used for.
>
> sankaran wrote:
> > This problem is tough, and looks like the CSR is
> not being saved and
> > restored correctly, which is why GIE is being
> missed. One way of tracking
> > this, is to create a large array in external
> memory.
> >
> > For each ISR, say ISR0....ISRn, you can store CSR
> before you disable the
> > interrupts, and after restoring the interrupts and
> these two values should
> > match.
> >
> > One other way is to write the interrupts using the
> interrupt support and
> let
> > the C ccompiler manage the save and restore of the
> registers. I am not
> sure
> > of a method to monitor a change of a specific
> register, there are ways to
> > track memory for specific values, not sure about
> registers.
> >
> > Regds
> > JS
> >
> > -----Original Message-----
> > From: c...
> [mailto:c...] On Behalf Of
> William
> > C Bonner
> > Sent: Friday, September 22, 2006 4:04 PM
> > To: c...
> > Subject: [c6x] Monitoring the state of the GIE
> Register
> >
> > I am having a problem with a program running and
> having interrupts get
> > disabled. The hardware I'm using has a sequence
> of thigns happening
> > that are fired off by timer interrupts and then by
> EDMA completion
> > interrupts, and then I also have a UART handler
> runnign related to
> > interrupts.
> >
> > Intermittently the processor stops sending all
> interrupts, and when I
> > halt the processor in the debugger, I can see that
> the GIE register > > 0. I would like to know if there is a way in code
> compser studio
> > 3.1.23 to monitor the state of a register, and
> break when it changes?
> >
> > There are several points in my code that I
> temporarily disable
> > interrupts (without first stopping timers or
> making sure that there
> > are no DMA transfers in progress) but I don't
> think that this should
> > cause a problem.
> >
> > Early on in my program, I enable interrupts using
> the following command.
> >
> > IRQ_globalEnable();
> >
> > I use the following commands to temporarily
> disable and re-enable
> > interrupts. Does this sound correct?
> >
> > Uint32 gie = IRQ_globalDisable();
> > IRQ_globalRestore(gie);
> >
> > I never explicitly disable interrupts in my code
> except with the pair
> > of commands I just listed, so I don't know what is
> causing the GIE
> > register to be set to zero.
> >
> > My thought is that if a timer was supposed to
> geneate an interrupt
> > while they are disabled, it will simply miss that
> interrupt, and
> > restart counting, generating an interrupt the next
> time. IS that correct?
> >
> > Similarly, the EDMA interrupt would simply be
> missed, and if another
> > EDMA transfer is started later, and interrupts are
> enabled again, it
> > will generate a single interrupt for the completed
> transfer.
> >
> > Any help is appreciated. Thanks.
> >
> > Wim.
> >
>

____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com