This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: dynamic allocation of memory during driver initialization?
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Grant Edwards <grante at visi dot com>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Fri, 8 Aug 2003 22:49:45 +0200
- Subject: Re: [ECOS] dynamic allocation of memory during driver initialization?
- References: <20030808153725.A11518@visi.com>
On Fri, Aug 08, 2003 at 03:37:29PM -0500, Grant Edwards wrote:
>
> How should a driver dynamically allocate buffer space during
> initialization? The driver doesn't know how many channels are
> present in the HW until runtime, and needs to allocate input
> and output buffers for channels only if they're present.
>
> I've found one comment that malloc() can't be used during
> driver init, so how is this situation typically handled?
You could allocate buffers then the channal is lookup'd and not at
initialisation time. malloc should be up and running by then. Or you
might be able to rearrange the ordering so that malloc is up before
the init it performed.
Andrew
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss