diff --git a/configure.in b/configure.in index 21290d3..fdc0870 100644 --- a/configure.in +++ b/configure.in @@ -8,6 +8,8 @@ AC_PROG_CC AM_PROG_LIBTOOL AC_PROG_INSTALL +AC_CHECK_SIZEOF(void *, 8) + # set the libtool so version numbers lt_major=4 lt_revision=0 diff --git a/src/fcp.c b/src/fcp.c index 9bc7fa1..5c29a6e 100644 --- a/src/fcp.c +++ b/src/fcp.c @@ -27,8 +27,8 @@ static int do_fcp_listen(struct raw1394_handle *handle, int startstop) req->type = RAW1394_REQ_FCP_LISTEN; req->generation = handle->generation; req->misc = startstop; - req->tag = (__u64)&rh; - req->recvb = (__u64)handle->buffer; + req->tag = ptr2int(&rh); + req->recvb = ptr2int(handle->buffer); req->length = 512; err = write(handle->fd, req, sizeof(*req)); diff --git a/src/iso.c b/src/iso.c index 7df6ec0..8d69b57 100644 --- a/src/iso.c +++ b/src/iso.c @@ -28,8 +28,8 @@ static int do_iso_listen(struct raw1394_handle *handle, int channel) req->type = RAW1394_REQ_ISO_LISTEN; req->generation = handle->generation; req->misc = channel; - req->tag = (__u64)&rh; - req->recvb = (__u64)handle->buffer; + req->tag = ptr2int(&rh); + req->recvb = ptr2int(handle->buffer); req->length = HBUF_SIZE; err = write(handle->fd, req, sizeof(*req)); diff --git a/src/main.c b/src/main.c index 0fe887b..744543c 100644 --- a/src/main.c +++ b/src/main.c @@ -158,7 +158,7 @@ int raw1394_get_port_info(struct raw1394_handle *handle, CLEAR_REQ(req); req->type = RAW1394_REQ_LIST_CARDS; req->generation = handle->generation; - req->recvb = (__u64)handle->buffer; + req->recvb = ptr2int(handle->buffer); req->length = HBUF_SIZE; while (1) { diff --git a/src/raw1394_private.h b/src/raw1394_private.h index 86688c7..616ac75 100644 --- a/src/raw1394_private.h +++ b/src/raw1394_private.h @@ -32,4 +32,12 @@ int _raw1394_sync_cb(struct raw1394_handle*, struct sync_cb_data*, int); #define HBUF_SIZE 8192 #define CLEAR_REQ(reqp) memset((reqp), 0, sizeof(struct raw1394_request)) +#if SIZEOF_VOID_P == 4 +#define int2ptr(x) ((void *)(__u32)x) +#define ptr2int(x) ((__u64)(__u32)x) +#else +#define int2ptr(x) ((void *)x) +#define ptr2int(x) ((__u64)x) +#endif + #endif /* _RAW1394_PRIVATE_H */ diff --git a/src/readwrite.c b/src/readwrite.c index 1e12b6c..333db8a 100644 --- a/src/readwrite.c +++ b/src/readwrite.c @@ -31,7 +31,7 @@ int raw1394_start_read(struct raw1394_handle *handle, nodeid_t node, req->address = ((__u64)node << 48) | addr; req->length = length; - req->recvb = (__u64)buffer; + req->recvb = ptr2int(buffer); return (int)write(handle->fd, req, sizeof(*req)); } @@ -50,7 +50,7 @@ int raw1394_start_write(struct raw1394_handle *handle, nodeid_t node, req->address = ((__u64)node << 48) | addr; req->length = length; - req->sendb = (__u64)data; + req->sendb = ptr2int(data); return (int)write(handle->fd, req, sizeof(*req)); } @@ -74,8 +74,8 @@ int raw1394_start_lock(struct raw1394_handle *handle, nodeid_t node, req->tag = tag; req->address = ((__u64)node << 48) | addr; - req->sendb = (__u64)sendbuf; - req->recvb = (__u64)result; + req->sendb = ptr2int(sendbuf); + req->recvb = ptr2int(result); req->misc = extcode; switch (extcode) { @@ -110,7 +110,7 @@ int raw1394_start_iso_write(struct raw1394_handle *handle, unsigned int channel, req->address = ((__u64)channel << 48) | speed; req->misc = (tag << 16) | sy; req->length = length; - req->sendb = data; + req->sendb = ptr2int(data); return (int)write(handle->fd, req, sizeof(*req)); }