Interrupt Handling - Simulation

Hey ed1k,

Why i need this? Well, as i’ve told before in other post, i’m porting
some
programs from the old DOS that use this feature.

Usualy DOS programs used INT 0x1c or INT 0x08 to take control every 55ms
(handle IRQ 0 or to be in
long train of handlers). But you don’t need use it anymore in QNX. You
have much more safe timers.

The timers in QNX are very safe to do this kind of work right? Every
time-interval i need to gather some hardware information and make some
decisions… i CAN thrust in the timers right? That’s what i see until now.
A little thing… In my program i try to configure the timer to repeat every,
for example, 100ms, my osciloscope shows me that i’m getting an accuracy of
80 ms, when i try to use 1ms is see that this accuracy is 0.8ms.
I’ve set the thread priority to 63, just for minimize the interferece with
other programs, and do some tests using and QNX build image too (As is
explain in Programmers Guide Manual) and again i get this 20% difference…

What makes this 20% difference?


What i want to do now is to test the InterruptAttach routines. I’m trying to
simulate an Paralel Interrupt to see if my program is working well, but it’s
more complicated then just send a 5v signal to the ACK pin of the port.

So, i just want to see if my InterruptAttach code is working, how can i
simulate an Interrupt ?

I’ve done a lot of sucessful tests using timer (Thanks to Rob again),
and
now i want the timer to generate an interrupt for my tests with
interrupt
routines.

You can use messages and pulses in QNX instead of users’ vectors and soft
INT in DOS. Ideology of
DOS and QNX is quite different. You’re able to use all your DOS background
but don’t copy
everything from one OS to another.

Yes… That’s what i’m trying to do… Porting not just the code from DOS to
QNX, but adapting the code to work better!

Thanx
Leandro

Leandro Colen <lcrocha@yahoo.com> wrote in article <acgbdh$rpd$2@inn.qnx.com>…
[cut]

What i want to do now is to test the InterruptAttach routines. I’m trying to
simulate an Paralel Interrupt to see if my program is working well, but it’s
more complicated then just send a 5v signal to the ACK pin of the port.

Why? Just slay parallel port manager. Also you have to enable interrupts from port, see port 0x37a
(0x27a) “Printer controls” bit 4. Your signal will cause hardware interrupt IRQ7 (IRQ5). Also be
very careful, look settings in BIOS, etc. to avoid hardware conflicts.

Eduard.
ed1k at ukr dot net

Leandro Colen wrote:

Why write a resource manager? If i write a Device driver and create the
/dev/leandrodd file, why should i use a resource manager to comunicate
between the client programs and my dd?

  1. Because it is good software engineering practice to separate
    interface and implementation.

  2. Because it is even better practice to draw your interface from an
    existing standard, if possible.

Resource managers not only separate interface and implementation, they
provide a standard interface, well understood by thousands (probably
hundreds of thousands of programmers), to which you can add extensions
in the form of devctls.

Now the second point is of marginal value if you are going to be the
only one to use your resource manager, but the first point, always has
great value (in portability and maintainability for instance), and while
you don’t have to use a resource manager to achieve #1, it makes it much
easier to do so, since everything is already laid out for you in the
form of the resmgr lib.

Rennie

Eduard,

first of all, let’s fix the stupid thing that i’ve done (2 posts)! :slight_smile: i’ll
answer the 2 posts in this one ok?

That’s what i see until now.
A little thing… In my program i try to configure the timer to repeat
every,
for example, 100ms, my osciloscope shows me that i’m getting an accuracy
of
80 ms, when i try to use 1ms is see that this accuracy is 0.8ms.
I’ve set the thread priority to 63, just for minimize the interferece
with
other programs, and do some tests using and QNX build image too (As is
explain in Programmers Guide Manual) and again i get this 20%
difference…



Very odd. Did you try the another osciloscope?

Not yet… good point… tomorrow i’ll see if it happens on other
osciloscope!

What i want to do now is to test the InterruptAttach routines. I’m
trying to
simulate an Paralel Interrupt to see if my program is working well, but
it’s
more complicated then just send a 5v signal to the ACK pin of the port.

Why? Just slay parallel port manager. Also you have to enable interrupts
from port, see port 0x37a
(0x27a) “Printer controls” bit 4. Your signal will cause hardware
interrupt IRQ7 (IRQ5). Also be
very careful, look settings in BIOS, etc. to avoid hardware conflicts.

Hey man… i have good news!!

I’ve done sucessful tests with interrupt handling!!

I’ve didn’t know that the serial port, every time that it receives an
incoming information, it generates an interrupt. I use the COM1 9-pin
connector and loopback the rx<->tx pin (2 and 3). In the interrupt handling
program, i configure the InterruptAttach to IRQ4 (COM1). In other program i
only send a byte to the port (in my case 0x3F8) and the interrupt handling
works as i want!

Finally i get it!! :slight_smile:))


As usual, i can’t leave any message that i post without a question right? So
there is (it’s more like a discussion):

Why write a resource manager? If i write a Device driver and create the
/dev/leandrodd file, why should i use a resource manager to comunicate
between the client programs and my dd?

Let’s take a look in a example:
i have a hardware to control the motors of my robotic arm, i’ll write the
device driver to access the hardware and create the /dev/roboarm file. When
the client process needs to manipulate the arm, it just have to open the
file and send the information ! Why is a good thing to write a resource
manager to receive the information from the client and ask for the hardware
to do it?

Maybe it’s for security? The client must send the information to the RM and
in the RM will check if it’s all ok?

I’m not asking for everyone to stop writing RM. I’m just trying to figure
out the real use of it!

I think that is much better to have security control when accessing the
hardware. I’ll do write the RM, but i need to understand this first!

Ok…that’s all for now! :slight_smile:

Once again, thanx to all and to Eduard
Leandro