Date: Fri, 16 Feb 2001 15:36:27 -0800 (PST) From: bruno@tinkerbox.org To: FreeBSD-gnats-submit@freebsd.org Subject: ports/25154: my previous port of uisp was full of errors, sorry. Message-ID: <20010216233627.43CE91978@mail.tinkerbox.org>
next in thread | raw e-mail | index | archive | help
>Number: 25154 >Category: ports >Synopsis: atmel AVR microcontroller in-circuit programmer >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Feb 16 15:40:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: bruno >Release: FreeBSD 4.2-RELEASE i386 >Organization: tinkerbox.org >Environment: FreeBSD 4.2-RELEASE i386 >Description: software to program an atmel AVR microcontroller through parallel or serial port >How-To-Repeat: N/A >Fix: # 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: # # uisp # uisp/Makefile # uisp/files # uisp/files/patch-ae # uisp/files/patch-ad # uisp/files/patch-ac # uisp/files/patch-ab # uisp/files/patch-aa # uisp/pkg-descr # uisp/pkg-comment # uisp/pkg-plist # uisp/distinfo # echo c - uisp mkdir -p uisp > /dev/null 2>&1 echo x - uisp/Makefile sed 's/^X//' >uisp/Makefile << 'END-of-uisp/Makefile' X# New ports collection makefile for: uisp X# Date created: 17 Feb 2001 X# Whom: Bruno Schwander<bruno@tinkerbox.org> X# X# $FreeBSD$ X# X XPORTNAME= uisp XPORTVERSION= 1.0b XPORTREVISION= 1 XCATEGORIES= devel XMASTER_SITES= http://medo.fov.uni-mb.si/mapp/uTools/ XEXTRACT_SUFX= .src.tar.gz X XMAINTAINER= ports@FreeBSD.org X XUSE_GMAKE= yes X XWRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}/src X X.include <bsd.port.mk> END-of-uisp/Makefile echo c - uisp/files mkdir -p uisp/files > /dev/null 2>&1 echo x - uisp/files/patch-ae sed 's/^X//' >uisp/files/patch-ae << 'END-of-uisp/files/patch-ae' X--- linux_serial_reg.h.orig Thu Jan 1 00:00:00 1970 X+++ linux_serial_reg.h Fri Feb 16 20:04:51 2001 X@@ -0,0 +1,144 @@ X+/* X+ * include/linux/serial_reg.h X+ * X+ * Copyright (C) 1992, 1994 by Theodore Ts'o. X+ * X+ * Redistribution of this file is permitted under the terms of the GNU X+ * Public License (GPL) X+ * X+ * These are the UART port assignments, expressed as offsets from the base X+ * register. These assignments should hold for any serial port based on X+ * a 8250, 16450, or 16550(A). X+ */ X+ X+#ifndef _LINUX_SERIAL_REG_H X+#define _LINUX_SERIAL_REG_H X+ X+#define UART_RX 0 /* In: Receive buffer (DLAB=0) */ X+#define UART_TX 0 /* Out: Transmit buffer (DLAB=0) */ X+#define UART_DLL 0 /* Out: Divisor Latch Low (DLAB=1) */ X+#define UART_DLM 1 /* Out: Divisor Latch High (DLAB=1) */ X+#define UART_IER 1 /* Out: Interrupt Enable Register */ X+#define UART_IIR 2 /* In: Interrupt ID Register */ X+#define UART_FCR 2 /* Out: FIFO Control Register */ X+#define UART_EFR 2 /* I/O: Extended Features Register */ X+ /* (DLAB=1, 16C660 only) */ X+#define UART_LCR 3 /* Out: Line Control Register */ X+#define UART_MCR 4 /* Out: Modem Control Register */ X+#define UART_LSR 5 /* In: Line Status Register */ X+#define UART_MSR 6 /* In: Modem Status Register */ X+#define UART_SCR 7 /* I/O: Scratch Register */ X+ X+/* X+ * These are the definitions for the FIFO Control Register X+ * (16650 only) X+ */ X+#define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */ X+#define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */ X+#define UART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */ X+#define UART_FCR_DMA_SELECT 0x08 /* For DMA applications */ X+#define UART_FCR_TRIGGER_MASK 0xC0 /* Mask for the FIFO trigger range */ X+#define UART_FCR_TRIGGER_1 0x00 /* Mask for trigger set at 1 */ X+#define UART_FCR_TRIGGER_4 0x40 /* Mask for trigger set at 4 */ X+#define UART_FCR_TRIGGER_8 0x80 /* Mask for trigger set at 8 */ X+#define UART_FCR_TRIGGER_14 0xC0 /* Mask for trigger set at 14 */ X+/* 16650 redefinitions */ X+#define UART_FCR6_R_TRIGGER_8 0x00 /* Mask for receive trigger set at 1 */ X+#define UART_FCR6_R_TRIGGER_16 0x40 /* Mask for receive trigger set at 4 */ X+#define UART_FCR6_R_TRIGGER_24 0x80 /* Mask for receive trigger set at 8 */ X+#define UART_FCR6_R_TRIGGER_28 0xC0 /* Mask for receive trigger set at 14 */ X+#define UART_FCR6_T_TRIGGER_16 0x00 /* Mask for transmit trigger set at 16 */ X+#define UART_FCR6_T_TRIGGER_8 0x10 /* Mask for transmit trigger set at 8 */ X+#define UART_FCR6_T_TRIGGER_24 0x20 /* Mask for transmit trigger set at 24 */ X+#define UART_FCR6_T_TRIGGER_30 0x30 /* Mask for transmit trigger set at 30 */ X+/* TI 16750 definitions */ X+#define UART_FCR7_64BYTE 0x20 /* Go into 64 byte mode */ X+ X+/* X+ * These are the definitions for the Line Control Register X+ * X+ * Note: if the word length is 5 bits (UART_LCR_WLEN5), then setting X+ * UART_LCR_STOP will select 1.5 stop bits, not 2 stop bits. X+ */ X+#define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ X+#define UART_LCR_SBC 0x40 /* Set break control */ X+#define UART_LCR_SPAR 0x20 /* Stick parity (?) */ X+#define UART_LCR_EPAR 0x10 /* Even parity select */ X+#define UART_LCR_PARITY 0x08 /* Parity Enable */ X+#define UART_LCR_STOP 0x04 /* Stop bits: 0=1 stop bit, 1= 2 stop bits */ X+#define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */ X+#define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */ X+#define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */ X+#define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */ X+ X+/* X+ * These are the definitions for the Line Status Register X+ */ X+#define UART_LSR_TEMT 0x40 /* Transmitter empty */ X+#define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */ X+#define UART_LSR_BI 0x10 /* Break interrupt indicator */ X+#define UART_LSR_FE 0x08 /* Frame error indicator */ X+#define UART_LSR_PE 0x04 /* Parity error indicator */ X+#define UART_LSR_OE 0x02 /* Overrun error indicator */ X+#define UART_LSR_DR 0x01 /* Receiver data ready */ X+ X+/* X+ * These are the definitions for the Interrupt Identification Register X+ */ X+#define UART_IIR_NO_INT 0x01 /* No interrupts pending */ X+#define UART_IIR_ID 0x06 /* Mask for the interrupt ID */ X+ X+#define UART_IIR_MSI 0x00 /* Modem status interrupt */ X+#define UART_IIR_THRI 0x02 /* Transmitter holding register empty */ X+#define UART_IIR_RDI 0x04 /* Receiver data interrupt */ X+#define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */ X+ X+/* X+ * These are the definitions for the Interrupt Enable Register X+ */ X+#define UART_IER_MSI 0x08 /* Enable Modem status interrupt */ X+#define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */ X+#define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */ X+#define UART_IER_RDI 0x01 /* Enable receiver data interrupt */ X+/* X+ * Sleep mode for ST16650 and TI16750. X+ * Note that for 16650, EFR-bit 4 must be selected as well. X+ */ X+#define UART_IERX_SLEEP 0x10 /* Enable sleep mode */ X+ X+/* X+ * These are the definitions for the Modem Control Register X+ */ X+#define UART_MCR_LOOP 0x10 /* Enable loopback test mode */ X+#define UART_MCR_OUT2 0x08 /* Out2 complement */ X+#define UART_MCR_OUT1 0x04 /* Out1 complement */ X+#define UART_MCR_RTS 0x02 /* RTS complement */ X+#define UART_MCR_DTR 0x01 /* DTR complement */ X+ X+/* X+ * These are the definitions for the Modem Status Register X+ */ X+#define UART_MSR_DCD 0x80 /* Data Carrier Detect */ X+#define UART_MSR_RI 0x40 /* Ring Indicator */ X+#define UART_MSR_DSR 0x20 /* Data Set Ready */ X+#define UART_MSR_CTS 0x10 /* Clear to Send */ X+#define UART_MSR_DDCD 0x08 /* Delta DCD */ X+#define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */ X+#define UART_MSR_DDSR 0x02 /* Delta DSR */ X+#define UART_MSR_DCTS 0x01 /* Delta CTS */ X+#define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */ X+ X+/* X+ * These are the definitions for the Extended Features Register X+ * (StarTech 16C660 only, when DLAB=1) X+ */ X+#define UART_EFR_CTS 0x80 /* CTS flow control */ X+#define UART_EFR_RTS 0x40 /* RTS flow control */ X+#define UART_EFR_SCD 0x20 /* Special character detect */ X+#define UART_EFR_ECB 0x10 /* Enhanced control bit */ X+/* X+ * the low four bits control software flow control X+ */ X+ X+#endif /* _LINUX_SERIAL_REG_H */ X+ END-of-uisp/files/patch-ae echo x - uisp/files/patch-ad sed 's/^X//' >uisp/files/patch-ad << 'END-of-uisp/files/patch-ad' X--- linux_lp.h.orig Thu Jan 1 00:00:00 1970 X+++ linux_lp.h Fri Feb 16 19:44:52 2001 X@@ -0,0 +1,188 @@ X+#ifndef _LINUX_LP_H X+#define _LINUX_LP_H X+ X+/* X+ * usr/include/linux/lp.h c.1991-1992 James Wiegand X+ * many modifications copyright (C) 1992 Michael K. Johnson X+ * Interrupt support added 1993 Nigel Gamble X+ */ X+ X+/* X+ * Per POSIX guidelines, this module reserves the LP and lp prefixes X+ * These are the lp_table[minor].flags flags... X+ */ X+#define LP_EXIST 0x0001 X+#define LP_SELEC 0x0002 X+#define LP_BUSY 0x0004 X+#define LP_BUSY_BIT_POS 2 X+#define LP_OFFL 0x0008 X+#define LP_NOPA 0x0010 X+#define LP_ERR 0x0020 X+#define LP_ABORT 0x0040 X+#define LP_CAREFUL 0x0080 /* obsoleted -arca */ X+#define LP_ABORTOPEN 0x0100 X+#define LP_TRUST_IRQ 0x0200 X+ X+/* timeout for each character. This is relative to bus cycles -- it X+ * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you X+ * have extremely slow printing, or if the machine seems to slow down X+ * a lot when you print. If you have slow printing, increase this X+ * number and recompile, and if your system gets bogged down, decrease X+ * this number. This can be changed with the tunelp(8) command as well. X+ */ X+ X+#define LP_INIT_CHAR 1000 X+ X+/* The parallel port specs apparently say that there needs to be X+ * a .5usec wait before and after the strobe. X+ */ X+ X+#define LP_INIT_WAIT 1 X+ X+/* This is the amount of time that the driver waits for the printer to X+ * catch up when the printer's buffer appears to be filled. If you X+ * want to tune this and have a fast printer (i.e. HPIIIP), decrease X+ * this number, and if you have a slow printer, increase this number. X+ * This is in hundredths of a second, the default 2 being .05 second. X+ * Or use the tunelp(8) command, which is especially nice if you want X+ * change back and forth between character and graphics printing, which X+ * are wildly different... X+ */ X+ X+#define LP_INIT_TIME 2 X+ X+/* IOCTL numbers */ X+#define LPCHAR 0x0601 /* corresponds to LP_INIT_CHAR */ X+#define LPTIME 0x0602 /* corresponds to LP_INIT_TIME */ X+#define LPABORT 0x0604 /* call with TRUE arg to abort on error, X+ FALSE to retry. Default is retry. */ X+#define LPSETIRQ 0x0605 /* call with new IRQ number, X+ or 0 for polling (no IRQ) */ X+#define LPGETIRQ 0x0606 /* get the current IRQ number */ X+#define LPWAIT 0x0608 /* corresponds to LP_INIT_WAIT */ X+/* NOTE: LPCAREFUL is obsoleted and it' s always the default right now -arca */ X+#define LPCAREFUL 0x0609 /* call with TRUE arg to require out-of-paper, off- X+ line, and error indicators good on all writes, X+ FALSE to ignore them. Default is ignore. */ X+#define LPABORTOPEN 0x060a /* call with TRUE arg to abort open() on error, X+ FALSE to ignore error. Default is ignore. */ X+#define LPGETSTATUS 0x060b /* return LP_S(minor) */ X+#define LPRESET 0x060c /* reset printer */ X+#ifdef LP_STATS X+#define LPGETSTATS 0x060d /* get statistics (struct lp_stats) */ X+#endif X+#define LPGETFLAGS 0x060e /* get status flags */ X+#define LPTRUSTIRQ 0x060f /* set/unset the LP_TRUST_IRQ flag */ X+ X+/* timeout for printk'ing a timeout, in jiffies (100ths of a second). X+ This is also used for re-checking error conditions if LP_ABORT is X+ not set. This is the default behavior. */ X+ X+#define LP_TIMEOUT_INTERRUPT (60 * HZ) X+#define LP_TIMEOUT_POLLED (10 * HZ) X+ X+#ifdef __KERNEL__ X+ X+/* Magic numbers for defining port-device mappings */ X+#define LP_PARPORT_UNSPEC -4 X+#define LP_PARPORT_AUTO -3 X+#define LP_PARPORT_OFF -2 X+#define LP_PARPORT_NONE -1 X+ X+#define LP_F(minor) lp_table[(minor)].flags /* flags for busy, etc. */ X+#define LP_CHAR(minor) lp_table[(minor)].chars /* busy timeout */ X+#define LP_TIME(minor) lp_table[(minor)].time /* wait time */ X+#define LP_WAIT(minor) lp_table[(minor)].wait /* strobe wait */ X+#define LP_IRQ(minor) lp_table[(minor)].dev->port->irq /* interrupt # */ X+ /* PARPORT_IRQ_NONE means polled */ X+#ifdef LP_STATS X+#define LP_STAT(minor) lp_table[(minor)].stats /* statistics area */ X+#endif X+#define LP_BUFFER_SIZE 256 X+ X+#define LP_BASE(x) lp_table[(x)].dev->port->base X+ X+#ifdef LP_STATS X+struct lp_stats { X+ unsigned long chars; X+ unsigned long sleeps; X+ unsigned int maxrun; X+ unsigned int maxwait; X+ unsigned int meanwait; X+ unsigned int mdev; X+}; X+#endif X+ X+struct lp_struct { X+ struct pardevice *dev; X+ unsigned long flags; X+ unsigned int chars; X+ unsigned int time; X+ unsigned int wait; X+ char *lp_buffer; X+#ifdef LP_STATS X+ unsigned int lastcall; X+ unsigned int runchars; X+ struct lp_stats stats; X+#endif X+ struct wait_queue *wait_q; X+ unsigned int last_error; X+ volatile unsigned int irq_detected:1; X+ volatile unsigned int irq_missed:1; X+}; X+ X+/* X+ * The following constants describe the various signals of the printer port X+ * hardware. Note that the hardware inverts some signals and that some X+ * signals are active low. An example is LP_STROBE, which must be programmed X+ * with 1 for being active and 0 for being inactive, because the strobe signal X+ * gets inverted, but it is also active low. X+ */ X+ X+/* X+ * bit defines for 8255 status port X+ * base + 1 X+ * accessed with LP_S(minor), which gets the byte... X+ */ X+#define LP_PBUSY 0x80 /* inverted input, active high */ X+#define LP_PACK 0x40 /* unchanged input, active low */ X+#define LP_POUTPA 0x20 /* unchanged input, active high */ X+#define LP_PSELECD 0x10 /* unchanged input, active high */ X+#define LP_PERRORP 0x08 /* unchanged input, active low */ X+ X+/* X+ * defines for 8255 control port X+ * base + 2 X+ * accessed with LP_C(minor) X+ */ X+#define LP_PINTEN 0x10 /* high to read data in or-ed with data out */ X+#define LP_PSELECP 0x08 /* inverted output, active low */ X+#define LP_PINITP 0x04 /* unchanged output, active low */ X+#define LP_PAUTOLF 0x02 /* inverted output, active low */ X+#define LP_PSTROBE 0x01 /* short high output on raising edge */ X+ X+/* X+ * the value written to ports to test existence. PC-style ports will X+ * return the value written. AT-style ports will return 0. so why not X+ * make them the same ? X+ */ X+#define LP_DUMMY 0x00 X+ X+/* X+ * This is the port delay time, in microseconds. X+ * It is used only in the lp_init() and lp_reset() routine. X+ */ X+#define LP_DELAY 50 X+ X+#define LP_POLLED(minor) (lp_table[(minor)].dev->port->irq == PARPORT_IRQ_NONE) X+#define LP_PREEMPTED(minor) (lp_table[(minor)].dev->port->waithead != NULL) X+ X+/* X+ * function prototypes X+ */ X+ X+extern int lp_init(void); X+ X+#endif X+ X+#endif END-of-uisp/files/patch-ad echo x - uisp/files/patch-ac sed 's/^X//' >uisp/files/patch-ac << 'END-of-uisp/files/patch-ac' X--- Serial.C.orig Tue Aug 29 17:08:28 2000 X+++ Serial.C Fri Feb 16 19:33:18 2001 X@@ -10,7 +10,11 @@ X #include <stdio.h> X #include <stdlib.h> X #include <unistd.h> X+#if defined (__FreeBSD__) X+#include <termios.h> X+#else X #include <termio.h> X+#endif X #include <fcntl.h> X #include "Global.h" X #include "Serial.h" END-of-uisp/files/patch-ac echo x - uisp/files/patch-ab sed 's/^X//' >uisp/files/patch-ab << 'END-of-uisp/files/patch-ab' X--- DAPA.h.orig Tue Aug 29 17:08:28 2000 X+++ DAPA.h Fri Feb 16 19:58:33 2001 X@@ -12,7 +12,9 @@ X #include <sys/types.h> X #include <time.h> X #include <unistd.h> X+#if !defined (__FreeBSD__) X #include <string> X+#endif X #include "Error.h" X X class TDAPA { END-of-uisp/files/patch-ab echo x - uisp/files/patch-aa sed 's/^X//' >uisp/files/patch-aa << 'END-of-uisp/files/patch-aa' X--- DAPA.C.orig Tue Aug 29 17:08:28 2000 X+++ DAPA.C Fri Feb 16 20:57:23 2001 X@@ -20,6 +20,7 @@ X X #include <stdio.h> X #include <stdlib.h> X+#if !defined (__FreeBSD__) X #include <linux/serial_reg.h> X X /* sys/io.h is the correct file. If your system doesn't have that X@@ -35,8 +36,20 @@ X #endif X */ X #include "io_uisp.h" X+#endif X X #include <unistd.h> X+ X+#if defined(__FreeBSD__) X+#define __KERNEL__ X+#define LP_STATS X+#include "linux_lp.h" X+#undef __KERNEL__ X+#undef LP_STATS X+#include "linux_serial_reg.h" X+#endif X+ X+#if !defined (__FreeBSD__) X #ifdef DIRTYHACK X #define __KERNEL__ X #endif X@@ -44,6 +57,14 @@ X #ifdef DIRTYHACK X #undef __KERNEL__ X #endif X+#else X+#include <sys/fcntl.h> X+#include <machine/cpufunc.h> X+#include <machine/sysarch.h> X+#define ioperm i386_set_ioperm X+#define _outb(a,b) outb(b,a) X+#endif X+ X #include <signal.h> X #include <sys/time.h> X #include "Global.h" X@@ -133,51 +154,51 @@ X void TDAPA::Reset(){ X switch(pa_type){ X case PAT_DAPA: X- outb(DAPA_SCK, BASE+2); usleep(1000); /* sck = 0, reset = 0 */ X- outb(DAPA_SCK | DAPA_RESET, BASE+2); /* sck = 0, reset = 1 */ X+ _outb(DAPA_SCK, BASE+2); usleep(1000); /* sck = 0, reset = 0 */ X+ _outb(DAPA_SCK | DAPA_RESET, BASE+2); /* sck = 0, reset = 1 */ X usleep(1000); X- outb(DAPA_SCK, BASE+2); usleep(1000); /* sck = 0, reset = 0 */ X+ _outb(DAPA_SCK, BASE+2); usleep(1000); /* sck = 0, reset = 0 */ X break; X X case PAT_DASA: X- outb(UART_LCR_WLEN8 | UART_LCR_SBC, UART_LCR+BASE); /* select IER and FCR */ X- outb(UART_MCR_DTR | UART_MCR_RTS, UART_MCR+BASE); /* enable port, no int. */ X- outb(0, UART_IER+BASE); /* disable int */ X- outb(UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, UART_FCR+BASE); /* disable fifo */ X+ _outb(UART_LCR_WLEN8 | UART_LCR_SBC, UART_LCR+BASE); /* select IER and FCR */ X+ _outb(UART_MCR_DTR | UART_MCR_RTS, UART_MCR+BASE); /* enable port, no int. */ X+ _outb(0, UART_IER+BASE); /* disable int */ X+ _outb(UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, UART_FCR+BASE); /* disable fifo */ X inb(UART_LSR+BASE); /* read int flags to clear them for good */ X inb(UART_RX+BASE); /* read int flags to clear them for good */ X inb(UART_IIR+BASE); /* read int flags to clear them for good */ X inb(UART_MSR+BASE); /* read int flags to clear them for good */ X usleep(100000); /* clk = sck = reset = 1 */ X- outb(0, UART_LCR+BASE); usleep(1000); /* clk = 0, sck = 1, reset = 1 */ X- outb(DASA_RESET, UART_MCR+BASE); usleep(1000); /* clk = 0, sck = 0, reset = 1 */ X- outb(0, UART_MCR+BASE); usleep(1000); /* clk = 0, sck = 0, reset = 0 */ X+ _outb(0, UART_LCR+BASE); usleep(1000); /* clk = 0, sck = 1, reset = 1 */ X+ _outb(DASA_RESET, UART_MCR+BASE); usleep(1000); /* clk = 0, sck = 0, reset = 1 */ X+ _outb(0, UART_MCR+BASE); usleep(1000); /* clk = 0, sck = 0, reset = 0 */ X break; X X case PAT_STK200: X- outb(STK2_ENA1 | STK2_ENA2, BASE); /* leave MCU */ X+ _outb(STK2_ENA1 | STK2_ENA2, BASE); /* leave MCU */ X usleep(30000); X- outb(STK2_ENA2, BASE); usleep(1000); /* sck = Z, reset = 0 */ X- outb(0, BASE); usleep(1000); /* sck = 0, reset = 0 */ X- outb(STK2_RESET, BASE); usleep(1000); /* sck = 0, reset = 1 */ X- outb(0, BASE); usleep(1000); /* sck = 0, reset = 0 */ X+ _outb(STK2_ENA2, BASE); usleep(1000); /* sck = Z, reset = 0 */ X+ _outb(0, BASE); usleep(1000); /* sck = 0, reset = 0 */ X+ _outb(STK2_RESET, BASE); usleep(1000); /* sck = 0, reset = 1 */ X+ _outb(0, BASE); usleep(1000); /* sck = 0, reset = 0 */ X break; X X case PAT_ABB: X- outb(0,BASE+2); usleep(30000); /* leave MCU */ X- outb(0,BASE); /* reset=sck=0 */ X- outb(ABB_EN,BASE+2); usleep(30000); /* enable 244 driver */ X- outb(ABB_RESET,BASE); usleep(30000); /* reset=1 */ X- outb(0,BASE); usleep(30000); /* reset=0*/ X+ _outb(0,BASE+2); usleep(30000); /* leave MCU */ X+ _outb(0,BASE); /* reset=sck=0 */ X+ _outb(ABB_EN,BASE+2); usleep(30000); /* enable 244 driver */ X+ _outb(ABB_RESET,BASE); usleep(30000); /* reset=1 */ X+ _outb(0,BASE); usleep(30000); /* reset=0*/ X // fprintf(stderr, "quiting ... test\n"); exit(1); X break; X X case PAT_AVRISP: X- outb(AVRISP_ENA, BASE); /* leave MCU */ X+ _outb(AVRISP_ENA, BASE); /* leave MCU */ X usleep(30000); X- outb(0, BASE); usleep(1000); /* sck = 0, reset = 0 */ X- outb(AVRISP_RESET, BASE); usleep(1000); /* sck = 0, reset = 1 */ X- outb(0, BASE); usleep(1000); /* sck = 0, reset = 0 */ X+ _outb(0, BASE); usleep(1000); /* sck = 0, reset = 0 */ X+ _outb(AVRISP_RESET, BASE); usleep(1000); /* sck = 0, reset = 1 */ X+ _outb(0, BASE); usleep(1000); /* sck = 0, reset = 0 */ X break; X X } X@@ -188,7 +209,7 @@ X void TDAPA::JustReset(){ X switch(pa_type){ X case PAT_DAPA: X- outb(DAPA_SCK | DAPA_RESET, BASE+2); /* sck = 0, reset = 1 */ X+ _outb(DAPA_SCK | DAPA_RESET, BASE+2); /* sck = 0, reset = 1 */ X break; X X case PAT_DASA: X@@ -196,16 +217,16 @@ X break; X X case PAT_STK200: X- outb(STK2_ENA2 | STK2_RESET, BASE); /* sck = Z, reset = 1 */ X+ _outb(STK2_ENA2 | STK2_RESET, BASE); /* sck = Z, reset = 1 */ X break; X X case PAT_ABB: X- outb(ABB_EN,BASE+2); /* enable 244 driver */ X- outb(ABB_RESET,BASE); /* reset=1 */ X+ _outb(ABB_EN,BASE+2); /* enable 244 driver */ X+ _outb(ABB_RESET,BASE); /* reset=1 */ X break; X X case PAT_AVRISP: X- outb(AVRISP_ENA | AVRISP_RESET, BASE); /* Leave MCU, reset = 1 */ X+ _outb(AVRISP_ENA | AVRISP_RESET, BASE); /* Leave MCU, reset = 1 */ X break; X } X usleep(20000); X@@ -214,28 +235,28 @@ X void TDAPA::SCKtoRetryEnable(){ X switch(pa_type){ X case PAT_DAPA: X- outb(0, BASE+2); BigDelay(); X- outb(DAPA_SCK, BASE+2); BigDelay(); X+ _outb(0, BASE+2); BigDelay(); X+ _outb(DAPA_SCK, BASE+2); BigDelay(); X break; X X case PAT_DASA: X- outb (DASA_SCK, UART_MCR+BASE); BigDelay (); /* sck = 1 */ X- outb (0, UART_MCR+BASE); BigDelay (); /* sck = 0 */ X+ _outb (DASA_SCK, UART_MCR+BASE); BigDelay (); /* sck = 1 */ X+ _outb (0, UART_MCR+BASE); BigDelay (); /* sck = 0 */ X break; X X case PAT_STK200: X- outb(STK2_SCK, BASE); BigDelay(); /* sck = 1 */ X- outb(0, BASE); BigDelay(); /* sck = 0 */ X+ _outb(STK2_SCK, BASE); BigDelay(); /* sck = 1 */ X+ _outb(0, BASE); BigDelay(); /* sck = 0 */ X break; X X case PAT_ABB: X- outb(ABB_SCK, BASE); BigDelay(); X- outb(0, BASE); BigDelay(); X+ _outb(ABB_SCK, BASE); BigDelay(); X+ _outb(0, BASE); BigDelay(); X break; X X case PAT_AVRISP: X- outb(AVRISP_SCK, BASE); BigDelay(); /* sck = 1 */ X- outb(0, BASE); BigDelay(); /* sck = 0 */ X+ _outb(AVRISP_SCK, BASE); BigDelay(); /* sck = 1 */ X+ _outb(0, BASE); BigDelay(); /* sck = 0 */ X break; X } X } X@@ -246,56 +267,56 @@ X for (i=0, mask = 0x80; i<8; i++, mask >>= 1){ X switch(pa_type){ X case PAT_DAPA: X- outb(b & mask ? DAPA_DOUT : 0, BASE); BigDelay(); X- outb(0, BASE+2); BigDelay (); X+ _outb(b & mask ? DAPA_DOUT : 0, BASE); BigDelay(); X+ _outb(0, BASE+2); BigDelay (); X if (!(inb (BASE+1) & DAPA_DIN)){received |= mask;} X- outb(DAPA_SCK, BASE+2); BigDelay(); X+ _outb(DAPA_SCK, BASE+2); BigDelay(); X break; X X case PAT_DASA: X- outb((b & mask) ? DASA_MOSI : 0, UART_LCR+BASE); /* send data bit, sck = 0 */ X- outb(DASA_SCK, UART_MCR+BASE); /* send data bit, sck = 1 */ X+ _outb((b & mask) ? DASA_MOSI : 0, UART_LCR+BASE); /* send data bit, sck = 0 */ X+ _outb(DASA_SCK, UART_MCR+BASE); /* send data bit, sck = 1 */ X if(longsck > -2) X BigDelay(); X if(i == 0 && longsck > 5) usleep(longsck); /* allow recharging of the capacitor */ X if (inb(UART_MSR+BASE) & DASA_MISO){received |= mask;} /* read data bit */ X- outb(0, UART_MCR+BASE); /* send data bit, sck = 0 */ X- outb(DASA_MOSI, UART_LCR+BASE); /* power it up */ X+ _outb(0, UART_MCR+BASE); /* send data bit, sck = 0 */ X+ _outb(DASA_MOSI, UART_LCR+BASE); /* power it up */ X if(longsck > -1) X BigDelay(); X break; X X case PAT_STK200: X- outb((b & mask) ? STK2_DOUT : 0, BASE); /* send data bit, sck = 0 */ X+ _outb((b & mask) ? STK2_DOUT : 0, BASE); /* send data bit, sck = 0 */ X BigDelay(); X if (inb(BASE + 1) & STK2_DIN){received |= mask;} /* read data bit */ X /* send data bit, sck = 1 */ X- outb(STK2_SCK | ((b & mask) ? STK2_DOUT : 0), BASE); X+ _outb(STK2_SCK | ((b & mask) ? STK2_DOUT : 0), BASE); X BigDelay(); X- outb((b & mask) ? STK2_DOUT : 0, BASE); /* send data bit, sck = 0 */ X+ _outb((b & mask) ? STK2_DOUT : 0, BASE); /* send data bit, sck = 0 */ X BigDelay(); X break; X X case PAT_ABB: X- outb((b & mask) ? ABB_DOUT : 0, BASE); /* send data bit, sck = 0 */ X+ _outb((b & mask) ? ABB_DOUT : 0, BASE); /* send data bit, sck = 0 */ X BigDelay(); X if (!(inb(BASE + 1) & ABB_DIN)){received |= mask;} /* read data bit */ X /* send data bit, sck = 1 */ X- outb(ABB_SCK | ((b & mask) ? ABB_DOUT : 0), BASE); X+ _outb(ABB_SCK | ((b & mask) ? ABB_DOUT : 0), BASE); X BigDelay(); X- outb((b & mask) ? ABB_DOUT : 0, BASE); /* send data bit, sck = 0 */ X+ _outb((b & mask) ? ABB_DOUT : 0, BASE); /* send data bit, sck = 0 */ X BigDelay(); X break; X X case PAT_AVRISP: X- outb((b & mask) ? AVRISP_DOUT : 0, BASE); /* send data bit, sck = 0 */ X+ _outb((b & mask) ? AVRISP_DOUT : 0, BASE); /* send data bit, sck = 0 */ X BigDelay(); X if (inb(BASE + 1) & AVRISP_DIN){received |= mask;} /* read data bit */ X /* send data bit, sck = 1 */ X X- outb(AVRISP_SCK | ((b & mask) ? AVRISP_DOUT : 0), BASE); X+ _outb(AVRISP_SCK | ((b & mask) ? AVRISP_DOUT : 0), BASE); X BigDelay(); X- outb((b & mask) ? AVRISP_DOUT : 0, BASE); /* send data bit, sck = 0 */ X+ _outb((b & mask) ? AVRISP_DOUT : 0, BASE); /* send data bit, sck = 0 */ X BigDelay(); X break; X } X@@ -397,9 +418,9 @@ X if (pa_type == PAT_AVRISP) { /* Check if dongle is present */ X unsigned char avrisp_present=1; X X- outb(AVRISP_DNG_OUT | AVRISP_ENA, BASE); X+ _outb(AVRISP_DNG_OUT | AVRISP_ENA, BASE); X if (!(inb(BASE+1)&AVRISP_DNG_IN)) avrisp_present=0; X- outb(AVRISP_ENA, BASE); X+ _outb(AVRISP_ENA, BASE); X if (inb(BASE+1)&AVRISP_DNG_IN) avrisp_present=0; X if (!(inb(BASE+1)&AVRISP_DNG_IN1)) avrisp_present=0; X if (!avrisp_present) { X@@ -410,12 +431,12 @@ X X TDAPA::~TDAPA(){ X switch(pa_type){ X- case PAT_DAPA: outb(DAPA_SCK | DAPA_RESET, BASE+2); break; X- case PAT_DASA: outb(DASA_RESET | DASA_SCK, UART_MCR+BASE); X- outb(DASA_MOSI, UART_LCR+BASE); break; X- case PAT_STK200: outb(STK2_ENA1 | STK2_ENA2 | STK2_RESET, BASE); break; X- case PAT_ABB: outb(0, BASE+2); outb(ABB_RESET, BASE); break; X- case PAT_AVRISP: outb(AVRISP_ENA | AVRISP_RESET, BASE); break; X+ case PAT_DAPA: _outb(DAPA_SCK | DAPA_RESET, BASE+2); break; X+ case PAT_DASA: _outb(DASA_RESET | DASA_SCK, UART_MCR+BASE); X+ _outb(DASA_MOSI, UART_LCR+BASE); break; X+ case PAT_STK200: _outb(STK2_ENA1 | STK2_ENA2 | STK2_RESET, BASE); break; X+ case PAT_ABB: _outb(0, BASE+2); _outb(ABB_RESET, BASE); break; X+ case PAT_AVRISP: _outb(AVRISP_ENA | AVRISP_RESET, BASE); break; X } X } END-of-uisp/files/patch-aa echo x - uisp/pkg-descr sed 's/^X//' >uisp/pkg-descr << 'END-of-uisp/pkg-descr' XThis is aport of uisp, a tool to program an atmel AVR microcontroller Xthrough your parallel or serial port. Several programming hardware are Xsupported, the only one I have tested and the simplest one (no component) Xis the in-circuit parallel programmer. Schematics are available online. X XWWW: http://medo.fov.uni-mb.si/mapp/uTools/index.html X X- Bruno X Xbruno@tinkerbox.org END-of-uisp/pkg-descr echo x - uisp/pkg-comment sed 's/^X//' >uisp/pkg-comment << 'END-of-uisp/pkg-comment' XA versatile programmer for atmel AVR microcontrollers END-of-uisp/pkg-comment echo x - uisp/pkg-plist sed 's/^X//' >uisp/pkg-plist << 'END-of-uisp/pkg-plist' Xbin/uisp END-of-uisp/pkg-plist echo x - uisp/distinfo sed 's/^X//' >uisp/distinfo << 'END-of-uisp/distinfo' XMD5 (uisp-1.0b.src.tar.gz) = 3945498181030e6c000f705ac53b920f END-of-uisp/distinfo exit >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010216233627.43CE91978>