<html><body><div>Hi,</div><div><br></div><div>As suggested by gedare, I think using zero length array to represent the mailbox buffer and tag data is a good way, much readable, clearer to abstract the structure of mailbox buffer, tag.</div><div>I've done an attemp, here is the scratch:</div><div><a href="https://github.com/yangqiao/rtems/commit/3ed7e9bde493bdc8e644fcefa285d99255201ada">https://github.com/yangqiao/rtems/commit/3ed7e9bde493bdc8e644fcefa285d99255201ada</a></div><div><br></div><div>The construction of a buffer is then decomposed by the following procedure:</div><div>1. Calculate the total length of buffer</div><div>2. Allocate and inite the buffer</div><div>3. Pack the request data into buffer</div><div>4. send the buffer by mailbox, then read the responce</div><div>5. Unpack the responce data into variables</div><div><br></div><div>I've tested it in userspace it works well but in kernel space I cannot allocate the memory by malloc. Is there any alternative way to let us use zero length array in the kernel driver? </div><div><br></div><div><br></div><div>Secondly, since part of functions in outch is considered sharable between bsps. If my implementation is acceptable, I'll push the refactor code for review. Here is my implementation</div><div><a href="https://github.com/yangqiao/rtems/commit/858a9b091025acc4bfe912f41d70c9a73b99d773">https://github.com/yangqiao/rtems/commit/858a9b091025acc4bfe912f41d70c9a73b99d773</a></div><div><br></div><div>Thanks in advance.</div></body></html>