wants source code of shutdown in C using interrupts ?

D

Dan Pop

In said:
Is there any code using interrupts .

There is no generic C code using interrupts. Such code is heavily
platform and implementation specific, so go to a newsgroup dedicated to
your platform.

Dan
 
M

Mark McIntyre

hello,
Is there any code using interrupts .

You can't do this in Standard C. Didn't someone already tell you that?

Please go to a group specialising in your hardware, and ask there.
 
K

Keith Thompson

Mark McIntyre said:
You can't do this in Standard C. Didn't someone already tell you that?

Please go to a group specialising in your hardware, and ask there.

Now that I think about it, this might refer to the facilities in
<signal.h>. (Is there a distinction between "signals" and
"interrupts"?)

To the original poster: Read your system's documentation on the
"signal" function. If this is what you're looking for, and you still
have questions after reading the documentation, come back with a more
specific question.
 
P

Paul

Keith Thompson said:
Now that I think about it, this might refer to the facilities in
<signal.h>. (Is there a distinction between "signals" and
"interrupts"?)

To the original poster: Read your system's documentation on the
"signal" function. If this is what you're looking for, and you still
have questions after reading the documentation, come back with a more
specific question.

Hello Sweety, we don't do home work or office assignments here. It
would be elegant that you hire some one for that.

-Paul.
 
D

Dan Pop

In said:
Now that I think about it, this might refer to the facilities in
<signal.h>. (Is there a distinction between "signals" and
"interrupts"?)

Yup, a fundamental one: an signal handler is an ordinary C function,
treated by the compiler like any other function (the compiler has no
idea it is compiling a signal handler) while an interrupt handler must
save *all* the CPU state it is disturbing upon entry and restore it
before returning. On most CPUs, it must also reenable the interrupt
that invoked it, usually using a different kind of return instruction
("return from interrupt" instead of "return from subroutine").

The declaration of a signal handler is:

void handler(int);

while the typical declaration of an interrupt handler is something like

void interrupt inthandler(void);

where the "interrupt" extension tells the compiler to add all the code
for performing the actions described above.

As interrupt handlers belong to the OS kernel, the need for such an
extension is limited to freestanding implementations and to very
primitive hosted platforms, like MSDOS, where there is no difference
between user code and OS code.

Because the serial port drivers of MSDOS are not interrupt driven,
any user program that needs *reliable* serial communication MUST
provide its own interrupt handler(s) for the serial port(s) it uses.
Easily done in C, because most MSDOS compilers provide the "interrupt"
extension described above along with library support for accessing the
I/O ports.

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top