piolib.c
来自「Vxworks的培训教程,大家分享下啊,」· C语言 代码 · 共 92 行
C
92 行
#include "pioLib.h"IMPORT DAADIO daadio;PIO pio;STATUS pioInit (outputEnableMask) UINT8 outputEnableMask; /* Mask to set which are output ports */ { /* If daadioInit() has not been called, fail */ if (daadio.initialized == FALSE) { printf ("daadio not initialized\n"); return (ERROR); } /* ?????????????????????????*/ }STATUS pioSet (port, channel, state) int port, channel; BOOL state; { /* Error checking... * Ensure pioInit() routine has been called * and the port and channel are within range. * Insure that the channel being set is in a * port configured as an output port. */ if (pio.initialized == FALSE) { printf ("pio not initialized\n"); return (ERROR); } if (port < 0 || port >= PIO_MAX_PORTS) { printf ("port number out of range\n"); return (ERROR); } if (channel < 0 || channel >= PIO_MAX_CHANNELS_PER_PORT) { printf ("channel number out of range\n"); return (ERROR); } if ((*((UINT8 *)daadio.baseAddr + PIO_OUTPUT_ENABLE_OFFSET) & (1 << port)) == 0) { printf ("can not set an input port\n"); return (ERROR); } /* ????????????????????? */ }int pioGet (port, channel) int port, channel; { /* Error checking... * Ensure that pioInit() routine has been called * and the port and channel are within range. */ if (pio.initialized == FALSE) { printf ("pio not initialized\n"); return (ERROR); } if (port < 0 || port >= PIO_MAX_PORTS) { printf ("port number out of range\n"); return (ERROR); } if (channel < 0 || channel >= PIO_MAX_CHANNELS_PER_PORT) { printf ("channel number out of range\n"); return (ERROR); } /* ????????????????????????????? */ }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?