This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Get interrupted PC when in an HWI (DSP BIOS c64+)

I am using DSP BIOS on a 64+ device, 6457.

I want to get the address of the code that was interrupted by a HWI in the running HWI. I have looked at the IRP but this is not pointing to the interrupted code. It appears to point at the HWI itself. Is the information I want available in the registers somewhere? Another possibility is to find the running thread handle and look in the TSK structure, but I am not sure if the interrupted address, or where the task will start to run again, is available.

  • Hi William,
    It should be the IRP register. I tried this with a SYS/BIOS (the newer version of DSP BIOS) Task example, setting the Clock tick period to 1 second, and setting a breakpoint in the Clock tick ISR. When CCS hit the Clock tick ISR, the IRP register contained an address in my task, as expected.
    Best regards,
    Janet
  • I'm using the HWI. I'm not sure if this makes a difference. The "ISR" for a HWI is just a normal C function and I don't know what the HWI "dispatcher" is doing to the IRP. It can be used as a general purpose register if interrupts are disabled. I may look at using a raw interrupt, not sure what else the HWI is doing that may require a HWI. Maybe I could add an interrupt just for what I want to do. If in a HWI IRP is still OK then I need to look at what I did again and check it. It looked like the HWI had the HWI entry in the IRP when I tryed it. Actually there could be issues with using the debugger to read the value. I will try again but set a break point else where. Perhaps I could "graph" the value to peek at it while the code is running.

  • How are you configuring the "mask" field in your HWI configurations?
  • It is set to "self", do you think if its set to all then I will see IRP unaltered? I could experiment with this.

  • Yes, my theory is that you might be seeing instances where multiple interrupts are pending. This is especially likely if you're stepping through code with JTAG. Make sure you set ALL of the HWIs to mask "all" instead of self. This is actually something that I always recommend to customers. As long as you try to keep your ISRs short, there's really no need for pre-emption.

  • I am still seeing the same results, even when all masks are set to all. The IRP is set to the address of the start of the HWI, not where the interrupted thread would continue from. I call PRD_tick(); in this HWI, could I convert it to a real interrupt and wrap the call in HWI_enter/HWI_exit ? I would have to use the interrupt key word, anything else I need to do? Not sure where I write the address of the real interrupt to or what other register I need to configure when not using the WI dispatcher.
  • Instead of setting a breakpoint in your function, can you set the breakpoint directly in the HWI table?  If in a disassembly window you type in "ISTP" that will take you to the start of the table and you should see labels corresponding to each interrupt.  So do you see IRP changing between entry to the HWI table and when you reach your C code?  I've looked at the source code, and I do not see anywhere that BIOS overwrites IRP.

  • Um? I think you are correct the dispatcher is not altering IRP. I had some finger trouble with setting the masks. I will try again. I think the IRP is the address of the HWI as it itself has been interrupted and then has already returned to then complete. When I did what you said I actually got the address of another HWI in the IRP and as I step it was unaltered in the HWI I was interested in.
  • I have all masks set to all and still seeing the same thing. I could have multiple interrupts pending but I still do not understand what I am seeing here.
  • Which HWI's address is in the IRQ register? That's the one that was pre-empted. That's where we need to focus our efforts. If you look at that address in the disassembly window you should be able to find a label in close proximity to understand which HWI it corresponds to.
  • Sorry Brad, I had not done the mask correctly. I was editing the tcf file but not changing the "intMask" in the HWI_Attrs passed to HWI_dispatchPlug(). An interpretation of what I was seeing was the dispatcher code you asked me to step though was not change IRP directly, it was enabling interrupts. A different interrupt was running at that point so the continuation address was the interrupt I was working on. So I think IRP was being set when interrupts were enabled and another interrupt fired. As you suggested, setting intMask to "all" (0xFFFF) means interrupts are still enabled in the dispatcher but now they are all masked so nothing fires. I am now seeing where in the "thread" the interrupt occurred. This is very useful for what I am investigation. Thanks Very much.