Update USB Serial Driver for use with RTEMS

This commit is contained in:
Kevin Kirspel
2017-05-12 08:16:24 -04:00
committed by Sebastian Huber
parent 746d74b516
commit 5040ee564c

View File

@@ -82,7 +82,9 @@ __FBSDID("$FreeBSD$");
#include <sys/priv.h> #include <sys/priv.h>
#include <sys/cons.h> #include <sys/cons.h>
#ifndef __rtems__
#include <dev/uart/uart_ppstypes.h> #include <dev/uart/uart_ppstypes.h>
#endif /* __rtems__ */
#include <dev/usb/usb.h> #include <dev/usb/usb.h>
#include <dev/usb/usbdi.h> #include <dev/usb/usbdi.h>
@@ -99,11 +101,13 @@ __FBSDID("$FreeBSD$");
static SYSCTL_NODE(_hw_usb, OID_AUTO, ucom, CTLFLAG_RW, 0, "USB ucom"); static SYSCTL_NODE(_hw_usb, OID_AUTO, ucom, CTLFLAG_RW, 0, "USB ucom");
#ifndef __rtems__
static int ucom_pps_mode; static int ucom_pps_mode;
SYSCTL_INT(_hw_usb_ucom, OID_AUTO, pps_mode, CTLFLAG_RWTUN, SYSCTL_INT(_hw_usb_ucom, OID_AUTO, pps_mode, CTLFLAG_RWTUN,
&ucom_pps_mode, 0, &ucom_pps_mode, 0,
"pulse capture mode: 0/1/2=disabled/CTS/DCD; add 0x10 to invert"); "pulse capture mode: 0/1/2=disabled/CTS/DCD; add 0x10 to invert");
#endif /* __rtems__ */
#ifdef USB_DEBUG #ifdef USB_DEBUG
static int ucom_debug = 0; static int ucom_debug = 0;
@@ -420,10 +424,12 @@ ucom_attach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc)
sc->sc_tty = tp; sc->sc_tty = tp;
#ifndef __rtems__
sc->sc_pps.ppscap = PPS_CAPTUREBOTH; sc->sc_pps.ppscap = PPS_CAPTUREBOTH;
sc->sc_pps.driver_abi = PPS_ABI_VERSION; sc->sc_pps.driver_abi = PPS_ABI_VERSION;
sc->sc_pps.driver_mtx = sc->sc_mtx; sc->sc_pps.driver_mtx = sc->sc_mtx;
pps_init_abi(&sc->sc_pps); pps_init_abi(&sc->sc_pps);
#endif /* __rtems__ */
DPRINTF("ttycreate: %s\n", buf); DPRINTF("ttycreate: %s\n", buf);
@@ -874,8 +880,10 @@ ucom_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td)
} else { } else {
error = ENOIOCTL; error = ENOIOCTL;
} }
#ifndef __rtems__
if (error == ENOIOCTL) if (error == ENOIOCTL)
error = pps_ioctl(cmd, data, &sc->sc_pps); error = pps_ioctl(cmd, data, &sc->sc_pps);
#endif /* __rtems__ */
break; break;
} }
return (error); return (error);
@@ -1082,7 +1090,9 @@ ucom_cfg_status_change(struct usb_proc_msg *_task)
uint8_t new_lsr; uint8_t new_lsr;
uint8_t msr_delta; uint8_t msr_delta;
uint8_t lsr_delta; uint8_t lsr_delta;
#ifndef __rtems__
uint8_t pps_signal; uint8_t pps_signal;
#endif /* __rtems__ */
tp = sc->sc_tty; tp = sc->sc_tty;
@@ -1111,6 +1121,7 @@ ucom_cfg_status_change(struct usb_proc_msg *_task)
sc->sc_msr = new_msr; sc->sc_msr = new_msr;
sc->sc_lsr = new_lsr; sc->sc_lsr = new_lsr;
#ifndef __rtems__
/* /*
* Time pulse counting support. * Time pulse counting support.
*/ */
@@ -1135,6 +1146,7 @@ ucom_cfg_status_change(struct usb_proc_msg *_task)
pps_event(&sc->sc_pps, onoff ? PPS_CAPTUREASSERT : pps_event(&sc->sc_pps, onoff ? PPS_CAPTUREASSERT :
PPS_CAPTURECLEAR); PPS_CAPTURECLEAR);
} }
#endif /* __rtems__ */
if (msr_delta & SER_DCD) { if (msr_delta & SER_DCD) {