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]

Re: dynamic allocation memory


> Hi, all:
>  
>          I use the malloc function in my device driver, but it seems
> something is wrong with this function. 

You say device driver. Do you mean ISR and DSR? If so, its a bad idea
to use malloc. malloc will need to use some sort of mutex primitive to
protect its data structures from multiple threads executing it
simultaniously. ISR and DSR cannot block so these primitives don't
work. 

Somewhere there is a document which states which functions you can
call in a DSR/ISR. For mempools the try get function will probably
work, but you have to be prepaired for it to return no memory.

        Andrew

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