Libraw1394 on FreeBSD
Mikhail Teterin
mi+kde at aldan.algebra.com
Mon Oct 16 21:34:09 PDT 2006
On Wednesday 11 October 2006 12:57, Buzz Slye wrote:
= Following is an example of iso.c.
Unfortunately, the example is not enough even for the libraw's own testlibraw utility:
cc -O2 -fno-strict-aliasing -pipe -march=opteron -o .libs/testlibraw testlibraw.o ../src/.libs/libraw1394.so -Wl,--rpath -Wl,/opt/lib
../src/.libs/libraw1394.so: undefined reference to `_raw1394_iso_iterate'
../src/.libs/libraw1394.so: undefined reference to `raw1394_iso_shutdown'
../src/.libs/libraw1394.so: undefined reference to `_dc1394_video_iso_handler'
gmake: *** [testlibraw] Error 1
Other tools, that come with the library complain about more symbols:
cc -O2 -fno-strict-aliasing -pipe -march=opteron -o .libs/sendiso sendiso.o ../src/.libs/libraw1394.so -Wl,--rpath -Wl,/opt/lib
sendiso.o(.text+0x38e): In function `send_file_once':
: undefined reference to `raw1394_iso_xmit_write'
sendiso.o(.text+0x3c2): In function `send_file_once':
: undefined reference to `raw1394_iso_xmit_init'
sendiso.o(.text+0x3d5): In function `send_file_once':
: undefined reference to `raw1394_iso_xmit_start'
sendiso.o(.text+0x62e): In function `main':
: undefined reference to `raw1394_iso_shutdown'
../src/.libs/libraw1394.so: undefined reference to `_raw1394_iso_iterate'
../src/.libs/libraw1394.so: undefined reference to `_dc1394_video_iso_handler'
gmake: *** [sendiso] Error 1
and
cc -O2 -fno-strict-aliasing -pipe -march=opteron -o .libs/dumpiso dumpiso.o ../src/.libs/libraw1394.so -Wl,--rpath -Wl,/opt/lib
dumpiso.o(.text+0x615): In function `main':
: undefined reference to `raw1394_iso_recv_init'
dumpiso.o(.text+0x62b): In function `main':
: undefined reference to `raw1394_iso_recv_start'
dumpiso.o(.text+0x651): In function `main':
: undefined reference to `raw1394_iso_shutdown'
dumpiso.o(.text+0x67e): In function `main':
: undefined reference to `raw1394_iso_multichannel_recv_init'
dumpiso.o(.text+0x68d): In function `main':
: undefined reference to `raw1394_iso_recv_set_channel_mask'
../src/.libs/libraw1394.so: undefined reference to `_raw1394_iso_iterate'
../src/.libs/libraw1394.so: undefined reference to `_dc1394_video_iso_handler'
gmake: *** [dumpiso] Error 1
Robert, if you plan to complete the functionality any time soon, you can use
the attached port-skeleton -- just put your version of iso.c into files/. I'll
be happy to finish off the port, once the library is complete enough for its
own tools to link and (even if "almost") work, and take care of PLIST, etc.
If you can't get to this, please, state so. I'm afraid, there is a
misconception, that there is nothing left to do here... :-) Thanks a lot!
Yours,
-mi
-------------- next part --------------
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# libraw1394
# libraw1394/Makefile
# libraw1394/distinfo
# libraw1394/files
# libraw1394/files/patch-types
# libraw1394/files/patch-eventloop
# libraw1394/files/patch-errors
# libraw1394/files/patch-iso
# libraw1394/files/iso.c
#
echo c - libraw1394
mkdir -p libraw1394 > /dev/null 2>&1
echo x - libraw1394/Makefile
sed 's/^X//' >libraw1394/Makefile << 'END-of-libraw1394/Makefile'
XPORTNAME= libraw1394
XPORTVERSION= 1.2.1
XMASTER_SITES= http://www.linux1394.org/dl/
XCATEGORIES= devel multimedia
X
XCOMMENT= Linux' API for direct access to the IEEE 1394 bus
X
XGNU_CONFIGURE= yes
X
Xpost-patch:
X ${MV} ${WRKSRC}/src/ieee1394-ioctl.h ${WRKSRC}/src/ieee1394-ioctl.h.org
X ${ECHO_MSG} '/* Meow-meow */' > ${WRKSRC}/src/ieee1394-ioctl.h
X
Xpost-configure:
X ${MV} ${WRKSRC}/src/iso.c ${WRKSRC}/src/iso.c.orig
X ${LN} -s ${FILESDIR}/iso.c ${WRKSRC}/src/
X
X.include <bsd.port.mk>
END-of-libraw1394/Makefile
echo x - libraw1394/distinfo
sed 's/^X//' >libraw1394/distinfo << 'END-of-libraw1394/distinfo'
XMD5 (libraw1394-1.2.1.tar.gz) = e6210ff05b7f4ec0401ad3d11f493e1a
XSHA256 (libraw1394-1.2.1.tar.gz) = 13381fb2ea63e6ee428d49c7f6679755a2c331f82afc19522794d11943bcab52
XSIZE (libraw1394-1.2.1.tar.gz) = 382992
END-of-libraw1394/distinfo
echo c - libraw1394/files
mkdir -p libraw1394/files > /dev/null 2>&1
echo x - libraw1394/files/patch-types
sed 's/^X//' >libraw1394/files/patch-types << 'END-of-libraw1394/files/patch-types'
X--- src/kernel-raw1394.h Fri Nov 5 19:26:44 2004
X+++ src/kernel-raw1394.h Mon Oct 9 13:40:37 2006
X@@ -73,43 +73,43 @@
X #define RAW1394_NOTIFY_ON 1
X
X-#include <asm/types.h>
X+#include <sys/types.h>
X
X struct raw1394_request {
X- __u32 type;
X- __s32 error;
X- __u32 misc;
X+ uint32_t type;
X+ int32_t error;
X+ uint32_t misc;
X
X- __u32 generation;
X- __u32 length;
X+ uint32_t generation;
X+ uint32_t length;
X
X- __u64 address;
X+ uint64_t address;
X
X- __u64 tag;
X+ uint64_t tag;
X
X- __u64 sendb;
X- __u64 recvb;
X+ uint64_t sendb;
X+ uint64_t recvb;
X };
X
X struct raw1394_khost_list {
X- __u32 nodes;
X- __u8 name[32];
X+ uint32_t nodes;
X+ uint8_t name[32];
X };
X
X typedef struct arm_request {
X- __u16 destination_nodeid;
X- __u16 source_nodeid;
X- __u64 destination_offset;
X- __u8 tlabel;
X- __u8 tcode;
X- __u8 extended_transaction_code;
X- __u32 generation;
X- __u16 buffer_length;
X- __u8 *buffer;
X+ uint16_t destination_nodeid;
X+ uint16_t source_nodeid;
X+ uint64_t destination_offset;
X+ uint8_t tlabel;
X+ uint8_t tcode;
X+ uint8_t extended_transaction_code;
X+ uint32_t generation;
X+ uint16_t buffer_length;
X+ uint8_t *buffer;
X } *arm_request_t;
X
X typedef struct arm_response {
X- __s32 response_code;
X- __u16 buffer_length;
X- __u8 *buffer;
X+ int32_t response_code;
X+ uint16_t buffer_length;
X+ uint8_t *buffer;
X } *arm_response_t;
X
X@@ -125,15 +125,15 @@
X /* must be identical to hpsb_iso_packet_info in iso.h! */
X struct raw1394_iso_packet_info {
X- __u32 offset;
X- __u16 len;
X- __u16 cycle; /* recv only */
X- __u8 channel; /* recv only */
X- __u8 tag;
X- __u8 sy;
X+ uint32_t offset;
X+ uint16_t len;
X+ uint16_t cycle; /* recv only */
X+ uint8_t channel; /* recv only */
X+ uint8_t tag;
X+ uint8_t sy;
X };
X
X /* argument for RAW1394_ISO_RECV/XMIT_PACKETS ioctls */
X struct raw1394_iso_packets {
X- __u32 n_packets;
X+ uint32_t n_packets;
X struct raw1394_iso_packet_info *infos;
X };
X@@ -141,20 +141,20 @@
X struct raw1394_iso_config {
X /* size of packet data buffer, in bytes (will be rounded up to PAGE_SIZE) */
X- __u32 data_buf_size;
X+ uint32_t data_buf_size;
X
X /* # of packets to buffer */
X- __u32 buf_packets;
X+ uint32_t buf_packets;
X
X /* iso channel (set to -1 for multi-channel recv) */
X- __s32 channel;
X+ int32_t channel;
X
X /* xmit only - iso transmission speed */
X- __u8 speed;
X+ uint8_t speed;
X
X /* The mode of the dma when receiving iso data. Must be supported by chip */
X- __u8 dma_mode;
X+ uint8_t dma_mode;
X
X /* max. latency of buffer, in packets (-1 if you don't care) */
X- __s32 irq_interval;
X+ int32_t irq_interval;
X };
X
X@@ -166,14 +166,14 @@
X /* number of packets waiting to be filled with data (ISO transmission)
X or containing data received (ISO reception) */
X- __u32 n_packets;
X+ uint32_t n_packets;
X
X /* approximate number of packets dropped due to overflow or
X underflow of the packet buffer (a value of zero guarantees
X that no packets have been dropped) */
X- __u32 overflows;
X+ uint32_t overflows;
X
X /* cycle number at which next packet will be transmitted;
X -1 if not known */
X- __s16 xmit_cycle;
X+ int16_t xmit_cycle;
X };
X
X--- src/raw1394_private.h Wed Feb 16 10:49:49 2005
X+++ src/raw1394_private.h Mon Oct 9 13:44:29 2006
X@@ -57,11 +57,6 @@
X #define CLEAR_REQ(reqp) memset((reqp), 0, sizeof(struct raw1394_request))
X
X-#if SIZEOF_VOID_P == 4
X-#define int2ptr(x) ((void *)(__u32)x)
X-#define ptr2int(x) ((__u64)(__u32)x)
X-#else
X-#define int2ptr(x) ((void *)x)
X-#define ptr2int(x) ((__u64)x)
X-#endif
X+#define int2ptr(x) ((void *)(uintptr_t)x)
X+#define ptr2int(x) ((uintptr_t)x)
X
X #endif /* _RAW1394_PRIVATE_H */
X--- src/readwrite.c Wed Nov 10 18:39:00 2004
X+++ src/readwrite.c Mon Oct 9 14:01:28 2006
X@@ -44,5 +44,5 @@
X req.tag = tag;
X
X- req.address = ((__u64)node << 48) | addr;
X+ req.address = ((uint64_t)node << 48) | addr;
X req.length = length;
X req.recvb = ptr2int(buffer);
X@@ -64,5 +64,5 @@
X req.tag = tag;
X
X- req.address = ((__u64)node << 48) | addr;
X+ req.address = ((uint64_t)node << 48) | addr;
X req.length = length;
X req.sendb = ptr2int(data);
X@@ -90,5 +90,5 @@
X req.tag = tag;
X
X- req.address = ((__u64)node << 48) | addr;
X+ req.address = ((uint64_t)node << 48) | addr;
X req.sendb = ptr2int(sendbuf);
X req.recvb = ptr2int(result);
X@@ -128,5 +128,5 @@
X req.tag = tag;
X
X- req.address = ((__u64)node << 48) | addr;
X+ req.address = ((uint64_t)node << 48) | addr;
X req.sendb = ptr2int(sendbuf);
X req.recvb = ptr2int(result);
X@@ -163,5 +163,5 @@
X req.tag = rawtag;
X
X- req.address = ((__u64)channel << 48) | speed;
X+ req.address = ((uint64_t)channel << 48) | speed;
X req.misc = (tag << 16) | sy;
X req.length = length;
X@@ -185,5 +185,5 @@
X req.tag = rawtag;
X
X- req.address = ((__u64)channel << 48) | speed;
X+ req.address = ((uint64_t)channel << 48) | speed;
X req.misc = (tag << 16) | sy;
X req.length = length;
END-of-libraw1394/files/patch-types
echo x - libraw1394/files/patch-eventloop
sed 's/^X//' >libraw1394/files/patch-eventloop << 'END-of-libraw1394/files/patch-eventloop'
X--- src/eventloop.c Sat Apr 8 22:29:54 2006
X+++ src/eventloop.c Mon Oct 9 13:54:59 2006
X@@ -21,5 +21,5 @@
X #include <config.h>
X #include <unistd.h>
X-#include <byteswap.h>
X+#include <sys/endian.h>
X
X #include "raw1394.h"
X@@ -57,5 +57,5 @@
X channel = (handle->buffer[0] >> 8) & 0x3f;
X #ifndef WORDS_BIGENDIAN
X- handle->buffer[0] = bswap_32(handle->buffer[0]);
X+ handle->buffer[0] = bswap32(handle->buffer[0]);
X #endif
X
END-of-libraw1394/files/patch-eventloop
echo x - libraw1394/files/patch-errors
sed 's/^X//' >libraw1394/files/patch-errors << 'END-of-libraw1394/files/patch-errors'
X--- src/errors.c Wed Nov 10 18:53:05 2004
X+++ src/errors.c Mon Oct 9 14:00:19 2006
X@@ -39,5 +39,9 @@
X 0xdead,
X 0xdead,
X+#ifdef EREMOTEIO
X EREMOTEIO, /* ack_data_error */
X+#else
X+ EIO,
X+#endif
X EPERM, /* ack_type_error */
X 0xdead /* invalid ack code */
X@@ -49,5 +53,9 @@
X 0xdead,
X EAGAIN, /* rcode_conflict_error */
X+#ifdef EREMOTEIO
X EREMOTEIO, /* rcode_data_error */
X+#else
X+ EIO,
X+#endif
X EPERM, /* rcode_type_error */
X EINVAL, /* rcode_address_error */
END-of-libraw1394/files/patch-errors
echo x - libraw1394/files/patch-iso
sed 's/^X//' >libraw1394/files/patch-iso << 'END-of-libraw1394/files/patch-iso'
X--- src/iso.c Sat Apr 8 22:02:31 2006
X+++ src/iso.c Mon Oct 9 14:17:43 2006
X@@ -17,5 +17,5 @@
X #include <sys/ioctl.h>
X #include <sys/mman.h>
X-#include <malloc.h>
X+#include <stdlib.h>
X
X #include "raw1394.h"
END-of-libraw1394/files/patch-iso
echo x - libraw1394/files/iso.c
sed 's/^X//' >libraw1394/files/iso.c << 'END-of-libraw1394/files/iso.c'
X/*
X * libraw1394 - library for raw access to the 1394 bus with the Linux subsystem.
X *
X * Copyright (C) 1999,2000,2001,2002 Andreas Bombe
X * new ISO API by Dan Maas
X *
X * This library is licensed under the GNU Lesser General Public License (LGPL),
X * version 2.1 or later. See the file COPYING.LIB in the distribution for
X * details.
X *
X * Rewritten for FreeBSD - R E Slye - 6/23/04
X * Most of the original code for Linux is not supported and is deleted.
X * This code may be used for receiving the iso stream download of a single
X * image from a digital camera. Stream xmit is not supported.
X */
X
X#include <stdio.h>
X#include <stdlib.h>
X#include <errno.h>
X#include <unistd.h>
X#include <string.h>
X#include <fcntl.h>
X#include <sys/ioctl.h>
X#include <sys/mman.h>
X#include <sys/types.h>
X#include <sys/poll.h>
X
X#include "raw1394.h"
X#include "kernel-raw1394.h"
X#include "raw1394_private.h"
X
Xextern int
X_dc1394_video_iso_handler(raw1394handle_t handle,
X int channel, size_t length, quadlet_t *data);
X
X/**
X * raw1394_start_iso_rcv - enable isochronous receiving
X * @channel: channel number to start receiving on
X *
X * Enables the reception of isochronous packets in @channel on @handle.
X * Isochronous packets are then passed to the callback specified with
X * _dc1394_video_iso_handler().
X **/
Xint
Xraw1394_start_iso_rcv(struct raw1394_handle *handle, unsigned int channel)
X{
X int size, rc;
X quadlet_t fwbuf[1026];
X
X while (1)
X {
X if ((size = read(handle->fd, fwbuf, sizeof(fwbuf))) < 0)
X {
X printf(" rv = %d errno = %d\n", size, errno);
X return (-1);
X }
X rc = _dc1394_video_iso_handler(handle, channel, size, fwbuf);
X if (rc < 0)
X return (-1);
X else if (rc > 0)
X break;
X }
X
X return 0;
X}
X
X/**
X * raw1394_stop_iso_rcv - stop isochronous receiving
X * @channel: channel to stop receiving on
X *
X * Stops the reception of isochronous packets in @channel on @handle.
X **/
Xint
Xraw1394_stop_iso_rcv(struct raw1394_handle *handle, unsigned int channel)
X{
X /* I don't know how to stop receiving on channel */
X
X return 0;
X}
END-of-libraw1394/files/iso.c
exit
More information about the freebsd-firewire
mailing list