Some code in the messageq sample looks like it's not doing what you intended, although it "works" as is. For clarity, consider fixing it up.
Int32 MessageQApp_writePattern(Ptr bufPtr, UInt32 offset, UInt32 bufSize, Int32 key)
is called like this:
status = MessageQApp_writePattern(
msg, sizeof(MessageQ_MsgHeader),
(MessageQ_getMsgSize(msg) - sizeof(MessageQ_MsgHeader)),
rProcId + PATTERNKEY);
which makes it look like the intention was to fill the entire message (after the header) with a byte pattern,
but it really only writes byte pattern in the middle bytes
for (charCount = offset; charCount < bufSize - 2; charCount++) // <-- you mean "< offset + bufSize - 1"?
{
pattern += key;
buffer[charCount] = pattern;
}
buffer[bufSize] = '\0'; // <-- you mean "buffer[charCount]" or "buffer[offset + bufSize - 1]"?
Cache_wbInv((Ptr) buffer, bufSize, Cache_Type_ALL, TRUE); <-- you mean "buffer + offset"?
The call to Cache_inv in MessageQApp_readPattern is similarly off.