som.c
来自「Vxworks的培训教程,大家分享下啊,」· C语言 代码 · 共 55 行
C
55 行
#include "pioLib.h"#include "msgQLib.h"/* Port C is actually hardwired to Port A. By changing the state of * one of the first three channels of Port C, we changed the input to * Port A. */STATUS flurbish (state) BOOL state; { return (pioSet (PORT_C, 0, state)); }STATUS dohickey (state) BOOL state; { return (pioSet (PORT_C, 1, state)); }STATUS nevester (state) BOOL state; { return (pioSet (PORT_C, 2, state)); }void monitorOM (msgQId, debug) MSG_Q_ID msgQId; int debug; { PIO_MSG_Q_DATA msgQData; int channel; /* Initialize the PORT B channels to OFF */ for (channel=0; channel<PIO_MAX_CHANNELS_PER_PORT; channel++) pioSet (PORT_B, channel, OFF); FOREVER { if (msgQReceive (msgQId, (char *) &msgQData, sizeof (PIO_MSG_Q_DATA), WAIT_FOREVER) == ERROR) { printf ("msgQReceive failed\n"); return; } pioSet (PORT_B, msgQData.channel, msgQData.state);#ifndef NDEBUG if (debug) printf ("port %d channel %d state %d time %d\n", msgQData.port, msgQData.channel, msgQData.state, msgQData.timeStamp);#endif } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?