Firmware, did anyone verify hook_fgv?

Dear all,
I modified a little the firmware of a usrp-based device.
I wanted to check the buffer overrun event on the BULK IN EP2 FIFO, but
the
interrupt autovectoring mechanism doesn’t work.
The following code

static void
isr_EP2FULLFLAG (void) interrupt
{
clear_fifo_gpif_irq ();

IOD ^= 0x01;

_usb_rx_overrun++;
}

void install_handlers (void)
{
setup_descriptors (); // ensure that they’re set before use

hook_uv (UV_SUDAV, (WORD) isr_SUDAV);
hook_uv (UV_USBRESET, (WORD) isr_USBRESET);
hook_uv (UV_HIGHSPEED, (WORD) isr_HIGHSPEED);

hook_fgv (FGV_EP2FF, (WORD) isr_EP2FULLFLAG);

SYNCDELAY; EP2FIFOIE = 0x01; /* The FF on the EP2, which is BULK IN */
SYNCDELAY;
USBIE = bmSUDAV | bmURES | bmHSGRANT;
}

I don’t see any changes in the port D bit 0 or _usb_rx_overrun variable,
even in case of the EP2 overrun, which I can less efficiently verify
with
EP2468STAT or EP24FIFOFLGS (and maybe EP2CS as well).
Any clue? Did someone ever try hook_fgv?

Regards,
Mic

Solved.
It was my fault, but the source in my opinion is a little misleading.
Since the USB interrupt autovector had been separated by the GPIF/FIFO
one
(likely as a memory optimization during changeset 2452), it is not
allowed
to use in hook_fgv the same vector_number as in hook_uv.
In fact FGV_MIN, defined as 0x80 in isr.h, is sequential in the unified
table USB+GPIF/FIFO to the last USB resource interrupt, but should be
0x0
when used to indicize the new _fifo_gpif_autovector at address 0x0080.
Maybe a little update to the firmware should be done, either updating
FGV_xxxx values in isr.h, or modifying the hook_fgv as follows:

/* begin */
void
hook_fgv (unsigned char vector_number, unsigned short addr)
{
bit t;
BYTE vector_idx;
// sanity checks

if (vector_number < FGV_MIN || vector_number > FGV_MAX)
return;

if ((vector_number & 0x3) != 0)
return;

vector_idx = vector_number - FGV_MIN;

t = EA;
EA = 0;
_fifo_gpif_autovector[vector_idx] = LJMP_OPCODE;
_fifo_gpif_autovector[vector_idx + 1] = addr >> 8;
_fifo_gpif_autovector[vector_idx + 2] = addr & 0xff;
EA = t;
}
/* end */

Comments?

Michele

On Mon, Dec 03, 2007 at 05:34:02PM +0100, Michele Bavaro wrote:

Solved.
It was my fault, but the source in my opinion is a little misleading.
Since the USB interrupt autovector had been separated by the GPIF/FIFO one
(likely as a memory optimization during changeset 2452), it is not allowed
to use in hook_fgv the same vector_number as in hook_uv.
In fact FGV_MIN, defined as 0x80 in isr.h, is sequential in the unified
table USB+GPIF/FIFO to the last USB resource interrupt, but should be 0x0
when used to indicize the new _fifo_gpif_autovector at address 0x0080.
Maybe a little update to the firmware should be done, either updating
FGV_xxxx values in isr.h, or modifying the hook_fgv as follows:

Thanks for finding this problem and suggesting the fixes.

I’ve fixed it in the trunk (r7060) by renumbering FGV_* from 0x00.

Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs