svn commit: r363290 - stable/11/lib/libc/locale

2020-07-17 Thread Joerg Wunsch
Author: joerg
Date: Fri Jul 17 22:07:19 2020
New Revision: 363290
URL: https://svnweb.freebsd.org/changeset/base/363290

Log:
  MFC r362708
  
  Explain how to learn about possible recognized locale names

Modified:
  stable/11/lib/libc/locale/setlocale.3
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/locale/setlocale.3
==
--- stable/11/lib/libc/locale/setlocale.3   Fri Jul 17 22:04:58 2020
(r363289)
+++ stable/11/lib/libc/locale/setlocale.3   Fri Jul 17 22:07:19 2020
(r363290)
@@ -115,9 +115,24 @@ argument of
 causes
 .Fn setlocale
 to return the current locale.
+.Pp
+The option
+.Fl a
+to the
+.Xr locale 1
+command can be used to display all further possible names for the
+.Fa locale
+argument that are recognized.
+Specifying any unrecognized value for
+.Fa locale
+makes
+.Fn setlocale
+fail.
+.Pp
 By default, C programs start in the
 .Li \&"C"
 locale.
+.Pp
 The only function in the library that sets the locale is
 .Fn setlocale ;
 the locale is never changed as a side effect of some other routine.
@@ -150,6 +165,7 @@ and the category
 .Sh ERRORS
 No errors are defined.
 .Sh SEE ALSO
+.Xr locale 1 ,
 .Xr localedef 1 ,
 .Xr catopen 3 ,
 .Xr ctype 3 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r363289 - stable/12/lib/libc/locale

2020-07-17 Thread Joerg Wunsch
Author: joerg
Date: Fri Jul 17 22:04:58 2020
New Revision: 363289
URL: https://svnweb.freebsd.org/changeset/base/363289

Log:
  MFC r362708
  
  Explain how to learn about possible recognized locale names

Modified:
  stable/12/lib/libc/locale/setlocale.3
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/locale/setlocale.3
==
--- stable/12/lib/libc/locale/setlocale.3   Fri Jul 17 21:55:24 2020
(r363288)
+++ stable/12/lib/libc/locale/setlocale.3   Fri Jul 17 22:04:58 2020
(r363289)
@@ -115,9 +115,24 @@ argument of
 causes
 .Fn setlocale
 to return the current locale.
+.Pp
+The option
+.Fl a
+to the
+.Xr locale 1
+command can be used to display all further possible names for the
+.Fa locale
+argument that are recognized.
+Specifying any unrecognized value for
+.Fa locale
+makes
+.Fn setlocale
+fail.
+.Pp
 By default, C programs start in the
 .Li \&"C"
 locale.
+.Pp
 The only function in the library that sets the locale is
 .Fn setlocale ;
 the locale is never changed as a side effect of some other routine.
@@ -150,6 +165,7 @@ and the category
 .Sh ERRORS
 No errors are defined.
 .Sh SEE ALSO
+.Xr locale 1 ,
 .Xr localedef 1 ,
 .Xr catopen 3 ,
 .Xr ctype 3 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362708 - head/lib/libc/locale

2020-06-27 Thread Joerg Wunsch
Author: joerg
Date: Sat Jun 27 20:55:47 2020
New Revision: 362708
URL: https://svnweb.freebsd.org/changeset/base/362708

Log:
  Explain how to learn about possible recognized locale names
  
  Posix says that the interpretation of the locale string is
  "implementation-defined", so we ought to document what is
  actually recognized.
  
  Also add a cross reference to locale(1).
  
  PR:   247553
  MFC after:1 week

Modified:
  head/lib/libc/locale/setlocale.3

Modified: head/lib/libc/locale/setlocale.3
==
--- head/lib/libc/locale/setlocale.3Sat Jun 27 20:01:56 2020
(r362707)
+++ head/lib/libc/locale/setlocale.3Sat Jun 27 20:55:47 2020
(r362708)
@@ -115,9 +115,24 @@ argument of
 causes
 .Fn setlocale
 to return the current locale.
+.Pp
+The option
+.Fl a
+to the
+.Xr locale 1
+command can be used to display all further possible names for the
+.Fa locale
+argument that are recognized.
+Specifying any unrecognized value for
+.Fa locale
+makes
+.Fn setlocale
+fail.
+.Pp
 By default, C programs start in the
 .Li \&"C"
 locale.
+.Pp
 The only function in the library that sets the locale is
 .Fn setlocale ;
 the locale is never changed as a side effect of some other routine.
@@ -150,6 +165,7 @@ and the category
 .Sh ERRORS
 No errors are defined.
 .Sh SEE ALSO
+.Xr locale 1 ,
 .Xr localedef 1 ,
 .Xr catopen 3 ,
 .Xr ctype 3 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r343226 - stable/11/sys/sys

2019-01-20 Thread Joerg Wunsch
Author: joerg
Date: Sun Jan 20 21:38:24 2019
New Revision: 343226
URL: https://svnweb.freebsd.org/changeset/base/343226

Log:
  MFC r342791: fix a typo in chio(4) (which propagates into chio(1))

Modified:
  stable/11/sys/sys/chio.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/chio.h
==
--- stable/11/sys/sys/chio.hSun Jan 20 21:09:44 2019(r343225)
+++ stable/11/sys/sys/chio.hSun Jan 20 21:38:24 2019(r343226)
@@ -262,7 +262,7 @@ struct changer_set_voltag_request {
 
 
 #defineCESTATUS_BITS   \
-   "\20\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
+   "\20\6INENAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
 
 #defineCHIOMOVE_IOW('c', 0x01, struct changer_move)
 #defineCHIOEXCHANGE_IOW('c', 0x02, struct changer_exchange)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r343227 - stable/10/sys/sys

2019-01-20 Thread Joerg Wunsch
Author: joerg
Date: Sun Jan 20 21:49:13 2019
New Revision: 343227
URL: https://svnweb.freebsd.org/changeset/base/343227

Log:
  MFC r342791: fix a typo in chio(4) (which propagates into chio(1))

Modified:
  stable/10/sys/sys/chio.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/sys/chio.h
==
--- stable/10/sys/sys/chio.hSun Jan 20 21:38:24 2019(r343226)
+++ stable/10/sys/sys/chio.hSun Jan 20 21:49:13 2019(r343227)
@@ -262,7 +262,7 @@ struct changer_set_voltag_request {
 
 
 #defineCESTATUS_BITS   \
-   "\20\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
+   "\20\6INENAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
 
 #defineCHIOMOVE_IOW('c', 0x01, struct changer_move)
 #defineCHIOEXCHANGE_IOW('c', 0x02, struct changer_exchange)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342791 - head/sys/sys

2019-01-05 Thread Joerg Wunsch
Author: joerg
Date: Sat Jan  5 21:07:49 2019
New Revision: 342791
URL: https://svnweb.freebsd.org/changeset/base/342791

Log:
  Fix an old typo in the element status display bits:
  
  INEAB -> INENAB (import is eNabled)
  
  Note that this kernel definition is exported into chio(1), and used
  for element display there.
  
  MFC after:1 week

Modified:
  head/sys/sys/chio.h

Modified: head/sys/sys/chio.h
==
--- head/sys/sys/chio.h Sat Jan  5 19:35:10 2019(r342790)
+++ head/sys/sys/chio.h Sat Jan  5 21:07:49 2019(r342791)
@@ -266,7 +266,7 @@ struct changer_set_voltag_request {
 
 
 #defineCESTATUS_BITS   \
-   "\20\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
+   "\20\6INENAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL"
 
 #defineCHIOMOVE_IOW('c', 0x01, struct changer_move)
 #defineCHIOEXCHANGE_IOW('c', 0x02, struct changer_exchange)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273181 - in head/sys/dev/usb: . serial

2014-10-16 Thread Joerg Wunsch
Author: joerg
Date: Thu Oct 16 19:53:32 2014
New Revision: 273181
URL: https://svnweb.freebsd.org/changeset/base/273181

Log:
  Add the Dresden Elektronik deRFnode device to uftdi(4).
  
  MFC after:1 week

Modified:
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/uftdi.c
==
--- head/sys/dev/usb/serial/uftdi.c Thu Oct 16 19:52:12 2014
(r273180)
+++ head/sys/dev/usb/serial/uftdi.c Thu Oct 16 19:53:32 2014
(r273181)
@@ -298,6 +298,7 @@ static const STRUCT_USB_HOST_ID uftdi_de
UFTDI_DEV(CONTEC, COM1USBH, 0),
UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, 0),
UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 0),
+   UFTDI_DEV(DRESDENELEKTRONIK, DE_RFNODE, 0),
UFTDI_DEV(DRESDENELEKTRONIK, LEVELSHIFTERSTICKLOWCOST, 0),
UFTDI_DEV(ELEKTOR, FT323R, 0),
UFTDI_DEV(EVOLUTION, ER1, 0),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsThu Oct 16 19:52:12 2014(r273180)
+++ head/sys/dev/usb/usbdevsThu Oct 16 19:53:32 2014(r273181)
@@ -1664,6 +1664,7 @@ product DREAMLINK DL100B  0x0004  USB Webm
 /* dresden elektronik products */
 product DRESDENELEKTRONIK SENSORTERMINALBOARD  0x0001 SensorTerminalBoard
 product DRESDENELEKTRONIK WIRELESSHANDHELDTERMINAL  0x0004 Wireless Handheld 
Terminal
+product DRESDENELEKTRONIK DE_RFNODE 0x001c deRFnode
 product DRESDENELEKTRONIK LEVELSHIFTERSTICKLOWCOST  0x0022 Levelshifter Stick 
Low Cost
 
 /* Dynastream Innovations */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269717 - stable/10/sys/cam/scsi

2014-08-08 Thread Joerg Wunsch
Author: joerg
Date: Fri Aug  8 14:42:03 2014
New Revision: 269717
URL: http://svnweb.freebsd.org/changeset/base/269717

Log:
  Merge r269353:
  
  Fix breakage introduced by r256843: removing the SA_CCB_WAITING bit
  left some of the decisions based on its counterpart, SA_CCB_BUFFER_IO
  being random.  As a result, propagation of the residual information
  for the SPACE command was broken, so the number of filemarks
  encountered during a SPACE operation was miscalculated.  Consequently,
  systems relying on properly tracked filemark counters (like Bacula)
  fell apart.
  
  The change also removes a switch/case in sadone() which r256843
  degraded to a single remaining case label.
  
  PR:   192285

Modified:
  stable/10/sys/cam/scsi/scsi_sa.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_sa.c
==
--- stable/10/sys/cam/scsi/scsi_sa.cFri Aug  8 14:23:20 2014
(r269716)
+++ stable/10/sys/cam/scsi/scsi_sa.cFri Aug  8 14:42:03 2014
(r269717)
@@ -113,16 +113,8 @@ typedef enum {
 #define ccb_pflags ppriv_field0
 #define ccb_bp ppriv_ptr1
 
-#defineSA_CCB_BUFFER_IO0x0
-#defineSA_CCB_TYPEMASK 0x1
-#defineSA_POSITION_UPDATED 0x2
-
-#defineSet_CCB_Type(x, type)   \
-   x-ccb_h.ccb_pflags = ~SA_CCB_TYPEMASK;\
-   x-ccb_h.ccb_pflags |= type
-
-#defineCCB_Type(x) (x-ccb_h.ccb_pflags  SA_CCB_TYPEMASK)
-
+/* bits in ccb_pflags */
+#defineSA_POSITION_UPDATED 0x1
 
 
 typedef enum {
@@ -1834,7 +1826,6 @@ again:
bp-bio_data, bp-bio_bcount, SSD_FULL_SIZE,
IO_TIMEOUT);
start_ccb-ccb_h.ccb_pflags = ~SA_POSITION_UPDATED;
-   Set_CCB_Type(start_ccb, SA_CCB_BUFFER_IO);
start_ccb-ccb_h.ccb_bp = bp;
bp = bioq_first(softc-bio_queue);
xpt_action(start_ccb);
@@ -1859,92 +1850,86 @@ sadone(struct cam_periph *periph, union 
 {
struct sa_softc *softc;
struct ccb_scsiio *csio;
+   struct bio *bp;
+   int error;
 
softc = (struct sa_softc *)periph-softc;
csio = done_ccb-csio;
-   switch (CCB_Type(csio)) {
-   case SA_CCB_BUFFER_IO:
-   {
-   struct bio *bp;
-   int error;
 
-   softc-dsreg = MTIO_DSREG_REST;
-   bp = (struct bio *)done_ccb-ccb_h.ccb_bp;
-   error = 0;
-   if ((done_ccb-ccb_h.status  CAM_STATUS_MASK) != CAM_REQ_CMP) {
-   if ((error = saerror(done_ccb, 0, 0)) == ERESTART) {
-   /*
-* A retry was scheduled, so just return.
-*/
-   return;
-   }
+   softc-dsreg = MTIO_DSREG_REST;
+   bp = (struct bio *)done_ccb-ccb_h.ccb_bp;
+   error = 0;
+   if ((done_ccb-ccb_h.status  CAM_STATUS_MASK) != CAM_REQ_CMP) {
+   if ((error = saerror(done_ccb, 0, 0)) == ERESTART) {
+   /*
+* A retry was scheduled, so just return.
+*/
+   return;
}
+   }
 
-   if (error == EIO) {
+   if (error == EIO) {
 
-   /*
-* Catastrophic error. Mark the tape as frozen
-* (we no longer know tape position).
-*
-* Return all queued I/O with EIO, and unfreeze
-* our queue so that future transactions that
-* attempt to fix this problem can get to the
-* device.
-*
-*/
+   /*
+* Catastrophic error. Mark the tape as frozen
+* (we no longer know tape position).
+*
+* Return all queued I/O with EIO, and unfreeze
+* our queue so that future transactions that
+* attempt to fix this problem can get to the
+* device.
+*
+*/
 
-   softc-flags |= SA_FLAG_TAPE_FROZEN;
-   bioq_flush(softc-bio_queue, NULL, EIO);
-   }
-   if (error != 0) {
-   bp-bio_resid = bp-bio_bcount;
-   bp-bio_error = error;
+   softc-flags |= SA_FLAG_TAPE_FROZEN;
+   bioq_flush(softc-bio_queue, NULL, EIO);
+   }
+   if (error != 0) {
+   bp-bio_resid = bp-bio_bcount;
+   bp-bio_error = error;
+   bp-bio_flags |= BIO_ERROR;
+   /*
+* In the error 

svn commit: r269718 - stable/10/sys/dev/usb/serial

2014-08-08 Thread Joerg Wunsch
Author: joerg
Date: Fri Aug  8 14:48:26 2014
New Revision: 269718
URL: http://svnweb.freebsd.org/changeset/base/269718

Log:
  Merge r269470:
  
  Avoid a divide-by-zero panic when setting the baudrate to 0.

Modified:
  stable/10/sys/dev/usb/serial/umcs.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/serial/umcs.c
==
--- stable/10/sys/dev/usb/serial/umcs.c Fri Aug  8 14:42:03 2014
(r269717)
+++ stable/10/sys/dev/usb/serial/umcs.c Fri Aug  8 14:48:26 2014
(r269718)
@@ -1083,7 +1083,10 @@ umcs7840_calc_baudrate(uint32_t rate, ui
 
for (i = 0; i  umcs7840_baudrate_divisors_len - 1 
!(rate  umcs7840_baudrate_divisors[i]  rate = 
umcs7840_baudrate_divisors[i + 1]); ++i);
-   *divisor = umcs7840_baudrate_divisors[i + 1] / rate;
+   if (rate == 0)
+   *divisor = 1;   /* XXX */
+   else
+   *divisor = umcs7840_baudrate_divisors[i + 1] / rate;
/* 0x00 .. 0x70 */
*clk = i  MCS7840_DEV_SPx_CLOCK_SHIFT;
return (0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269721 - stable/9/sys/dev/usb/serial

2014-08-08 Thread Joerg Wunsch
Author: joerg
Date: Fri Aug  8 14:56:04 2014
New Revision: 269721
URL: http://svnweb.freebsd.org/changeset/base/269721

Log:
  MFC r269470: Avoid divide-by-zero panic when setting baudrate to 0.

Modified:
  stable/9/sys/dev/usb/serial/umcs.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/usb/serial/umcs.c
==
--- stable/9/sys/dev/usb/serial/umcs.c  Fri Aug  8 14:53:01 2014
(r269720)
+++ stable/9/sys/dev/usb/serial/umcs.c  Fri Aug  8 14:56:04 2014
(r269721)
@@ -1083,7 +1083,10 @@ umcs7840_calc_baudrate(uint32_t rate, ui
 
for (i = 0; i  umcs7840_baudrate_divisors_len - 1 
!(rate  umcs7840_baudrate_divisors[i]  rate = 
umcs7840_baudrate_divisors[i + 1]); ++i);
-   *divisor = umcs7840_baudrate_divisors[i + 1] / rate;
+   if (rate == 0)
+   *divisor = 1;   /* XXX */
+   else
+   *divisor = umcs7840_baudrate_divisors[i + 1] / rate;
/* 0x00 .. 0x70 */
*clk = i  MCS7840_DEV_SPx_CLOCK_SHIFT;
return (0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269722 - stable/8/sys/dev/usb/serial

2014-08-08 Thread Joerg Wunsch
Author: joerg
Date: Fri Aug  8 15:04:02 2014
New Revision: 269722
URL: http://svnweb.freebsd.org/changeset/base/269722

Log:
  MFC r269470: avoid divide-by-zero panic when setting baudrate to 0.

Modified:
  stable/8/sys/dev/usb/serial/umcs.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/usb/   (props changed)

Modified: stable/8/sys/dev/usb/serial/umcs.c
==
--- stable/8/sys/dev/usb/serial/umcs.c  Fri Aug  8 14:56:04 2014
(r269721)
+++ stable/8/sys/dev/usb/serial/umcs.c  Fri Aug  8 15:04:02 2014
(r269722)
@@ -1059,7 +1059,10 @@ umcs7840_calc_baudrate(uint32_t rate, ui
 
for (i = 0; i  umcs7840_baudrate_divisors_len - 1 
!(rate  umcs7840_baudrate_divisors[i]  rate = 
umcs7840_baudrate_divisors[i + 1]); ++i);
-   *divisor = umcs7840_baudrate_divisors[i + 1] / rate;
+   if (rate == 0)
+   *divisor = 1;   /* XXX */
+   else
+   *divisor = umcs7840_baudrate_divisors[i + 1] / rate;
/* 0x00 .. 0x70 */
*clk = i  MCS7840_DEV_SPx_CLOCK_SHIFT;
return (0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269470 - head/sys/dev/usb/serial

2014-08-03 Thread Joerg Wunsch
Author: joerg
Date: Sun Aug  3 10:47:45 2014
New Revision: 269470
URL: http://svnweb.freebsd.org/changeset/base/269470

Log:
  Avoid a divide-by-zero panic when setting the baudrate to 0.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/usb/serial/umcs.c

Modified: head/sys/dev/usb/serial/umcs.c
==
--- head/sys/dev/usb/serial/umcs.c  Sun Aug  3 10:02:14 2014
(r269469)
+++ head/sys/dev/usb/serial/umcs.c  Sun Aug  3 10:47:45 2014
(r269470)
@@ -1083,7 +1083,10 @@ umcs7840_calc_baudrate(uint32_t rate, ui
 
for (i = 0; i  umcs7840_baudrate_divisors_len - 1 
!(rate  umcs7840_baudrate_divisors[i]  rate = 
umcs7840_baudrate_divisors[i + 1]); ++i);
-   *divisor = umcs7840_baudrate_divisors[i + 1] / rate;
+   if (rate == 0)
+   *divisor = 1;   /* XXX */
+   else
+   *divisor = umcs7840_baudrate_divisors[i + 1] / rate;
/* 0x00 .. 0x70 */
*clk = i  MCS7840_DEV_SPx_CLOCK_SHIFT;
return (0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r269353 - head/sys/cam/scsi

2014-07-31 Thread Joerg Wunsch
Author: joerg
Date: Thu Jul 31 22:09:50 2014
New Revision: 269353
URL: http://svnweb.freebsd.org/changeset/base/269353

Log:
  Fix breakage introduced by r256843: removing the SA_CCB_WAITING bit
  left some of the decisions based on its counterpart, SA_CCB_BUFFER_IO
  being random.  As a result, propagation of the residual information
  for the SPACE command was broken, so the number of filemarks
  encountered during a SPACE operation was miscalculated.  Consequently,
  systems relying on properly tracked filemark counters (like Bacula)
  fell apart.
  
  The change also removes a switch/case in sadone() which r256843
  degraded to a single remaining case label.
  
  PR:   192285
  Approved by:  ken
  MFC after:2 weeks

Modified:
  head/sys/cam/scsi/scsi_sa.c

Modified: head/sys/cam/scsi/scsi_sa.c
==
--- head/sys/cam/scsi/scsi_sa.c Thu Jul 31 22:05:18 2014(r269352)
+++ head/sys/cam/scsi/scsi_sa.c Thu Jul 31 22:09:50 2014(r269353)
@@ -113,16 +113,8 @@ typedef enum {
 #define ccb_pflags ppriv_field0
 #define ccb_bp ppriv_ptr1
 
-#defineSA_CCB_BUFFER_IO0x0
-#defineSA_CCB_TYPEMASK 0x1
-#defineSA_POSITION_UPDATED 0x2
-
-#defineSet_CCB_Type(x, type)   \
-   x-ccb_h.ccb_pflags = ~SA_CCB_TYPEMASK;\
-   x-ccb_h.ccb_pflags |= type
-
-#defineCCB_Type(x) (x-ccb_h.ccb_pflags  SA_CCB_TYPEMASK)
-
+/* bits in ccb_pflags */
+#defineSA_POSITION_UPDATED 0x1
 
 
 typedef enum {
@@ -1835,7 +1827,6 @@ again:
bp-bio_data, bp-bio_bcount, SSD_FULL_SIZE,
IO_TIMEOUT);
start_ccb-ccb_h.ccb_pflags = ~SA_POSITION_UPDATED;
-   Set_CCB_Type(start_ccb, SA_CCB_BUFFER_IO);
start_ccb-ccb_h.ccb_bp = bp;
bp = bioq_first(softc-bio_queue);
xpt_action(start_ccb);
@@ -1860,92 +1851,86 @@ sadone(struct cam_periph *periph, union 
 {
struct sa_softc *softc;
struct ccb_scsiio *csio;
+   struct bio *bp;
+   int error;
 
softc = (struct sa_softc *)periph-softc;
csio = done_ccb-csio;
-   switch (CCB_Type(csio)) {
-   case SA_CCB_BUFFER_IO:
-   {
-   struct bio *bp;
-   int error;
 
-   softc-dsreg = MTIO_DSREG_REST;
-   bp = (struct bio *)done_ccb-ccb_h.ccb_bp;
-   error = 0;
-   if ((done_ccb-ccb_h.status  CAM_STATUS_MASK) != CAM_REQ_CMP) {
-   if ((error = saerror(done_ccb, 0, 0)) == ERESTART) {
-   /*
-* A retry was scheduled, so just return.
-*/
-   return;
-   }
+   softc-dsreg = MTIO_DSREG_REST;
+   bp = (struct bio *)done_ccb-ccb_h.ccb_bp;
+   error = 0;
+   if ((done_ccb-ccb_h.status  CAM_STATUS_MASK) != CAM_REQ_CMP) {
+   if ((error = saerror(done_ccb, 0, 0)) == ERESTART) {
+   /*
+* A retry was scheduled, so just return.
+*/
+   return;
}
+   }
 
-   if (error == EIO) {
+   if (error == EIO) {
 
-   /*
-* Catastrophic error. Mark the tape as frozen
-* (we no longer know tape position).
-*
-* Return all queued I/O with EIO, and unfreeze
-* our queue so that future transactions that
-* attempt to fix this problem can get to the
-* device.
-*
-*/
+   /*
+* Catastrophic error. Mark the tape as frozen
+* (we no longer know tape position).
+*
+* Return all queued I/O with EIO, and unfreeze
+* our queue so that future transactions that
+* attempt to fix this problem can get to the
+* device.
+*
+*/
 
-   softc-flags |= SA_FLAG_TAPE_FROZEN;
-   bioq_flush(softc-bio_queue, NULL, EIO);
-   }
-   if (error != 0) {
-   bp-bio_resid = bp-bio_bcount;
-   bp-bio_error = error;
+   softc-flags |= SA_FLAG_TAPE_FROZEN;
+   bioq_flush(softc-bio_queue, NULL, EIO);
+   }
+   if (error != 0) {
+   bp-bio_resid = bp-bio_bcount;
+   bp-bio_error = error;
+   bp-bio_flags |= BIO_ERROR;
+   /*
+* In the error case, position is updated in saerror.
+*/

svn commit: r264328 - in stable/10/sys/dev/usb: . serial

2014-04-10 Thread Joerg Wunsch
Author: joerg
Date: Thu Apr 10 21:53:50 2014
New Revision: 264328
URL: http://svnweb.freebsd.org/changeset/base/264328

Log:
  Merge r264084: make the Dresden Elektronik USB Level Shifter Low Cost
  known to the FTDI driver.

Modified:
  stable/10/sys/dev/usb/serial/uftdi.c
  stable/10/sys/dev/usb/usbdevs
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/serial/uftdi.c
==
--- stable/10/sys/dev/usb/serial/uftdi.cThu Apr 10 21:03:46 2014
(r264327)
+++ stable/10/sys/dev/usb/serial/uftdi.cThu Apr 10 21:53:50 2014
(r264328)
@@ -235,6 +235,7 @@ static const STRUCT_USB_HOST_ID uftdi_de
UFTDI_DEV(CONTEC, COM1USBH, UFTDI_TYPE_AUTO),
UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, UFTDI_TYPE_8U232AM),
UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 
UFTDI_TYPE_8U232AM),
+   UFTDI_DEV(DRESDENELEKTRONIK, LEVELSHIFTERSTICKLOWCOST, 
UFTDI_TYPE_8U232AM),
UFTDI_DEV(ELEKTOR, FT323R, UFTDI_TYPE_AUTO),
UFTDI_DEV(EVOLUTION, ER1, UFTDI_TYPE_AUTO),
UFTDI_DEV(EVOLUTION, HYBRID, UFTDI_TYPE_AUTO),

Modified: stable/10/sys/dev/usb/usbdevs
==
--- stable/10/sys/dev/usb/usbdevs   Thu Apr 10 21:03:46 2014
(r264327)
+++ stable/10/sys/dev/usb/usbdevs   Thu Apr 10 21:53:50 2014
(r264328)
@@ -1650,6 +1650,7 @@ product DRAYTEK VIGOR550  0x0550  Vigor550
 /* dresden elektronik products */
 product DRESDENELEKTRONIK SENSORTERMINALBOARD  0x0001 SensorTerminalBoard
 product DRESDENELEKTRONIK WIRELESSHANDHELDTERMINAL  0x0004 Wireless Handheld 
Terminal
+product DRESDENELEKTRONIK LEVELSHIFTERSTICKLOWCOST  0x0022 Levelshifter Stick 
Low Cost
 
 /* Dynastream Innovations */
 product DYNASTREAM ANTDEVBOARD 0x1003  ANT dev board
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r264329 - in stable/9/sys/dev/usb: . serial

2014-04-10 Thread Joerg Wunsch
Author: joerg
Date: Thu Apr 10 22:05:50 2014
New Revision: 264329
URL: http://svnweb.freebsd.org/changeset/base/264329

Log:
  MFC r264084: make the Dresden Elektronik USB Level Shifter Stick Low Cost
  known to the FTDI driver.

Modified:
  stable/9/sys/dev/usb/serial/uftdi.c
  stable/9/sys/dev/usb/usbdevs
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/usb/serial/uftdi.c
==
--- stable/9/sys/dev/usb/serial/uftdi.c Thu Apr 10 21:53:50 2014
(r264328)
+++ stable/9/sys/dev/usb/serial/uftdi.c Thu Apr 10 22:05:50 2014
(r264329)
@@ -235,6 +235,7 @@ static const STRUCT_USB_HOST_ID uftdi_de
UFTDI_DEV(CONTEC, COM1USBH, UFTDI_TYPE_AUTO),
UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, UFTDI_TYPE_8U232AM),
UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 
UFTDI_TYPE_8U232AM),
+   UFTDI_DEV(DRESDENELEKTRONIK, LEVELSHIFTERSTICKLOWCOST, 
UFTDI_TYPE_8U232AM),
UFTDI_DEV(ELEKTOR, FT323R, UFTDI_TYPE_AUTO),
UFTDI_DEV(EVOLUTION, ER1, UFTDI_TYPE_AUTO),
UFTDI_DEV(EVOLUTION, HYBRID, UFTDI_TYPE_AUTO),

Modified: stable/9/sys/dev/usb/usbdevs
==
--- stable/9/sys/dev/usb/usbdevsThu Apr 10 21:53:50 2014
(r264328)
+++ stable/9/sys/dev/usb/usbdevsThu Apr 10 22:05:50 2014
(r264329)
@@ -1654,6 +1654,7 @@ product DRAYTEK VIGOR550  0x0550  Vigor550
 /* dresden elektronik products */
 product DRESDENELEKTRONIK SENSORTERMINALBOARD  0x0001 SensorTerminalBoard
 product DRESDENELEKTRONIK WIRELESSHANDHELDTERMINAL  0x0004 Wireless Handheld 
Terminal
+product DRESDENELEKTRONIK LEVELSHIFTERSTICKLOWCOST  0x0022 Levelshifter Stick 
Low Cost
 
 /* Dynastream Innovations */
 product DYNASTREAM ANTDEVBOARD 0x1003  ANT dev board
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r264330 - in stable/8/sys/dev/usb: . serial

2014-04-10 Thread Joerg Wunsch
Author: joerg
Date: Thu Apr 10 22:10:29 2014
New Revision: 264330
URL: http://svnweb.freebsd.org/changeset/base/264330

Log:
  MFC r264084: make the Dresden Elektronik USB Level Shifter Stick Low Cost
  known to the FTDI driver.

Modified:
  stable/8/sys/dev/usb/serial/uftdi.c
  stable/8/sys/dev/usb/usbdevs
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/usb/   (props changed)

Modified: stable/8/sys/dev/usb/serial/uftdi.c
==
--- stable/8/sys/dev/usb/serial/uftdi.c Thu Apr 10 22:05:50 2014
(r264329)
+++ stable/8/sys/dev/usb/serial/uftdi.c Thu Apr 10 22:10:29 2014
(r264330)
@@ -235,6 +235,7 @@ static const STRUCT_USB_HOST_ID uftdi_de
UFTDI_DEV(CONTEC, COM1USBH, UFTDI_TYPE_AUTO),
UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, UFTDI_TYPE_8U232AM),
UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 
UFTDI_TYPE_8U232AM),
+   UFTDI_DEV(DRESDENELEKTRONIK, LEVELSHIFTERSTICKLOWCOST, 
UFTDI_TYPE_8U232AM),
UFTDI_DEV(ELEKTOR, FT323R, UFTDI_TYPE_AUTO),
UFTDI_DEV(EVOLUTION, ER1, UFTDI_TYPE_AUTO),
UFTDI_DEV(EVOLUTION, HYBRID, UFTDI_TYPE_AUTO),

Modified: stable/8/sys/dev/usb/usbdevs
==
--- stable/8/sys/dev/usb/usbdevsThu Apr 10 22:05:50 2014
(r264329)
+++ stable/8/sys/dev/usb/usbdevsThu Apr 10 22:10:29 2014
(r264330)
@@ -1654,6 +1654,7 @@ product DRAYTEK VIGOR550  0x0550  Vigor550
 /* dresden elektronik products */
 product DRESDENELEKTRONIK SENSORTERMINALBOARD  0x0001 SensorTerminalBoard
 product DRESDENELEKTRONIK WIRELESSHANDHELDTERMINAL  0x0004 Wireless Handheld 
Terminal
+product DRESDENELEKTRONIK LEVELSHIFTERSTICKLOWCOST  0x0022 Levelshifter Stick 
Low Cost
 
 /* Dynastream Innovations */
 product DYNASTREAM ANTDEVBOARD 0x1003  ANT dev board
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r264084 - in head/sys/dev/usb: . serial

2014-04-03 Thread Joerg Wunsch
Author: joerg
Date: Thu Apr  3 20:00:02 2014
New Revision: 264084
URL: http://svnweb.freebsd.org/changeset/base/264084

Log:
  Add the Dresden Elektronik USB Levelshifter Stick Low Cost to the
  list of known FTDI devices.
  
  
https://shop.dresden-elektronik.de/accessories/levelshifter/usb-pegelwandler-stick-basic.html
  
  MFC after:1 week

Modified:
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/uftdi.c
==
--- head/sys/dev/usb/serial/uftdi.c Thu Apr  3 17:55:08 2014
(r264083)
+++ head/sys/dev/usb/serial/uftdi.c Thu Apr  3 20:00:02 2014
(r264084)
@@ -277,6 +277,7 @@ static const STRUCT_USB_HOST_ID uftdi_de
UFTDI_DEV(CONTEC, COM1USBH, UFTDI_TYPE_AUTO),
UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, UFTDI_TYPE_8U232AM),
UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 
UFTDI_TYPE_8U232AM),
+   UFTDI_DEV(DRESDENELEKTRONIK, LEVELSHIFTERSTICKLOWCOST, 
UFTDI_TYPE_8U232AM),
UFTDI_DEV(ELEKTOR, FT323R, UFTDI_TYPE_AUTO),
UFTDI_DEV(EVOLUTION, ER1, UFTDI_TYPE_AUTO),
UFTDI_DEV(EVOLUTION, HYBRID, UFTDI_TYPE_AUTO),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsThu Apr  3 17:55:08 2014(r264083)
+++ head/sys/dev/usb/usbdevsThu Apr  3 20:00:02 2014(r264084)
@@ -1654,6 +1654,7 @@ product DRAYTEK VIGOR550  0x0550  Vigor550
 /* dresden elektronik products */
 product DRESDENELEKTRONIK SENSORTERMINALBOARD  0x0001 SensorTerminalBoard
 product DRESDENELEKTRONIK WIRELESSHANDHELDTERMINAL  0x0004 Wireless Handheld 
Terminal
+product DRESDENELEKTRONIK LEVELSHIFTERSTICKLOWCOST  0x0022 Levelshifter Stick 
Low Cost
 
 /* Dynastream Innovations */
 product DYNASTREAM ANTDEVBOARD 0x1003  ANT dev board
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r255262 - stable/9/sys/dev/fdc

2013-09-05 Thread Joerg Wunsch
Author: joerg
Date: Thu Sep  5 19:25:36 2013
New Revision: 255262
URL: http://svnweb.freebsd.org/changeset/base/255262

Log:
  Merge r254809 and r254937 from head:
  
  . Fix the 2step feature (i.e. 360 KiB floppies in 1200 MiB drives)
  . Fix the FDOPT_NOERROR option

Modified:
  stable/9/sys/dev/fdc/fdc.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/fdc/fdc.c
==
--- stable/9/sys/dev/fdc/fdc.c  Thu Sep  5 19:02:03 2013(r255261)
+++ stable/9/sys/dev/fdc/fdc.c  Thu Sep  5 19:25:36 2013(r255262)
@@ -528,7 +528,8 @@ fdc_reset(struct fdc_data *fdc)
if (fdc_cmd(fdc, 4,
I8207X_CONFIG,
0,
-   0x40 |  /* Enable Implied Seek */
+   /* 0x40 | *//* Enable Implied Seek -
+* breaks 2step! */
0x10 |  /* Polling disabled */
(fifo_threshold - 1),   /* Fifo threshold */
0x00,   /* Precomp track */
@@ -760,10 +761,13 @@ fdc_worker(struct fdc_data *fdc)
int i, nsect;
int st0, st3, cyl, mfm, steptrac, cylinder, descyl, sec;
int head;
+   int override_error;
static int need_recal;
struct fdc_readid *idp;
struct fd_formb *finfo;
 
+   override_error = 0;
+
/* Have we exhausted our retries ? */
bp = fdc-bp;
fd = fdc-fd;
@@ -922,14 +926,8 @@ fdc_worker(struct fdc_data *fdc)
 
/*
 * SEEK to where we want to be
-*
-* Enhanced controllers do implied seeks for readwrite as long as
-* we do not need multiple steps per track.
 */
-   if (cylinder != fd-track  (
-   fdc-fdct != FDC_ENHANCED ||
-   descyl != cylinder ||
-   (bp-bio_cmd  (BIO_RDID|BIO_FMT {
+   if (cylinder != fd-track) {
retry_line = __LINE__;
if (fdc_cmd(fdc, 3, NE7CMD_SEEK, fd-fdsu, descyl, 0))
return (1);
@@ -1095,7 +1093,10 @@ fdc_worker(struct fdc_data *fdc)
fdc-status[3], fdc-status[4], fdc-status[5]);
}
retry_line = __LINE__;
-   return (1);
+   if (fd-options  FDOPT_NOERROR)
+   override_error = 1;
+   else
+   return (1);
}
/* All OK */
switch(bp-bio_cmd) {
@@ -1116,10 +1117,16 @@ fdc_worker(struct fdc_data *fdc)
bp-bio_resid -= fd-fd_iosize;
bp-bio_completed += fd-fd_iosize;
fd-fd_ioptr += fd-fd_iosize;
-   /* Since we managed to get something done, reset the retry */
-   fdc-retry = 0;
-   if (bp-bio_resid  0)
-   return (0);
+   if (override_error) {
+   if ((debugflags  4))
+   printf(FDOPT_NOERROR: returning bad data\n);
+   } else {
+   /* Since we managed to get something done,
+* reset the retry */
+   fdc-retry = 0;
+   if (bp-bio_resid  0)
+   return (0);
+   }
break;
case BIO_FMT:
break;
@@ -1411,6 +1418,7 @@ fd_access(struct g_provider *pp, int r, 
ae = e + pp-ace;
 
if (ar == 0  aw == 0  ae == 0) {
+   fd-options = ~(FDOPT_NORETRY | FDOPT_NOERRLOG | 
FDOPT_NOERROR);
device_unbusy(fd-dev);
return (0);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r255264 - stable/8/sys/dev/fdc

2013-09-05 Thread Joerg Wunsch
Author: joerg
Date: Thu Sep  5 20:34:58 2013
New Revision: 255264
URL: http://svnweb.freebsd.org/changeset/base/255264

Log:
  Merged r254809 and 254937 from head:
  
  . Fix 2step feature (i.e. 360 KiB media in 1200 KiB drives)
  . Fix FDOPT_NOERROR option

Modified:
  stable/8/sys/dev/fdc/fdc.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/dev/fdc/fdc.c
==
--- stable/8/sys/dev/fdc/fdc.c  Thu Sep  5 20:18:59 2013(r255263)
+++ stable/8/sys/dev/fdc/fdc.c  Thu Sep  5 20:34:58 2013(r255264)
@@ -528,7 +528,8 @@ fdc_reset(struct fdc_data *fdc)
if (fdc_cmd(fdc, 4,
I8207X_CONFIG,
0,
-   0x40 |  /* Enable Implied Seek */
+   /* 0x40 | *//* Enable Implied Seek -
+* breaks 2step! */
0x10 |  /* Polling disabled */
(fifo_threshold - 1),   /* Fifo threshold */
0x00,   /* Precomp track */
@@ -760,10 +761,13 @@ fdc_worker(struct fdc_data *fdc)
int i, nsect;
int st0, st3, cyl, mfm, steptrac, cylinder, descyl, sec;
int head;
+   int override_error;
static int need_recal;
struct fdc_readid *idp;
struct fd_formb *finfo;
 
+   override_error = 0;
+
/* Have we exhausted our retries ? */
bp = fdc-bp;
fd = fdc-fd;
@@ -924,14 +928,8 @@ fdc_worker(struct fdc_data *fdc)
 
/*
 * SEEK to where we want to be
-*
-* Enhanced controllers do implied seeks for readwrite as long as
-* we do not need multiple steps per track.
 */
-   if (cylinder != fd-track  (
-   fdc-fdct != FDC_ENHANCED ||
-   descyl != cylinder ||
-   (bp-bio_cmd  (BIO_RDID|BIO_FMT {
+   if (cylinder != fd-track) {
retry_line = __LINE__;
if (fdc_cmd(fdc, 3, NE7CMD_SEEK, fd-fdsu, descyl, 0))
return (1);
@@ -1101,7 +1099,10 @@ fdc_worker(struct fdc_data *fdc)
fdc-status[3], fdc-status[4], fdc-status[5]);
}
retry_line = __LINE__;
-   return (1);
+   if (fd-options  FDOPT_NOERROR)
+   override_error = 1;
+   else
+   return (1);
}
/* All OK */
switch(bp-bio_cmd) {
@@ -1122,10 +1123,16 @@ fdc_worker(struct fdc_data *fdc)
bp-bio_resid -= fd-fd_iosize;
bp-bio_completed += fd-fd_iosize;
fd-fd_ioptr += fd-fd_iosize;
-   /* Since we managed to get something done, reset the retry */
-   fdc-retry = 0;
-   if (bp-bio_resid  0)
-   return (0);
+   if (override_error) {
+   if ((debugflags  4))
+   printf(FDOPT_NOERROR: returning bad data\n);
+   } else {
+   /* Since we managed to get something done,
+* reset the retry */
+   fdc-retry = 0;
+   if (bp-bio_resid  0)
+   return (0);
+   }
break;
case BIO_FMT:
break;
@@ -1417,6 +1424,7 @@ fd_access(struct g_provider *pp, int r, 
ae = e + pp-ace;
 
if (ar == 0  aw == 0  ae == 0) {
+   fd-options = ~(FDOPT_NORETRY | FDOPT_NOERRLOG | 
FDOPT_NOERROR);
device_unbusy(fd-dev);
return (0);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r254937 - head/sys/dev/fdc

2013-08-26 Thread Joerg Wunsch
Author: joerg
Date: Mon Aug 26 21:15:50 2013
New Revision: 254937
URL: http://svnweb.freebsd.org/changeset/base/254937

Log:
  Reimplement the FDOPT_NOERROR feature that was kicked out in r134081.
  
  It is needed for fdread(1) in order to be able to recover from CRC
  errors in the data field of a floppy sector (by returning the sector
  data that failed CRC, rather than inventing dummy data).
  
  When closing the device, clear all transient device options.
  
  MFC after:1 week

Modified:
  head/sys/dev/fdc/fdc.c

Modified: head/sys/dev/fdc/fdc.c
==
--- head/sys/dev/fdc/fdc.c  Mon Aug 26 20:39:02 2013(r254936)
+++ head/sys/dev/fdc/fdc.c  Mon Aug 26 21:15:50 2013(r254937)
@@ -761,10 +761,13 @@ fdc_worker(struct fdc_data *fdc)
int i, nsect;
int st0, st3, cyl, mfm, steptrac, cylinder, descyl, sec;
int head;
+   int override_error;
static int need_recal;
struct fdc_readid *idp;
struct fd_formb *finfo;
 
+   override_error = 0;
+
/* Have we exhausted our retries ? */
bp = fdc-bp;
fd = fdc-fd;
@@ -1090,7 +1093,10 @@ fdc_worker(struct fdc_data *fdc)
fdc-status[3], fdc-status[4], fdc-status[5]);
}
retry_line = __LINE__;
-   return (1);
+   if (fd-options  FDOPT_NOERROR)
+   override_error = 1;
+   else
+   return (1);
}
/* All OK */
switch(bp-bio_cmd) {
@@ -,10 +1117,16 @@ fdc_worker(struct fdc_data *fdc)
bp-bio_resid -= fd-fd_iosize;
bp-bio_completed += fd-fd_iosize;
fd-fd_ioptr += fd-fd_iosize;
-   /* Since we managed to get something done, reset the retry */
-   fdc-retry = 0;
-   if (bp-bio_resid  0)
-   return (0);
+   if (override_error) {
+   if ((debugflags  4))
+   printf(FDOPT_NOERROR: returning bad data\n);
+   } else {
+   /* Since we managed to get something done,
+* reset the retry */
+   fdc-retry = 0;
+   if (bp-bio_resid  0)
+   return (0);
+   }
break;
case BIO_FMT:
break;
@@ -1406,6 +1418,7 @@ fd_access(struct g_provider *pp, int r, 
ae = e + pp-ace;
 
if (ar == 0  aw == 0  ae == 0) {
+   fd-options = ~(FDOPT_NORETRY | FDOPT_NOERRLOG | 
FDOPT_NOERROR);
device_unbusy(fd-dev);
return (0);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r254809 - head/sys/dev/fdc

2013-08-24 Thread Joerg Wunsch
Author: joerg
Date: Sat Aug 24 21:04:54 2013
New Revision: 254809
URL: http://svnweb.freebsd.org/changeset/base/254809

Log:
  Do not use Enable Implied Seek on enhanced floppy controllers.  This
  breaks the 2step feature of the driver, e.g. in order to read 360
  KiB media on a 1200 KiB drive.
  
  As the only potential advantage of implied (vs. explicit) seeks is to
  minimize the software effort, yet our driver always contained the
  logic needed for explicit seeks, simply dropping implied seeks is the
  best solution without introducing risks for new bugs.  There is no
  performance penalty, reading a 1440 KiB medium takes exactly the same
  time with both, implied or explicit seeks.
  
  MFC after:1 week

Modified:
  head/sys/dev/fdc/fdc.c

Modified: head/sys/dev/fdc/fdc.c
==
--- head/sys/dev/fdc/fdc.c  Sat Aug 24 21:00:39 2013(r254808)
+++ head/sys/dev/fdc/fdc.c  Sat Aug 24 21:04:54 2013(r254809)
@@ -528,7 +528,8 @@ fdc_reset(struct fdc_data *fdc)
if (fdc_cmd(fdc, 4,
I8207X_CONFIG,
0,
-   0x40 |  /* Enable Implied Seek */
+   /* 0x40 | *//* Enable Implied Seek -
+* breaks 2step! */
0x10 |  /* Polling disabled */
(fifo_threshold - 1),   /* Fifo threshold */
0x00,   /* Precomp track */
@@ -922,14 +923,8 @@ fdc_worker(struct fdc_data *fdc)
 
/*
 * SEEK to where we want to be
-*
-* Enhanced controllers do implied seeks for readwrite as long as
-* we do not need multiple steps per track.
 */
-   if (cylinder != fd-track  (
-   fdc-fdct != FDC_ENHANCED ||
-   descyl != cylinder ||
-   (bp-bio_cmd  (BIO_RDID|BIO_FMT {
+   if (cylinder != fd-track) {
retry_line = __LINE__;
if (fdc_cmd(fdc, 3, NE7CMD_SEEK, fd-fdsu, descyl, 0))
return (1);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r238618 - head/etc/mtree

2012-07-19 Thread Joerg Wunsch
Author: joerg
Date: Thu Jul 19 11:18:41 2012
New Revision: 238618
URL: http://svn.freebsd.org/changeset/base/238618

Log:
  Add share/examples/libusb20 to the list of directories.

Modified:
  head/etc/mtree/BSD.usr.dist

Modified: head/etc/mtree/BSD.usr.dist
==
--- head/etc/mtree/BSD.usr.dist Thu Jul 19 11:15:53 2012(r238617)
+++ head/etc/mtree/BSD.usr.dist Thu Jul 19 11:18:41 2012(r238618)
@@ -271,6 +271,8 @@
 ..
 ..
 ..
+libusb20
+..
 libvgl
 ..
 mdoc
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r238603 - in head/share/examples: . libusb20

2012-07-18 Thread Joerg Wunsch
Author: joerg
Date: Wed Jul 18 21:30:17 2012
New Revision: 238603
URL: http://svn.freebsd.org/changeset/base/238603

Log:
  Add some examples about how to use FreeBSD's libusb20 in your own
  code.

Added:
  head/share/examples/libusb20/
  head/share/examples/libusb20/Makefile   (contents, props changed)
  head/share/examples/libusb20/README   (contents, props changed)
  head/share/examples/libusb20/aux.c   (contents, props changed)
  head/share/examples/libusb20/aux.h   (contents, props changed)
  head/share/examples/libusb20/bulk.c   (contents, props changed)
  head/share/examples/libusb20/control.c   (contents, props changed)
Modified:
  head/share/examples/Makefile

Modified: head/share/examples/Makefile
==
--- head/share/examples/MakefileWed Jul 18 19:28:22 2012
(r238602)
+++ head/share/examples/MakefileWed Jul 18 21:30:17 2012
(r238603)
@@ -20,6 +20,7 @@ LDIRS=BSD_daemon \
ipfw \
jails \
kld \
+   libusb20 \
libvgl \
mdoc \
netgraph \
@@ -110,6 +111,12 @@ XFILES=BSD_daemon/FreeBSD.pfa \
kld/syscall/module/syscall.c \
kld/syscall/test/Makefile \
kld/syscall/test/call.c \
+   libusb20/Makefile \
+   libusb20/README \
+   libusb20/aux.c \
+   libusb20/aux.h \
+   libusb20/bulk.c \
+   libusb20/control.c \
libvgl/Makefile \
libvgl/demo.c \
mdoc/POSIX-copyright \

Added: head/share/examples/libusb20/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/examples/libusb20/Makefile   Wed Jul 18 21:30:17 2012
(r238603)
@@ -0,0 +1,13 @@
+# $FreeBSD$
+TARGETS=   bulk control
+
+all: $(TARGETS)
+
+bulk: bulk.o aux.o
+   $(CC) $(CFLAGS) -o bulk bulk.o aux.o -lusb
+
+control: control.o aux.o
+   $(CC) $(CFLAGS) -o control control.o aux.o -lusb
+
+clean:
+   rm -f $(TARGETS) *.o *~

Added: head/share/examples/libusb20/README
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/examples/libusb20/README Wed Jul 18 21:30:17 2012
(r238603)
@@ -0,0 +1,42 @@
+As I dug my own way through the documentation of libusb 2.0 that ships
+with FreeBSD 8+ as the OS'es own USB library API, I noticed there are
+only few code examples around under /usr/src (namely, usbconfig
+itself).
+
+The libusb20(3) man page is a starting point, but it's a reference
+manual, nothing less, nothing more.  Using just a reference, it's not
+very easy to start writing your own code based on that.
+
+So I started writing my own examples, to get a feeling about how to
+use the library.  I covered two typical scenarios which are common for
+a number of devices.
+
+The first one is called bulk, and uses bulk output (host to device)
+and input transfers to talk to an USB device.
+
+The second one is called control, and can use both control output
+and input transfers, as well as so-called interrupt transfers.  The
+latter are used for data that are being reported frequently or
+repeatedly, like position updates from a pointing device (mouse).
+Despite of its name, the host has to poll devices for their interrupt
+transfers on each USB frame (i.e., each 1 ms).
+
+Recommended reading is the USB 3.0 specification (the older 2.0 one
+would do as well), to be found under
+
+http://www.usb.org/developers/docs/
+
+as well as documents for individual USB device classes where
+appropriate.
+
+Feel free to be liberal in the licensing of these examples: while the
+beer-ware license mandates to keep the license notice, this only
+applies to modifications of the original examples itself.  For
+copypasting (even a larger) piece of an example into your own work, I
+won't imply you have to reproduce the beer-ware license text there.
+Feel free to credit my name in your derived work if you want.
+
+Dresden, July 2012
+Joerg Wunsch jo...@freebsd.org
+
+# $FreeBSD$

Added: head/share/examples/libusb20/aux.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/examples/libusb20/aux.c  Wed Jul 18 21:30:17 2012
(r238603)
@@ -0,0 +1,120 @@
+/* 
+ * THE BEER-WARE LICENSE (Revision 42) (by Poul-Henning Kamp):
+ * jo...@freebsd.org wrote this file.  As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return.Joerg Wunsch
+ * 
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Helper functions common to all

svn commit: r223514 - stable/8/usr.sbin/fdread

2011-06-24 Thread Joerg Wunsch
Author: joerg
Date: Fri Jun 24 19:24:56 2011
New Revision: 223514
URL: http://svn.freebsd.org/changeset/base/223514

Log:
  Open the floppy disk device with O_RDONLY rather than O_RDWR.  After
  all, this is the fd*read* command, and thus should be able to read
  even write-protected disks.

Modified:
  stable/8/usr.sbin/fdread/fdread.c
Directory Properties:
  stable/8/usr.sbin/fdread/   (props changed)

Modified: stable/8/usr.sbin/fdread/fdread.c
==
--- stable/8/usr.sbin/fdread/fdread.c   Fri Jun 24 19:02:56 2011
(r223513)
+++ stable/8/usr.sbin/fdread/fdread.c   Fri Jun 24 19:24:56 2011
(r223514)
@@ -149,7 +149,7 @@ main(int argc, char **argv)
err(EX_OSERR, cannot create output file %s, fname);
}
 
-   if ((fd = open(_devname, O_RDWR)) == -1)
+   if ((fd = open(_devname, O_RDONLY)) == -1)
err(EX_OSERR, cannot open device %s, _devname);
 
return (numids? doreadid(fd, numids, trackno): doread(fd, of, 
_devname));
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r223197 - head/usr.sbin/fdread

2011-06-17 Thread Joerg Wunsch
Author: joerg
Date: Fri Jun 17 18:56:51 2011
New Revision: 223197
URL: http://svn.freebsd.org/changeset/base/223197

Log:
  Open the floppy disk device with O_RDONLY rather than O_RDWR.  After
  all, this is the fd*read* command, and thus should be able to read
  even write-protected disks.
  
  MFC after:1 week

Modified:
  head/usr.sbin/fdread/fdread.c

Modified: head/usr.sbin/fdread/fdread.c
==
--- head/usr.sbin/fdread/fdread.c   Fri Jun 17 18:49:59 2011
(r223196)
+++ head/usr.sbin/fdread/fdread.c   Fri Jun 17 18:56:51 2011
(r223197)
@@ -149,7 +149,7 @@ main(int argc, char **argv)
err(EX_OSERR, cannot create output file %s, fname);
}
 
-   if ((fd = open(_devname, O_RDWR)) == -1)
+   if ((fd = open(_devname, O_RDONLY)) == -1)
err(EX_OSERR, cannot open device %s, _devname);
 
return (numids? doreadid(fd, numids, trackno): doread(fd, of, 
_devname));
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r216573 - stable/8/sys/dev/ieee488

2010-12-19 Thread Joerg Wunsch
Author: joerg
Date: Sun Dec 19 21:33:28 2010
New Revision: 216573
URL: http://svn.freebsd.org/changeset/base/216573

Log:
  Fix __retval vs. retval confusion: retval is meant to store the (userland)
  pointer where data is to be returned by ibask() (currently unimplemented),
  while __retval holds the value returned by the libgpib ibfoo() functions.
  
  The confusion resulted in the ibfoo() functions returning an uninitialized
  value except in situations where the GPIB activity has been terminated
  abnormally.
  
  Implement more of __ibsta: END and SRQI status bits (taken out of the
  uPD7210 IRQ status).
  
  Approved by:  re (kib)

Modified:
  stable/8/sys/dev/ieee488/ibfoo.c

Modified: stable/8/sys/dev/ieee488/ibfoo.c
==
--- stable/8/sys/dev/ieee488/ibfoo.cSun Dec 19 21:18:33 2010
(r216572)
+++ stable/8/sys/dev/ieee488/ibfoo.cSun Dec 19 21:33:28 2010
(r216573)
@@ -333,6 +333,14 @@ gpib_ib_wait_xfer(struct upd7210 *u, str
break;
}
}
+   if ((u-rreg[ISR1]  IXR1_ENDRX) != 0) {
+   ib-ap-__retval |= END;
+   ib-ap-__ibsta |= END;
+   }
+   if ((u-rreg[ISR2]  IXR2_SRQI) != 0) {
+   ib-ap-__retval |= SRQI;
+   ib-ap-__ibsta |= SRQI;
+   }
ib-mode = BUSY;
ib-buf = NULL;
upd7210_wr(u, IMR1, 0);
@@ -1027,7 +1035,7 @@ gpib_ib_ioctl(struct cdev *dev, u_long c
ap-__iberr = 0;
ap-__ibsta = 0;
ap-__ibcnt = 0;
-   ap-retval = 0;
+   ap-__retval = 0;
 
if (ap-__field  __F_TMO) {
if (ap-tmo  0 || ap-tmo = max_timeouts)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r216355 - head/sys/dev/ieee488

2010-12-10 Thread Joerg Wunsch
Author: joerg
Date: Fri Dec 10 14:04:41 2010
New Revision: 216355
URL: http://svn.freebsd.org/changeset/base/216355

Log:
  Fix __retval vs. retval confusion: retval is meant to store the (userland)
  pointer where data is to be returned by ibask() (currently unimplemented),
  while __retval holds the value returned by the libgpib ibfoo() functions.
  
  The confusion resulted in the ibfoo() functions returning an uninitialized
  value except in situations where the GPIB activity has been terminated
  abnormally.
  
  MFC after:3 days

Modified:
  head/sys/dev/ieee488/ibfoo.c

Modified: head/sys/dev/ieee488/ibfoo.c
==
--- head/sys/dev/ieee488/ibfoo.cFri Dec 10 11:02:59 2010
(r216354)
+++ head/sys/dev/ieee488/ibfoo.cFri Dec 10 14:04:41 2010
(r216355)
@@ -1019,7 +1019,7 @@ gpib_ib_ioctl(struct cdev *dev, u_long c
ap-__iberr = 0;
ap-__ibsta = 0;
ap-__ibcnt = 0;
-   ap-retval = 0;
+   ap-__retval = 0;
 
if (ap-__field  __F_TMO) {
if (ap-tmo  0 || ap-tmo = max_timeouts)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r216364 - head/sys/dev/ieee488

2010-12-10 Thread Joerg Wunsch
Author: joerg
Date: Fri Dec 10 22:20:11 2010
New Revision: 216364
URL: http://svn.freebsd.org/changeset/base/216364

Log:
  Implement more of __ibsta: END and SRQI status bits (taken out of the
  uPD7210 IRQ status).
  
  MFC after:1 week

Modified:
  head/sys/dev/ieee488/ibfoo.c

Modified: head/sys/dev/ieee488/ibfoo.c
==
--- head/sys/dev/ieee488/ibfoo.cFri Dec 10 21:45:10 2010
(r216363)
+++ head/sys/dev/ieee488/ibfoo.cFri Dec 10 22:20:11 2010
(r216364)
@@ -333,6 +333,14 @@ gpib_ib_wait_xfer(struct upd7210 *u, str
break;
}
}
+   if ((u-rreg[ISR1]  IXR1_ENDRX) != 0) {
+   ib-ap-__retval |= END;
+   ib-ap-__ibsta |= END;
+   }
+   if ((u-rreg[ISR2]  IXR2_SRQI) != 0) {
+   ib-ap-__retval |= SRQI;
+   ib-ap-__ibsta |= SRQI;
+   }
ib-mode = BUSY;
ib-buf = NULL;
upd7210_wr(u, IMR1, 0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205667 - stable/8/etc/defaults

2010-03-25 Thread Joerg Wunsch
Author: joerg
Date: Fri Mar 26 05:13:43 2010
New Revision: 205667
URL: http://svn.freebsd.org/changeset/base/205667

Log:
  r205509:
  
Add .snap to daily_clean_tmps_ignore; /tmp/.snap ist not supposed to
be auto-removed (and /tmp is a filesystem of its own now by
default).

Modified:
  stable/8/etc/defaults/periodic.conf
Directory Properties:
  stable/8/etc/   (props changed)

Modified: stable/8/etc/defaults/periodic.conf
==
--- stable/8/etc/defaults/periodic.conf Fri Mar 26 03:02:31 2010
(r205666)
+++ stable/8/etc/defaults/periodic.conf Fri Mar 26 05:13:43 2010
(r205667)
@@ -46,7 +46,7 @@ daily_clean_tmps_enable=NO  # Delete
 daily_clean_tmps_dirs=/tmp   # Delete under here
 daily_clean_tmps_days=3  # If not accessed for
 daily_clean_tmps_ignore=.X*-lock .X11-unix .ICE-unix .font-unix .XIM-unix
-daily_clean_tmps_ignore=$daily_clean_tmps_ignore quota.user quota.group
+daily_clean_tmps_ignore=$daily_clean_tmps_ignore quota.user quota.group .snap
# Don't delete these
 daily_clean_tmps_verbose=YES # Mention files deleted
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205509 - head/etc/defaults

2010-03-23 Thread Joerg Wunsch
Author: joerg
Date: Tue Mar 23 06:19:44 2010
New Revision: 205509
URL: http://svn.freebsd.org/changeset/base/205509

Log:
  Add .snap to daily_clean_tmps_ignore; /tmp/.snap ist not supposed to
  be auto-removed (and /tmp is a filesystem of its own now by default).
  
  MFC after:3 days

Modified:
  head/etc/defaults/periodic.conf

Modified: head/etc/defaults/periodic.conf
==
--- head/etc/defaults/periodic.conf Tue Mar 23 04:07:49 2010
(r205508)
+++ head/etc/defaults/periodic.conf Tue Mar 23 06:19:44 2010
(r205509)
@@ -46,7 +46,7 @@ daily_clean_tmps_enable=NO  # Delete
 daily_clean_tmps_dirs=/tmp   # Delete under here
 daily_clean_tmps_days=3  # If not accessed for
 daily_clean_tmps_ignore=.X*-lock .X11-unix .ICE-unix .font-unix .XIM-unix
-daily_clean_tmps_ignore=$daily_clean_tmps_ignore quota.user quota.group
+daily_clean_tmps_ignore=$daily_clean_tmps_ignore quota.user quota.group .snap
# Don't delete these
 daily_clean_tmps_verbose=YES # Mention files deleted
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205068 - stable/8/usr.bin/perror

2010-03-11 Thread Joerg Wunsch
Author: joerg
Date: Fri Mar 12 05:16:24 2010
New Revision: 205068
URL: http://svn.freebsd.org/changeset/base/205068

Log:
  (r205011) The number argument is everything but optional.

Modified:
  stable/8/usr.bin/perror/perror.1
Directory Properties:
  stable/8/usr.bin/perror/   (props changed)

Modified: stable/8/usr.bin/perror/perror.1
==
--- stable/8/usr.bin/perror/perror.1Fri Mar 12 05:08:05 2010
(r205067)
+++ stable/8/usr.bin/perror/perror.1Fri Mar 12 05:16:24 2010
(r205068)
@@ -34,7 +34,7 @@
 .Nd print an error number as a string
 .Sh SYNOPSIS
 .Nm
-.Op Ar number
+.Ar number
 .Sh DESCRIPTION
 The
 .Nm
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r204491 - stable/8/sys/dev/ieee488

2010-02-28 Thread Joerg Wunsch
Author: joerg
Date: Sun Feb 28 22:25:39 2010
New Revision: 204491
URL: http://svn.freebsd.org/changeset/base/204491

Log:
  MFC r203360
  
GPIB overhaul, part #2: make the tnt4882 driver work with the newer
TNT5004 IC.  This involved a major rewrite of a number of things, as
this chip no longer supports the NAT7210 legacy mode but requires the
host to use the (more modern) FIFO mode.
  
In theory, this also ought to work on the older TNT4882C chip.  I'll
probably add this as optional support (perhaps by a device.hints flag)
later on.  By now, FIFO mode is *only* activates iff a TNT5004 chip
has been detected (where the old code didn't work at all), while
everything else is supposed to use the old code.

Added:
  stable/8/sys/dev/ieee488/tnt4882.h
 - copied unchanged from r203360, head/sys/dev/ieee488/tnt4882.h
Modified:
  stable/8/sys/dev/ieee488/ibfoo.c
  stable/8/sys/dev/ieee488/pcii.c
  stable/8/sys/dev/ieee488/tnt4882.c
  stable/8/sys/dev/ieee488/upd7210.c
  stable/8/sys/dev/ieee488/upd7210.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/netinet/   (props changed)

Modified: stable/8/sys/dev/ieee488/ibfoo.c
==
--- stable/8/sys/dev/ieee488/ibfoo.cSun Feb 28 22:09:09 2010
(r204490)
+++ stable/8/sys/dev/ieee488/ibfoo.cSun Feb 28 22:25:39 2010
(r204491)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2005 Poul-Henning Kamp p...@freebsd.org
+ * Copyright (c) 2010 Joerg Wunsch jo...@freebsd.org
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -40,6 +41,7 @@ __FBSDID($FreeBSD$);
 #include sys/kernel.h
 #include sys/limits.h
 #include sys/module.h
+#include sys/rman.h
 #include sys/bus.h
 #include sys/lock.h
 #include sys/mutex.h
@@ -53,6 +55,7 @@ __FBSDID($FreeBSD$);
 
 #define UPD7210_SW_DRIVER
 #include dev/ieee488/upd7210.h
+#include dev/ieee488/tnt4882.h
 
 static MALLOC_DEFINE(M_IBFOO, IBFOO, IBFOO);
 
@@ -94,7 +97,10 @@ struct ibfoo {
PIO_IDATA,
PIO_ODATA,
PIO_CMD,
-   DMA_IDATA
+   DMA_IDATA,
+   FIFO_IDATA,
+   FIFO_ODATA,
+   FIFO_CMD
}   mode;
 
struct timeval  deadline;
@@ -170,7 +176,7 @@ ib_set_errno(struct ibarg *ap, int errno
 }
 
 static int
-gpib_ib_irq(struct upd7210 *u, int intr __unused)
+gpib_ib_irq(struct upd7210 *u, int isr_3)
 {
struct ibfoo *ib;
 
@@ -211,11 +217,53 @@ gpib_ib_irq(struct upd7210 *u, int intr 
if (!(u-rreg[ISR1]  IXR1_ENDRX))
return (0);
break;
+   case FIFO_IDATA:
+   if (!(isr_3  0x15))
+   return (0);
+   while (ib-buflen != 0  (isr_3  0x04 /* NEF */) != 0) {
+   *ib-buf = bus_read_1(u-reg_res[0], fifob);
+   ib-buf++;
+   ib-buflen--;
+   isr_3 = bus_read_1(u-reg_res[0], isr3);
+   }
+   if ((isr_3  0x01) != 0 /* xfr done */ ||
+   (u-rreg[ISR1]  IXR1_ENDRX) != 0 ||
+   ib-buflen == 0)
+   break;
+   if (isr_3  0x10)
+   /* xfr stopped */
+   bus_write_1(u-reg_res[0], cmdr, 0x04); /* GO */
+   upd7210_wr(u, AUXMR, AUXMR_RFD);
+   return (1);
+   case FIFO_CMD:
+   case FIFO_ODATA:
+   if (!(isr_3  0x19))
+   return (0);
+   if (ib-buflen == 0)
+   /* xfr DONE */
+   break;
+   while (ib-buflen != 0  (isr_3  0x08 /* NFF */) != 0) {
+   bus_write_1(u-reg_res[0], fifob, *ib-buf);
+   ib-buf++;
+   ib-buflen--;
+   isr_3 = bus_read_1(u-reg_res[0], isr3);
+   }
+   if (isr_3  0x10)
+   /* xfr stopped */
+   bus_write_1(u-reg_res[0], cmdr, 0x04); /* GO */
+   if (ib-buflen == 0)
+   /* no more NFF interrupts wanted */
+   bus_write_1(u-reg_res[0], imr3, 0x11); /* STOP IE, 
DONE IE */
+   return (1);
default:
return (0);
}
upd7210_wr(u, IMR1, 0);
upd7210_wr(u, IMR2, 0);
+   if (u-use_fifo) {
+   bus_write_1(u-reg_res[0], imr3, 0x00);
+   bus_write_1(u-reg_res[0], cmdr, 0x22); /* soft RESET */
+   }
ib-mode = BUSY;
wakeup(ib

svn commit: r203500 - stable/8/gnu/usr.bin/groff/tmac

2010-02-04 Thread Joerg Wunsch
Author: joerg
Date: Thu Feb  4 19:47:26 2010
New Revision: 203500
URL: http://svn.freebsd.org/changeset/base/203500

Log:
  MFC r203357: teach groff about libgpib.

Modified:
  stable/8/gnu/usr.bin/groff/tmac/mdoc.local
Directory Properties:
  stable/8/gnu/usr.bin/groff/   (props changed)

Modified: stable/8/gnu/usr.bin/groff/tmac/mdoc.local
==
--- stable/8/gnu/usr.bin/groff/tmac/mdoc.local  Thu Feb  4 18:56:38 2010
(r203499)
+++ stable/8/gnu/usr.bin/groff/tmac/mdoc.local  Thu Feb  4 19:47:26 2010
(r203500)
@@ -46,6 +46,7 @@
 .ds doc-str-Lb-libelf  ELF Parsing Library (libelf, \-lelf)
 .ds doc-str-Lb-libfetchFile Transfer Library (libfetch, \-lfetch)
 .ds doc-str-Lb-libgeom Userland API Library for kernel GEOM subsystem 
(libgeom, \-lgeom)
+.ds doc-str-Lb-libgpib General-Purpose Instrument Bus (GPIB) library 
(libgpib, \-lgpib)
 .ds doc-str-Lb-libipx  IPX Address Conversion Support Library (libipx, 
\-lipx)
 .ds doc-str-Lb-libjail Jail Library (libjail, \-ljail)
 .ds doc-str-Lb-libkiconv   Kernel side iconv library (libkiconv, \-lkiconv)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r203501 - stable/8/lib/libgpib

2010-02-04 Thread Joerg Wunsch
Author: joerg
Date: Thu Feb  4 19:49:07 2010
New Revision: 203501
URL: http://svn.freebsd.org/changeset/base/203501

Log:
  MFC r203356: add a manpage for gpib(3).

Added:
  stable/8/lib/libgpib/gpib.3
 - copied unchanged from r203356, head/lib/libgpib/gpib.3
Modified:
  stable/8/lib/libgpib/Makefile
Directory Properties:
  stable/8/lib/libgpib/   (props changed)

Modified: stable/8/lib/libgpib/Makefile
==
--- stable/8/lib/libgpib/Makefile   Thu Feb  4 19:47:26 2010
(r203500)
+++ stable/8/lib/libgpib/Makefile   Thu Feb  4 19:49:07 2010
(r203501)
@@ -7,4 +7,23 @@ INCSDIR=   ${INCLUDEDIR}/gpib
 SRCS=  ibfoo.c
 WARNS?=6
 
+MAN=   gpib.3
+
+# MLINKS are only provided for functions that are actually
+# implemented; update this if missing pieces have been filled in.
+MLINKS+=   gpib.3 ibclr.3
+MLINKS+=   gpib.3 ibdev.3
+MLINKS+=   gpib.3 ibdma.3
+MLINKS+=   gpib.3 ibeos.3
+MLINKS+=   gpib.3 ibeot.3
+MLINKS+=   gpib.3 ibloc.3
+MLINKS+=   gpib.3 ibonl.3
+MLINKS+=   gpib.3 ibpad.3
+MLINKS+=   gpib.3 ibrd.3
+MLINKS+=   gpib.3 ibsad.3
+MLINKS+=   gpib.3 ibsic.3
+MLINKS+=   gpib.3 ibtmo.3
+MLINKS+=   gpib.3 ibtrg.3
+MLINKS+=   gpib.3 ibwrt.3
+
 .include bsd.lib.mk

Copied: stable/8/lib/libgpib/gpib.3 (from r203356, head/lib/libgpib/gpib.3)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/8/lib/libgpib/gpib.3 Thu Feb  4 19:49:07 2010(r203501, copy 
of r203356, head/lib/libgpib/gpib.3)
@@ -0,0 +1,738 @@
+.\ Copyright (c) 2010, Joerg Wunsch
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd February 1, 2010
+.Dt GPIB 3
+.Os
+.Sh NAME
+.\ .Nm ibask ,
+.\ .Nm ibbna ,
+.\ .Nm ibcac ,
+.Nm ibclr ,
+.\ .Nm ibcmd ,
+.\ .Nm ibcmda ,
+.\ .Nm ibconfig ,
+.Nm ibdev ,
+.\ .Nm ibdiag ,
+.Nm ibdma ,
+.Nm ibeos ,
+.Nm ibeot ,
+.\ .Nm ibevent ,
+.\ .Nm ibfind ,
+.\ .Nm ibgts ,
+.\ .Nm ibist ,
+.\ .Nm iblines ,
+.\ .Nm ibllo ,
+.\ .Nm ibln ,
+.Nm ibloc ,
+.Nm ibonl ,
+.Nm ibpad ,
+.\ .Nm ibpct ,
+.\ .Nm ibpoke ,
+.\ .Nm ibppc ,
+.Nm ibrd ,
+.\ .Nm ibrda ,
+.\ .Nm ibrdf ,
+.\ .Nm ibrdkey ,
+.\ .Nm ibrpp ,
+.\ .Nm ibrsc ,
+.\ .Nm ibrsp ,
+.\ .Nm ibrsv ,
+.Nm ibsad ,
+.\ .Nm ibsgnl ,
+.Nm ibsic ,
+.\ .Nm ibsre ,
+.\ .Nm ibsrq ,
+.\ .Nm ibstop ,
+.Nm ibtmo ,
+.\ .Nm ibtrap ,
+.Nm ibtrg ,
+.\ .Nm ibwait ,
+.Nm ibwrt
+.\ .Nm ibwrta ,
+.\ .Nm ibwrtf ,
+.\ .Nm ibwrtkey ,
+.\ .Nm ibxtrc
+.Nd GPIB library
+.Sh LIBRARY
+.Lb libgpib
+.Sh SYNOPSIS
+.In gpib.h
+.Pp
+.Dv extern int ibcnt ,
+.Dv iberr ,
+.Dv ibsta ;
+.Pp
+.Ft int
+.Fn ibask int handle int option int *retval
+.Ft int
+.Fn ibbna int handle char *bdname
+.Ft int
+.Fn ibcac int handle int v
+.Ft int
+.Fn ibclr int handle
+.Ft int
+.Fn ibcmd int handle void *buffer long cnt
+.Ft int
+.Fn ibcmda int handle void *buffer long cnt
+.Ft int
+.Fn ibconfig int handle int option int value
+.Ft int
+.Fn ibdev int boardID int pad int sad int tmo int eot int eos
+.Ft int
+.Fn ibdiag int handle void *buffer long cnt
+.Ft int
+.Fn ibdma int handle int v
+.Ft int
+.Fn ibeos int handle int eos
+.Ft int
+.Fn ibeot int handle int eot
+.Ft int
+.Fn ibevent int handle short *event
+.Ft int
+.Fn ibfind char *bdname
+.Ft int
+.Fn ibgts int handle int v
+.Ft int
+.Fn ibist int handle int v
+.Ft int
+.Fn iblines int handle short *lines
+.Ft int
+.Fn ibllo int handle
+.Ft int
+.Fn ibln int handle int padval int sadval short *listenflag
+.Ft int
+.Fn ibloc int handle
+.Ft int
+.Fn ibonl int handle int v
+.Ft int
+.Fn ibpad

svn commit: r203502 - stable/8/share/man/man4

2010-02-04 Thread Joerg Wunsch
Author: joerg
Date: Thu Feb  4 19:49:41 2010
New Revision: 203502
URL: http://svn.freebsd.org/changeset/base/203502

Log:
  MFC r203359: active xrefs to gpib(3) now that it's actually there.

Modified:
  stable/8/share/man/man4/gpib.4
  stable/8/share/man/man4/pcii.4
  stable/8/share/man/man4/tnt4882.4
Directory Properties:
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man4/de.4   (props changed)

Modified: stable/8/share/man/man4/gpib.4
==
--- stable/8/share/man/man4/gpib.4  Thu Feb  4 19:49:07 2010
(r203501)
+++ stable/8/share/man/man4/gpib.4  Thu Feb  4 19:49:41 2010
(r203502)
@@ -54,7 +54,7 @@ When opening, an instrument can send dat
 bus in an unaddressed mode, for example hard-copy printer data.
 .El
 .Sh SEE ALSO
-.\ .Xr libgpib 3 ,
+.Xr gpib 3 ,
 .Xr pcii 4 ,
 .Xr tnt4882 4
 .Sh HISTORY

Modified: stable/8/share/man/man4/pcii.4
==
--- stable/8/share/man/man4/pcii.4  Thu Feb  4 19:49:07 2010
(r203501)
+++ stable/8/share/man/man4/pcii.4  Thu Feb  4 19:49:41 2010
(r203502)
@@ -84,7 +84,7 @@ National Instruments GPIB-PCII/PCIIA (in
 Axiom AX5488
 .El
 .Sh SEE ALSO
-.\ .Xr libgpib 3 ,
+.Xr gpib 3 ,
 .Xr gpib 4 ,
 .Xr device.hints 5
 .Sh HISTORY

Modified: stable/8/share/man/man4/tnt4882.4
==
--- stable/8/share/man/man4/tnt4882.4   Thu Feb  4 19:49:07 2010
(r203501)
+++ stable/8/share/man/man4/tnt4882.4   Thu Feb  4 19:49:41 2010
(r203502)
@@ -43,7 +43,7 @@ the TNT4882 bus interface chip.
 This chip emulates a NEC \(mcPD7210 controller IC as the main
 interface between the host computer and the instrument bus.
 .Sh SEE ALSO
-.\ .Xr libgpib 3 ,
+.Xr gpib 3 ,
 .Xr gpib 4 ,
 .Sh HISTORY
 The
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r203356 - head/lib/libgpib

2010-02-01 Thread Joerg Wunsch
Author: joerg
Date: Mon Feb  1 20:53:55 2010
New Revision: 203356
URL: http://svn.freebsd.org/changeset/base/203356

Log:
  Finally, document libgpib.
  
  MFC after:3 days

Added:
  head/lib/libgpib/gpib.3   (contents, props changed)
Modified:
  head/lib/libgpib/Makefile

Modified: head/lib/libgpib/Makefile
==
--- head/lib/libgpib/Makefile   Mon Feb  1 20:50:49 2010(r203355)
+++ head/lib/libgpib/Makefile   Mon Feb  1 20:53:55 2010(r203356)
@@ -6,4 +6,23 @@ INCS=  gpib.h
 INCSDIR=   ${INCLUDEDIR}/gpib
 SRCS=  ibfoo.c
 
+MAN=   gpib.3
+
+# MLINKS are only provided for functions that are actually
+# implemented; update this if missing pieces have been filled in.
+MLINKS+=   gpib.3 ibclr.3
+MLINKS+=   gpib.3 ibdev.3
+MLINKS+=   gpib.3 ibdma.3
+MLINKS+=   gpib.3 ibeos.3
+MLINKS+=   gpib.3 ibeot.3
+MLINKS+=   gpib.3 ibloc.3
+MLINKS+=   gpib.3 ibonl.3
+MLINKS+=   gpib.3 ibpad.3
+MLINKS+=   gpib.3 ibrd.3
+MLINKS+=   gpib.3 ibsad.3
+MLINKS+=   gpib.3 ibsic.3
+MLINKS+=   gpib.3 ibtmo.3
+MLINKS+=   gpib.3 ibtrg.3
+MLINKS+=   gpib.3 ibwrt.3
+
 .include bsd.lib.mk

Added: head/lib/libgpib/gpib.3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libgpib/gpib.3 Mon Feb  1 20:53:55 2010(r203356)
@@ -0,0 +1,738 @@
+.\ Copyright (c) 2010, Joerg Wunsch
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd February 1, 2010
+.Dt GPIB 3
+.Os
+.Sh NAME
+.\ .Nm ibask ,
+.\ .Nm ibbna ,
+.\ .Nm ibcac ,
+.Nm ibclr ,
+.\ .Nm ibcmd ,
+.\ .Nm ibcmda ,
+.\ .Nm ibconfig ,
+.Nm ibdev ,
+.\ .Nm ibdiag ,
+.Nm ibdma ,
+.Nm ibeos ,
+.Nm ibeot ,
+.\ .Nm ibevent ,
+.\ .Nm ibfind ,
+.\ .Nm ibgts ,
+.\ .Nm ibist ,
+.\ .Nm iblines ,
+.\ .Nm ibllo ,
+.\ .Nm ibln ,
+.Nm ibloc ,
+.Nm ibonl ,
+.Nm ibpad ,
+.\ .Nm ibpct ,
+.\ .Nm ibpoke ,
+.\ .Nm ibppc ,
+.Nm ibrd ,
+.\ .Nm ibrda ,
+.\ .Nm ibrdf ,
+.\ .Nm ibrdkey ,
+.\ .Nm ibrpp ,
+.\ .Nm ibrsc ,
+.\ .Nm ibrsp ,
+.\ .Nm ibrsv ,
+.Nm ibsad ,
+.\ .Nm ibsgnl ,
+.Nm ibsic ,
+.\ .Nm ibsre ,
+.\ .Nm ibsrq ,
+.\ .Nm ibstop ,
+.Nm ibtmo ,
+.\ .Nm ibtrap ,
+.Nm ibtrg ,
+.\ .Nm ibwait ,
+.Nm ibwrt
+.\ .Nm ibwrta ,
+.\ .Nm ibwrtf ,
+.\ .Nm ibwrtkey ,
+.\ .Nm ibxtrc
+.Nd GPIB library
+.Sh LIBRARY
+.Lb libgpib
+.Sh SYNOPSIS
+.In gpib.h
+.Pp
+.Dv extern int ibcnt ,
+.Dv iberr ,
+.Dv ibsta ;
+.Pp
+.Ft int
+.Fn ibask int handle int option int *retval
+.Ft int
+.Fn ibbna int handle char *bdname
+.Ft int
+.Fn ibcac int handle int v
+.Ft int
+.Fn ibclr int handle
+.Ft int
+.Fn ibcmd int handle void *buffer long cnt
+.Ft int
+.Fn ibcmda int handle void *buffer long cnt
+.Ft int
+.Fn ibconfig int handle int option int value
+.Ft int
+.Fn ibdev int boardID int pad int sad int tmo int eot int eos
+.Ft int
+.Fn ibdiag int handle void *buffer long cnt
+.Ft int
+.Fn ibdma int handle int v
+.Ft int
+.Fn ibeos int handle int eos
+.Ft int
+.Fn ibeot int handle int eot
+.Ft int
+.Fn ibevent int handle short *event
+.Ft int
+.Fn ibfind char *bdname
+.Ft int
+.Fn ibgts int handle int v
+.Ft int
+.Fn ibist int handle int v
+.Ft int
+.Fn iblines int handle short *lines
+.Ft int
+.Fn ibllo int handle
+.Ft int
+.Fn ibln int handle int padval int sadval short *listenflag
+.Ft int
+.Fn ibloc int handle
+.Ft int
+.Fn ibonl int handle int v
+.Ft int
+.Fn ibpad int handle int pad
+.Ft int
+.Fn ibpct int handle
+.Ft int
+.Fn ibpoke int handle int option int value
+.Ft int
+.Fn ibppc int handle int v
+.Ft int
+.Fn ibrd int handle void *buffer long cnt
+.Ft int
+.Fn

svn commit: r203357 - head/gnu/usr.bin/groff/tmac

2010-02-01 Thread Joerg Wunsch
Author: joerg
Date: Mon Feb  1 20:54:45 2010
New Revision: 203357
URL: http://svn.freebsd.org/changeset/base/203357

Log:
  Add a libgpib to the list of known .Lb names.
  
  MFC after:3 days

Modified:
  head/gnu/usr.bin/groff/tmac/mdoc.local

Modified: head/gnu/usr.bin/groff/tmac/mdoc.local
==
--- head/gnu/usr.bin/groff/tmac/mdoc.local  Mon Feb  1 20:53:55 2010
(r203356)
+++ head/gnu/usr.bin/groff/tmac/mdoc.local  Mon Feb  1 20:54:45 2010
(r203357)
@@ -46,6 +46,7 @@
 .ds doc-str-Lb-libelf  ELF Parsing Library (libelf, \-lelf)
 .ds doc-str-Lb-libfetchFile Transfer Library (libfetch, \-lfetch)
 .ds doc-str-Lb-libgeom Userland API Library for kernel GEOM subsystem 
(libgeom, \-lgeom)
+.ds doc-str-Lb-libgpib General-Purpose Instrument Bus (GPIB) library 
(libgpib, \-lgpib)
 .ds doc-str-Lb-libipx  IPX Address Conversion Support Library (libipx, 
\-lipx)
 .ds doc-str-Lb-libjail Jail Library (libjail, \-ljail)
 .ds doc-str-Lb-libkiconv   Kernel side iconv library (libkiconv, \-lkiconv)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r203359 - head/share/man/man4

2010-02-01 Thread Joerg Wunsch
Author: joerg
Date: Mon Feb  1 21:01:20 2010
New Revision: 203359
URL: http://svn.freebsd.org/changeset/base/203359

Log:
  Add xrefs to gpib(3), now that it exists.
  
  MFC after:3 days

Modified:
  head/share/man/man4/gpib.4
  head/share/man/man4/pcii.4
  head/share/man/man4/tnt4882.4

Modified: head/share/man/man4/gpib.4
==
--- head/share/man/man4/gpib.4  Mon Feb  1 20:58:45 2010(r203358)
+++ head/share/man/man4/gpib.4  Mon Feb  1 21:01:20 2010(r203359)
@@ -87,7 +87,7 @@ When opening, an instrument can send dat
 bus in an unaddressed mode, for example hard-copy printer data.
 .El
 .Sh SEE ALSO
-.\ .Xr libgpib 3 ,
+.Xr gpib 3 ,
 .Xr pcii 4 ,
 .Xr tnt4882 4
 .Sh HISTORY

Modified: head/share/man/man4/pcii.4
==
--- head/share/man/man4/pcii.4  Mon Feb  1 20:58:45 2010(r203358)
+++ head/share/man/man4/pcii.4  Mon Feb  1 21:01:20 2010(r203359)
@@ -84,7 +84,7 @@ National Instruments GPIB-PCII/PCIIA (in
 Axiom AX5488
 .El
 .Sh SEE ALSO
-.\ .Xr libgpib 3 ,
+.Xr gpib 3 ,
 .Xr gpib 4 ,
 .Xr device.hints 5
 .Sh HISTORY

Modified: head/share/man/man4/tnt4882.4
==
--- head/share/man/man4/tnt4882.4   Mon Feb  1 20:58:45 2010
(r203358)
+++ head/share/man/man4/tnt4882.4   Mon Feb  1 21:01:20 2010
(r203359)
@@ -43,7 +43,7 @@ the TNT4882 bus interface chip.
 This chip emulates a NEC \(mcPD7210 controller IC as the main
 interface between the host computer and the instrument bus.
 .Sh SEE ALSO
-.\ .Xr libgpib 3 ,
+.Xr gpib 3 ,
 .Xr gpib 4 ,
 .Sh HISTORY
 The
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r203360 - head/sys/dev/ieee488

2010-02-01 Thread Joerg Wunsch
Author: joerg
Date: Mon Feb  1 21:21:10 2010
New Revision: 203360
URL: http://svn.freebsd.org/changeset/base/203360

Log:
  GPIB overhaul, part #2: make the tnt4882 driver work with the newer
  TNT5004 IC.  This involved a major rewrite of a number of things, as
  this chip no longer supports the NAT7210 legacy mode but requires the
  host to use the (more modern) FIFO mode.
  
  In theory, this also ought to work on the older TNT4882C chip.  I'll
  probably add this as optional support (perhaps by a device.hints flag)
  later on.  By now, FIFO mode is *only* activates iff a TNT5004 chip
  has been detected (where the old code didn't work at all), while
  everything else is supposed to use the old code.
  
  MFC after:2 weeks

Added:
  head/sys/dev/ieee488/tnt4882.h   (contents, props changed)
Modified:
  head/sys/dev/ieee488/ibfoo.c
  head/sys/dev/ieee488/pcii.c
  head/sys/dev/ieee488/tnt4882.c
  head/sys/dev/ieee488/upd7210.c
  head/sys/dev/ieee488/upd7210.h

Modified: head/sys/dev/ieee488/ibfoo.c
==
--- head/sys/dev/ieee488/ibfoo.cMon Feb  1 21:01:20 2010
(r203359)
+++ head/sys/dev/ieee488/ibfoo.cMon Feb  1 21:21:10 2010
(r203360)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2005 Poul-Henning Kamp p...@freebsd.org
+ * Copyright (c) 2010 Joerg Wunsch jo...@freebsd.org
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -40,6 +41,7 @@ __FBSDID($FreeBSD$);
 #include sys/kernel.h
 #include sys/limits.h
 #include sys/module.h
+#include sys/rman.h
 #include sys/bus.h
 #include sys/lock.h
 #include sys/mutex.h
@@ -53,6 +55,7 @@ __FBSDID($FreeBSD$);
 
 #define UPD7210_SW_DRIVER
 #include dev/ieee488/upd7210.h
+#include dev/ieee488/tnt4882.h
 
 static MALLOC_DEFINE(M_IBFOO, IBFOO, IBFOO);
 
@@ -94,7 +97,10 @@ struct ibfoo {
PIO_IDATA,
PIO_ODATA,
PIO_CMD,
-   DMA_IDATA
+   DMA_IDATA,
+   FIFO_IDATA,
+   FIFO_ODATA,
+   FIFO_CMD
}   mode;
 
struct timeval  deadline;
@@ -170,7 +176,7 @@ ib_set_errno(struct ibarg *ap, int errno
 }
 
 static int
-gpib_ib_irq(struct upd7210 *u, int intr __unused)
+gpib_ib_irq(struct upd7210 *u, int isr_3)
 {
struct ibfoo *ib;
 
@@ -211,11 +217,53 @@ gpib_ib_irq(struct upd7210 *u, int intr 
if (!(u-rreg[ISR1]  IXR1_ENDRX))
return (0);
break;
+   case FIFO_IDATA:
+   if (!(isr_3  0x15))
+   return (0);
+   while (ib-buflen != 0  (isr_3  0x04 /* NEF */) != 0) {
+   *ib-buf = bus_read_1(u-reg_res[0], fifob);
+   ib-buf++;
+   ib-buflen--;
+   isr_3 = bus_read_1(u-reg_res[0], isr3);
+   }
+   if ((isr_3  0x01) != 0 /* xfr done */ ||
+   (u-rreg[ISR1]  IXR1_ENDRX) != 0 ||
+   ib-buflen == 0)
+   break;
+   if (isr_3  0x10)
+   /* xfr stopped */
+   bus_write_1(u-reg_res[0], cmdr, 0x04); /* GO */
+   upd7210_wr(u, AUXMR, AUXMR_RFD);
+   return (1);
+   case FIFO_CMD:
+   case FIFO_ODATA:
+   if (!(isr_3  0x19))
+   return (0);
+   if (ib-buflen == 0)
+   /* xfr DONE */
+   break;
+   while (ib-buflen != 0  (isr_3  0x08 /* NFF */) != 0) {
+   bus_write_1(u-reg_res[0], fifob, *ib-buf);
+   ib-buf++;
+   ib-buflen--;
+   isr_3 = bus_read_1(u-reg_res[0], isr3);
+   }
+   if (isr_3  0x10)
+   /* xfr stopped */
+   bus_write_1(u-reg_res[0], cmdr, 0x04); /* GO */
+   if (ib-buflen == 0)
+   /* no more NFF interrupts wanted */
+   bus_write_1(u-reg_res[0], imr3, 0x11); /* STOP IE, 
DONE IE */
+   return (1);
default:
return (0);
}
upd7210_wr(u, IMR1, 0);
upd7210_wr(u, IMR2, 0);
+   if (u-use_fifo) {
+   bus_write_1(u-reg_res[0], imr3, 0x00);
+   bus_write_1(u-reg_res[0], cmdr, 0x22); /* soft RESET */
+   }
ib-mode = BUSY;
wakeup(ib-buflen);
return (1);
@@ -227,6 +275,7 @@ gpib_ib_timeout(void *arg)
struct upd7210 *u;
struct ibfoo *ib;
struct timeval tv;
+   u_int isr_3;
 
u = arg;
ib = u-ibfoo;
@@ -241,7 +290,11 @@ gpib_ib_timeout(void *arg)
if (ib-mode  BUSY) {
upd7210_rd(u, ISR1);
upd7210_rd(u, ISR2);
-   gpib_ib_irq(u, 2);
+   if (u-use_fifo

svn commit: r203162 - stable/8/share/man/man4

2010-01-29 Thread Joerg Wunsch
Author: joerg
Date: Fri Jan 29 10:38:54 2010
New Revision: 203162
URL: http://svn.freebsd.org/changeset/base/203162

Log:
  MFC r203125: fix typo in .Xr.

Modified:
  stable/8/share/man/man4/gpib.4
Directory Properties:
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man4/de.4   (props changed)

Modified: stable/8/share/man/man4/gpib.4
==
--- stable/8/share/man/man4/gpib.4  Fri Jan 29 10:32:01 2010
(r203161)
+++ stable/8/share/man/man4/gpib.4  Fri Jan 29 10:38:54 2010
(r203162)
@@ -55,7 +55,7 @@ bus in an unaddressed mode, for example 
 .El
 .Sh SEE ALSO
 .\ .Xr libgpib 3 ,
-.Xr gpib 4 ,
+.Xr pcii 4 ,
 .Xr tnt4882 4
 .Sh HISTORY
 The
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r203125 - head/share/man/man4

2010-01-28 Thread Joerg Wunsch
Author: joerg
Date: Thu Jan 28 19:12:40 2010
New Revision: 203125
URL: http://svn.freebsd.org/changeset/base/203125

Log:
  Fix typo in xref (it accidentally referenced itself).
  
  MFC after:1 day

Modified:
  head/share/man/man4/gpib.4

Modified: head/share/man/man4/gpib.4
==
--- head/share/man/man4/gpib.4  Thu Jan 28 18:15:19 2010(r203124)
+++ head/share/man/man4/gpib.4  Thu Jan 28 19:12:40 2010(r203125)
@@ -88,7 +88,7 @@ bus in an unaddressed mode, for example 
 .El
 .Sh SEE ALSO
 .\ .Xr libgpib 3 ,
-.Xr gpib 4 ,
+.Xr pcii 4 ,
 .Xr tnt4882 4
 .Sh HISTORY
 The
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r203064 - stable/8/sys/dev/ieee488

2010-01-27 Thread Joerg Wunsch
Author: joerg
Date: Wed Jan 27 10:32:02 2010
New Revision: 203064
URL: http://svn.freebsd.org/changeset/base/203064

Log:
  Merge of r202870,202898:
  
  Overhaul of the pcii driver:
  
  . Properly allocate all IO space resources.  These cards scatter their
IO addresses over a range of 0x1600 bytes, and they require an
additional address for special interrupt handling.
  
  . Implement the special interrupt handling per the GPIB-PCIIA
Technical Reference Manual; this was apparently not declared for the
clone card this driver has been originally implemented for, but it
turned out to be needed for both, an original NI brand PCII/PCIIA
card as well as the Axiom AX5488 clone.
  
  . Add some diagnostic messages for various resource allocation etc.
failures during probe.
  
  . Add some comments about the structure of the IO address space that
is used by these cards.

Modified:
  stable/8/sys/dev/ieee488/pcii.c
  stable/8/sys/dev/ieee488/tnt4882.c
  stable/8/sys/dev/ieee488/upd7210.c
  stable/8/sys/dev/ieee488/upd7210.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/ieee488/pcii.c
==
--- stable/8/sys/dev/ieee488/pcii.c Wed Jan 27 10:20:10 2010
(r203063)
+++ stable/8/sys/dev/ieee488/pcii.c Wed Jan 27 10:32:02 2010
(r203064)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2005 Poul-Henning Kamp p...@freebsd.org
+ * Copyright (c) 2010 Joerg Wunsch jo...@freebsd.org
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,6 +34,8 @@
  *
  *Tested and known working:
  * BC Microsystems PC488A-0
+ * National Instruments GPIB-PCII/PCIIA (in PCIIa mode)
+ * Axiom AX5488
  *
  */
 
@@ -56,7 +59,7 @@ __FBSDID($FreeBSD$);
 
 struct pcii_softc {
int foo;
-   struct resource *res[3];
+   struct resource *res[11];
void *intr_handler;
struct upd7210  upd7210;
 };
@@ -79,6 +82,14 @@ static struct resource_spec pcii_res_spe
{ SYS_RES_IRQ,  0, RF_ACTIVE | RF_SHAREABLE},
{ SYS_RES_DRQ,  0, RF_ACTIVE | RF_SHAREABLE | RF_OPTIONAL},
{ SYS_RES_IOPORT,   0, RF_ACTIVE},
+   { SYS_RES_IOPORT,   1, RF_ACTIVE},
+   { SYS_RES_IOPORT,   2, RF_ACTIVE},
+   { SYS_RES_IOPORT,   3, RF_ACTIVE},
+   { SYS_RES_IOPORT,   4, RF_ACTIVE},
+   { SYS_RES_IOPORT,   5, RF_ACTIVE},
+   { SYS_RES_IOPORT,   6, RF_ACTIVE},
+   { SYS_RES_IOPORT,   7, RF_ACTIVE},
+   { SYS_RES_IOPORT,   8, RF_ACTIVE | RF_SHAREABLE},
{ -1, 0, 0 }
 };
 
@@ -92,7 +103,7 @@ static int
 pcii_probe(device_t dev)
 {
int rid, i, j;
-   u_long start, count;
+   u_long start, count, addr;
int error = 0;
struct pcii_softc *sc;
 
@@ -102,30 +113,90 @@ pcii_probe(device_t dev)
rid = 0;
if (bus_get_resource(dev, SYS_RES_IOPORT, rid, start, count) != 0)
return ENXIO;
-   if ((start  0x3ff) != 0x2e1)
+   /*
+* The PCIIA decodes a fixed pattern of 0x2e1 for the lower 10
+* address bits A0 ... A9.  Bits A10 through A12 are used by
+* the �PD7210 register select lines.  This makes the
+* individual 7210 register being 0x400 bytes apart in the ISA
+* bus address space.  Address bits A13 and A14 are compared
+* to a DIP switch setting on the card, allowing for up to 4
+* different cards being installed (at base addresses 0x2e1,
+* 0x22e1, 0x42e1, and 0x62e1, respectively).  A15 has been
+* used to select an optional on-board time-of-day clock chip
+* (MM58167A) on the original PCIIA rather than the �PD7210
+* (which is not implemented on later boards).  The
+* documentation states the respective addresses for that chip
+* should be handled as reserved addresses, which we don't do
+* (right now).  Finally, the IO addresses 0x2f0 ... 0x2f7 for
+* a special interrupt handling feature (re-enable
+* interrupts so the IRQ can be shared).
+*
+* Usually, the user will only set the base address in the
+* device hints, so we handle the rest here.
+*
+* (Source: GPIB-PCIIA Technical Reference Manual, September
+* 1989 Edition, National Instruments.)
+*/
+   if ((start  0x3ff) != 0x2e1) {
+   if (bootverbose)
+   printf(pcii_probe: PCIIA base address 0x%lx not 
+  0x2e1/0x22e1/0x42e1/0x62e1\n,
+  start);
return (ENXIO

svn commit: r203065 - stable/8/share/man/man4

2010-01-27 Thread Joerg Wunsch
Author: joerg
Date: Wed Jan 27 10:42:34 2010
New Revision: 203065
URL: http://svn.freebsd.org/changeset/base/203065

Log:
  Merge r202943: Add man pages for the gpib(4), pcii(4), and tnt4882(4)
  drivers.

Added:
  stable/8/share/man/man4/gpib.4
 - copied unchanged from r202943, head/share/man/man4/gpib.4
  stable/8/share/man/man4/pcii.4
 - copied unchanged from r202943, head/share/man/man4/pcii.4
  stable/8/share/man/man4/tnt4882.4
 - copied unchanged from r202943, head/share/man/man4/tnt4882.4
Modified:
  stable/8/share/man/man4/Makefile
Directory Properties:
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man4/de.4   (props changed)

Modified: stable/8/share/man/man4/Makefile
==
--- stable/8/share/man/man4/MakefileWed Jan 27 10:32:02 2010
(r203064)
+++ stable/8/share/man/man4/MakefileWed Jan 27 10:42:34 2010
(r203065)
@@ -117,6 +117,7 @@ MAN=aac.4 \
geom_linux_lvm.4 \
geom_uzip.4 \
gif.4 \
+   gpib.4 \
gre.4 \
harp.4 \
hatm.4 \
@@ -297,6 +298,7 @@ MAN=aac.4 \
pci.4 \
pcib.4 \
pcic.4 \
+   pcii.4 \
pcm.4 \
pcn.4 \
pim.4 \
@@ -394,6 +396,7 @@ MAN=aac.4 \
textdump.4 \
ti.4 \
tl.4 \
+   tnt4882.4 \
trm.4 \
tty.4 \
tun.4 \

Copied: stable/8/share/man/man4/gpib.4 (from r202943, 
head/share/man/man4/gpib.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/8/share/man/man4/gpib.4  Wed Jan 27 10:42:34 2010
(r203065, copy of r202943, head/share/man/man4/gpib.4)
@@ -0,0 +1,67 @@
+.\ Copyright (c) 2010, Joerg Wunsch
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd January 24, 2010
+.Dt GPIB 4
+.Os
+.Sh NAME
+.Nm gpib
+.Nd General-Purpose Instrument Bus (GPIB) driver
+.Sh SYNOPSIS
+Either of the
+.Xr pcii 4
+or
+.Xr tnt4882 4
+drivers use this driver as the backend.
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for driving an IEEE-488 bus, also called
+IEC-625 (or just IEC bus), or HP-IB (Hewlett Packard Instrument
+Bus), or GPIB (General Purpose Instrument Bus).
+The device can become either a listener, talker, controller, and
+in particular a master controller on the bus.
+.Sh FILES
+.Bl -tag -width /dev/gpibNNib
+.It Pa /dev/gpib Ns Em N Ns ib
+Main device node to access the driver.
+.It Pa /dev/gpib Ns Em N Ns l
+Listen-only entry to the driver.
+When opening, an instrument can send data to this device on the
+bus in an unaddressed mode, for example hard-copy printer data.
+.El
+.Sh SEE ALSO
+.\ .Xr libgpib 3 ,
+.Xr gpib 4 ,
+.Xr tnt4882 4
+.Sh HISTORY
+The
+.Nm
+driver was written by Poul-Henning Kamp, and first appeared in
+.Fx 5.4 .
+.Sh AUTHORS
+This manual page was written by
+.An J\(:org Wunsch .

Copied: stable/8/share/man/man4/pcii.4 (from r202943, 
head/share/man/man4/pcii.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/8/share/man/man4/pcii.4  Wed Jan 27 10:42:34 2010
(r203065, copy of r202943, head/share/man/man4/pcii.4)
@@ -0,0 +1,97 @@
+.\ Copyright (c) 2010, Joerg Wunsch
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions

svn commit: r202943 - head/share/man/man4

2010-01-24 Thread Joerg Wunsch
Author: joerg
Date: Sun Jan 24 19:11:08 2010
New Revision: 202943
URL: http://svn.freebsd.org/changeset/base/202943

Log:
  Add man pages for the gpib(4), pcii(4), and tnt4882(4) drivers.
  
  MFC after:3 days

Added:
  head/share/man/man4/gpib.4   (contents, props changed)
  head/share/man/man4/pcii.4   (contents, props changed)
  head/share/man/man4/tnt4882.4   (contents, props changed)
Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileSun Jan 24 18:56:57 2010
(r202942)
+++ head/share/man/man4/MakefileSun Jan 24 19:11:08 2010
(r202943)
@@ -120,6 +120,7 @@ MAN=aac.4 \
geom_linux_lvm.4 \
geom_uzip.4 \
gif.4 \
+   gpib.4 \
gre.4 \
harp.4 \
hatm.4 \
@@ -302,6 +303,7 @@ MAN=aac.4 \
pci.4 \
pcib.4 \
pcic.4 \
+   pcii.4 \
pcm.4 \
pcn.4 \
pim.4 \
@@ -400,6 +402,7 @@ MAN=aac.4 \
textdump.4 \
ti.4 \
tl.4 \
+   tnt4882.4 \
trm.4 \
tty.4 \
tun.4 \

Added: head/share/man/man4/gpib.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/gpib.4  Sun Jan 24 19:11:08 2010(r202943)
@@ -0,0 +1,67 @@
+.\ Copyright (c) 2010, Joerg Wunsch
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd January 24, 2010
+.Dt GPIB 4
+.Os
+.Sh NAME
+.Nm gpib
+.Nd General-Purpose Instrument Bus (GPIB) driver
+.Sh SYNOPSIS
+Either of the
+.Xr pcii 4
+or
+.Xr tnt4882 4
+drivers use this driver as the backend.
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for driving an IEEE-488 bus, also called
+IEC-625 (or just IEC bus), or HP-IB (Hewlett Packard Instrument
+Bus), or GPIB (General Purpose Instrument Bus).
+The device can become either a listener, talker, controller, and
+in particular a master controller on the bus.
+.Sh FILES
+.Bl -tag -width /dev/gpibNNib
+.It Pa /dev/gpib Ns Em N Ns ib
+Main device node to access the driver.
+.It Pa /dev/gpib Ns Em N Ns l
+Listen-only entry to the driver.
+When opening, an instrument can send data to this device on the
+bus in an unaddressed mode, for example hard-copy printer data.
+.El
+.Sh SEE ALSO
+.\ .Xr libgpib 3 ,
+.Xr gpib 4 ,
+.Xr tnt4882 4
+.Sh HISTORY
+The
+.Nm
+driver was written by Poul-Henning Kamp, and first appeared in
+.Fx 5.4 .
+.Sh AUTHORS
+This manual page was written by
+.An J\(:org Wunsch .

Added: head/share/man/man4/pcii.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/pcii.4  Sun Jan 24 19:11:08 2010(r202943)
@@ -0,0 +1,97 @@
+.\ Copyright (c) 2010, Joerg Wunsch
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES

svn commit: r202962 - head/share/man/man4

2010-01-24 Thread Joerg Wunsch
Author: joerg
Date: Mon Jan 25 06:37:44 2010
New Revision: 202962
URL: http://svn.freebsd.org/changeset/base/202962

Log:
  Add an example, derived from the basic demo phk once sent me.

Modified:
  head/share/man/man4/gpib.4

Modified: head/share/man/man4/gpib.4
==
--- head/share/man/man4/gpib.4  Mon Jan 25 06:18:31 2010(r202961)
+++ head/share/man/man4/gpib.4  Mon Jan 25 06:37:44 2010(r202962)
@@ -44,6 +44,39 @@ IEC-625 (or just IEC bus), or HP-IB (H
 Bus), or GPIB (General Purpose Instrument Bus).
 The device can become either a listener, talker, controller, and
 in particular a master controller on the bus.
+.Ss Example
+The following example code queries the device provided as
+.Va argv[1]
+for its identification response.
+.Bd -literal
+/* compile with:  cc -O -o ibtest ibtest.c -lgpib */
+
+#include stdio.h
+#include stdlib.h
+#include err.h
+#include vis.h
+
+#include gpib/gpib.h
+
+int
+main(int argc, char **argv)
+{
+   int dmm;
+unsigned char buf[100];
+char vbuf[sizeof buf * 4];
+
+/* DVM */
+dmm = ibdev(0, (argc  1? atoi(argv[1]): 7), 0,
+   T10s, 1, 0);
+if (dmm  0)
+errx(1, ibdev = %d\\n, dmm);
+ibwrt(dmm, *IDN?\\r\\n, 7);
+ibrd(dmm, buf, sizeof buf - 1);
+strvisx(vbuf, buf, ibcnt, VIS_WHITE | VIS_CSTYLE);
+printf(%s\\n, vbuf);
+return (0);
+}
+.Ed
 .Sh FILES
 .Bl -tag -width /dev/gpibNNib
 .It Pa /dev/gpib Ns Em N Ns ib
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r202870 - head/sys/dev/ieee488

2010-01-23 Thread Joerg Wunsch
As Joerg Wunsch wrote:

   . Implement the special interrupt handling per the GPIB-PCIIA
 Technical Reference Manual; this was apparently not declared for the
 clone card this driver has been originally implemented for, [...]

s/declared/required/

-- 
cheers, Jorg   .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202898 - head/sys/dev/ieee488

2010-01-23 Thread Joerg Wunsch
Author: joerg
Date: Sat Jan 23 21:33:33 2010
New Revision: 202898
URL: http://svn.freebsd.org/changeset/base/202898

Log:
  Fix breakage introduced to the tnt4882 driver in r202870.  This PCI
  frontend uses the same uPD7210 backend as the pcii ISA frontend, so
  the backend has to cope with both situations.
  
  Also, hide the first printf in pcii_probe (address mismatch) behind
  bootverbose as the ISA bus parent tries to probe all configured ISA
  devices against each driver, so a the console has been cluttered with
  this message for a bunch of unrelated driver probes.
  
  MFC after:3 days

Modified:
  head/sys/dev/ieee488/pcii.c
  head/sys/dev/ieee488/tnt4882.c
  head/sys/dev/ieee488/upd7210.c
  head/sys/dev/ieee488/upd7210.h

Modified: head/sys/dev/ieee488/pcii.c
==
--- head/sys/dev/ieee488/pcii.c Sat Jan 23 20:28:37 2010(r202897)
+++ head/sys/dev/ieee488/pcii.c Sat Jan 23 21:33:33 2010(r202898)
@@ -138,9 +138,10 @@ pcii_probe(device_t dev)
 * 1989 Edition, National Instruments.)
 */
if ((start  0x3ff) != 0x2e1) {
-   printf(pcii_probe: PCIIA base address 0x%lx not 
-  0x2e1/0x22e1/0x42e1/0x62e1\n,
-  start);
+   if (bootverbose)
+   printf(pcii_probe: PCIIA base address 0x%lx not 
+  0x2e1/0x22e1/0x42e1/0x62e1\n,
+  start);
return (ENXIO);
}
 
@@ -234,6 +235,7 @@ pcii_attach(device_t dev)
 
for (rid = 0; rid  8; rid++) {
sc-upd7210.reg_res[rid] = sc-res[2 + rid];
+   sc-upd7210.reg_offset[rid] = 0;
}
sc-upd7210.irq_clear_res = sc-res[10];
 

Modified: head/sys/dev/ieee488/tnt4882.c
==
--- head/sys/dev/ieee488/tnt4882.c  Sat Jan 23 20:28:37 2010
(r202897)
+++ head/sys/dev/ieee488/tnt4882.c  Sat Jan 23 21:33:33 2010
(r202898)
@@ -309,6 +309,9 @@ tnt_attach(device_t dev)
/* No DMA help */
sc-upd7210.dmachan = -1;
 
+   /* No special interrupt handling needed here. */
+   sc-upd7210.irq_clear_res = NULL;
+
upd7210attach(sc-upd7210);
 
return (0);

Modified: head/sys/dev/ieee488/upd7210.c
==
--- head/sys/dev/ieee488/upd7210.c  Sat Jan 23 20:28:37 2010
(r202897)
+++ head/sys/dev/ieee488/upd7210.c  Sat Jan 23 21:33:33 2010
(r202898)
@@ -72,7 +72,7 @@ upd7210_rd(struct upd7210 *u, enum upd72
 {
u_int r;
 
-   r = bus_read_1(u-reg_res[reg], 0);
+   r = bus_read_1(u-reg_res[reg], u-reg_offset[reg]);
u-rreg[reg] = r;
return (r);
 }
@@ -81,7 +81,7 @@ void
 upd7210_wr(struct upd7210 *u, enum upd7210_wreg reg, u_int val)
 {
 
-   bus_write_1(u-reg_res[reg], 0, val);
+   bus_write_1(u-reg_res[reg], u-reg_offset[reg], val);
u-wreg[reg] = val;
if (reg == AUXMR)
u-wreg[8 + (val  5)] = val  0x1f;
@@ -125,7 +125,8 @@ upd7210intr(void *arg)
 * Some clones apparently don't implement this
 * feature, but National Instrument cards do.
 */
-   bus_write_1(u-irq_clear_res, 0, 42);
+   if (u-irq_clear_res != NULL)
+   bus_write_1(u-irq_clear_res, 0, 42);
}
mtx_unlock(u-mutex);
 }

Modified: head/sys/dev/ieee488/upd7210.h
==
--- head/sys/dev/ieee488/upd7210.h  Sat Jan 23 20:28:37 2010
(r202897)
+++ head/sys/dev/ieee488/upd7210.h  Sat Jan 23 21:33:33 2010
(r202898)
@@ -50,6 +50,7 @@ typedef int upd7210_irq_t(struct upd7210
 struct upd7210 {
struct resource *reg_res[8];
struct resource *irq_clear_res;
+   u_int   reg_offset[8];
int dmachan;
int unit;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r202870 - head/sys/dev/ieee488

2010-01-22 Thread Joerg Wunsch
Author: joerg
Date: Sat Jan 23 07:54:06 2010
New Revision: 202870
URL: http://svn.freebsd.org/changeset/base/202870

Log:
  Overhaul of the pcii driver:
  
  . Properly allocate all IO space resources.  These cards scatter their
IO addresses over a range of 0x1600 bytes, and they require an
additional address for special interrupt handling.
  
  . Implement the special interrupt handling per the GPIB-PCIIA
Technical Reference Manual; this was apparently not declared for the
clone card this driver has been originally implemented for, but it
turned out to be needed for both, an original NI brand PCII/PCIIA
card as well as the Axiom AX5488 clone.
  
  . Add some diagnostic messages for various resource allocation etc.
failures during probe.
  
  . Add some comments about the structure of the IO address space that
is used by these cards.
  
  MFC after:1 day

Modified:
  head/sys/dev/ieee488/pcii.c
  head/sys/dev/ieee488/upd7210.c
  head/sys/dev/ieee488/upd7210.h

Modified: head/sys/dev/ieee488/pcii.c
==
--- head/sys/dev/ieee488/pcii.c Sat Jan 23 07:52:44 2010(r202869)
+++ head/sys/dev/ieee488/pcii.c Sat Jan 23 07:54:06 2010(r202870)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2005 Poul-Henning Kamp p...@freebsd.org
+ * Copyright (c) 2010 Joerg Wunsch jo...@freebsd.org
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,6 +34,8 @@
  *
  *Tested and known working:
  * BC Microsystems PC488A-0
+ * National Instruments GPIB-PCII/PCIIA (in PCIIa mode)
+ * Axiom AX5488
  *
  */
 
@@ -56,7 +59,7 @@ __FBSDID($FreeBSD$);
 
 struct pcii_softc {
int foo;
-   struct resource *res[3];
+   struct resource *res[11];
void *intr_handler;
struct upd7210  upd7210;
 };
@@ -79,6 +82,14 @@ static struct resource_spec pcii_res_spe
{ SYS_RES_IRQ,  0, RF_ACTIVE | RF_SHAREABLE},
{ SYS_RES_DRQ,  0, RF_ACTIVE | RF_SHAREABLE | RF_OPTIONAL},
{ SYS_RES_IOPORT,   0, RF_ACTIVE},
+   { SYS_RES_IOPORT,   1, RF_ACTIVE},
+   { SYS_RES_IOPORT,   2, RF_ACTIVE},
+   { SYS_RES_IOPORT,   3, RF_ACTIVE},
+   { SYS_RES_IOPORT,   4, RF_ACTIVE},
+   { SYS_RES_IOPORT,   5, RF_ACTIVE},
+   { SYS_RES_IOPORT,   6, RF_ACTIVE},
+   { SYS_RES_IOPORT,   7, RF_ACTIVE},
+   { SYS_RES_IOPORT,   8, RF_ACTIVE | RF_SHAREABLE},
{ -1, 0, 0 }
 };
 
@@ -92,7 +103,7 @@ static int
 pcii_probe(device_t dev)
 {
int rid, i, j;
-   u_long start, count;
+   u_long start, count, addr;
int error = 0;
struct pcii_softc *sc;
 
@@ -102,30 +113,89 @@ pcii_probe(device_t dev)
rid = 0;
if (bus_get_resource(dev, SYS_RES_IOPORT, rid, start, count) != 0)
return ENXIO;
-   if ((start  0x3ff) != 0x2e1)
+   /*
+* The PCIIA decodes a fixed pattern of 0x2e1 for the lower 10
+* address bits A0 ... A9.  Bits A10 through A12 are used by
+* the �PD7210 register select lines.  This makes the
+* individual 7210 register being 0x400 bytes apart in the ISA
+* bus address space.  Address bits A13 and A14 are compared
+* to a DIP switch setting on the card, allowing for up to 4
+* different cards being installed (at base addresses 0x2e1,
+* 0x22e1, 0x42e1, and 0x62e1, respectively).  A15 has been
+* used to select an optional on-board time-of-day clock chip
+* (MM58167A) on the original PCIIA rather than the �PD7210
+* (which is not implemented on later boards).  The
+* documentation states the respective addresses for that chip
+* should be handled as reserved addresses, which we don't do
+* (right now).  Finally, the IO addresses 0x2f0 ... 0x2f7 for
+* a special interrupt handling feature (re-enable
+* interrupts so the IRQ can be shared).
+*
+* Usually, the user will only set the base address in the
+* device hints, so we handle the rest here.
+*
+* (Source: GPIB-PCIIA Technical Reference Manual, September
+* 1989 Edition, National Instruments.)
+*/
+   if ((start  0x3ff) != 0x2e1) {
+   printf(pcii_probe: PCIIA base address 0x%lx not 
+  0x2e1/0x22e1/0x42e1/0x62e1\n,
+  start);
return (ENXIO);
-   count = 1;
-   if (bus_set_resource(dev, SYS_RES_IOPORT, rid, start, count) != 0)
+   }
+
+   for (rid = 0, addr = start; rid  8; rid++, addr += 0x400) {
+   if (bus_set_resource(dev, SYS_RES_IOPORT, rid, addr, 1) != 0) {
+   printf(pcii_probe: could not set IO port 0x%lx\n,
+  addr);
+   return (ENXIO

svn commit: r194891 - head/sys/dev/fdc

2009-06-24 Thread Joerg Wunsch
Author: joerg
Date: Wed Jun 24 19:30:31 2009
New Revision: 194891
URL: http://svn.freebsd.org/changeset/base/194891

Log:
  With the fdc control device disappearing some 5 years ago, it is no
  longer useful for the FD_STYPE and FD_SOPTS ioctls to insist on being
  issued on a writable file descriptor.  Otherwise, there's no longer a
  chance to set the drive type or options when a read-only medium is
  present in the drive, as there is no way to obtain a writable fd then.

Modified:
  head/sys/dev/fdc/fdc.c

Modified: head/sys/dev/fdc/fdc.c
==
--- head/sys/dev/fdc/fdc.c  Wed Jun 24 19:25:47 2009(r194890)
+++ head/sys/dev/fdc/fdc.c  Wed Jun 24 19:30:31 2009(r194891)
@@ -1498,8 +1498,6 @@ fd_ioctl(struct g_provider *pp, u_long c
return (0);
 
case FD_STYPE:  /* set drive type */
-   if (!(fflag  FWRITE))
-   return (EPERM);
/*
 * Allow setting drive type temporarily iff
 * currently unset.  Used for fdformat so any
@@ -1521,8 +1519,6 @@ fd_ioctl(struct g_provider *pp, u_long c
return (0);
 
case FD_SOPTS:  /* set drive options */
-   if (!(fflag  FWRITE))
-   return (EPERM);
fd-options = *(int *)data;
return (0);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r194892 - in head/usr.sbin: fdcontrol fdformat fdread fdwrite

2009-06-24 Thread Joerg Wunsch
Author: joerg
Date: Wed Jun 24 19:47:53 2009
New Revision: 194892
URL: http://svn.freebsd.org/changeset/base/194892

Log:
  Drop the defunct FDOPT_NOERRLOG option from all the floppy utilities.
  The kernel does not log floppy media errors anymore.
  
  In fdcontrol, do always open the file descriptor in read-only mode so
  it can operate on read-only media, as there is no longer a separate
  control device to operate on.

Modified:
  head/usr.sbin/fdcontrol/fdcontrol.c
  head/usr.sbin/fdformat/fdformat.c
  head/usr.sbin/fdread/fdread.c
  head/usr.sbin/fdwrite/fdwrite.c

Modified: head/usr.sbin/fdcontrol/fdcontrol.c
==
--- head/usr.sbin/fdcontrol/fdcontrol.c Wed Jun 24 19:30:31 2009
(r194891)
+++ head/usr.sbin/fdcontrol/fdcontrol.c Wed Jun 24 19:47:53 2009
(r194892)
@@ -72,7 +72,7 @@ main(int argc, char **argv)
enum fd_drivetype type;
struct fd_type ft, newft, *fdtp;
const char *name, *descr;
-   int fd, i, mode, autofmt;
+   int fd, i, autofmt;
 
autofmt = 0;
while((i = getopt(argc, argv, aFf:s:v)) != -1)
@@ -116,12 +116,7 @@ main(int argc, char **argv)
if(argc != 1)
usage();
 
-   if (show || showfmt)
-   mode = O_RDONLY | O_NONBLOCK;
-   else
-   mode = O_RDWR;
-
-   if((fd = open(argv[0], mode))  0)
+   if((fd = open(argv[0], O_RDONLY | O_NONBLOCK))  0)
err(EX_UNAVAILABLE, open(%s), argv[0]);
 
if (ioctl(fd, FD_GDTYPE, type) == -1)

Modified: head/usr.sbin/fdformat/fdformat.c
==
--- head/usr.sbin/fdformat/fdformat.c   Wed Jun 24 19:30:31 2009
(r194891)
+++ head/usr.sbin/fdformat/fdformat.c   Wed Jun 24 19:47:53 2009
(r194892)
@@ -146,7 +146,7 @@ main(int argc, char **argv)
struct fdc_status fdcs[MAXPRINTERRS];
int format, fill, quiet, verify, verify_only, confirm;
int fd, c, i, track, error, tracks_per_dot, bytes_per_track, errs;
-   int fdopts, flags;
+   int flags;
char *fmtstring, *device;
const char *name, *descr;
 
@@ -250,11 +250,6 @@ main(int argc, char **argv)
errx(EX_OSERR, not a floppy disk: %s, device);
if (ioctl(fd, FD_GDTYPE, type) == -1)
err(EX_OSERR, ioctl(FD_GDTYPE));
-   if (ioctl(fd, FD_GOPTS, fdopts) == -1)
-   err(EX_OSERR, ioctl(FD_GOPTS));
-   fdopts |= FDOPT_NOERRLOG;
-   if (ioctl(fd, FD_SOPTS, fdopts) == -1)
-   err(EX_OSERR, ioctl(FD_SOPTS, FDOPT_NOERRLOG));
if (format) {
getname(type, name, descr);
fdtp = get_fmt(format, type);

Modified: head/usr.sbin/fdread/fdread.c
==
--- head/usr.sbin/fdread/fdread.c   Wed Jun 24 19:30:31 2009
(r194891)
+++ head/usr.sbin/fdread/fdread.c   Wed Jun 24 19:47:53 2009
(r194892)
@@ -166,9 +166,6 @@ doread(int fd, FILE *of, const char *_de
 
if (ioctl(fd, FD_GTYPE, fdt) == -1)
err(EX_OSERR, ioctl(FD_GTYPE) failed -- not a floppy?);
-   fdopts = FDOPT_NOERRLOG;
-   if (ioctl(fd, FD_SOPTS, fdopts) == -1)
-   err(EX_OSERR, ioctl(FD_SOPTS, FDOPT_NOERRLOG));
 
secsize = 128  fdt.secsize;
tracksize = fdt.sectrac * secsize;
@@ -300,7 +297,7 @@ doread(int fd, FILE *of, const char *_de
 int
 doreadid(int fd, unsigned int numids, unsigned int trackno)
 {
-   int rv = 0, fdopts;
+   int rv = 0;
unsigned int i;
struct fdc_readid info;
struct fdc_status fdcs;
@@ -309,10 +306,6 @@ doreadid(int fd, unsigned int numids, un
if (ioctl(fd, FD_GTYPE, fdt) == -1)
err(EX_OSERR, ioctl(FD_GTYPE) failed -- not a floppy?);
 
-   fdopts = FDOPT_NOERRLOG;
-   if (ioctl(fd, FD_SOPTS, fdopts) == -1)
-   err(EX_OSERR, ioctl(FD_SOPTS, FDOPT_NOERRLOG));
-
for (i = 0; i  numids; i++) {
info.cyl = trackno / fdt.heads;
info.head = fdt.heads  1? trackno % fdt.heads: 0;

Modified: head/usr.sbin/fdwrite/fdwrite.c
==
--- head/usr.sbin/fdwrite/fdwrite.c Wed Jun 24 19:30:31 2009
(r194891)
+++ head/usr.sbin/fdwrite/fdwrite.c Wed Jun 24 19:47:53 2009
(r194892)
@@ -66,7 +66,7 @@ main(int argc, char **argv)
 {
 int inputfd = -1, c, fdn = 0, i,j,fd;
 int bpt, verbose=1, nbytes=0, track;
-int interactive = 1, fdopts;
+int interactive = 1;
 const char *device= /dev/fd0;
 char *trackbuf = 0,*vrfybuf = 0;
 struct fd_type fdt;
@@ -130,9 +130,6 @@ main(int argc, char **argv)
 
if(ioctl(fd, FD_GTYPE, fdt)  0)
errx(1, not a floppy disk: %s, device);
-   fdopts = FDOPT_NOERRLOG;
-   if (ioctl(fd, 

svn commit: r194896 - in stable/7/sys: . dev/fdc

2009-06-24 Thread Joerg Wunsch
Author: joerg
Date: Wed Jun 24 20:22:46 2009
New Revision: 194896
URL: http://svn.freebsd.org/changeset/base/194896

Log:
  Do not insist on the fd being read/write for the FD_SOPTS and FD_STYPE
  ioctls, so they can be applied to read/only media.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/dev/fdc/fdc.c

Modified: stable/7/sys/dev/fdc/fdc.c
==
--- stable/7/sys/dev/fdc/fdc.c  Wed Jun 24 20:06:16 2009(r194895)
+++ stable/7/sys/dev/fdc/fdc.c  Wed Jun 24 20:22:46 2009(r194896)
@@ -1498,8 +1498,6 @@ fd_ioctl(struct g_provider *pp, u_long c
return (0);
 
case FD_STYPE:  /* set drive type */
-   if (!(fflag  FWRITE))
-   return (EPERM);
/*
 * Allow setting drive type temporarily iff
 * currently unset.  Used for fdformat so any
@@ -1521,8 +1519,6 @@ fd_ioctl(struct g_provider *pp, u_long c
return (0);
 
case FD_SOPTS:  /* set drive options */
-   if (!(fflag  FWRITE))
-   return (EPERM);
fd-options = *(int *)data;
return (0);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r194899 - in stable/7/usr.sbin: fdcontrol fdformat fdread fdwrite

2009-06-24 Thread Joerg Wunsch
Author: joerg
Date: Wed Jun 24 20:40:10 2009
New Revision: 194899
URL: http://svn.freebsd.org/changeset/base/194899

Log:
  Remove the defunct FDOPT_NOERRLOG; floppy media errors are no longer
  logged by the kernel anyway.
  
  In fdcontrol, open the file descriptor read-only, so the format for
  read-only media can be set.

Modified:
  stable/7/usr.sbin/fdcontrol/   (props changed)
  stable/7/usr.sbin/fdcontrol/fdcontrol.c
  stable/7/usr.sbin/fdformat/   (props changed)
  stable/7/usr.sbin/fdformat/fdformat.c
  stable/7/usr.sbin/fdread/   (props changed)
  stable/7/usr.sbin/fdread/fdread.c
  stable/7/usr.sbin/fdwrite/   (props changed)
  stable/7/usr.sbin/fdwrite/fdwrite.c

Modified: stable/7/usr.sbin/fdcontrol/fdcontrol.c
==
--- stable/7/usr.sbin/fdcontrol/fdcontrol.c Wed Jun 24 20:29:10 2009
(r194898)
+++ stable/7/usr.sbin/fdcontrol/fdcontrol.c Wed Jun 24 20:40:10 2009
(r194899)
@@ -72,7 +72,7 @@ main(int argc, char **argv)
enum fd_drivetype type;
struct fd_type ft, newft, *fdtp;
const char *name, *descr;
-   int fd, i, mode, autofmt;
+   int fd, i, autofmt;
 
autofmt = 0;
while((i = getopt(argc, argv, aFf:s:v)) != -1)
@@ -116,12 +116,7 @@ main(int argc, char **argv)
if(argc != 1)
usage();
 
-   if (show || showfmt)
-   mode = O_RDONLY | O_NONBLOCK;
-   else
-   mode = O_RDWR;
-
-   if((fd = open(argv[0], mode))  0)
+   if((fd = open(argv[0], O_RDONLY | O_NONBLOCK))  0)
err(EX_UNAVAILABLE, open(%s), argv[0]);
 
if (ioctl(fd, FD_GDTYPE, type) == -1)

Modified: stable/7/usr.sbin/fdformat/fdformat.c
==
--- stable/7/usr.sbin/fdformat/fdformat.c   Wed Jun 24 20:29:10 2009
(r194898)
+++ stable/7/usr.sbin/fdformat/fdformat.c   Wed Jun 24 20:40:10 2009
(r194899)
@@ -146,7 +146,7 @@ main(int argc, char **argv)
struct fdc_status fdcs[MAXPRINTERRS];
int format, fill, quiet, verify, verify_only, confirm;
int fd, c, i, track, error, tracks_per_dot, bytes_per_track, errs;
-   int fdopts, flags;
+   int flags;
char *fmtstring, *device;
const char *name, *descr;
 
@@ -250,11 +250,6 @@ main(int argc, char **argv)
errx(EX_OSERR, not a floppy disk: %s, device);
if (ioctl(fd, FD_GDTYPE, type) == -1)
err(EX_OSERR, ioctl(FD_GDTYPE));
-   if (ioctl(fd, FD_GOPTS, fdopts) == -1)
-   err(EX_OSERR, ioctl(FD_GOPTS));
-   fdopts |= FDOPT_NOERRLOG;
-   if (ioctl(fd, FD_SOPTS, fdopts) == -1)
-   err(EX_OSERR, ioctl(FD_SOPTS, FDOPT_NOERRLOG));
if (format) {
getname(type, name, descr);
fdtp = get_fmt(format, type);

Modified: stable/7/usr.sbin/fdread/fdread.c
==
--- stable/7/usr.sbin/fdread/fdread.c   Wed Jun 24 20:29:10 2009
(r194898)
+++ stable/7/usr.sbin/fdread/fdread.c   Wed Jun 24 20:40:10 2009
(r194899)
@@ -166,9 +166,6 @@ doread(int fd, FILE *of, const char *_de
 
if (ioctl(fd, FD_GTYPE, fdt) == -1)
err(EX_OSERR, ioctl(FD_GTYPE) failed -- not a floppy?);
-   fdopts = FDOPT_NOERRLOG;
-   if (ioctl(fd, FD_SOPTS, fdopts) == -1)
-   err(EX_OSERR, ioctl(FD_SOPTS, FDOPT_NOERRLOG));
 
secsize = 128  fdt.secsize;
tracksize = fdt.sectrac * secsize;
@@ -300,7 +297,7 @@ doread(int fd, FILE *of, const char *_de
 int
 doreadid(int fd, unsigned int numids, unsigned int trackno)
 {
-   int rv = 0, fdopts;
+   int rv = 0;
unsigned int i;
struct fdc_readid info;
struct fdc_status fdcs;
@@ -309,10 +306,6 @@ doreadid(int fd, unsigned int numids, un
if (ioctl(fd, FD_GTYPE, fdt) == -1)
err(EX_OSERR, ioctl(FD_GTYPE) failed -- not a floppy?);
 
-   fdopts = FDOPT_NOERRLOG;
-   if (ioctl(fd, FD_SOPTS, fdopts) == -1)
-   err(EX_OSERR, ioctl(FD_SOPTS, FDOPT_NOERRLOG));
-
for (i = 0; i  numids; i++) {
info.cyl = trackno / fdt.heads;
info.head = fdt.heads  1? trackno % fdt.heads: 0;

Modified: stable/7/usr.sbin/fdwrite/fdwrite.c
==
--- stable/7/usr.sbin/fdwrite/fdwrite.c Wed Jun 24 20:29:10 2009
(r194898)
+++ stable/7/usr.sbin/fdwrite/fdwrite.c Wed Jun 24 20:40:10 2009
(r194899)
@@ -66,7 +66,7 @@ main(int argc, char **argv)
 {
 int inputfd = -1, c, fdn = 0, i,j,fd;
 int bpt, verbose=1, nbytes=0, track;
-int interactive = 1, fdopts;
+int interactive = 1;
 const char *device= /dev/fd0;
 char *trackbuf = 0,*vrfybuf = 0;
 struct fd_type fdt;
@@ -130,9 +130,6 @@ main(int argc, char 

svn commit: r189449 - in head/sys/dev/usb: . serial

2009-03-06 Thread Joerg Wunsch
Author: joerg
Date: Fri Mar  6 14:53:51 2009
New Revision: 189449
URL: http://svn.freebsd.org/changeset/base/189449

Log:
  Add a couple of more things to the FTDI driver I came across:
  
  . Dresden Elektronik Wireless Handheld Terminal
  . Atmel STK541 Zigbee Controller
  
  MFC after:1 week

Modified:
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/uftdi.c
==
--- head/sys/dev/usb/serial/uftdi.c Fri Mar  6 13:24:54 2009
(r189448)
+++ head/sys/dev/usb/serial/uftdi.c Fri Mar  6 14:53:51 2009
(r189449)
@@ -201,7 +201,9 @@ MODULE_DEPEND(uftdi, ucom, 1, 1, 1);
 MODULE_DEPEND(uftdi, usb, 1, 1, 1);
 
 static struct usb2_device_id uftdi_devs[] = {
+   {USB_VPI(USB_VENDOR_ATMEL, USB_PRODUCT_ATMEL_STK541, 
UFTDI_TYPE_8U232AM)},
{USB_VPI(USB_VENDOR_DRESDENELEKTRONIK, 
USB_PRODUCT_DRESDENELEKTRONIK_SENSORTERMINALBOARD, UFTDI_TYPE_8U232AM)},
+   {USB_VPI(USB_VENDOR_DRESDENELEKTRONIK, 
USB_PRODUCT_DRESDENELEKTRONIK_WIRELESSHANDHELDTERMINAL, UFTDI_TYPE_8U232AM)},
{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U100AX, 
UFTDI_TYPE_SIO)},
{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_2232C, 
UFTDI_TYPE_8U232AM)},
{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U232AM, 
UFTDI_TYPE_8U232AM)},

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsFri Mar  6 13:24:54 2009(r189448)
+++ head/sys/dev/usb/usbdevsFri Mar  6 14:53:51 2009(r189449)
@@ -911,6 +911,7 @@ product ATHEROS2 AR5523_3   0x0005  AR5523
 product ATHEROS2 AR5523_3_NF   0x0006  AR5523 (no firmware)
 
 /* Atmel Comp. products */
+product ATMEL STK541   0x2109  Zigbee Controller
 product ATMEL UHB124   0x3301  UHB124 hub
 product ATMEL DWL120   0x7603  DWL-120 Wireless Adapter
 product ATMEL BW0020x7605  BW002 Wireless Adapter
@@ -1174,6 +1175,7 @@ product DRAYTEK VIGOR550  0x0550  Vigor550
 
 /* dresden elektronik products */
 product DRESDENELEKTRONIK SENSORTERMINALBOARD  0x0001 SensorTerminalBoard
+product DRESDENELEKTRONIK WIRELESSHANDHELDTERMINAL  0x0004 Wireless Handheld 
Terminal
 
 /* Dynastream Innovations */
 product DYNASTREAM ANTDEVBOARD 0x1003  ANT dev board
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r187568 - head/sys/dev/usb

2009-01-21 Thread Joerg Wunsch
Author: joerg
Date: Wed Jan 21 20:57:28 2009
New Revision: 187568
URL: http://svn.freebsd.org/changeset/base/187568

Log:
  Add the dresden elektronik SensorTerminalBoard which uses an FT245.

Modified:
  head/sys/dev/usb/uftdi.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/uftdi.c
==
--- head/sys/dev/usb/uftdi.cWed Jan 21 20:53:36 2009(r187567)
+++ head/sys/dev/usb/uftdi.cWed Jan 21 20:57:28 2009(r187568)
@@ -186,6 +186,9 @@ uftdi_match(device_t self)
if (uaa-vendor == USB_VENDOR_MELCO 
(uaa-product == USB_PRODUCT_MELCO_PCOPRS1))
return (UMATCH_VENDOR_PRODUCT);
+   if (uaa-vendor == USB_VENDOR_DRESDENELEKTRONIK 
+   (uaa-product == USB_PRODUCT_DRESDENELEKTRONIK_SENSORTERMINALBOARD))
+   return (UMATCH_VENDOR_PRODUCT);
 
return (UMATCH_NONE);
 }
@@ -316,6 +319,18 @@ uftdi_attach(device_t self)
}
break;
 
+   case USB_VENDOR_DRESDENELEKTRONIK:
+   switch( uaa-product ){
+   case USB_PRODUCT_DRESDENELEKTRONIK_SENSORTERMINALBOARD:
+   sc-sc_type = UFTDI_TYPE_8U232AM;
+   sc-sc_hdrlen = 0;
+   break;
+
+   default:/* Can't happen */
+   goto bad;
+   }
+   break;
+
default:/* Can't happen */
goto bad;
}

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsWed Jan 21 20:53:36 2009(r187567)
+++ head/sys/dev/usb/usbdevsWed Jan 21 20:57:28 2009(r187568)
@@ -623,6 +623,7 @@ vendor QCOM 0x18e8  Qcom
 vendor LINKSYS30x1915  Linksys
 vendor QUALCOMMINC 0x19d2  Qualcomm, Incorporated
 vendor STELERA 0x1a8d  Stelera Wireless
+vendor DRESDENELEKTRONIK 0x1cf1 dresden elektronik
 vendor DLINK   0x2001  D-Link
 vendor PLANEX2 0x2019  Planex Communications
 vendor ERICSSON0x2282  Ericsson
@@ -1169,6 +1170,9 @@ product DMI CFSM_RW   0xa109  CF/SM Reader
 /* DrayTek products */
 product DRAYTEK VIGOR550   0x0550  Vigor550
 
+/* dresden elektronik products */
+product DRESDENELEKTRONIK SENSORTERMINALBOARD  0x0001 SensorTerminalBoard
+
 /* Dynastream Innovations */
 product DYNASTREAM ANTDEVBOARD 0x1003  ANT dev board
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r184867 - stable/7/bin/chio

2008-11-12 Thread Joerg Wunsch
Author: joerg
Date: Wed Nov 12 09:35:57 2008
New Revision: 184867
URL: http://svn.freebsd.org/changeset/base/184867

Log:
  (MFC r184484)
  When running a chio return operation using a physical source unit
  rather than a voltag name, do not set the CESR_VOLTAGS flags in the
  CHIOGSTATUS command requesting the current status.  As voltags are an
  optional feature that must be handled as reserved by media changers
  not implementing the feature, always setting CESR_VOLTAGS resulted in
  the command being aborted with an `Invalid field in CDB', and
  consequently the chio return failed, for media changers that do not
  support voltags.
  
  Approved by:  re (kib)

Modified:
  stable/7/bin/chio/   (props changed)
  stable/7/bin/chio/chio.c

Modified: stable/7/bin/chio/chio.c
==
--- stable/7/bin/chio/chio.cWed Nov 12 09:04:44 2008(r184866)
+++ stable/7/bin/chio/chio.cWed Nov 12 09:35:57 2008(r184867)
@@ -69,7 +69,7 @@ staticconst char *bits_to_string(ces_st
 
 static void find_element(char *, uint16_t *, uint16_t *);
 static struct changer_element_status *get_element_status
-  (unsigned int, unsigned int);
+  (unsigned int, unsigned int, int);
 
 static int do_move(const char *, int, char **);
 static int do_exchange(const char *, int, char **);
@@ -969,7 +969,8 @@ do_return(const char *cname, int argc, c
++argv; --argc;
 
/* Get the status */
-   ces = get_element_status((unsigned int)type, (unsigned int)element);
+   ces = get_element_status((unsigned int)type, (unsigned int)element,
+   CHET_VT == type);
 
if (NULL == ces)
errx(1, %s: null element status pointer, cname);
@@ -1004,7 +1005,7 @@ usage:
  * should free() it when done.
  */
 static struct changer_element_status *
-get_element_status(unsigned int type, unsigned int element)
+get_element_status(unsigned int type, unsigned int element, int use_voltags)
 {
struct changer_element_status_request cesr;
struct changer_element_status *ces;
@@ -1020,7 +1021,8 @@ get_element_status(unsigned int type, un
cesr.cesr_element_type = (uint16_t)type;
cesr.cesr_element_base = (uint16_t)element;
cesr.cesr_element_count = 1;/* Only this one element */
-   cesr.cesr_flags |= CESR_VOLTAGS;/* Grab voltags as well */
+   if (use_voltags)
+   cesr.cesr_flags |= CESR_VOLTAGS; /* Grab voltags as well */
cesr.cesr_element_status = ces;
 
if (ioctl(changer_fd, CHIOGSTATUS, (char *)cesr) == -1) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to [EMAIL PROTECTED]


svn commit: r184484 - head/bin/chio

2008-10-30 Thread Joerg Wunsch
Author: joerg
Date: Thu Oct 30 19:51:02 2008
New Revision: 184484
URL: http://svn.freebsd.org/changeset/base/184484

Log:
  When running a chio return operation using a physical source unit
  rather than a voltag name, do not set the CESR_VOLTAGS flags in the
  CHIOGSTATUS command requesting the current status.  As voltags are an
  optional feature that must be handled as reserved by media changers
  not implementing the feature, always setting CESR_VOLTAGS resulted in
  the command being aborted with an `Invalid field in CDB', and
  consequently the chio return failed, for media changers that do not
  support voltags.
  
  MFC after:1 week

Modified:
  head/bin/chio/chio.c

Modified: head/bin/chio/chio.c
==
--- head/bin/chio/chio.cThu Oct 30 17:54:20 2008(r184483)
+++ head/bin/chio/chio.cThu Oct 30 19:51:02 2008(r184484)
@@ -69,7 +69,7 @@ staticconst char *bits_to_string(ces_st
 
 static void find_element(char *, uint16_t *, uint16_t *);
 static struct changer_element_status *get_element_status
-  (unsigned int, unsigned int);
+  (unsigned int, unsigned int, int);
 
 static int do_move(const char *, int, char **);
 static int do_exchange(const char *, int, char **);
@@ -969,7 +969,8 @@ do_return(const char *cname, int argc, c
++argv; --argc;
 
/* Get the status */
-   ces = get_element_status((unsigned int)type, (unsigned int)element);
+   ces = get_element_status((unsigned int)type, (unsigned int)element,
+   CHET_VT == type);
 
if (NULL == ces)
errx(1, %s: null element status pointer, cname);
@@ -1004,7 +1005,7 @@ usage:
  * should free() it when done.
  */
 static struct changer_element_status *
-get_element_status(unsigned int type, unsigned int element)
+get_element_status(unsigned int type, unsigned int element, int use_voltags)
 {
struct changer_element_status_request cesr;
struct changer_element_status *ces;
@@ -1020,7 +1021,8 @@ get_element_status(unsigned int type, un
cesr.cesr_element_type = (uint16_t)type;
cesr.cesr_element_base = (uint16_t)element;
cesr.cesr_element_count = 1;/* Only this one element */
-   cesr.cesr_flags |= CESR_VOLTAGS;/* Grab voltags as well */
+   if (use_voltags)
+   cesr.cesr_flags |= CESR_VOLTAGS; /* Grab voltags as well */
cesr.cesr_element_status = ces;
 
if (ioctl(changer_fd, CHIOGSTATUS, (char *)cesr) == -1) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to [EMAIL PROTECTED]