MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / par_write_data

Function par_write_data

src/parallel.c:234–271  ·  view source on GitHub ↗

* \brief Send data on Parallel port * \param port * \param data */

Source from the content-addressed store, hash-verified

232 * \param data
233 */
234int HAMLIB_API par_write_data(hamlib_port_t *port, unsigned char data)
235{
236#ifdef HAVE_LINUX_PPDEV_H
237 int status;
238 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
239
240 status = ioctl(port->fd, PPWDATA, &data);
241 return status == 0 ? RIG_OK : -RIG_EIO;
242#elif defined(HAVE_DEV_PPBUS_PPI_H)
243 int status;
244 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
245
246 status = ioctl(port->fd, PPISDATA, &data);
247 return status == 0 ? RIG_OK : -RIG_EIO;
248#elif defined(__WIN64__) || defined(__WIN32__)
249 unsigned int dummy = 0;
250
251 intptr_t handle;
252 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
253
254
255 handle = _get_osfhandle(port->fd);
256
257 if (handle != (intptr_t)INVALID_HANDLE_VALUE)
258 {
259 if (!(DeviceIoControl((HANDLE)handle, NT_IOCTL_DATA, &data, sizeof(data),
260 NULL, 0, (LPDWORD)&dummy, NULL)))
261 {
262 rig_debug(RIG_DEBUG_ERR, "%s: DeviceIoControl failed!\n", __func__);
263 return -RIG_EIO;
264 }
265 }
266
267 return RIG_OK;
268#else
269 return -RIG_ENIMPL;
270#endif
271}
272
273
274/**

Callers 9

write_latchFunction · 0.85
ad_bitFunction · 0.85
ad_writeFunction · 0.85
dds60_openFunction · 0.85
setDirectionFunction · 0.85
if100_set_positionFunction · 0.85
setDirectionFunction · 0.85
ars_clear_data_pinFunction · 0.85
ars_set_data_pinFunction · 0.85

Calls 1

rig_debugFunction · 0.85

Tested by

no test coverage detected