[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7511 - in gnuradio/branches/releases/3.1: . gnuradio-
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r7511 - in gnuradio/branches/releases/3.1: . gnuradio-core/src/lib/io |
Date: |
Fri, 25 Jan 2008 08:09:48 -0700 (MST) |
Author: jcorgan
Date: 2008-01-25 08:09:48 -0700 (Fri, 25 Jan 2008)
New Revision: 7511
Modified:
gnuradio/branches/releases/3.1/configure.ac
gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_sink.cc
gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_sink.h
gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_source.cc
gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_source.h
gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/ppio_ppdev.cc
Log:
Applied changeset r7454 on trunk to release branch.
Modified: gnuradio/branches/releases/3.1/configure.ac
===================================================================
--- gnuradio/branches/releases/3.1/configure.ac 2008-01-25 14:56:57 UTC (rev
7510)
+++ gnuradio/branches/releases/3.1/configure.ac 2008-01-25 15:09:48 UTC (rev
7511)
@@ -110,8 +110,9 @@
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h strings.h time.h sys/ioctl.h sys/time.h
unistd.h)
-AC_CHECK_HEADERS(linux/ppdev.h sys/mman.h sys/select.h sys/types.h)
+AC_CHECK_HEADERS(linux/ppdev.h dev/ppbus/ppi.h sys/mman.h sys/select.h
sys/types.h)
AC_CHECK_HEADERS(sys/resource.h stdint.h sched.h signal.h sys/syscall.h)
+AC_CHECK_HEADERS(netinet/in.h)
AC_CHECK_HEADERS(windows.h)
dnl Checks for typedefs, structures, and compiler characteristics.
Modified: gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_sink.cc
===================================================================
--- gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_sink.cc
2008-01-25 14:56:57 UTC (rev 7510)
+++ gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_sink.cc
2008-01-25 15:09:48 UTC (rev 7511)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,6 +20,9 @@
* Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <gr_udp_sink.h>
#include <gr_io_signature.h>
#include <stdexcept>
Modified: gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_sink.h
===================================================================
--- gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_sink.h
2008-01-25 14:56:57 UTC (rev 7510)
+++ gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_sink.h
2008-01-25 15:09:48 UTC (rev 7511)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,6 +27,10 @@
#include <omnithread.h>
#include <sys/socket.h>
#include <arpa/inet.h>
+#include <sys/socket.h>
+#if defined(HAVE_NETINET_IN_H)
+#include <netinet/in.h>
+#endif
class gr_udp_sink;
typedef boost::shared_ptr<gr_udp_sink> gr_udp_sink_sptr;
@@ -70,8 +74,8 @@
struct in_addr d_ip_dst; // store the destination ip info
unsigned short d_port_src; // the port number to open for connections
to this service
unsigned short d_port_dst; // port number of the remove system
- sockaddr_in d_sockaddr_src; // store the source sockaddr data
(formatted IP address and port number)
- sockaddr_in d_sockaddr_dst; // store the destination sockaddr data
(formatted IP address and port number)
+ struct sockaddr_in d_sockaddr_src; // store the source sockaddr data
(formatted IP address and port number)
+ struct sockaddr_in d_sockaddr_dst; // store the destination sockaddr
data (formatted IP address and port number)
protected:
/*!
Modified:
gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_source.cc
===================================================================
--- gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_source.cc
2008-01-25 14:56:57 UTC (rev 7510)
+++ gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_source.cc
2008-01-25 15:09:48 UTC (rev 7511)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,6 +20,9 @@
* Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <gr_udp_source.h>
#include <gr_io_signature.h>
#include <stdexcept>
Modified:
gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_source.h
===================================================================
--- gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_source.h
2008-01-25 14:56:57 UTC (rev 7510)
+++ gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_udp_source.h
2008-01-25 15:09:48 UTC (rev 7511)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,6 +27,9 @@
#include <omnithread.h>
#include <sys/socket.h>
#include <arpa/inet.h>
+#if defined(HAVE_NETINET_IN_H)
+#include <netinet/in.h>
+#endif
class gr_udp_source;
typedef boost::shared_ptr<gr_udp_source> gr_udp_source_sptr;
@@ -62,8 +65,7 @@
int d_socket_rcv; // handle to socket retuned in the accept
call
struct in_addr d_ip_src; // store the source IP address to use
unsigned short d_port_src; // the port number to open for connections
to this service
- sockaddr_in d_sockaddr_src; // store the source sockaddr data (formatted
IP address and port number)
-
+ struct sockaddr_in d_sockaddr_src; // store the source sockaddr data
(formatted IP address and port number)
char *d_temp_buff; // hold buffer between calls
ssize_t d_residual; // hold information about number of bytes stored in
the temp buffer
size_t d_temp_offset; // point to temp buffer location offset
Modified: gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/ppio_ppdev.cc
===================================================================
--- gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/ppio_ppdev.cc
2008-01-25 14:56:57 UTC (rev 7510)
+++ gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/ppio_ppdev.cc
2008-01-25 15:09:48 UTC (rev 7511)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2001,2003,2004 Free Software Foundation, Inc.
+ * Copyright 2001,2003,2004,2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -32,11 +32,16 @@
#include <errno.h>
#include <stdio.h>
#include <stdexcept>
-#ifdef HAVE_LINUX_PPDEV_H
+#if defined(HAVE_LINUX_PPDEV_H)
#include <sys/ioctl.h>
#include <linux/ppdev.h>
#include <linux/parport.h>
#include <sstream>
+#elif defined(HAVE_DEV_PPBUS_PPI_H)
+#include <sys/ioctl.h>
+#include <dev/ppbus/ppi.h>
+#include <dev/ppbus/ppbconf.h>
+#include <sstream>
#else
// #warn "ppio_ppdev is not functional on this platform"
#endif
@@ -53,84 +58,138 @@
static int SP_ACTIVE_LOW_BITS = 0x80;
-#ifndef HAVE_LINUX_PPDEV_H // use stubs
+#if defined(HAVE_LINUX_PPDEV_H)
+// The real Linux code...
+
ppio_ppdev::ppio_ppdev (int which)
{
- std::cerr << "ppio_ppdev: Not implemented on this platform\n";
- throw std::runtime_error ("not implmeneted");
+ std::ostringstream filename;
+ filename << "/dev/parport" << which;
+ const char *c_filename = filename.str().c_str();
+
+ if ((d_fd = open (c_filename, O_RDWR)) < 0){
+ int my_errno = errno;
+ perror (c_filename);
+ if (my_errno == ENOENT){
+ std::cerr << "Does the device file " << c_filename << " exist?\n";
+ std::cerr << "If not, as root execute: \n";
+ std::cerr << " # mknod " << c_filename << " c 99 0\n";
+ std::cerr << " # chmod 666 " << c_filename << std::endl;
+ }
+ throw std::runtime_error ("open");
+ }
+
+ int mode = IEEE1284_MODE_COMPAT;
+ if (ioctl (d_fd, PPSETMODE, &mode) != 0){
+ perror ("ppio_ppdev: PPSETMODE");
+ close (d_fd);
+ throw std::runtime_error ("PPSETMODE");
+ }
}
ppio_ppdev::~ppio_ppdev ()
{
+ close (d_fd);
}
+
void
ppio_ppdev::write_data (unsigned char v)
{
+ if (ioctl (d_fd, PPWDATA, &v) != 0){
+ perror ("ppio_ppdev: PPWDATA");
+ throw std::runtime_error ("PPWDATA");
+ }
}
unsigned char
ppio_ppdev::read_data ()
{
- return 0;
+ unsigned char v;
+
+ if (ioctl (d_fd, PPRDATA, &v) != 0){
+ perror ("ppio_ppdev: PPRDATA");
+ throw std::runtime_error ("PPRDATA");
+ }
+ return v;
}
void
ppio_ppdev::write_control (unsigned char v)
{
+ unsigned char ctrl = v ^ CP_ACTIVE_LOW_BITS;
+ if (ioctl (d_fd, PPWCONTROL, &ctrl) != 0){
+ perror ("ppio_ppdev: PPWCONTROL");
+ throw std::runtime_error ("PPWCONTROL");
+ }
}
unsigned char
ppio_ppdev::read_control ()
{
- return 0;
+ unsigned char ctrl;
+ if (ioctl (d_fd, PPRCONTROL, &ctrl) != 0){
+ perror ("ppio_ppdev: PPRCONTROL");
+ throw std::runtime_error ("PPRCONTROL");
+ }
+
+ return ctrl ^ CP_ACTIVE_LOW_BITS;
}
unsigned char
ppio_ppdev::read_status ()
{
- return 0;
+ unsigned char status;
+ if (ioctl (d_fd, PPRSTATUS, &status) != 0){
+ perror ("ppio_ppdev: PPRSTATUS");
+ throw std::runtime_error ("PPRSTATUS");
+ }
+
+ return status ^ SP_ACTIVE_LOW_BITS;
}
void
ppio_ppdev::lock ()
{
+ if (ioctl (d_fd, PPCLAIM) != 0){
+ perror ("ppio_ppdev: PPCLAIM");
+ throw std::runtime_error ("PPCLAIM");
+ }
}
void
ppio_ppdev::unlock ()
{
+ if (ioctl (d_fd, PPRELEASE) != 0){
+ perror ("ppio_ppdev: PPRELEASE");
+ throw std::runtime_error ("PPRELEASE");
+ }
}
-#else
+#elif defined(HAVE_DEV_PPBUS_PPI_H)
-// The real code...
+// The real FreeBSD code... (Could work on other BSDs as well)
ppio_ppdev::ppio_ppdev (int which)
{
std::ostringstream filename;
- filename << "/dev/parport" << which;
+ filename << "/dev/ppi" << which;
const char *c_filename = filename.str().c_str();
-
if ((d_fd = open (c_filename, O_RDWR)) < 0){
int my_errno = errno;
perror (c_filename);
- if (my_errno == ENOENT){
- std::cerr << "Does the device file " << c_filename << " exist?\n";
- std::cerr << "If not, as root execute: \n";
- std::cerr << " # mknod " << c_filename << " c 99 0\n";
- std::cerr << " # chmod 666 " << c_filename << std::endl;
- }
throw std::runtime_error ("open");
}
+#if 0
int mode = IEEE1284_MODE_COMPAT;
if (ioctl (d_fd, PPSETMODE, &mode) != 0){
perror ("ppio_ppdev: PPSETMODE");
close (d_fd);
throw std::runtime_error ("PPSETMODE");
}
+#endif
}
ppio_ppdev::~ppio_ppdev ()
@@ -142,9 +201,9 @@
void
ppio_ppdev::write_data (unsigned char v)
{
- if (ioctl (d_fd, PPWDATA, &v) != 0){
- perror ("ppio_ppdev: PPWDATA");
- throw std::runtime_error ("PPWDATA");
+ if (ioctl (d_fd, PPISDATA, &v) != 0){
+ perror ("ppio_ppdev: PPISDATA");
+ throw std::runtime_error ("PPISDATA");
}
}
@@ -153,9 +212,9 @@
{
unsigned char v;
- if (ioctl (d_fd, PPRDATA, &v) != 0){
- perror ("ppio_ppdev: PPRDATA");
- throw std::runtime_error ("PPRDATA");
+ if (ioctl (d_fd, PPIGDATA, &v) != 0){
+ perror ("ppio_ppdev: PPIGDATA");
+ throw std::runtime_error ("PPIGDATA");
}
return v;
}
@@ -164,9 +223,9 @@
ppio_ppdev::write_control (unsigned char v)
{
unsigned char ctrl = v ^ CP_ACTIVE_LOW_BITS;
- if (ioctl (d_fd, PPWCONTROL, &ctrl) != 0){
- perror ("ppio_ppdev: PPWCONTROL");
- throw std::runtime_error ("PPWCONTROL");
+ if (ioctl (d_fd, PPISCTRL, &ctrl) != 0){
+ perror ("ppio_ppdev: PPISCTRL");
+ throw std::runtime_error ("PPISCTRL");
}
}
@@ -174,9 +233,9 @@
ppio_ppdev::read_control ()
{
unsigned char ctrl;
- if (ioctl (d_fd, PPRCONTROL, &ctrl) != 0){
- perror ("ppio_ppdev: PPRCONTROL");
- throw std::runtime_error ("PPRCONTROL");
+ if (ioctl (d_fd, PPIGCTRL, &ctrl) != 0){
+ perror ("ppio_ppdev: PPIGCTRL");
+ throw std::runtime_error ("PPIGCTRL");
}
return ctrl ^ CP_ACTIVE_LOW_BITS;
@@ -186,32 +245,73 @@
ppio_ppdev::read_status ()
{
unsigned char status;
- if (ioctl (d_fd, PPRSTATUS, &status) != 0){
- perror ("ppio_ppdev: PPRSTATUS");
- throw std::runtime_error ("PPRSTATUS");
+ if (ioctl (d_fd, PPIGSTATUS, &status) != 0){
+ perror ("ppio_ppdev: PPIGSTATUS");
+ throw std::runtime_error ("PPIGSTATUS");
}
-
return status ^ SP_ACTIVE_LOW_BITS;
}
void
ppio_ppdev::lock ()
{
- if (ioctl (d_fd, PPCLAIM) != 0){
- perror ("ppio_ppdev: PPCLAIM");
- throw std::runtime_error ("PPCLAIM");
- }
}
void
ppio_ppdev::unlock ()
{
- if (ioctl (d_fd, PPRELEASE) != 0){
- perror ("ppio_ppdev: PPRELEASE");
- throw std::runtime_error ("PPRELEASE");
- }
}
+#else
+/* Apparently, non real code */
+ppio_ppdev::ppio_ppdev (int which)
+{
+ std::cerr << "ppio_ppdev: Not implemented on this platform\n";
+ throw std::runtime_error ("not implmeneted");
+}
+
+ppio_ppdev::~ppio_ppdev ()
+{
+}
+
+void
+ppio_ppdev::write_data (unsigned char v)
+{
+}
+
+unsigned char
+ppio_ppdev::read_data ()
+{
+ return 0;
+}
+
+void
+ppio_ppdev::write_control (unsigned char v)
+{
+}
+
+unsigned char
+ppio_ppdev::read_control ()
+{
+ return 0;
+}
+
+unsigned char
+ppio_ppdev::read_status ()
+{
+ return 0;
+}
+
+void
+ppio_ppdev::lock ()
+{
+}
+
+void
+ppio_ppdev::unlock ()
+{
+}
+
#endif
ppio_ppdev_sptr
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7511 - in gnuradio/branches/releases/3.1: . gnuradio-core/src/lib/io,
jcorgan <=