debian/0000755000000000000000000000000012173440217007167 5ustar debian/langford-utils.examples0000644000000000000000000000000712075033372013657 0ustar test/* debian/patches/0000755000000000000000000000000012173440230010611 5ustar debian/patches/static0000644000000000000000000000435112127323724012035 0ustar Description: Make internal functions static Author: Simon Richter Last-Update: 2013-01-08 Index: langford-0.0.20130221/langford.c =================================================================== --- langford-0.0.20130221.orig/langford.c 2013-04-04 18:18:16.923472049 +0200 +++ langford-0.0.20130221/langford.c 2013-04-04 18:18:27.271471819 +0200 @@ -42,7 +42,7 @@ /**Figures out elements are used in a circular buffer */ -int circ_buff_filled(int start, int end, int len) { +static int circ_buff_filled(int start, int end, int len) { int rc; rc = end - start; @@ -57,7 +57,7 @@ /**Figures out how many elements of a circular buffer are available to be filled */ -int circ_buff_avail(int start, int end, int len) { +static int circ_buff_avail(int start, int end, int len) { return len - circ_buff_filled(start, end, len) - 1; }; @@ -69,7 +69,7 @@ - constantly performs read operations from the device via DMA - copy transferred rx data to cdev_read_buff */ -int dev_read_task(void *data) { +static int dev_read_task(void *data) { int DescLevel; /*Descriptor FIFO level read from device*/ int DescActive, DescComp; /*Number of descriptors to be serviced and the number of completed descriptors*/ int BuffStart, BuffEnd; /*Indices to beginning and end of DMA buffers ring array (DevPrivData->RxDmaBuffsBusAddr)*/ @@ -210,7 +210,7 @@ - reads tx data from cdev_write_buff - constantly performs write operations to the device via DMA */ -int dev_write_task(void *data) { +static int dev_write_task(void *data) { int DescLevel; /*Descriptor FIFO level read from device*/ int DescActive, DescComp; /*Number of descriptors to be serviced and the number of completed descriptors*/ int BuffStart, BuffEnd; /*Indices to beginning and end of DMA buffers ring array (DevPrivData->TxDmaBuffsBusAddr)*/ @@ -434,7 +434,7 @@ /**Helper function for ioctrl (called ioctl handler and driver) */ -int ioctl_helper(int cmd, int *parg) { +static int ioctl_helper(int cmd, int *parg) { int AddrOffset; int BitOffset; @@ -684,7 +684,7 @@ State = 1 - Power on State = 0 - Power off */ -void PowerPeriph(int State) { +static void PowerPeriph(int State) { int nState = !State; int Val1 = 1; State = !nState; debian/patches/hardening0000644000000000000000000000277712127323732012516 0ustar Description: Accept Debian's hardening flags Author: Simon Richter Last-Update: 2013-01-14 Index: langford-0.0.20130221/Makefile =================================================================== --- langford-0.0.20130221.orig/Makefile 2013-02-21 23:26:58.000000000 +0100 +++ langford-0.0.20130221/Makefile 2013-04-04 18:18:33.395471682 +0200 @@ -28,10 +28,10 @@ echo "Remember to run langford_init in order to initialize the device at /dev/langford" langford_util: langford_util.cpp - g++ $< -ansi -Wall -g -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ langford_adc_util: langford_adc_util.cpp langford_spi.cpp - g++ langford_adc_util.cpp langford_spi.cpp -ansi -Wall -g -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ libs: make -f libs/Makefile Index: langford-0.0.20130221/libs/Makefile =================================================================== --- langford-0.0.20130221.orig/libs/Makefile 2013-02-21 23:26:58.000000000 +0100 +++ langford-0.0.20130221/libs/Makefile 2013-04-04 18:18:33.395471682 +0200 @@ -5,10 +5,10 @@ all: langford_rf_fsynth langford_rx_rf_bb_vga langford_rf_fsynth: $(FSYNTHSRC) - g++ -ansi -Wall $(FSYNTHSRC) -o langford_rf_fsynth + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ langford_rx_rf_bb_vga: $(VGASRC) - g++ -ansi -Wall $(VGASRC) -o langford_rx_rf_bb_vga + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ install: langford_rf_fsynth langford_rx_rf_bb_vga sudo cp langford_rx_rf_bb_vga langford_rf_fsynth /usr/bin debian/patches/unsigned0000644000000000000000000000676312127323726012375 0ustar Description: Make variables containing positive offsets unsigned Author: Simon Richter Last-Update: 2013-01-08 Index: langford-0.0.20130221/langford.c =================================================================== --- langford-0.0.20130221.orig/langford.c 2013-04-04 18:18:27.271471819 +0200 +++ langford-0.0.20130221/langford.c 2013-04-04 18:18:29.647471766 +0200 @@ -27,13 +27,13 @@ static DEFINE_MUTEX(cdev_read_buff_mutex); /**< Read buffer mutex*/ static uint8_t *cdev_read_buff; /**< Read buffer*/ -static int cdev_read_buff_start; /**< Start pointer to read buffer*/ -static int cdev_read_buff_end; /**< End pointer to read buffer*/ +static unsigned int cdev_read_buff_start; /**< Start pointer to read buffer*/ +static unsigned int cdev_read_buff_end; /**< End pointer to read buffer*/ static DEFINE_MUTEX(cdev_write_buff_mutex); /**< Write buffer mutex*/ static uint8_t *cdev_write_buff; /**< Write buffer*/ -static int cdev_write_buff_start; /**< Start pointer to write buffer*/ -static int cdev_write_buff_end; /**< End pointer to write buffer*/ +static unsigned int cdev_write_buff_start; /**< Start pointer to write buffer*/ +static unsigned int cdev_write_buff_end; /**< End pointer to write buffer*/ /*DMA read and write threads*/ static struct task_struct *dev_read_thread; /**< Thread in charge of reading data from PCIe device*/ @@ -42,7 +42,7 @@ /**Figures out elements are used in a circular buffer */ -static int circ_buff_filled(int start, int end, int len) { +static unsigned int circ_buff_filled(unsigned int start, unsigned int end, unsigned int len) { int rc; rc = end - start; @@ -57,7 +57,7 @@ /**Figures out how many elements of a circular buffer are available to be filled */ -static int circ_buff_avail(int start, int end, int len) { +static unsigned int circ_buff_avail(unsigned int start, unsigned int end, unsigned int len) { return len - circ_buff_filled(start, end, len) - 1; }; @@ -72,9 +72,9 @@ static int dev_read_task(void *data) { int DescLevel; /*Descriptor FIFO level read from device*/ int DescActive, DescComp; /*Number of descriptors to be serviced and the number of completed descriptors*/ - int BuffStart, BuffEnd; /*Indices to beginning and end of DMA buffers ring array (DevPrivData->RxDmaBuffsBusAddr)*/ + unsigned int BuffStart, BuffEnd; /*Indices to beginning and end of DMA buffers ring array (DevPrivData->RxDmaBuffsBusAddr)*/ int Ctr; - int BuffsToWrite; + unsigned int BuffsToWrite; uint32_t DescAddr; printk(KERN_DEBUG DRIVER_NAME " Read thread created\n"); @@ -213,9 +213,9 @@ static int dev_write_task(void *data) { int DescLevel; /*Descriptor FIFO level read from device*/ int DescActive, DescComp; /*Number of descriptors to be serviced and the number of completed descriptors*/ - int BuffStart, BuffEnd; /*Indices to beginning and end of DMA buffers ring array (DevPrivData->TxDmaBuffsBusAddr)*/ + unsigned int BuffStart, BuffEnd; /*Indices to beginning and end of DMA buffers ring array (DevPrivData->TxDmaBuffsBusAddr)*/ int Ctr; - int BuffsToWrite; + unsigned int BuffsToWrite; uint32_t DescAddr; printk(KERN_DEBUG DRIVER_NAME " Write thread created\n"); @@ -390,7 +390,7 @@ /**Service user mode writes */ static ssize_t cdev_write(struct file *file, const char __user *buf, size_t len, loff_t *ppos) { - int cdev_buff_avail; + unsigned int cdev_buff_avail; #if VERBOSE_LOGGING_W printk(KERN_DEBUG DRIVER_NAME " User requested write of %zu bytes\n", len); debian/patches/minmax0000644000000000000000000000133712127323721012035 0ustar Description: Fix MIN/MAX macros These macros did not properly guard against operator precedence issues. Author: Simon Richter Last-Update: 2013-01-08 Index: langford-0.0.20130221/langford.h =================================================================== --- langford-0.0.20130221.orig/langford.h 2013-04-04 18:18:17.499472037 +0200 +++ langford-0.0.20130221/langford.h 2013-04-04 18:18:21.151471955 +0200 @@ -108,7 +108,7 @@ /*Program macros*/ /**Given 2 numbers, return the larger one*/ -#define MAX(a, b) ((a > b) ? a : b) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) /**Given 2 numbers, return the smaller one*/ -#define MIN(a, b) ((a < b) ? a : b) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) debian/patches/fixbuild0000644000000000000000000000633212173440230012346 0ustar Description: Fix the build system Author: Simon Richter Last-Update: 2013-04-04 Index: langford-0.0.20130228/Makefile =================================================================== --- langford-0.0.20130228.orig/Makefile 2013-07-23 10:35:51.000000000 +0200 +++ langford-0.0.20130228/Makefile 2013-07-23 10:36:09.612619337 +0200 @@ -1,33 +1,11 @@ obj-m = langford.o KVERSION = $(shell uname -r) -all: langford.ko langford_util langford_adc_util +all: libs langford_util langford_adc_util langford.ko: langford.c export CCFLAGS="-ansi -Wall" - sudo make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules - -install: langford.ko langford_util langford_adc_util - #Ensure module recompilation everytime it needs to be installed. - #(Prevents module version errors after kernel upgrades.) - -sudo rm -f langford.ko - -sudo rm -rf /dev/langford - -sudo modprobe -r langford - make langford.ko - sudo cp langford.ko /lib/modules/`uname -r`/kernel/drivers/misc - sudo depmod -a - sudo modprobe langford -#Allow some time for driver to finish loading. If driver does not complete loading, no character device will be registered and mknod will fail. - sleep 3 - sync - sudo cp langford_util /usr/bin - sudo cp langford_adc_util /usr/bin - sudo cp langford_init /usr/bin -#Create langford group, if not already. - -sudo groupadd langford - sudo chmod a+rx /usr/bin/langford_util - make -C libs/ install - echo "Remember to run langford_init in order to initialize the device at /dev/langford" + $(MAKE) -C /lib/modules/$(KVERSION)/build M=$(PWD) modules langford_util: langford_util.cpp $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ @@ -36,23 +14,16 @@ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ libs: - make -f libs/Makefile + $(MAKE) -C libs/ clean: - -sudo make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean - -sudo rm -rf langford.ko.gz langford_util langford_adc_util - make -C libs/ clean + #$(MAKE) -C /lib/modules/$(KVERSION)/build M=$(PWD) clean + $(RM) -r langford.ko.gz langford_util langford_adc_util + $(MAKE) -C libs/ clean distclean: clean - -sudo make -C ./ clean - -sudo rm -rf .tmp* - -sudo rm -rf *~ - #-sudo rm modules.order Module.symvers - -uninstall: - -sudo rm /usr/bin/langford_util - -sudo rm /usr/bin/langford_init - -sudo rm /usr/bin/langford_adc_util - # Remove langford group - -sudo groupdel langford - make -C libs/ uninstall + $(MAKE) -C ./ clean + $(RM) -r .tmp* + $(RM) -r *~ + +.PHONY: all libs clean distclean Index: langford-0.0.20130228/libs/Makefile =================================================================== --- langford-0.0.20130228.orig/libs/Makefile 2013-07-23 10:35:51.000000000 +0200 +++ langford-0.0.20130228/libs/Makefile 2013-07-23 10:35:51.000000000 +0200 @@ -10,13 +10,6 @@ langford_rx_rf_bb_vga: $(VGASRC) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ -install: langford_rf_fsynth langford_rx_rf_bb_vga - sudo cp langford_rx_rf_bb_vga langford_rf_fsynth /usr/bin - sudo chmod a+rx /usr/bin/langford_rx_rf_bb_vga /usr/bin/langford_rf_fsynth - -uninstall: - -sudo rm -rf /usr/bin/langford_rx_rf_bb_vga /usr/bin/langford_rf_fsynth - -clean: - -sudo rm -rf langford_rf_fsynth langford_rx_rf_bb_vga +clean distclean: + $(RM) langford_rf_fsynth langford_rx_rf_bb_vga debian/patches/circular0000644000000000000000000000203312127323730012342 0ustar Description: Make ring buffer code overflow free Author: Simon Richter Last-Update: 2013-01-08 Index: langford-0.0.20130221/langford.c =================================================================== --- langford-0.0.20130221.orig/langford.c 2013-04-04 18:18:29.647471766 +0200 +++ langford-0.0.20130221/langford.c 2013-04-04 18:18:31.511471724 +0200 @@ -43,22 +43,20 @@ /**Figures out elements are used in a circular buffer */ static unsigned int circ_buff_filled(unsigned int start, unsigned int end, unsigned int len) { - int rc; - - rc = end - start; - - if (rc < 0) { - rc = len + rc; - }; - - return rc; + if (start > end) + return len - start + end; + else + return end - start; }; /**Figures out how many elements of a circular buffer are available to be filled */ static unsigned int circ_buff_avail(unsigned int start, unsigned int end, unsigned int len) { - return len - circ_buff_filled(start, end, len) - 1; + if (start > end) + return start - end - 1; + else + return len - end + start - 1; }; debian/patches/series0000644000000000000000000000007312127325353012035 0ustar minmax static unsigned circular hardening devinit fixbuild debian/patches/devinit0000644000000000000000000000226512127323734012213 0ustar Description: Remove __devinit/__devexit for Linux 3.8 Author: Simon Richter Last-Update: 2013-03-11 Index: langford-0.0.20130221/langford.c =================================================================== --- langford-0.0.20130221.orig/langford.c 2013-04-04 18:18:31.511471724 +0200 +++ langford-0.0.20130221/langford.c 2013-04-04 18:18:35.571471633 +0200 @@ -913,7 +913,7 @@ Be sure to perform the exact opposite of this function in driver_remove */ -static int __devinit driver_probe(struct pci_dev *dev, const struct pci_device_id *id) { +static int driver_probe(struct pci_dev *dev, const struct pci_device_id *id) { int rc; printk(KERN_INFO DRIVER_NAME " Probing and setting up device...\n"); @@ -1041,7 +1041,7 @@ Be sure to undo all the changes made by driver_probe */ -static void __devexit driver_remove(struct pci_dev *dev) { +static void driver_remove(struct pci_dev *dev) { printk(KERN_INFO DRIVER_NAME " Removing device...\n"); reset_dma(); pci_iounmap(dev, DevPrivData->pBar1); @@ -1064,7 +1064,7 @@ .name = DRIVER_NAME, .id_table = driver_ids, .probe = driver_probe, - .remove = __devexit_p(driver_remove), + .remove = driver_remove, }; debian/control0000644000000000000000000000174112075104744010600 0ustar Source: langford Section: kernel Priority: extra Maintainer: Simon Richter Build-Depends: debhelper (>= 9), dkms Standards-Version: 3.9.3 Homepage: http://www.pervices.com/ Package: langford-utils Architecture: linux-any Section: electronics Depends: ${shlibs:Depends}, ${misc:Depends} Recommends: langford-dkms Suggests: gnuradio Description: Control programs for the Per Vices Noctar IQ demodulator board These utilities can be used to set up low level functions in the "Noctar" (formerly "Phi") IQ demodulator board from Per Vices. . If you are unsure whether you need this package, then you don't. Package: langford-dkms Architecture: all Depends: ${misc:Depends} Description: Kernel drivers for the Per Vices Noctar IQ demodulator board This package contains the source code and build scripts for the driver required to use the "Noctar" (formerly "Phi") IQ demodulator board from Per Vices. . If you are unsure whether you need this package, then you don't. debian/copyright0000644000000000000000000000203412075041204011113 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: langford Source: http://www.pervices.com/ Files: * Copyright: 2012, 2013 Per Vices co. License: GPL-2+ Files: debian/* Copyright: 2013 Simon Richter License: GPL-2+ License: GPL-2+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see . On Debian systems, the complete text of the GNU General Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". debian/langford-dkms.install0000644000000000000000000000026312075030632013305 0ustar langford.c /usr/src/langford-0.0.20130108/ langford.h /usr/src/langford-0.0.20130108/ langford_ioctl.h /usr/src/langford-0.0.20130108/ Makefile /usr/src/langford-0.0.20130108/ debian/source/0000755000000000000000000000000012117413601010462 5ustar debian/source/include-binaries0000644000000000000000000000012312117413601013616 0ustar langford_adc_util langford_util libs/langford_rf_fsynth libs/langford_rx_rf_bb_vga debian/source/format0000644000000000000000000000001412073013466011676 0ustar 3.0 (quilt) debian/compat0000644000000000000000000000000212073016165010365 0ustar 9 debian/langford-dkms.dkms0000644000000000000000000000050612117412345012577 0ustar PACKAGE_NAME="langford" PACKAGE_VERSION="0.0.20130108" MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build" CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean" AUTOINSTALL=yes BUILT_MODULE_NAME[0]=langford DEST_MODULE_LOCATION[0]=/extra debian/rules0000755000000000000000000000027312173434722010255 0ustar #!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 %: dh $* --parallel --with dkms override_dh_auto_install: override_dh_compress: dh_compress -X.grc debian/changelog0000644000000000000000000000131212173440207011035 0ustar langford (0.0.20130228-3) unstable; urgency=low * Fix package build, again. -- Simon Richter Tue, 23 Jul 2013 10:36:13 +0200 langford (0.0.20130228-2) unstable; urgency=low * Fix package build -- Simon Richter Tue, 23 Jul 2013 10:11:40 +0200 langford (0.0.20130228-1) unstable; urgency=low * New upstream release -- Simon Richter Mon, 22 Jul 2013 17:52:38 +0200 langford (0.0.20130221-2) unstable; urgency=low * Fix package build -- Simon Richter Thu, 04 Apr 2013 21:39:45 +0200 langford (0.0.20130221-1) unstable; urgency=low * Initial release -- Simon Richter Thu, 04 Apr 2013 18:17:33 +0200 debian/langford-utils.install0000644000000000000000000000017312075033363013513 0ustar langford_util /usr/bin langford_adc_util /usr/bin libs/langford_rf_fsynth /usr/bin libs/langford_rx_rf_bb_vga /usr/bin