Re: [PATCH 8/9] Patching USB serial drivers and Termios for use in RTEMS
On 16/2/17 12:06 am, Gedare Bloom wrote: > On Tue, Feb 14, 2017 at 9:43 PM, Chris Johns wrote: >> On 15/02/2017 00:33, Sebastian Huber wrote: >>> >>> For imports of FreeBSD files into RTEMS or Newlib, please use the SVN >>> checkout to get the right $FreeBSD$ identifiers, e.g. >>> >>> >>> https://git.rtems.org/rtems/tree/cpukit/libcsupport/include/sys/event.h#n26 >>> >> >> Maybe a note in libbsd about this would help? I no idea where else this >> could be documented. >> > For RTEMS proper we keep this kind of information somewhere in our > coding conventions, currrently these are documented on our wiki. In > this case, a line item can be added to Maintainability, or to the > linked 3rd party code to call out FreeBSD code specifically. > > https://devel.rtems.org/wiki/Developer/Coding/Conventions#Maintainability > > https://devel.rtems.org/wiki/Developer/Coding/ThirdPartyCode > This looks fine. Thanks. Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH 8/9] Patching USB serial drivers and Termios for use in RTEMS
On Tue, Feb 14, 2017 at 9:43 PM, Chris Johns wrote: > On 15/02/2017 00:33, Sebastian Huber wrote: >> >> For imports of FreeBSD files into RTEMS or Newlib, please use the SVN >> checkout to get the right $FreeBSD$ identifiers, e.g. >> >> >> https://git.rtems.org/rtems/tree/cpukit/libcsupport/include/sys/event.h#n26 >> > > Maybe a note in libbsd about this would help? I no idea where else this > could be documented. > For RTEMS proper we keep this kind of information somewhere in our coding conventions, currrently these are documented on our wiki. In this case, a line item can be added to Maintainability, or to the linked 3rd party code to call out FreeBSD code specifically. https://devel.rtems.org/wiki/Developer/Coding/Conventions#Maintainability https://devel.rtems.org/wiki/Developer/Coding/ThirdPartyCode > Chris > > ___ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH 8/9] Patching USB serial drivers and Termios for use in RTEMS
On 15/02/2017 00:33, Sebastian Huber wrote: For imports of FreeBSD files into RTEMS or Newlib, please use the SVN checkout to get the right $FreeBSD$ identifiers, e.g. https://git.rtems.org/rtems/tree/cpukit/libcsupport/include/sys/event.h#n26 Maybe a note in libbsd about this would help? I no idea where else this could be documented. Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH 8/9] Patching USB serial drivers and Termios for use in RTEMS
For imports of FreeBSD files into RTEMS or Newlib, please use the SVN checkout to get the right $FreeBSD$ identifiers, e.g. https://git.rtems.org/rtems/tree/cpukit/libcsupport/include/sys/event.h#n26 On 14/02/17 13:32, Kirspel, Kevin wrote: OK. I want to update my RTEMS termios patch anyway to include a couple of changes that fell out of the FREEBSD USB serial test cases. Kevin Kirspel Electrical Engineer - Sr. Staff Idexx Roswell 235 Hembree Park Drive Roswell GA 30076 Tel: (770)-510- ext. 81642 Direct: (770)-688-1642 Fax: (770)-510-4445 -Original Message- From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de] Sent: Tuesday, February 14, 2017 3:23 AM To: Kirspel, Kevin ; devel@rtems.org Subject: Re: [PATCH 8/9] Patching USB serial drivers and Termios for use in RTEMS We should first make the Termios API provided by RTEMS more FreeBSD compatible: https://urldefense.proofpoint.com/v2/url?u=https-3A__devel.rtems.org_ticket_2897&d=DwIF-g&c=2do6VJGs3LvEOe4OFFM1bA&r=HDiJ93ANMEQ32G5JGdpyUxbdebuwKHBbeiHMr3RbR74&m=b-FtaO1HmjucZKZlsvK6tIij6oZHXcLVEQDsr-_9vzo&s=Lk4w_YapbZ_YpYJxpoNWtTLXIafXLa4ORXwi8DNZykw&e= Would you mind sending the relevant patches of this ticket to the mailing list? Since is a POSIX header file, it should go into Newlib from my point of view. https://urldefense.proofpoint.com/v2/url?u=https-3A__devel.rtems.org_ticket_2833&d=DwIF-g&c=2do6VJGs3LvEOe4OFFM1bA&r=HDiJ93ANMEQ32G5JGdpyUxbdebuwKHBbeiHMr3RbR74&m=b-FtaO1HmjucZKZlsvK6tIij6oZHXcLVEQDsr-_9vzo&s=QKAQ8SOYH7JdglpgNU1JgKrjx0pkXnYxgmhzNuY6mEs&e= -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
RE: [PATCH 8/9] Patching USB serial drivers and Termios for use in RTEMS
OK. I want to update my RTEMS termios patch anyway to include a couple of changes that fell out of the FREEBSD USB serial test cases. Kevin Kirspel Electrical Engineer - Sr. Staff Idexx Roswell 235 Hembree Park Drive Roswell GA 30076 Tel: (770)-510- ext. 81642 Direct: (770)-688-1642 Fax: (770)-510-4445 -Original Message- From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de] Sent: Tuesday, February 14, 2017 3:23 AM To: Kirspel, Kevin ; devel@rtems.org Subject: Re: [PATCH 8/9] Patching USB serial drivers and Termios for use in RTEMS We should first make the Termios API provided by RTEMS more FreeBSD compatible: https://urldefense.proofpoint.com/v2/url?u=https-3A__devel.rtems.org_ticket_2897&d=DwIF-g&c=2do6VJGs3LvEOe4OFFM1bA&r=HDiJ93ANMEQ32G5JGdpyUxbdebuwKHBbeiHMr3RbR74&m=b-FtaO1HmjucZKZlsvK6tIij6oZHXcLVEQDsr-_9vzo&s=Lk4w_YapbZ_YpYJxpoNWtTLXIafXLa4ORXwi8DNZykw&e= Would you mind sending the relevant patches of this ticket to the mailing list? Since is a POSIX header file, it should go into Newlib from my point of view. https://urldefense.proofpoint.com/v2/url?u=https-3A__devel.rtems.org_ticket_2833&d=DwIF-g&c=2do6VJGs3LvEOe4OFFM1bA&r=HDiJ93ANMEQ32G5JGdpyUxbdebuwKHBbeiHMr3RbR74&m=b-FtaO1HmjucZKZlsvK6tIij6oZHXcLVEQDsr-_9vzo&s=QKAQ8SOYH7JdglpgNU1JgKrjx0pkXnYxgmhzNuY6mEs&e= -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH 8/9] Patching USB serial drivers and Termios for use in RTEMS
We should first make the Termios API provided by RTEMS more FreeBSD compatible: https://devel.rtems.org/ticket/2897 Would you mind sending the relevant patches of this ticket to the mailing list? Since is a POSIX header file, it should go into Newlib from my point of view. https://devel.rtems.org/ticket/2833 -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 8/9] Patching USB serial drivers and Termios for use in RTEMS
--- freebsd/sys/dev/usb/serial/uplcom.c| 22 freebsd/sys/dev/usb/serial/usb_serial.c| 24 freebsd/sys/dev/usb/usb_dev.c | 18 +++ freebsd/sys/fs/devfs/devfs_int.h | 2 +- freebsd/sys/kern/kern_conf.c | 16 +-- freebsd/sys/kern/subr_taskqueue.c | 10 -- freebsd/sys/kern/tty.c | 179 - freebsd/sys/kern/tty_ttydisc.c | 22 freebsd/sys/sys/_termios.h | 30 + freebsd/sys/sys/conf.h | 2 + freebsd/sys/sys/file.h | 4 + freebsd/sys/sys/proc.h | 2 + freebsd/sys/sys/ttydefaults.h | 15 +++ rtemsbsd/include/rtems/bsd/local/opt_gdb.h | 1 + rtemsbsd/include/rtems/bsd/local/opt_usb.h | 2 +- rtemsbsd/sys/fs/devfs/devfs_devs.c | 86 +- 16 files changed, 406 insertions(+), 29 deletions(-) mode change 100644 => 100755 freebsd/sys/dev/usb/serial/uplcom.c mode change 100644 => 100755 freebsd/sys/dev/usb/serial/usb_serial.c mode change 100644 => 100755 freebsd/sys/dev/usb/usb_dev.c mode change 100644 => 100755 freebsd/sys/fs/devfs/devfs_int.h mode change 100644 => 100755 freebsd/sys/kern/kern_conf.c mode change 100644 => 100755 freebsd/sys/kern/subr_taskqueue.c mode change 100644 => 100755 freebsd/sys/kern/tty.c mode change 100644 => 100755 freebsd/sys/kern/tty_ttydisc.c mode change 100644 => 100755 freebsd/sys/sys/_termios.h mode change 100644 => 100755 freebsd/sys/sys/conf.h mode change 100644 => 100755 freebsd/sys/sys/file.h mode change 100644 => 100755 freebsd/sys/sys/proc.h mode change 100644 => 100755 freebsd/sys/sys/ttydefaults.h create mode 100755 rtemsbsd/include/rtems/bsd/local/opt_gdb.h mode change 100644 => 100755 rtemsbsd/include/rtems/bsd/local/opt_usb.h diff --git a/freebsd/sys/dev/usb/serial/uplcom.c b/freebsd/sys/dev/usb/serial/uplcom.c old mode 100644 new mode 100755 index 31b5867..9ad11b7 --- a/freebsd/sys/dev/usb/serial/uplcom.c +++ b/freebsd/sys/dev/usb/serial/uplcom.c @@ -651,6 +651,9 @@ uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) { struct uplcom_softc *sc = ucom->sc_parent; uint8_t i; +#ifdef __rtems__ + uint32_t c_ospeed = rtems_bsd_get_output_speed(t); +#endif /* __rtems__ */ DPRINTF("\n"); @@ -666,15 +669,27 @@ uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) */ if (sc->sc_chiptype != TYPE_PL2303HX) { for (i = 0; i < N_UPLCOM_RATES; i++) { +#ifndef __rtems__ if (uplcom_rates[i] == t->c_ospeed) +#else /* __rtems__ */ + if (uplcom_rates[i] == c_ospeed) +#endif /* __rtems__ */ return (0); } } else { +#ifndef __rtems__ if (t->c_ospeed <= 600) +#else /* __rtems__ */ + if (c_ospeed <= 600) +#endif /* __rtems__ */ return (0); } +#ifndef __rtems__ DPRINTF("uplcom_param: bad baud rate (%d)\n", t->c_ospeed); +#else /* __rtems__ */ + DPRINTF("uplcom_param: bad baud rate (%d)\n", c_ospeed); +#endif /* __rtems__ */ return (EIO); } @@ -684,12 +699,19 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termios *t) struct uplcom_softc *sc = ucom->sc_parent; struct usb_cdc_line_state ls; struct usb_device_request req; +#ifdef __rtems__ + uint32_t c_ospeed = rtems_bsd_get_output_speed(t); +#endif /* __rtems__ */ DPRINTF("sc = %p\n", sc); memset(&ls, 0, sizeof(ls)); +#ifndef __rtems__ USETDW(ls.dwDTERate, t->c_ospeed); +#else /* __rtems__ */ + USETDW(ls.dwDTERate, c_ospeed); +#endif /* __rtems__ */ if (t->c_cflag & CSTOPB) { ls.bCharFormat = UCDC_STOP_BIT_2; diff --git a/freebsd/sys/dev/usb/serial/usb_serial.c b/freebsd/sys/dev/usb/serial/usb_serial.c old mode 100644 new mode 100755 index f425a16..f9f735a --- a/freebsd/sys/dev/usb/serial/usb_serial.c +++ b/freebsd/sys/dev/usb/serial/usb_serial.c @@ -82,7 +82,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef __rtems__ #include +#endif /* __rtems__ */ #include #include @@ -99,11 +101,13 @@ __FBSDID("$FreeBSD$"); static SYSCTL_NODE(_hw_usb, OID_AUTO, ucom, CTLFLAG_RW, 0, "USB ucom"); +#ifndef __rtems__ static int ucom_pps_mode; SYSCTL_INT(_hw_usb_ucom, OID_AUTO, pps_mode, CTLFLAG_RWTUN, &ucom_pps_mode, 0, "pulse capture mode: 0/1/2=disabled/CTS/DCD; add 0x10 to invert"); +#endif /* __rtems__ */ #ifdef USB_DEBUG static int ucom_debug = 0; @@ -418,10 +422,12 @@ ucom_attach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc) sc->sc_tty = tp; +#ifndef __rtems__ sc->sc_pps.ppscap = PPS_CAPTUREBOTH; sc->sc_pps.driver_abi = PPS_ABI_VERSION; sc->sc_pps.driver_mtx = sc->sc_mtx; pps_init_abi(&sc->sc_pps); +#endif /* __rtems_