This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: dynamic allocation of memory during driver initialization?


One possiblity might be to do this from the device lookup() function that is
called from cyg_io_lookup().  You would need to make sure that you only
performed the allocation/initialization once (the first time) for each
device instance, to prevent memory leaks (there is no close()).  This method
would result in only allocating the memory if the device is actually used.

Jay

-----Original Message-----
From: Grant Edwards [mailto:grante@visi.com]
Sent: Friday, August 08, 2003 1:37 PM
To: ecos-discuss@sources.redhat.com
Subject: [ECOS] dynamic allocation of memory during driver
initialization?



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?

-- 
Grant Edwards
grante@visi.com

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]