473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ISR and a normal function

Hi all,

Can any one tell the actual differences between a software ISR in C
and a normal C function?
What are the things to be taken care when writing an ISR in C?
I have an embedded hardware with l2/l3 switching logic. I want to
register for an interrupt with the hardware and i want an ISR in C to
get executed for that interrupt.

With Regards
Anwar
Jun 27 '08 #1
8 3210
vh************@gmail.com wrote:
Hi all,

Can any one tell the actual differences between a software ISR in C
and a normal C function?
What are the things to be taken care when writing an ISR in C?
I have an embedded hardware with l2/l3 switching logic. I want to
register for an interrupt with the hardware and i want an ISR in C to
get executed for that interrupt.
ISR? Do you mean a TSR? I haven't heard of an ISR.

--
Jim Langston
ta*******@rocketmail.com
Jun 27 '08 #2
On 21 May, 13:43, "Jim Langston" <tazmas...@rocketmail.comwrote:
vhanwaribra...@gmail.com wrote:
Hi all,
Can any one tell the actual differences between a software ISR in C
and a normal C function?
What are the things to be taken care when writing an ISR in C?
I have an embedded hardware with l2/l3 switching logic. I want to
register for an interrupt with the hardware and i want an ISR in C to
get executed for that interrupt.

ISR? Do you mean a TSR? I haven't heard of an ISR.
I presume ISR = Interrupt Service Routine.

Jun 27 '08 #3
In article <0f373d8e-9264-48fa-a4b6-79ac944cf5d8
@d1g2000hsg.googlegroups.com>, sp****@gmail.com says...
On 21 May, 13:43, "Jim Langston" <tazmas...@rocketmail.comwrote:
vhanwaribra...@gmail.com wrote:
Hi all,
Can any one tell the actual differences between a software ISR in C
and a normal C function?
What are the things to be taken care when writing an ISR in C?
I have an embedded hardware with l2/l3 switching logic. I want to
register for an interrupt with the hardware and i want an ISR in C to
get executed for that interrupt.
ISR? Do you mean a TSR? I haven't heard of an ISR.

I presume ISR = Interrupt Service Routine.

Yep, and I'm pretty sure any support for hardware and software
interrupts are a compiler specific extension and not standard C.

Jim
Jun 27 '08 #4
On May 21, 3:58 pm, James Beck <j...@reallykillersystems.comwrote:
In article <0f373d8e-9264-48fa-a4b6-79ac944cf5d8
@d1g2000hsg.googlegroups.com>, spi...@gmail.com says...
On 21 May, 13:43, "Jim Langston" <tazmas...@rocketmail.comwrote:
vhanwaribra...@gmail.com wrote:
Hi all,
Can any one tell the actual differences between a software ISR in C
and a normal C function?
What are the things to be taken care when writing an ISR in C?
I have an embedded hardware with l2/l3 switching logic. I want to
register for an interrupt with the hardware and i want an ISR in C to
get executed for that interrupt.
ISR? Do you mean a TSR? I haven't heard of an ISR.
I presume ISR = Interrupt Service Routine.

Yep, and I'm pretty sure any support for hardware and software
interrupts are a compiler specific extension and not standard C.
Well, signals are interrupts aren't they? Standard C has <signal.h>.
Jun 27 '08 #5
In article <bb1689f3-74ee-477f-9e43-8d23457bba24
@t54g2000hsg.googlegroups.com>, vi******@gmail.com says...
On May 21, 3:58 pm, James Beck <j...@reallykillersystems.comwrote:
In article <0f373d8e-9264-48fa-a4b6-79ac944cf5d8
@d1g2000hsg.googlegroups.com>, spi...@gmail.com says...
On 21 May, 13:43, "Jim Langston" <tazmas...@rocketmail.comwrote:
vhanwaribra...@gmail.com wrote:
Hi all,
Can any one tell the actual differences between a software ISR in C
and a normal C function?
What are the things to be taken care when writing an ISR in C?
I have an embedded hardware with l2/l3 switching logic. I want to
register for an interrupt with the hardware and i want an ISR in C to
get executed for that interrupt.
ISR? Do you mean a TSR? I haven't heard of an ISR.
I presume ISR = Interrupt Service Routine.
Yep, and I'm pretty sure any support for hardware and software
interrupts are a compiler specific extension and not standard C.
Well, signals are interrupts aren't they? Standard C has <signal.h>.
Can you use that to handle a UART interrupt?
From what I see SIGXXXX is pretty OS specific, ANSI or not.
SIGINT in MS-DOS is int0x23, program termination. Not very useful for
anything other than executing some custom shutdown/exit routine.

Jim

Jun 27 '08 #6
In article <bb**********************************@t54g2000hsg. googlegroups.com>,
<vi******@gmail.comwrote:
>Yep, and I'm pretty sure any support for hardware and software
interrupts are a compiler specific extension and not standard C.
>Well, signals are interrupts aren't they?
True in a sense, but probably not relevant to the OP's situation.

C's and Unix's signals are an abstraction of hardware interrupts.
When, say, a segmentation violation happens the processor gets an
interrupt, which is handled by the kernel. That handling may involve
calling a signal handler in the affected C program. But there is no
necessary relation between the calling convention used by the hardware
interrupt and that used by the resulting C signal. The call to the
signal handler is just like any other function call - or at least,
sufficiently like it that the signal handler can be used a a normal C
function, while the call to the interrupt handler probably uses a
quite different convention, probably a very minimal one that requires
the called function to save registers and so on.

-- Richard
--
:wq
Jun 27 '08 #7
On May 21, 7:44*pm, rich...@cogsci.ed.ac.uk (Richard Tobin) wrote:
In article <bb1689f3-74ee-477f-9e43-8d23457bb...@t54g2000hsg.googlegroups.com>,

*<vipps...@gmail.comwrote:
Yep, and I'm pretty sure any support for hardware and software
interrupts are a compiler specific extension and not standard C.
Well, signals are interrupts aren't they?

True in a sense, but probably not relevant to the OP's situation.

C's and Unix's signals are an abstraction of hardware interrupts.
When, say, a segmentation violation happens the processor gets an
interrupt, which is handled by the kernel. *That handling may involve
calling a signal handler in the affected C program. *But there is no
necessary relation between the calling convention used by the hardware
interrupt and that used by the resulting C signal. *The call to the
signal handler is just like any other function call - or at least,
sufficiently like it that the signal handler can be used a a normal C
function, while the call to the interrupt handler probably uses a
quite different convention, probably a very minimal one that requires
the called function to save registers and so on.

-- Richard
--
:wq
Hi Richard,
I have heard that when you are writing an interrrupt service routine
(ISR), it should not
use semaphores or mutexes and not to use printfs inside ISR.
Whats the exact reason behind this?

With Regards
Anwar
Jun 27 '08 #8
In article <0c**********************************@l28g2000prd. googlegroups.com>,
<vh************@gmail.comwrote:
>I have heard that when you are writing an interrrupt service routine
(ISR), it should not
use semaphores or mutexes and not to use printfs inside ISR.
Whats the exact reason behind this?
Obviously you don't want an interrupt handler to block the operating
system from doing other things for more than a few nanoseconds, but
exactly what that implies depends on your system.

-- Richard
--
:wq
Jun 27 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Irmen de Jong | last post by:
Okay I tried some profiling, but am uncertain about the results I'm getting. They confuse the hell out of me. I have a test program (see below) that essentially has two loops that get called...
4
by: Morgan Cheng | last post by:
I tried to build a CThread on linux which imitate the behavior of java Thread. I think this is still in the scope of C++. First, I tried this way #include <pthread.h> class CThread { public:...
3
by: Johnny | last post by:
Hi, I wonder what is the difference between the built-in function getattr() and the normal call of a function of a class. Here is the details: getattr( object, name) Return the value of...
9
by: Andy Chalkley | last post by:
Hi I need to convert surname and firstname fields in a table from upper case to normal. There are about 10000 records. Typically: DE ANTONIO De Antonio CONROY, R W AND...
1
by: Richard Hollenbeck | last post by:
I noticed I can't push a value into a text box by saying something like, "txtThisTextBox = intSomeVariable * 0.5" because I get an run-time error saying I can't assign a value to this object....
1
by: atahim | last post by:
I have a query in my database that calculates '# of Days' based on a start and end date and displays it amongst other fields. What i need to do now is develop another query that will give me the...
3
by: littlecharva | last post by:
Hi I need to convert a complicated Excel document that's been created by some Maths boffin into a program in C#. I've been doing really well (despite my Mathematical handicap) until I hit the...
5
by: abc | last post by:
Hello folks, Does this qualify as normal behavior to you ?Compiled this with gcc 3.2 ----------------------------- #include <stdio.h> static int array; void initPointer(int * i_p)
1
by: =?Utf-8?B?SmNr?= | last post by:
I am trying to access the registry from a normal user by the following code .... but failed!! However, it works under admin user logon. I think I need to grant some access right to the normal...
0
by: shrik | last post by:
I have following error : Total giant files in replay configuration file are : File name : /new_file/prob1.rec Given file /new_file/prob1.rec is successfully verified. Splitting for giant file...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.