Make interrupt pipe interval time configurable.
- Add kernel options: {UPLCOM,UVSCOM}_INTR_INTERVAL - Add sysctl variables: 'hw.usb.{uplcom,uvscom}.interval' MFC after: 1 week
This commit is contained in:
parent
6702d85006
commit
565f53bbaa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=122796
@ -2232,8 +2232,14 @@ options USB_DEBUG
|
||||
options UKBD_DFLT_KEYMAP # specify the built-in keymap
|
||||
makeoptions UKBD_DFLT_KEYMAP=it.iso
|
||||
|
||||
# options for uplcom:
|
||||
options UPLCOM_INTR_INTERVAL=100 # interrpt pipe interval
|
||||
# in milliseconds
|
||||
|
||||
# options for uvscom:
|
||||
options UVSCOM_DEFAULT_OPKTSIZE=8 # default output packet size
|
||||
options UVSCOM_INTR_INTERVAL=100 # interrpt pipe interval
|
||||
# in milliseconds
|
||||
|
||||
#####################################################################
|
||||
# FireWire support
|
||||
|
@ -552,7 +552,9 @@ BUS_DEBUG opt_bus.h
|
||||
# options for USB support
|
||||
USB_DEBUG opt_usb.h
|
||||
UKBD_DFLT_KEYMAP opt_ukbd.h
|
||||
UPLCOM_INTR_INTERVAL opt_uplcom.h
|
||||
UVSCOM_DEFAULT_OPKTSIZE opt_uvscom.h
|
||||
UVSCOM_INTR_INTERVAL opt_uvscom.h
|
||||
|
||||
# Vinum options
|
||||
VINUMDEBUG opt_vinum.h
|
||||
|
@ -73,6 +73,8 @@ __FBSDID("$FreeBSD$");
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opt_uplcom.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -103,9 +105,9 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <dev/usb/ucomvar.h>
|
||||
|
||||
SYSCTL_NODE(_hw_usb, OID_AUTO, uplcom, CTLFLAG_RW, 0, "USB uplcom");
|
||||
#ifdef USB_DEBUG
|
||||
static int uplcomdebug = 0;
|
||||
SYSCTL_NODE(_hw_usb, OID_AUTO, uplcom, CTLFLAG_RW, 0, "USB uplcom");
|
||||
SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RW,
|
||||
&uplcomdebug, 0, "uplcom debug level");
|
||||
|
||||
@ -124,7 +126,9 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RW,
|
||||
#define UPLCOM_IFACE_INDEX 0
|
||||
#define UPLCOM_SECOND_IFACE_INDEX 1
|
||||
|
||||
#ifndef UPLCOM_INTR_INTERVAL
|
||||
#define UPLCOM_INTR_INTERVAL 100 /* ms */
|
||||
#endif
|
||||
|
||||
#define UPLCOM_SET_REQUEST 0x01
|
||||
#define UPLCOM_SET_CRTSCTS 0x41
|
||||
@ -238,6 +242,29 @@ MODULE_DEPEND(uplcom, usb, 1, 1, 1);
|
||||
MODULE_DEPEND(uplcom, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
|
||||
MODULE_VERSION(uplcom, UPLCOM_MODVER);
|
||||
|
||||
static int uplcominterval = UPLCOM_INTR_INTERVAL;
|
||||
|
||||
static int
|
||||
sysctl_hw_usb_uplcom_interval(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
int err, val;
|
||||
|
||||
val = uplcominterval;
|
||||
err = sysctl_handle_int(oidp, &val, sizeof(val), req);
|
||||
if (err != 0 || req->newptr == NULL)
|
||||
return (err);
|
||||
if (0 < val && val <= 1000)
|
||||
uplcominterval = val;
|
||||
else
|
||||
err = EINVAL;
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_hw_usb_uplcom, OID_AUTO, interval, CTLTYPE_INT | CTLFLAG_RW,
|
||||
0, sizeof(int), sysctl_hw_usb_uplcom_interval,
|
||||
"I", "uplcom interrpt pipe interval");
|
||||
|
||||
USB_MATCH(uplcom)
|
||||
{
|
||||
USB_MATCH_START(uplcom, uaa);
|
||||
@ -702,7 +729,7 @@ uplcom_open(void *addr, int portno)
|
||||
sc->sc_intr_buf,
|
||||
sc->sc_isize,
|
||||
uplcom_intr,
|
||||
UPLCOM_INTR_INTERVAL);
|
||||
uplcominterval);
|
||||
if (err) {
|
||||
printf("%s: cannot open interrupt pipe (addr %d)\n",
|
||||
USBDEVNAME(sc->sc_ucom.sc_dev),
|
||||
|
@ -93,7 +93,9 @@ SYSCTL_INT(_hw_usb_uvscom, OID_AUTO, debug, CTLFLAG_RW,
|
||||
#define UVSCOM_CONFIG_INDEX 0
|
||||
#define UVSCOM_IFACE_INDEX 0
|
||||
|
||||
#ifndef UVSCOM_INTR_INTERVAL
|
||||
#define UVSCOM_INTR_INTERVAL 100 /* mS */
|
||||
#endif
|
||||
|
||||
#define UVSCOM_UNIT_WAIT 5
|
||||
|
||||
@ -251,6 +253,7 @@ MODULE_DEPEND(uvscom, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
|
||||
MODULE_VERSION(uvscom, UVSCOM_MODVER);
|
||||
|
||||
static int uvscomobufsiz = UVSCOM_DEFAULT_OPKTSIZE;
|
||||
static int uvscominterval = UVSCOM_INTR_INTERVAL;
|
||||
|
||||
static int
|
||||
sysctl_hw_usb_uvscom_opktsize(SYSCTL_HANDLER_ARGS)
|
||||
@ -269,9 +272,29 @@ sysctl_hw_usb_uvscom_opktsize(SYSCTL_HANDLER_ARGS)
|
||||
return (err);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_hw_usb_uvscom_interval(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
int err, val;
|
||||
|
||||
val = uvscominterval;
|
||||
err = sysctl_handle_int(oidp, &val, sizeof(val), req);
|
||||
if (err != 0 || req->newptr == NULL)
|
||||
return (err);
|
||||
if (0 < val && val <= 1000)
|
||||
uvscominterval = val;
|
||||
else
|
||||
err = EINVAL;
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_hw_usb_uvscom, OID_AUTO, opktsize, CTLTYPE_INT | CTLFLAG_RW,
|
||||
0, sizeof(int), sysctl_hw_usb_uvscom_opktsize,
|
||||
"I", "uvscom output packet size");
|
||||
SYSCTL_PROC(_hw_usb_uvscom, OID_AUTO, interval, CTLTYPE_INT | CTLFLAG_RW,
|
||||
0, sizeof(int), sysctl_hw_usb_uvscom_interval,
|
||||
"I", "uvscom interrpt pipe interval");
|
||||
|
||||
USB_MATCH(uvscom)
|
||||
{
|
||||
@ -748,6 +771,9 @@ uvscom_open(void *addr, int portno)
|
||||
|
||||
DPRINTF(("uvscom_open: sc = %p\n", sc));
|
||||
|
||||
/* change output packet size */
|
||||
sc->sc_ucom.sc_obufsize = uvscomobufsiz;
|
||||
|
||||
if (sc->sc_intr_number != -1 && sc->sc_intr_pipe == NULL) {
|
||||
DPRINTF(("uvscom_open: open interrupt pipe.\n"));
|
||||
|
||||
@ -769,7 +795,7 @@ uvscom_open(void *addr, int portno)
|
||||
sc->sc_intr_buf,
|
||||
sc->sc_isize,
|
||||
uvscom_intr,
|
||||
UVSCOM_INTR_INTERVAL);
|
||||
uvscominterval);
|
||||
if (err) {
|
||||
printf("%s: cannot open interrupt pipe (addr %d)\n",
|
||||
USBDEVNAME(sc->sc_ucom.sc_dev),
|
||||
|
@ -4,7 +4,8 @@ S= ${.CURDIR}/../..
|
||||
.PATH: $S/dev/usb
|
||||
|
||||
KMOD= uplcom
|
||||
SRCS= uplcom.c ucomvar.h opt_usb.h device_if.h bus_if.h vnode_if.h
|
||||
SRCS= uplcom.c ucomvar.h opt_usb.h opt_uplcom.h \
|
||||
device_if.h bus_if.h vnode_if.h
|
||||
NOMAN=
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
Loading…
Reference in New Issue
Block a user