diff options
author | jhay <jhay@FreeBSD.org> | 2005-07-29 02:11:28 +0800 |
---|---|---|
committer | jhay <jhay@FreeBSD.org> | 2005-07-29 02:11:28 +0800 |
commit | 87f949939e59293ab350bc3575a6519e0eef0994 (patch) | |
tree | 9c1a10126c3e599a420e310ac45f4efdb5df2c04 /lang/nqc | |
parent | 59fc07142155a6c6262b2d83ac6dd3f5a7e13405 (diff) | |
download | freebsd-ports-gnome-87f949939e59293ab350bc3575a6519e0eef0994.tar.gz freebsd-ports-gnome-87f949939e59293ab350bc3575a6519e0eef0994.tar.zst freebsd-ports-gnome-87f949939e59293ab350bc3575a6519e0eef0994.zip |
Update to nqc-3.1.r2.
Diffstat (limited to 'lang/nqc')
-rw-r--r-- | lang/nqc/Makefile | 6 | ||||
-rw-r--r-- | lang/nqc/distinfo | 4 | ||||
-rw-r--r-- | lang/nqc/files/RCX_USBTowerPipe_fbsd.cpp | 320 | ||||
-rw-r--r-- | lang/nqc/files/patch-RCX_Image.h | 18 | ||||
-rw-r--r-- | lang/nqc/files/patch-RCX_USBTowerPipe_fbsd.cpp | 10 | ||||
-rw-r--r-- | lang/nqc/files/patch-aa | 102 |
6 files changed, 13 insertions, 447 deletions
diff --git a/lang/nqc/Makefile b/lang/nqc/Makefile index aad916a75835..8e869b9038ca 100644 --- a/lang/nqc/Makefile +++ b/lang/nqc/Makefile @@ -6,8 +6,7 @@ # PORTNAME= nqc -PORTVERSION= 2.5.r3 -PORTREVISION= 1 +PORTVERSION= 3.1.r2 CATEGORIES= lang MASTER_SITES= http://bricxcc.sourceforge.net/nqc/release/ EXTRACT_SUFX= .tgz @@ -21,9 +20,6 @@ CC= ${CXX} MAN1= nqc.1 PLIST_FILES= bin/nqc -pre-configure: - ${CP} ${FILESDIR}/RCX_USBTowerPipe_fbsd.cpp ${WRKSRC}/rcxlib/ - do-install: ${INSTALL_PROGRAM} ${WRKSRC}/bin/nqc ${PREFIX}/bin ${INSTALL_MAN} ${WRKSRC}/nqc-man-2.1r1-0.man ${PREFIX}/man/man1/nqc.1 diff --git a/lang/nqc/distinfo b/lang/nqc/distinfo index 2abbb6b2b19a..28259690e83c 100644 --- a/lang/nqc/distinfo +++ b/lang/nqc/distinfo @@ -1,2 +1,2 @@ -MD5 (nqc-2.5.r3.tgz) = 65917b5057533f9c12b9504f0c966f8d -SIZE (nqc-2.5.r3.tgz) = 224377 +MD5 (nqc-3.1.r2.tgz) = b2236a455b9daa52e492bfa4bd51ff52 +SIZE (nqc-3.1.r2.tgz) = 326613 diff --git a/lang/nqc/files/RCX_USBTowerPipe_fbsd.cpp b/lang/nqc/files/RCX_USBTowerPipe_fbsd.cpp deleted file mode 100644 index fd0eaacf61aa..000000000000 --- a/lang/nqc/files/RCX_USBTowerPipe_fbsd.cpp +++ /dev/null @@ -1,320 +0,0 @@ - -#include <sys/types.h> -#include <sys/ioctl.h> -#include <errno.h> -#include <fcntl.h> -#include <poll.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <dev/usb/usb.h> - -#include "RCX_Pipe.h" - -#include "PDebug.h" - -#define kVendorID 1684 -#define kProductID 1 -#define kConfiguration 0 -#define kReadPipe 1 -#define kWritePipe 2 - -// these should come from a LEGO include -#define LTW_REQ_GET_PARM 1 -#define LTW_REQ_SET_PARM 2 -#define LTW_PARM_RANGE 2 -#define LTW_RANGE_SHORT 1 -#define LTW_RANGE_MEDIUM 2 - - -#define LTW_REQ_SET_TX_SPEED 0xEF -#define LTW_REQ_SET_RX_SPEED 0xF1 - -#define SPEED_COMM_BAUD_2400 8 -#define SPEED_COMM_BAUD_4800 0x10 - -#define LTW_REQ_SET_TX_CARRIER_FREQUENCY 0xF4 - -#define UInt32 uint32_t -#define UInt16 uint16_t -#define UInt8 uint8_t -#define IOReturn int - -typedef struct LTW_REQ_REPLY_HEADER { - UInt16 wNoOfBytes; // Number of bytes in the reply - UInt8 bErrCode; // Request return code - UInt8 bValue; // Request return value -} LTW_REQ_REPLY_HEADER; - -typedef LTW_REQ_REPLY_HEADER LTW_REQ_GET_SET_PARM_REPLY; - -class RCX_USBTowerPipe_fbsd : public RCX_Pipe -{ -public: - RCX_USBTowerPipe_fbsd(); - ~RCX_USBTowerPipe_fbsd() { Close(); } - - virtual RCX_Result Open(const char *name, int mode); - virtual void Close(); - - virtual int GetCapabilities() const; - virtual RCX_Result SetMode(int mode); - - virtual long Read(void *ptr, long count, long timeout_ms); - virtual long Write(const void *ptr, long count); - -private: - enum { - kReadPacketSize = 8 - }; - - IOReturn OpenDevice(short vendorID, short productID); - IOReturn OpenInterface(); - IOReturn ControlRequest(UInt8 request, UInt16 value); - IOReturn ControlRequest(UInt8 request, UInt8 loByte, UInt8 hiByte) { - return ControlRequest(request, loByte + (hiByte << 8)); - } - - int fdCntrl; - int fdRd; - int fdWr; - - char *devname; -}; - - -RCX_Pipe* RCX_NewUSBTowerPipe() -{ - return new RCX_USBTowerPipe_fbsd(); -} - - -RCX_USBTowerPipe_fbsd::RCX_USBTowerPipe_fbsd() - : fdCntrl(0), devname(0) -{ -} - - -RCX_Result RCX_USBTowerPipe_fbsd::Open(const char *name, int mode) -{ - IOReturn err; - - if (mode != kNormalIrMode) return kRCX_PipeModeError; - - err = OpenDevice(kVendorID, kProductID); - PREQUIRENOT(err, Fail_OpenDevice); - - err = OpenInterface(); - PREQUIRENOT(err, Fail_OpenInterface); - - UInt8 range; - range = (strcmp(name, "short")==0) ? LTW_RANGE_SHORT : LTW_RANGE_MEDIUM; - ControlRequest(LTW_REQ_SET_PARM, LTW_PARM_RANGE,range); - - return 0; - -Fail_OpenInterface: -Fail_OpenDevice: - Close(); - return kRCX_OpenSerialError; -} - - -void RCX_USBTowerPipe_fbsd::Close() -{ - if (devname != NULL) { - close(fdWr); - close(fdRd); - close(fdCntrl); - devname = NULL; - } -} - - -int RCX_USBTowerPipe_fbsd::GetCapabilities() const -{ - return kNormalIrMode | kFastIrMode | kFastOddParityFlag | kAbsorb55Flag; -} - - -RCX_Result RCX_USBTowerPipe_fbsd::SetMode(int mode) -{ - switch(mode) { - case kNormalIrMode: - ControlRequest(LTW_REQ_SET_TX_SPEED, SPEED_COMM_BAUD_2400); - ControlRequest(LTW_REQ_SET_RX_SPEED, SPEED_COMM_BAUD_2400); - return kRCX_OK; - case kFastIrMode: - ControlRequest(LTW_REQ_SET_PARM, LTW_PARM_RANGE, LTW_RANGE_SHORT); - ControlRequest(LTW_REQ_SET_TX_SPEED, SPEED_COMM_BAUD_4800); - ControlRequest(LTW_REQ_SET_RX_SPEED, SPEED_COMM_BAUD_4800); - ControlRequest(LTW_REQ_SET_TX_CARRIER_FREQUENCY, 38); - return kRCX_OK; - default: - return kRCX_PipeModeError; - } -} - - -#define MAX_PACKET 200 - -long RCX_USBTowerPipe_fbsd::Write(const void *ptr, long length) -{ - const unsigned char *data = (const unsigned char *)ptr; - - int total = 0; - -// printf("Write %ld\n", length); - - while(length > 0) { - IOReturn err; - int count = length; - if (count > MAX_PACKET) - count = MAX_PACKET; - err = write(fdWr, (void *)data, count); - if (err == count) - err = 0; - PREQUIRENOT(err, Fail_WritePipe); - - length -= count; - data += count; - total += count; - } - -Fail_WritePipe: -// printf("Done %d\n", total); - return total; -} - - - -long RCX_USBTowerPipe_fbsd::Read(void *data, long length, long timeout_ms) -{ - const unsigned char *rdptr = (const unsigned char *)data; - IOReturn err; - int count; - int total = 0; - struct pollfd pfd; - -// printf("Read %ld, timeout %ld\n", length, timeout_ms); - while(length > 0) { - pfd.fd = fdRd; - pfd.events = POLLIN; - err = poll(&pfd, 1, timeout_ms); - if (err == 0) - break; - if (err == -1) { - if(errno == EINTR) - continue; - else - break; - } - count = length; - if (count > MAX_PACKET) - count = MAX_PACKET; - err = read(fdRd, (void *)rdptr, count); - if (err == -1) - break; - -// printf("err %d\n", err); - if (err == 0 || err == -1) - goto Fail_ReadPipe; - - count = err; - length -= count; - rdptr += count; - total += count; - } - -Fail_ReadPipe: -// printf("Got %d\n", total); - return total; -} - - -IOReturn RCX_USBTowerPipe_fbsd::OpenDevice(short vendorID, short productID) -{ - char *dn = "/dev/ugen0"; - int err, fd; - usb_device_descriptor_t usbdd; - - fd = open(dn, O_RDWR); - if (fd == -1) - return errno; - err = ioctl(fd, USB_GET_DEVICE_DESC, &usbdd); - if (err == -1) { - perror("ioctl error"); - return errno; - } -// printf("idVendor %d\n", UGETW(usbdd.idVendor)); -// printf("idProduct %d\n", UGETW(usbdd.idProduct)); - if (UGETW(usbdd.idVendor) != kVendorID || - UGETW(usbdd.idProduct) != kProductID) { - fprintf(stderr, "This is not an USB IR Tower!\n"); - return -1; - } - - devname = dn; - fdCntrl = fd; - - return 0; -} - - -IOReturn RCX_USBTowerPipe_fbsd::OpenInterface() -{ - char *dn; - int err, iov; - - dn = (char *)malloc(strlen(devname) + 2 + 1); - strcpy(dn, devname); - strcat(dn, ".1"); - fdRd = open(dn, O_RDONLY|O_NONBLOCK); - if (fdRd == -1) { - perror(dn); - return -1; - } - iov = 1; - err = ioctl(fdRd, USB_SET_SHORT_XFER, &iov); - if (fdRd == -1) { - perror("ioctl USB_SET_SHORT_XFER"); - return -1; - } - iov = 5000; - err = ioctl(fdRd, USB_SET_TIMEOUT, &iov); - if (fdRd == -1) { - perror("ioctl USB_SET_TIMEOUT"); - return -1; - } - - strcpy(dn, devname); - strcat(dn, ".2"); - fdWr = open(dn, O_WRONLY); - iov = 5000; -// ioctl(fdWr, USB_SET_TIMEOUT, &iov); - - return 0; -} - - -IOReturn RCX_USBTowerPipe_fbsd::ControlRequest(UInt8 request, UInt16 value) -{ - IOReturn err; - struct usb_ctl_request req; - LTW_REQ_GET_SET_PARM_REPLY reply; - - req.ucr_request.bmRequestType = UT_READ_VENDOR_DEVICE; - req.ucr_request.bRequest = request; - USETW(req.ucr_request.wValue, value); - USETW(req.ucr_request.wIndex, 0); - USETW(req.ucr_request.wLength, sizeof(reply)); - req.ucr_data = &reply; - - err = ioctl(fdCntrl, USB_DO_REQUEST, &req); - - // size of actual reply in req.wLenDone - //printf("%d %d %d\n", reply.wNoOfBytes, reply.bErrCode, reply.bValue); - - return err; -} diff --git a/lang/nqc/files/patch-RCX_Image.h b/lang/nqc/files/patch-RCX_Image.h deleted file mode 100644 index 1f3c1b74ae23..000000000000 --- a/lang/nqc/files/patch-RCX_Image.h +++ /dev/null @@ -1,18 +0,0 @@ ---- rcxlib/RCX_Image.h.org Sun Nov 9 06:14:23 2003 -+++ rcxlib/RCX_Image.h Tue Aug 17 12:58:19 2004 -@@ -78,7 +78,6 @@ - void Clear(); - int GetSize() const; - --private: - class Chunk - { - public: -@@ -106,6 +105,7 @@ - friend class RCX_Image; - }; - -+private: - struct Variable - { - int fIndex; diff --git a/lang/nqc/files/patch-RCX_USBTowerPipe_fbsd.cpp b/lang/nqc/files/patch-RCX_USBTowerPipe_fbsd.cpp new file mode 100644 index 000000000000..5448e8463d6d --- /dev/null +++ b/lang/nqc/files/patch-RCX_USBTowerPipe_fbsd.cpp @@ -0,0 +1,10 @@ +--- rcxlib/RCX_USBTowerPipe_fbsd.cpp.org Mon Jun 13 21:36:21 2005 ++++ rcxlib/RCX_USBTowerPipe_fbsd.cpp Sun Jul 3 21:30:09 2005 +@@ -224,6 +224,7 @@ + while(length > 0) { + pfd.fd = fdRd; + pfd.events = POLLIN; ++ usleep(timeout_ms * 1000 / 8); + err = poll(&pfd, 1, timeout_ms); + if (err == 0) + break; diff --git a/lang/nqc/files/patch-aa b/lang/nqc/files/patch-aa deleted file mode 100644 index fd5553e04c4b..000000000000 --- a/lang/nqc/files/patch-aa +++ /dev/null @@ -1,102 +0,0 @@ ---- Makefile.orig Sun Nov 9 06:14:20 2003 -+++ Makefile Tue Nov 25 19:51:54 2003 -@@ -28,20 +28,20 @@ - # - # Pick your C++ compiler. - # --CC=g++ -+CXX?=${CXX} - # CC=gcc - - # - # Pick your YACC processor - # --YACC = bison -y --# YACC = yacc -+# YACC = bison -y -+YACC ?= yacc - - # - # Define the FLEX processor - # note - lex will not work - # --FLEX = flex -+FLEX ?= flex - - # Link in any necessary C++ libraries - # -@@ -50,19 +50,20 @@ - - - # installation information --BINDIR=/usr/local/bin --MANDIR=/usr/local/man/man1 -+PREFIX?=/usr/local -+BINDIR=$(PREFIX)/bin -+MANDIR=$(PREFIX)/man/man1 - MANEXT=1 - - - # other commands --CP=cp -f --MKDIR=mkdir --MV=mv -f --RM=rm -f -+CP?=cp -f -+MKDIR?=mkdir -+MV?=mv -f -+RM?=rm -f - - # CFLAGS --CFLAGS = -pipe -Iplatform -Ircxlib -Inqc -Icompiler -Wall -Wstrict-prototypes -Wmissing-prototypes -+CFLAGS += -Iplatform -Ircxlib -Inqc -Icompiler - - USBOBJ = rcxlib/RCX_USBTowerPipe_none.o - -@@ -87,18 +88,23 @@ - # Solaris - CFLAGS += -DSOLARIS - else -+ifneq (,$(strip $(findstring $(OSTYPE), FreeBSD))) -+ # FreeBSD -+ USBOBJ = rcxlib/RCX_USBTowerPipe_fbsd.o -+else - # default Unix build without USB support - CFLAGS += -O6 - endif - endif - endif -+endif - - - # this must happen after the platform tweaks just in case the platform - # wants to redefine the default serial name - # - ifndef DEFAULT_SERIAL_NAME -- DEFAULT_SERIAL_NAME = "/dev/ttyS0" -+ DEFAULT_SERIAL_NAME = "/dev/cuaa0" - endif - CFLAGS += -DDEFAULT_SERIAL_NAME='$(DEFAULT_SERIAL_NAME)' - -@@ -150,10 +156,10 @@ - $(MKDIR) bin - - bin/nqc : compiler/parse.cpp $(OBJ) -- $(CC) -o $@ $(OBJ) $(LIBS) -+ $(CXX) -o $@ $(OBJ) $(LIBS) - - bin/mkdata : mkdata/mkdata.cpp nqc/SRecord.cpp -- $(CC) -o bin/mkdata -Inqc/ -Iplatform/ mkdata/mkdata.cpp nqc/SRecord.cpp -+ $(CXX) -o bin/mkdata -Inqc/ -Iplatform/ mkdata/mkdata.cpp nqc/SRecord.cpp - - # - # clean up stuff -@@ -213,7 +219,7 @@ - # general rule for compiling - # - .cpp.o: -- $(CC) -c $(CFLAGS) $< -o $*.o -+ $(CXX) -c $(CFLAGS) $< -o $*.o - - - # |