Interrupts on the PC/104-bus of an MBX860-board

bridged with qdn.public.bsp
Post Reply
Prof. Dr. B. Buchholz

Interrupts on the PC/104-bus of an MBX860-board

Post by Prof. Dr. B. Buchholz » Mon May 12, 2003 2:15 pm

Hello Everyone,

we are using the MBX860-board from Motorola with QNX Momentics PE 6.2.x
(for Education). We have to write a resource manager for a data-
acquisition board (Diamond MM-AT), which uses interrupts and sits on the
PC/104-bus.

On an x86-platform we were able to work with the boards interrupt by
using the calls to ThreadCtl(), mmap_device_io(),
InterruptAttachEvent(), InterruptWait(), and InterruptUnmask().
But on th MBX860-board we didn't succeed to get an interrupt.

We suppose, that we have to do some initialization work in the
image startup program. (We are using the board support package for the
MBX860.) The information in the "Building Embedded Systems" document
was not not sufficient for us.

Does anyone have some hints or code-examples for our problem?

Thanks in advance

Bernhard Buchholz
TFH-Berlin, University of Applied Sciences

Dmitri Poustovalov

Re: Interrupts on the PC/104-bus of an MBX860-board

Post by Dmitri Poustovalov » Mon May 19, 2003 8:02 pm

What interrupt are you attaching to? All ISA interrupts are multiplexed
into IRQ3 on MBX860. Try to attach PPC800_INTR_IRQ3 and post here results.

Prof. Dr. B. Buchholz wrote:
Hello Everyone,

we are using the MBX860-board from Motorola with QNX Momentics PE 6.2.x
(for Education). We have to write a resource manager for a data-
acquisition board (Diamond MM-AT), which uses interrupts and sits on the
PC/104-bus.

On an x86-platform we were able to work with the boards interrupt by
using the calls to ThreadCtl(), mmap_device_io(),
InterruptAttachEvent(), InterruptWait(), and InterruptUnmask().
But on th MBX860-board we didn't succeed to get an interrupt.

We suppose, that we have to do some initialization work in the
image startup program. (We are using the board support package for the
MBX860.) The information in the "Building Embedded Systems" document
was not not sufficient for us.

Does anyone have some hints or code-examples for our problem?

Thanks in advance

Bernhard Buchholz
TFH-Berlin, University of Applied Sciences

Bernhard Buchholz

Re: Interrupts on the PC/104-bus of an MBX860-board

Post by Bernhard Buchholz » Wed May 21, 2003 3:18 pm

Hallo Dimitri,

sorry that i am responding so late, but the student who encountered this
interrupt-problem in his diploma work came back into the lab today.

He has tried to follow your suggestion - but didn't succeed.

Here are the essential parts of the code he used:

///////////////////////////////////////////////////////////////////////////////////
// Resource Manager
//////////////////////////////////////////////////////////////////////////////////

volatile int counter = 0;

// thread for the interrupt service routine
void * dmmat_interrupt(void * data )
{
struct sigevent event;
event.sigev_notify = SIGEV_INTR;

InterruptAttachEvent(PPC800_INTR_IRQ3, &event, 0);

while(1)
{
// => the following output appears
printf("waiting for IRQ %i\n", PPC800_INTR_IRQ3);
InterruptWait(NULL,NULL) ;
counter++; // => counter never increments
InterruptUnmask(PPC800_INTR_IRQ3,id);
}
}

In the init_intrinfo()-routine he used for the startup-program there is
also a line (***) he is not sure about.

////////////////////////////////////////////////////////////////////////////////
// using startup-mbx800
// /usr/src/bsp-6.2.1/ppc/mbx800/src/hardware/startup/boards/mbx800
/////////////////////////////////////////////////////////////////////////////////

// init_intrinfo.c
void
init_intrinfo() {
/* Mask off all the interrupt sources */
PPC800_IMMR(SIMASK,32) = 0; // => is this initialisation
// correct (***) ?

// program CPIC
// PPC800_IMMR(CIMR, 32) = 0;
PPC800_IMMR(CICR, 32) &= ~PPC8CPM_CICR_IRLM;
PPC800_IMMR(CICR, 32) |= (PPC8CPM_CICR_IEN |
PPC8CPM_CICR_IRL(PPC8CPM_CICR_IRL_D));

add_interrupt_array(intrs, sizeof(intrs));
}

Thanks in advance

Bernhard


Dmitri Poustovalov schrieb:
What interrupt are you attaching to? All ISA interrupts are multiplexed
into IRQ3 on MBX860. Try to attach PPC800_INTR_IRQ3 and post here results.

Prof. Dr. B. Buchholz wrote:


Hello Everyone,


we are using the MBX860-board from Motorola with QNX Momentics PE 6.2.x
(for Education). We have to write a resource manager for a data-
acquisition board (Diamond MM-AT), which uses interrupts and sits on the
PC/104-bus.


On an x86-platform we were able to work with the boards interrupt by
using the calls to ThreadCtl(), mmap_device_io(),
InterruptAttachEvent(), InterruptWait(), and InterruptUnmask().
But on th MBX860-board we didn't succeed to get an interrupt.


We suppose, that we have to do some initialization work in the
image startup program. (We are using the board support package for the
MBX860.) The information in the "Building Embedded Systems" document
was not not sufficient for us.


Does anyone have some hints or code-examples for our problem?


Thanks in advance


Bernhard Buchholz
TFH-Berlin, University of Applied Sciences




Dmitri Poustovalov

Re: Interrupts on the PC/104-bus of an MBX860-board

Post by Dmitri Poustovalov » Sun May 25, 2003 10:53 pm

Hi Bernhard,

The initialization you're concerned about, is correct. h/w interrupts
should be disabled/masked before the kernel kicks in. When you attach an
interrupt handler, the kernel will enable/unmask it for you.

Your PC-104 board is behind PCI controller and ISA-PCI bridge. I
guess,some or both of those devices have to be configured properly. Good
news there is a pci server called pci-mbx in your mbx860 BSP package. It
is hard to say how usefull this server is, but it might be a start
point.Anyway if "PCI & PowerPC" is not diploma's subject and you are
concerned with time of your project, then I would recommend you to stick
to x86.

Good luck,
-Dmitri


Bernhard Buchholz wrote:
Hallo Dimitri,

sorry that i am responding so late, but the student who encountered this
interrupt-problem in his diploma work came back into the lab today.

He has tried to follow your suggestion - but didn't succeed.

Here are the essential parts of the code he used:


///////////////////////////////////////////////////////////////////////////////////
// Resource Manager

//////////////////////////////////////////////////////////////////////////////////
volatile int counter = 0;

// thread for the interrupt service routine
void * dmmat_interrupt(void * data )
{
struct sigevent event;
event.sigev_notify = SIGEV_INTR;

InterruptAttachEvent(PPC800_INTR_IRQ3, &event, 0);

while(1)
{
// => the following output appears
printf("waiting for IRQ %i\n", PPC800_INTR_IRQ3);
InterruptWait(NULL,NULL) ;
counter++; // => counter never increments
InterruptUnmask(PPC800_INTR_IRQ3,id);
}
}

In the init_intrinfo()-routine he used for the startup-program there is
also a line (***) he is not sure about.


////////////////////////////////////////////////////////////////////////////////
// using startup-mbx800
// /usr/src/bsp-6.2.1/ppc/mbx800/src/hardware/startup/boards/mbx800

/////////////////////////////////////////////////////////////////////////////////
// init_intrinfo.c
void
init_intrinfo() {
/* Mask off all the interrupt sources */
PPC800_IMMR(SIMASK,32) = 0; // => is this initialisation
// correct (***) ?

// program CPIC
// PPC800_IMMR(CIMR, 32) = 0;
PPC800_IMMR(CICR, 32) &= ~PPC8CPM_CICR_IRLM;
PPC800_IMMR(CICR, 32) |= (PPC8CPM_CICR_IEN |
PPC8CPM_CICR_IRL(PPC8CPM_CICR_IRL_D));

add_interrupt_array(intrs, sizeof(intrs));
}

Thanks in advance

Bernhard
Dmitri Poustovalov schrieb:
What interrupt are you attaching to? All ISA interrupts are multiplexed
into IRQ3 on MBX860. Try to attach PPC800_INTR_IRQ3 and post here results.

Prof. Dr. B. Buchholz wrote:


Hello Everyone,


we are using the MBX860-board from Motorola with QNX Momentics PE 6.2.x
(for Education). We have to write a resource manager for a data-
acquisition board (Diamond MM-AT), which uses interrupts and sits on the
PC/104-bus.


On an x86-platform we were able to work with the boards interrupt by
using the calls to ThreadCtl(), mmap_device_io(),
InterruptAttachEvent(), InterruptWait(), and InterruptUnmask().
But on th MBX860-board we didn't succeed to get an interrupt.


We suppose, that we have to do some initialization work in the
image startup program. (We are using the board support package for the
MBX860.) The information in the "Building Embedded Systems" document
was not not sufficient for us.


Does anyone have some hints or code-examples for our problem?


Thanks in advance


Bernhard Buchholz
TFH-Berlin, University of Applied Sciences




Bernhard Buchholz

Re: Interrupts on the PC/104-bus of an MBX860-board

Post by Bernhard Buchholz » Mon May 26, 2003 3:48 pm

Hi Dimitri,

thanks for responding. I was afraid to run into configuring bit by bit
the Winbond 83C553F PCI-ISA bridge. I thought, that this stuff is
hopefully done by the bsp. But i have got a users manual for this device
now.

Unfortunately the work has to be done on the MBX-board because its the
platform we use in our labs work. (With the bsp for LynxOs everything
worked smoothly.)

I will report our results to you as soon as possible.

Thanks

Bernhard

Bernhard Buchholz

Re: Interrupts on the PC/104-bus of an MBX860-board

Post by Bernhard Buchholz » Tue Jun 10, 2003 3:23 pm

Hi Dimitri,

good news: we are now able to produce and to receive Interrupts from
the PC/104 ananlog-i/o card correctly on the MBX860. The key to this
was the enabling of the corresponding interrupt in the Winbond PCI-ISA
bridge. I found some help in the VxWorks bsp for the MBX860.

The C-code to set the corresponding mask in the Winbond chip is
as follows:

#define IOBASE 0x80000000

// Interrupt Controller Register
#define PIC1_OCW1_REG 0x021
#define PIC1_EDGE_LEVEL_REG 0x4D0


/* --------------------------------------------------------
Before waiting for the PPC800_INTR_IRQ3 hardware interrupt,
we have to do some initialization work of the Windbond
Interrupt Controller.
----------------------------------------------------------*/

void initWinbondIntController()
{

uintptr_t ptr;

if((ThreadCtl(_NTO_TCTL_IO, NULL)) < 0 )
{
perror("I/O Permission");
return EXIT_FAILURE;
}

// map 1024 bytes of the device's physical memory into
// the process's address space
ptr = mmap_device_memory(0, 1024 ,
PROT_READ|PROT_WRITE|PROT_NOCACHE, 0,
IOBASE );
if ( ptr == MAP_FAILED )
{
perror( "mmap_device_memory for physical address failed" );
exit( EXIT_FAILURE );
}

// Enable Interrupt 3
out8(ptr + PIC1_OCW1_REG, (in8(ptr + PIC1_OCW1_REG ) & 0xF7) );

// Make IRQ 3 level sensitive
out8(ptr + PIC1_EDGE_LEVEL_REG ,
(in8(ptr + PIC1_EDGE_LEVEL_REG ) | 0x08));
}


Thank you very much for your help!

Bernhard

Post Reply

Return to “qdn.public.bsp”