Changeset 7454

Show
Ignore:
Timestamp:
01/16/08 13:38:04
Author:
eb
Message:

Merged -r7436:7453 eb/freebsd into trunk. This is a part of a set of
patches from Diane Bruce for FreeBSD. Still need to resolve the
issue of where/how to include config.h in all swig code and
how to select wx version on systems with more than one version installed.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gnuradio/trunk/configure.ac

    r7062 r7454  
    126126AC_HEADER_SYS_WAIT 
    127127AC_CHECK_HEADERS(fcntl.h limits.h strings.h time.h sys/ioctl.h sys/time.h unistd.h) 
    128 AC_CHECK_HEADERS(linux/ppdev.h sys/mman.h sys/select.h sys/types.h) 
     128AC_CHECK_HEADERS(linux/ppdev.h dev/ppbus/ppi.h sys/mman.h sys/select.h sys/types.h) 
    129129AC_CHECK_HEADERS(sys/resource.h stdint.h sched.h signal.h sys/syscall.h) 
     130AC_CHECK_HEADERS(netinet/in.h) 
    130131AC_CHECK_HEADERS(windows.h) 
    131132 
  • gnuradio/trunk/gnuradio-core/src/lib/io/gr_udp_sink.cc

    r6044 r7454  
    11/* -*- c++ -*- */ 
    22/* 
    3  * Copyright 2007 Free Software Foundation, Inc. 
     3 * Copyright 2007,2008 Free Software Foundation, Inc. 
    44 *  
    55 * This file is part of GNU Radio 
     
    2121 */ 
    2222 
     23#ifdef HAVE_CONFIG_H 
     24#include "config.h" 
     25#endif 
    2326#include <gr_udp_sink.h> 
    2427#include <gr_io_signature.h> 
  • gnuradio/trunk/gnuradio-core/src/lib/io/gr_udp_sink.h

    r6044 r7454  
    11/* -*- c++ -*- */ 
    22/* 
    3  * Copyright 2007 Free Software Foundation, Inc. 
     3 * Copyright 2007,2008 Free Software Foundation, Inc. 
    44 *  
    55 * This file is part of GNU Radio 
     
    2828#include <sys/socket.h> 
    2929#include <arpa/inet.h> 
     30#include <sys/socket.h> 
     31#if defined(HAVE_NETINET_IN_H) 
     32#include <netinet/in.h> 
     33#endif 
    3034 
    3135class gr_udp_sink; 
     
    7175  unsigned short d_port_src;        // the port number to open for connections to this service 
    7276  unsigned short d_port_dst;        // port number of the remove system 
    73   sockaddr_in    d_sockaddr_src;    // store the source sockaddr data (formatted IP address and port number) 
    74   sockaddr_in    d_sockaddr_dst;    // store the destination sockaddr data (formatted IP address and port number) 
     77  struct sockaddr_in    d_sockaddr_src;    // store the source sockaddr data (formatted IP address and port number) 
     78  struct sockaddr_in    d_sockaddr_dst;    // store the destination sockaddr data (formatted IP address and port number) 
    7579 
    7680 protected: 
  • gnuradio/trunk/gnuradio-core/src/lib/io/gr_udp_source.cc

    r6044 r7454  
    11/* -*- c++ -*- */ 
    22/* 
    3  * Copyright 2007 Free Software Foundation, Inc. 
     3 * Copyright 2007,2008 Free Software Foundation, Inc. 
    44 *  
    55 * This file is part of GNU Radio 
     
    2121 */ 
    2222 
     23#ifdef HAVE_CONFIG_H 
     24#include "config.h" 
     25#endif 
    2326#include <gr_udp_source.h> 
    2427#include <gr_io_signature.h> 
  • gnuradio/trunk/gnuradio-core/src/lib/io/gr_udp_source.h

    r6044 r7454  
    11/* -*- c++ -*- */ 
    22/* 
    3  * Copyright 2007 Free Software Foundation, Inc. 
     3 * Copyright 2007,2008 Free Software Foundation, Inc. 
    44 *  
    55 * This file is part of GNU Radio 
     
    2828#include <sys/socket.h> 
    2929#include <arpa/inet.h> 
     30#if defined(HAVE_NETINET_IN_H) 
     31#include <netinet/in.h> 
     32#endif 
    3033 
    3134class gr_udp_source; 
     
    6366  struct in_addr d_ip_src;        // store the source IP address to use 
    6467  unsigned short d_port_src;      // the port number to open for connections to this service 
    65   sockaddr_in    d_sockaddr_src;  // store the source sockaddr data (formatted IP address and port number) 
    66  
     68  struct sockaddr_in    d_sockaddr_src;  // store the source sockaddr data (formatted IP address and port number) 
    6769  char *d_temp_buff;    // hold buffer between calls 
    6870  ssize_t d_residual;   // hold information about number of bytes stored in the temp buffer 
  • gnuradio/trunk/gnuradio-core/src/lib/io/ppio_ppdev.cc

    r6044 r7454  
    11/* -*- c++ -*- */ 
    22/* 
    3  * Copyright 2001,2003,2004 Free Software Foundation, Inc. 
     3 * Copyright 2001,2003,2004,2008 Free Software Foundation, Inc. 
    44 *  
    55 * This file is part of GNU Radio 
     
    3333#include <stdio.h> 
    3434#include <stdexcept> 
    35 #ifdef HAVE_LINUX_PPDEV_H 
     35#if defined(HAVE_LINUX_PPDEV_H) 
    3636#include <sys/ioctl.h> 
    3737#include <linux/ppdev.h> 
    3838#include <linux/parport.h> 
    3939#include <sstream> 
     40#elif defined(HAVE_DEV_PPBUS_PPI_H) 
     41#include <sys/ioctl.h> 
     42#include <dev/ppbus/ppi.h> 
     43#include <dev/ppbus/ppbconf.h> 
     44#include <sstream> 
    4045#else 
    4146// #warn "ppio_ppdev is not functional on this platform" 
     
    5459static int SP_ACTIVE_LOW_BITS   = 0x80; 
    5560 
    56 #ifndef HAVE_LINUX_PPDEV_H              // use stubs 
    57  
    58 ppio_ppdev::ppio_ppdev (int which) 
    59 
    60   std::cerr << "ppio_ppdev: Not implemented on this platform\n"; 
    61   throw std::runtime_error ("not implmeneted"); 
    62 
    63  
    64 ppio_ppdev::~ppio_ppdev () 
    65 
    66 
    67  
    68 void  
    69 ppio_ppdev::write_data (unsigned char v) 
    70 
    71 
    72  
    73 unsigned char 
    74 ppio_ppdev::read_data () 
    75 
    76   return 0; 
    77 
    78  
    79 void  
    80 ppio_ppdev::write_control (unsigned char v) 
    81 
    82 
    83  
    84 unsigned char 
    85 ppio_ppdev::read_control () 
    86 
    87   return 0; 
    88 
    89  
    90 unsigned char 
    91 ppio_ppdev::read_status () 
    92 
    93   return 0; 
    94 
    95  
    96 void 
    97 ppio_ppdev::lock () 
    98 
    99 
    100  
    101 void 
    102 ppio_ppdev::unlock () 
    103 
    104 
    105  
    106 #else            
    107  
    108 // The real code... 
     61#if defined(HAVE_LINUX_PPDEV_H) 
     62 
     63// The real Linux code... 
    10964 
    11065ppio_ppdev::ppio_ppdev (int which) 
     
    213168} 
    214169 
     170#elif defined(HAVE_DEV_PPBUS_PPI_H) 
     171 
     172// The real FreeBSD code... (Could work on other BSDs as well) 
     173 
     174ppio_ppdev::ppio_ppdev (int which) 
     175{ 
     176  std::ostringstream filename; 
     177  filename << "/dev/ppi" << which; 
     178  const char *c_filename = filename.str().c_str(); 
     179  if ((d_fd = open (c_filename, O_RDWR)) < 0){ 
     180    int my_errno = errno; 
     181    perror (c_filename); 
     182    throw std::runtime_error ("open"); 
     183  } 
     184 
     185#if 0 
     186  int mode = IEEE1284_MODE_COMPAT; 
     187  if (ioctl (d_fd, PPSETMODE, &mode) != 0){ 
     188    perror ("ppio_ppdev: PPSETMODE"); 
     189    close (d_fd); 
     190    throw std::runtime_error ("PPSETMODE"); 
     191  } 
     192#endif 
     193} 
     194 
     195ppio_ppdev::~ppio_ppdev () 
     196{ 
     197  close (d_fd); 
     198} 
     199 
     200 
     201void  
     202ppio_ppdev::write_data (unsigned char v) 
     203{ 
     204  if (ioctl (d_fd, PPISDATA, &v) != 0){ 
     205    perror ("ppio_ppdev: PPISDATA"); 
     206    throw std::runtime_error ("PPISDATA"); 
     207  } 
     208} 
     209 
     210unsigned char 
     211ppio_ppdev::read_data () 
     212{ 
     213  unsigned char v; 
     214 
     215  if (ioctl (d_fd, PPIGDATA, &v) != 0){ 
     216    perror ("ppio_ppdev: PPIGDATA"); 
     217    throw std::runtime_error ("PPIGDATA"); 
     218  } 
     219  return v; 
     220} 
     221 
     222void  
     223ppio_ppdev::write_control (unsigned char v) 
     224{ 
     225  unsigned char ctrl = v ^ CP_ACTIVE_LOW_BITS; 
     226  if (ioctl (d_fd, PPISCTRL, &ctrl) != 0){ 
     227    perror ("ppio_ppdev: PPISCTRL"); 
     228    throw std::runtime_error ("PPISCTRL"); 
     229  } 
     230} 
     231 
     232unsigned char 
     233ppio_ppdev::read_control () 
     234{ 
     235  unsigned char ctrl; 
     236  if (ioctl (d_fd, PPIGCTRL, &ctrl) != 0){ 
     237    perror ("ppio_ppdev: PPIGCTRL"); 
     238    throw std::runtime_error ("PPIGCTRL"); 
     239  } 
     240 
     241  return ctrl ^ CP_ACTIVE_LOW_BITS; 
     242} 
     243 
     244unsigned char 
     245ppio_ppdev::read_status () 
     246{ 
     247  unsigned char status; 
     248  if (ioctl (d_fd, PPIGSTATUS, &status) != 0){ 
     249    perror ("ppio_ppdev: PPIGSTATUS"); 
     250    throw std::runtime_error ("PPIGSTATUS"); 
     251  } 
     252  return status ^ SP_ACTIVE_LOW_BITS; 
     253} 
     254 
     255void 
     256ppio_ppdev::lock () 
     257{ 
     258} 
     259 
     260void 
     261ppio_ppdev::unlock () 
     262{ 
     263} 
     264#else 
     265/* Apparently, non real code */ 
     266 
     267ppio_ppdev::ppio_ppdev (int which) 
     268{ 
     269  std::cerr << "ppio_ppdev: Not implemented on this platform\n"; 
     270  throw std::runtime_error ("not implmeneted"); 
     271} 
     272 
     273ppio_ppdev::~ppio_ppdev () 
     274{ 
     275} 
     276 
     277void  
     278ppio_ppdev::write_data (unsigned char v) 
     279{ 
     280} 
     281 
     282unsigned char 
     283ppio_ppdev::read_data () 
     284{ 
     285  return 0; 
     286} 
     287 
     288void  
     289ppio_ppdev::write_control (unsigned char v) 
     290{ 
     291} 
     292 
     293unsigned char 
     294ppio_ppdev::read_control () 
     295{ 
     296  return 0; 
     297} 
     298 
     299unsigned char 
     300ppio_ppdev::read_status () 
     301{ 
     302  return 0; 
     303} 
     304 
     305void 
     306ppio_ppdev::lock () 
     307{ 
     308} 
     309 
     310void 
     311ppio_ppdev::unlock () 
     312{ 
     313} 
     314 
    215315#endif 
    216316