2000-06-14 11:01:42 -04:00
|
|
|
|
/*
|
|
|
|
|
* libraw1394 - library for raw access to the 1394 bus with the Linux subsystem.
|
|
|
|
|
*
|
2002-10-13 18:54:49 -04:00
|
|
|
|
* Copyright (C) 1999,2000,2001,2002 Andreas Bombe
|
2002-10-23 17:18:49 -04:00
|
|
|
|
* 2002 Christian Toegel <christian.toegel@gmx.at>
|
|
|
|
|
* 2002 Manfred Weihs <weihs@ict.tuwien.ac.at>
|
2000-06-14 11:01:42 -04:00
|
|
|
|
*
|
|
|
|
|
* This library is licensed under the GNU Lesser General Public License (LGPL),
|
|
|
|
|
* version 2.1 or later. See the file COPYING.LIB in the distribution for
|
|
|
|
|
* details.
|
2002-10-23 17:18:49 -04:00
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* Contributions:
|
|
|
|
|
*
|
|
|
|
|
* Christian Toegel <christian.toegel@gmx.at>
|
|
|
|
|
* lock64 request
|
|
|
|
|
* transmit physical packet
|
|
|
|
|
* raw1394_echo_request, raw1394_wake_up (interrupt blocking wait)
|
|
|
|
|
*
|
|
|
|
|
* Manfred Weihs <weihs@ict.tuwien.ac.at>
|
|
|
|
|
* raw1394_start_async_send, raw1394_async_send
|
2000-06-14 11:01:42 -04:00
|
|
|
|
*/
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
2000-05-28 17:00:56 -04:00
|
|
|
|
#include <config.h>
|
1999-12-02 18:07:38 -05:00
|
|
|
|
#include <unistd.h>
|
2000-02-06 10:10:14 -05:00
|
|
|
|
#include <errno.h>
|
2002-10-23 17:18:49 -04:00
|
|
|
|
#include <string.h>
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
|
|
|
|
#include "raw1394.h"
|
|
|
|
|
#include "kernel-raw1394.h"
|
|
|
|
|
#include "raw1394_private.h"
|
|
|
|
|
|
2007-05-30 01:11:30 -04:00
|
|
|
|
#if HAVE_VALGRIND_VALGRIND_H
|
|
|
|
|
# include <valgrind/memcheck.h>
|
|
|
|
|
# ifndef VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE
|
|
|
|
|
# define VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(m, n) do {} while(0)
|
|
|
|
|
# endif
|
|
|
|
|
#else
|
|
|
|
|
# define VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(m, n) do {} while(0)
|
|
|
|
|
#endif
|
|
|
|
|
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_start_read(struct ieee1394_handle *handle, nodeid_t node,
|
1999-12-02 18:07:38 -05:00
|
|
|
|
nodeaddr_t addr, size_t length, quadlet_t *buffer,
|
|
|
|
|
unsigned long tag)
|
|
|
|
|
{
|
2003-07-22 10:54:19 -04:00
|
|
|
|
struct raw1394_request req;
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
CLEAR_REQ(&req);
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.type = RAW1394_REQ_ASYNC_READ;
|
|
|
|
|
req.generation = handle->generation;
|
|
|
|
|
req.tag = tag;
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.address = ((__u64)node << 48) | addr;
|
|
|
|
|
req.length = length;
|
|
|
|
|
req.recvb = ptr2int(buffer);
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
return (int)write(handle->fd, &req, sizeof(req));
|
1999-12-02 18:07:38 -05:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-13 18:54:49 -04:00
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_start_write(struct ieee1394_handle *handle, nodeid_t node,
|
1999-12-02 18:07:38 -05:00
|
|
|
|
nodeaddr_t addr, size_t length, quadlet_t *data,
|
|
|
|
|
unsigned long tag)
|
|
|
|
|
{
|
2003-07-22 10:54:19 -04:00
|
|
|
|
struct raw1394_request req;
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
CLEAR_REQ(&req);
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.type = RAW1394_REQ_ASYNC_WRITE;
|
|
|
|
|
req.generation = handle->generation;
|
|
|
|
|
req.tag = tag;
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.address = ((__u64)node << 48) | addr;
|
|
|
|
|
req.length = length;
|
|
|
|
|
req.sendb = ptr2int(data);
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
return (int)write(handle->fd, &req, sizeof(req));
|
1999-12-02 18:07:38 -05:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-13 18:54:49 -04:00
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_start_lock(struct ieee1394_handle *handle, nodeid_t node,
|
2000-02-06 10:10:14 -05:00
|
|
|
|
nodeaddr_t addr, unsigned int extcode, quadlet_t data,
|
2000-04-14 20:33:26 -04:00
|
|
|
|
quadlet_t arg, quadlet_t *result, unsigned long tag)
|
2000-02-06 10:10:14 -05:00
|
|
|
|
{
|
2003-07-22 10:54:19 -04:00
|
|
|
|
struct raw1394_request req;
|
2000-02-06 10:10:14 -05:00
|
|
|
|
quadlet_t sendbuf[2];
|
|
|
|
|
|
|
|
|
|
if ((extcode > 7) || (extcode == 0)) {
|
|
|
|
|
errno = EINVAL;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
CLEAR_REQ(&req);
|
2000-02-06 10:10:14 -05:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.type = RAW1394_REQ_LOCK;
|
|
|
|
|
req.generation = handle->generation;
|
|
|
|
|
req.tag = tag;
|
2000-02-06 10:10:14 -05:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.address = ((__u64)node << 48) | addr;
|
|
|
|
|
req.sendb = ptr2int(sendbuf);
|
|
|
|
|
req.recvb = ptr2int(result);
|
|
|
|
|
req.misc = extcode;
|
2000-02-06 10:10:14 -05:00
|
|
|
|
|
|
|
|
|
switch (extcode) {
|
|
|
|
|
case 3: /* EXTCODE_FETCH_ADD */
|
|
|
|
|
case 4: /* EXTCODE_LITTLE_ADD */
|
|
|
|
|
sendbuf[0] = data;
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.length = 4;
|
2000-02-06 10:10:14 -05:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
sendbuf[0] = arg;
|
|
|
|
|
sendbuf[1] = data;
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.length = 8;
|
2000-02-06 10:10:14 -05:00
|
|
|
|
break;
|
|
|
|
|
}
|
2003-07-22 10:54:19 -04:00
|
|
|
|
return (int)write(handle->fd, &req, sizeof(req));
|
2002-10-23 17:18:49 -04:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_start_lock64(struct ieee1394_handle *handle, nodeid_t node,
|
2002-10-23 17:18:49 -04:00
|
|
|
|
nodeaddr_t addr, unsigned int extcode, octlet_t data,
|
|
|
|
|
octlet_t arg, octlet_t *result, unsigned long tag)
|
|
|
|
|
{
|
2003-07-22 10:54:19 -04:00
|
|
|
|
struct raw1394_request req;
|
2002-10-23 17:18:49 -04:00
|
|
|
|
octlet_t sendbuf[2];
|
|
|
|
|
|
|
|
|
|
if ((extcode > 7) || (extcode == 0)) {
|
|
|
|
|
errno = EINVAL;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
CLEAR_REQ(&req);
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.type = RAW1394_REQ_LOCK64;
|
|
|
|
|
req.generation = handle->generation;
|
|
|
|
|
req.tag = tag;
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.address = ((__u64)node << 48) | addr;
|
|
|
|
|
req.sendb = ptr2int(sendbuf);
|
|
|
|
|
req.recvb = ptr2int(result);
|
|
|
|
|
req.misc = extcode;
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
|
|
|
|
switch (extcode) {
|
|
|
|
|
case 3: /* EXTCODE_FETCH_ADD */
|
|
|
|
|
case 4: /* EXTCODE_LITTLE_ADD */
|
|
|
|
|
sendbuf[0] = data;
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.length = 8;
|
2002-10-23 17:18:49 -04:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
sendbuf[0] = arg;
|
|
|
|
|
sendbuf[1] = data;
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.length = 16;
|
2002-10-23 17:18:49 -04:00
|
|
|
|
break;
|
|
|
|
|
}
|
2000-02-06 10:10:14 -05:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
return (int)write(handle->fd, &req, sizeof(req));
|
2000-02-06 10:10:14 -05:00
|
|
|
|
}
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
2002-10-13 18:54:49 -04:00
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_start_async_stream(struct ieee1394_handle *handle,
|
2003-09-10 22:47:22 -04:00
|
|
|
|
unsigned int channel,
|
|
|
|
|
unsigned int tag, unsigned int sy,
|
|
|
|
|
unsigned int speed, size_t length, quadlet_t *data,
|
|
|
|
|
unsigned long rawtag)
|
|
|
|
|
{
|
2003-09-26 09:51:31 -04:00
|
|
|
|
struct raw1394_request req;
|
2003-09-10 22:47:22 -04:00
|
|
|
|
|
2003-09-26 09:51:31 -04:00
|
|
|
|
CLEAR_REQ(&req);
|
2003-09-10 22:47:22 -04:00
|
|
|
|
|
2003-09-26 09:51:31 -04:00
|
|
|
|
req.type = RAW1394_REQ_ASYNC_STREAM;
|
|
|
|
|
req.generation = handle->generation;
|
|
|
|
|
req.tag = rawtag;
|
2003-09-10 22:47:22 -04:00
|
|
|
|
|
2003-09-26 09:51:31 -04:00
|
|
|
|
req.address = ((__u64)channel << 48) | speed;
|
|
|
|
|
req.misc = (tag << 16) | sy;
|
|
|
|
|
req.length = length;
|
|
|
|
|
req.sendb = ptr2int(data);
|
2003-09-10 22:47:22 -04:00
|
|
|
|
|
2003-09-26 09:51:31 -04:00
|
|
|
|
return (int)write(handle->fd, &req, sizeof(req));
|
2003-09-10 22:47:22 -04:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_start_async_send(struct ieee1394_handle *handle,
|
2002-10-23 17:18:49 -04:00
|
|
|
|
size_t length, size_t header_length, unsigned int expect_response,
|
|
|
|
|
quadlet_t *data, unsigned long rawtag)
|
|
|
|
|
{
|
2003-07-22 10:54:19 -04:00
|
|
|
|
struct raw1394_request req;
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
CLEAR_REQ(&req);
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.type = RAW1394_REQ_ASYNC_SEND;
|
|
|
|
|
req.generation = handle->generation;
|
|
|
|
|
req.tag = rawtag;
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.length = length;
|
|
|
|
|
req.misc = (expect_response << 16) | (header_length & 0xffff);
|
|
|
|
|
req.sendb = ptr2int(data);
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
return (int)write(handle->fd, &req, sizeof(req));
|
2002-10-23 17:18:49 -04:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
1999-12-29 17:24:32 -05:00
|
|
|
|
#define SYNCFUNC_VARS \
|
|
|
|
|
struct sync_cb_data sd = { 0, 0 }; \
|
|
|
|
|
struct raw1394_reqhandle rh = { (req_callback_t)_raw1394_sync_cb, \
|
|
|
|
|
&sd }; \
|
2001-01-18 20:11:48 -05:00
|
|
|
|
int err = 0
|
|
|
|
|
|
2007-05-30 01:11:30 -04:00
|
|
|
|
#define SYNCFUNC_BODY_WO_RETURN \
|
2001-01-18 20:11:48 -05:00
|
|
|
|
while (!sd.done) { \
|
|
|
|
|
if (err < 0) return err; \
|
|
|
|
|
err = raw1394_loop_iterate(handle); \
|
|
|
|
|
} \
|
2008-04-23 20:44:36 -04:00
|
|
|
|
handle->mode.ieee1394->err = sd.errcode; \
|
2007-05-30 01:11:30 -04:00
|
|
|
|
errno = raw1394_errcode_to_errno(sd.errcode);
|
|
|
|
|
|
|
|
|
|
#define SYNCFUNC_BODY \
|
|
|
|
|
SYNCFUNC_BODY_WO_RETURN \
|
2001-01-18 20:11:48 -05:00
|
|
|
|
return (errno ? -1 : 0)
|
1999-12-02 18:07:38 -05:00
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_read(struct raw1394_handle *handle, nodeid_t node, nodeaddr_t addr,
|
1999-12-02 18:07:38 -05:00
|
|
|
|
size_t length, quadlet_t *buffer)
|
|
|
|
|
{
|
|
|
|
|
SYNCFUNC_VARS;
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
err = ieee1394_start_read(handle->mode.ieee1394, node, addr, length, buffer,
|
1999-12-02 18:07:38 -05:00
|
|
|
|
(unsigned long)&rh);
|
|
|
|
|
|
2007-05-30 01:11:30 -04:00
|
|
|
|
SYNCFUNC_BODY_WO_RETURN;
|
|
|
|
|
if(!errno) {
|
|
|
|
|
VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(buffer, length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (errno ? -1 : 0);
|
1999-12-02 18:07:38 -05:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_write(struct raw1394_handle *handle, nodeid_t node, nodeaddr_t addr,
|
1999-12-02 18:07:38 -05:00
|
|
|
|
size_t length, quadlet_t *data)
|
|
|
|
|
{
|
|
|
|
|
SYNCFUNC_VARS;
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
err = ieee1394_start_write(handle->mode.ieee1394, node, addr, length, data,
|
1999-12-02 18:07:38 -05:00
|
|
|
|
(unsigned long)&rh);
|
|
|
|
|
|
|
|
|
|
SYNCFUNC_BODY;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_lock(struct raw1394_handle *handle, nodeid_t node, nodeaddr_t addr,
|
2000-04-14 20:33:26 -04:00
|
|
|
|
unsigned int extcode, quadlet_t data, quadlet_t arg,
|
|
|
|
|
quadlet_t *result)
|
2000-02-06 10:10:14 -05:00
|
|
|
|
{
|
|
|
|
|
SYNCFUNC_VARS;
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
err = ieee1394_start_lock(handle->mode.ieee1394, node, addr, extcode, data, arg, result,
|
2000-02-06 10:10:14 -05:00
|
|
|
|
(unsigned long)&rh);
|
|
|
|
|
|
2007-05-30 01:11:30 -04:00
|
|
|
|
SYNCFUNC_BODY_WO_RETURN;
|
|
|
|
|
if(!errno) {
|
|
|
|
|
VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(result, sizeof(quadlet_t));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (errno ? -1 : 0);
|
2000-02-06 10:10:14 -05:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_lock64(struct raw1394_handle *handle, nodeid_t node, nodeaddr_t addr,
|
2002-10-23 17:18:49 -04:00
|
|
|
|
unsigned int extcode, octlet_t data, octlet_t arg,
|
|
|
|
|
octlet_t *result)
|
|
|
|
|
{
|
|
|
|
|
SYNCFUNC_VARS;
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
err = ieee1394_start_lock64(handle->mode.ieee1394, node, addr, extcode, data, arg, result,
|
2002-10-23 17:18:49 -04:00
|
|
|
|
(unsigned long)&rh);
|
|
|
|
|
|
|
|
|
|
SYNCFUNC_BODY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_async_stream(struct raw1394_handle *handle, unsigned int channel,
|
2003-09-10 22:47:22 -04:00
|
|
|
|
unsigned int tag, unsigned int sy, unsigned int speed,
|
|
|
|
|
size_t length, quadlet_t *data)
|
|
|
|
|
{
|
|
|
|
|
SYNCFUNC_VARS;
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
err = ieee1394_start_async_stream(handle->mode.ieee1394, channel, tag, sy, speed, length,
|
2003-09-10 22:47:22 -04:00
|
|
|
|
data, (unsigned long)&rh);
|
|
|
|
|
|
|
|
|
|
SYNCFUNC_BODY;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_async_send(struct raw1394_handle *handle ,
|
2002-10-23 17:18:49 -04:00
|
|
|
|
size_t length, size_t header_length, unsigned int expect_response,
|
|
|
|
|
quadlet_t *data)
|
|
|
|
|
{
|
|
|
|
|
SYNCFUNC_VARS;
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
err = ieee1394_start_async_send(handle->mode.ieee1394, length, header_length, expect_response,
|
2002-10-23 17:18:49 -04:00
|
|
|
|
data, (unsigned long)&rh);
|
|
|
|
|
|
|
|
|
|
SYNCFUNC_BODY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_start_phy_packet_write(struct ieee1394_handle *handle,
|
2002-10-23 17:18:49 -04:00
|
|
|
|
quadlet_t data, unsigned long tag)
|
|
|
|
|
{
|
2003-07-22 10:54:19 -04:00
|
|
|
|
struct raw1394_request req;
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
CLEAR_REQ(&req);
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.type = RAW1394_REQ_PHYPACKET;
|
|
|
|
|
req.generation = handle->generation;
|
|
|
|
|
req.tag = tag;
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.sendb = data;
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
return (int)write(handle->fd, &req, sizeof(req));
|
2002-10-23 17:18:49 -04:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_phy_packet_write (struct raw1394_handle *handle, quadlet_t data)
|
2002-10-23 17:18:49 -04:00
|
|
|
|
{
|
|
|
|
|
SYNCFUNC_VARS;
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
err = ieee1394_start_phy_packet_write(handle->mode.ieee1394, data, (unsigned long)&rh);
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
|
|
|
|
SYNCFUNC_BODY; /* return 0 on success */
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_echo_request(struct ieee1394_handle *handle, quadlet_t data)
|
2002-10-23 17:18:49 -04:00
|
|
|
|
{
|
2003-07-22 10:54:19 -04:00
|
|
|
|
struct raw1394_request req;
|
2002-10-23 17:18:49 -04:00
|
|
|
|
int retval=0;
|
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
CLEAR_REQ(&req);
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
req.type = RAW1394_REQ_ECHO;
|
|
|
|
|
req.misc = data;
|
2002-10-23 17:18:49 -04:00
|
|
|
|
|
2003-07-22 10:54:19 -04:00
|
|
|
|
retval = (int)write(handle->fd, &req, sizeof(req));
|
|
|
|
|
if (retval == sizeof(req)) {
|
2002-10-23 17:18:49 -04:00
|
|
|
|
return 0; /* succcess */
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-23 20:44:36 -04:00
|
|
|
|
int ieee1394_wake_up(ieee1394handle_t handle)
|
2002-10-23 17:18:49 -04:00
|
|
|
|
{
|
2008-04-23 20:44:36 -04:00
|
|
|
|
return ieee1394_echo_request(handle, 0);
|
2002-10-23 17:18:49 -04:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-02 18:07:38 -05:00
|
|
|
|
#undef SYNCFUNC_VARS
|
|
|
|
|
#undef SYNCFUNC_BODY
|