參考資訊:
https://forums.windriver.com/t/vxworks-software-development-kit-sdk/43
https://d13321s3lxgewa.cloudfront.net/downloads/wrsdk-vxworks7-docs/2309/README_qemu.html
https://www.ee.torontomu.ca/~courses/ee8205/Data-Sheets/Tornado-VxWorks/vxworks/ref/msgQLib.html#msgQReceive
main.c
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <msgQLib.h>
int main(int argc, char **argv)
{
MSG_Q_ID id = NULL;
char buf[100] = {0};
id = msgQCreate(10, 100, MSG_Q_FIFO);
printf("Msg ID %p\n", id);
if (id) {
buf[0] = 0x12;
buf[1] = 0x23;
msgQSend(id, buf, sizeof(buf), WAIT_FOREVER, MSG_PRI_NORMAL);
memset(buf, 0, sizeof(buf));
msgQReceive(id, buf, sizeof(buf), WAIT_FOREVER);
printf("Ret 0x%x, 0x%x\n", buf[0], buf[1]);
msgQDelete(id);
}
return 0;
}
編譯
$ wr-cc main.c -o main
執行
-> cmd
[vxWorks *]# app
Msg ID 0x10038
Ret 0x12, 0x23