EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

regarding ISR

Started by alee...@gmail.com January 28, 2008
<aleemakhtar1@gmail.com> wrote in message 
news:b140416d-2767-40e2-b8f6-d3d8e91ea71f@e6g2000prf.googlegroups.com...
> can i allocate dynamic memory in ISR ?? If yes wat shd be the > precautions i need to take care ??
In most systems, the answer is NO. Reasons: a)Functions such as malloc() are typically not re-entrant. b)The allocation would take too long (defeats the rationale of an ISR). Generally, knowing what you may and may not do from within an ISR is one of the really important design rules of a system ... -- David T. Ashley (dta@e3ft.com) http://www.e3ft.com (Consulting Home Page) http://www.dtashley.com (Personal Home Page) http://gpl.e3ft.com (GPL Publications and Projects)
In message <479E489E.48BE6473@yahoo.com>, CBFalconer 
<cbfalconer@yahoo.com> writes
>Stephen Pelc wrote: >> David Brown <david@westcontrol.removethisbit.com> wrote: >> >>> Before posting again, please learn to type correctly. >> >> May I suggest, that for a different view, you read: >> The Cell Phone: An Anthropology of Communication >> By Heather A. Horst, Daniel Miller > >Let me point out that Usenet is NOT - repeat NOT - a Cell Phone.
It's on my cell phone or is that the phone in my cell? :-) -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
On Jan 29, 7:52=A0am, t...@nospam.com (Tom) wrote:
> In article <b140416d-2767-40e2-b8f6-d3d8e91ea...@e6g2000prf.googlegroups.c=
om>, "aleemakht...@gmail.com" <aleemakht...@gmail.com> wrote:
> > >can i allocate dynamic memory in ISR ?? > > Yes, it's your CPU so you can do anything you want with it. You can can ev=
en
> disable IRQs or dynamic memory altogether if you really want to. > > > If yes wat shd be the > >precautions i need to take care ?? > > There are many, and this is by no means an exhaustive list but the first > percautions that come to mind are correct handling of the following scenar=
ios:
> > - The allocation fails because there is no more dynamic memory available. > - The allocation takes too long and causes a subsequent IRQ to be missed. > - The IRQ occurs while the mainline is in the middle of allocating/freeing=
> dynamic memory and your memory manager is non re-entrant. > - A higher priority IRQ occurs and causes another ISR to start while this =
one
> is in the middle of allocating memory. > > Other percautions will depend on whether or not you are using a paged memo=
ry
> architecture, and whether pages are being swapped to secondary storage, et=
c.
> You also might want to search for "deferred procedure call" >
Nice Explanation :):) Karthik Balaguru

The 2024 Embedded Online Conference