Example of memory pool + struct + mailbox.

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: Example of memory pool + struct + mailbox.

Post by mabl »

Hello Giovanni,

I'd also really much like to see the mail method you described. Do you still plan on adding this? I have not seen it in the TODO.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Example of memory pool + struct + mailbox.

Post by Giovanni »

Yes, it is planned, I just forgot to add it to the to-do list, probably I will give it a try later today.

What is really needed is just a special kind of memory pool where the allocation operation is guarded by a semaphore, probably it would be better give it a more generic name than "mail".

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Example of memory pool + struct + mailbox.

Post by Giovanni »

I added this "mail pool" handler to the repository, look under ./os/various, it is not tested yet but very simple.

I didn't add explicit send/receive functions, the normal mailbox functions can be used (mail goes into the mailbox after all :-)).

It is called "mail pool" but it is a generic pool of objects guarded by a semaphore, probably it will get a more generic name later and included in the kernel.

Giovanni
jscott
Posts: 129
Joined: Tue Jul 03, 2012 3:50 pm

Re: Example of memory pool + struct + mailbox.

Post by jscott »

Hi Giovanni,

I don't see this in current releases... was there some problems with using mail pools?

Or, did you implement them some other way?

I need a way to send intact messages to serial devices and I am looking at
using memory pools to hold my messages, then a "serial server" that retrieves
pool ids from a mail box and zips them out the serial port.

The messages will come from several threads at essentially random times.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Example of memory pool + struct + mailbox.

Post by Giovanni »

Hi,

I removed that module from the distribution, you have to get it from some old repository revision (look the history of ./os/various).

You can do exactly the same thing using 2 mailboxes, one containing the unused objects and the other for sending them. It is like a 2-way communication.

Giovanni
Post Reply