Re: [PATCH 5/7] Adding RTEMS support for FREEBSD TTY

2017-04-07 Thread Sebastian Huber

On 06/04/17 03:11, Kevin Kirspel wrote:

---
  rtemsbsd/include/machine/rtems-bsd-commands.h |   2 +
  rtemsbsd/include/machine/rtems-bsd-kernel-space.h |   1 +
  rtemsbsd/include/rtems/bsd/local/opt_gdb.h|   1 +
  rtemsbsd/include/rtems/netcmds-config.h   |   2 +
  rtemsbsd/rtems/rtems-bsd-shell-stty.c |  40 +++
  rtemsbsd/sys/fs/devfs/devfs_devs.c|  86 +-
  rtemsbsd/sys/fs/devfs/devfs_vnops.c   | 136 ++
  rtemsbsd/sys/net/ppp_tty.c|  10 +-
  8 files changed, 263 insertions(+), 15 deletions(-)
  create mode 100644 rtemsbsd/include/rtems/bsd/local/opt_gdb.h
  create mode 100644 rtemsbsd/rtems/rtems-bsd-shell-stty.c
  mode change 100755 => 100644 rtemsbsd/sys/fs/devfs/devfs_devs.c
  create mode 100644 rtemsbsd/sys/fs/devfs/devfs_vnops.c

[...]


diff --git a/rtemsbsd/sys/fs/devfs/devfs_vnops.c 
b/rtemsbsd/sys/fs/devfs/devfs_vnops.c
new file mode 100644
index 000..8c4a786
--- /dev/null
+++ b/rtemsbsd/sys/fs/devfs/devfs_vnops.c
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2016 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  


This should probably be your copyright (please check other files too).


diff --git a/rtemsbsd/sys/net/ppp_tty.c b/rtemsbsd/sys/net/ppp_tty.c
index 9d416ea..718b146 100644
--- a/rtemsbsd/sys/net/ppp_tty.c
+++ b/rtemsbsd/sys/net/ppp_tty.c
@@ -426,16 +426,8 @@ ppptioctl(struct rtems_termios_tty *tty, 
rtems_libio_ioctl_args_t *args)
  struct ppp_softc   *sc= tty->t_sc;
  
  switch (cmd) {

-case RTEMS_IO_RCVWAKEUP:
  case RTEMS_IO_SNDWAKEUP:
-case TIOCDRAIN:
-case TIOCFLUSH:
-case TIOCGETA:
-case TIOCGETD:
-case TIOCSETA:
-case TIOCSETAF:
-case TIOCSETAW:
-case TIOCSETD:
+case RTEMS_IO_RCVWAKEUP:
  error = rtems_termios_ioctl(args);
break;
  


Are you sure of this change? The PPP driver is a standard Termios driver 
ported from the old network stack. It would be nice to get rid of it 
eventually.


--
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:RE:[PATCH] Update:Change format specifiers to fix 4 warnings.

2017-04-07 Thread Cillian O'Donnell
Great! That looks like a cleaner, more standardized solution. I was just
hacking away until the warnings stopped. So can I go ahead and #include
 or should I wait until  is defined before
doing any more? Does this work for printk() too?

Thanks Joel.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

RE: [PATCH 5/7] Adding RTEMS support for FREEBSD TTY

2017-04-07 Thread Kirspel, Kevin
I will revert the PPP changes.  It will still uses RTEMS termios instead of 
FREEBSD.

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: Friday, April 07, 2017 5:12 AM
To: Kirspel, Kevin ; devel@rtems.org
Subject: Re: [PATCH 5/7] Adding RTEMS support for FREEBSD TTY

On 06/04/17 03:11, Kevin Kirspel wrote:
> ---
>   rtemsbsd/include/machine/rtems-bsd-commands.h |   2 +
>   rtemsbsd/include/machine/rtems-bsd-kernel-space.h |   1 +
>   rtemsbsd/include/rtems/bsd/local/opt_gdb.h|   1 +
>   rtemsbsd/include/rtems/netcmds-config.h   |   2 +
>   rtemsbsd/rtems/rtems-bsd-shell-stty.c |  40 +++
>   rtemsbsd/sys/fs/devfs/devfs_devs.c|  86 +-
>   rtemsbsd/sys/fs/devfs/devfs_vnops.c   | 136 
> ++
>   rtemsbsd/sys/net/ppp_tty.c|  10 +-
>   8 files changed, 263 insertions(+), 15 deletions(-)
>   create mode 100644 rtemsbsd/include/rtems/bsd/local/opt_gdb.h
>   create mode 100644 rtemsbsd/rtems/rtems-bsd-shell-stty.c
>   mode change 100755 => 100644 rtemsbsd/sys/fs/devfs/devfs_devs.c
>   create mode 100644 rtemsbsd/sys/fs/devfs/devfs_vnops.c
[...]

> diff --git a/rtemsbsd/sys/fs/devfs/devfs_vnops.c 
> b/rtemsbsd/sys/fs/devfs/devfs_vnops.c
> new file mode 100644
> index 000..8c4a786
> --- /dev/null
> +++ b/rtemsbsd/sys/fs/devfs/devfs_vnops.c
> @@ -0,0 +1,136 @@
> +/*
> + * Copyright (c) 2016 embedded brains GmbH.  All rights reserved.
> + *
> + *  embedded brains GmbH
> + *  Dornierstr. 4
> + *  82178 Puchheim
> + *  Germany
> + *  

This should probably be your copyright (please check other files too).

> diff --git a/rtemsbsd/sys/net/ppp_tty.c b/rtemsbsd/sys/net/ppp_tty.c 
> index 9d416ea..718b146 100644
> --- a/rtemsbsd/sys/net/ppp_tty.c
> +++ b/rtemsbsd/sys/net/ppp_tty.c
> @@ -426,16 +426,8 @@ ppptioctl(struct rtems_termios_tty *tty, 
> rtems_libio_ioctl_args_t *args)
>   struct ppp_softc   *sc= tty->t_sc;
>   
>   switch (cmd) {
> -case RTEMS_IO_RCVWAKEUP:
>   case RTEMS_IO_SNDWAKEUP:
> -case TIOCDRAIN:
> -case TIOCFLUSH:
> -case TIOCGETA:
> -case TIOCGETD:
> -case TIOCSETA:
> -case TIOCSETAF:
> -case TIOCSETAW:
> -case TIOCSETD:
> +case RTEMS_IO_RCVWAKEUP:
>   error = rtems_termios_ioctl(args);
>   break;
>   

Are you sure of this change? The PPP driver is a standard Termios driver ported 
from the old network stack. It would be nice to get rid of it eventually.

--
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: RE:[PATCH] Update:Change format specifiers to fix 4 warnings.

2017-04-07 Thread Joel Sherrill
On Fri, Apr 7, 2017 at 4:15 AM, Cillian O'Donnell 
wrote:

> Great! That looks like a cleaner, more standardized solution. I was just
> hacking away until the warnings stopped. So can I go ahead and #include
>  or should I wait until  is defined before
> doing any more? Does this work for printk() too?
>

First the easy answer. printk() supports a subset of printf() formats. So
as long as it is a supported printf format, then yes. But I just looked for
printk() documentation and I don't see any. The code is in
cpukit/libcsupport/src/vprintk.c for a double check. It is supposed to
support everything required by any test.

If a file only uses C99 standard PRI constants, then use 

If a file needs the extra ones being collected into ,
then it should include that.

No need to introduce an unneeded dependency.

Funny, how this simple set of warnings has rippled. It also makes me
want to file a ticket for printk() documentation and adding code style
rules about .

--joel



>
> Thanks Joel.
>
> ___
> 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

[PATCH 1/2] Using inttypes macros fixes 4 format warnings

2017-04-07 Thread Cillian O'Donnell
---
 cpukit/libdl/rtl-obj-cache.c | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/cpukit/libdl/rtl-obj-cache.c b/cpukit/libdl/rtl-obj-cache.c
index a4676cf..c859f60 100644
--- a/cpukit/libdl/rtl-obj-cache.c
+++ b/cpukit/libdl/rtl-obj-cache.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include "rtl-obj-cache.h"
@@ -78,11 +79,12 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache_t* cache,
   struct stat sb;
 
   if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))
-printf ("rtl: cache: %2d: fd=%d offset=%d length=%d area=[%d,%d] 
cache=[%d,%d] size=%d\n",
-fd, cache->fd, (int) offset, (int) *length,
-(int) offset, (int) offset + *length,
-(int) cache->offset, (int) cache->offset + cache->level,
-(int) cache->file_size);
+printf ("rtl: cache: %2d: fd=%d offset=%" PRIdMAX "length=%zu area=[%"
+PRIdMAX ",%" PRIdMAX "] cache=[%" PRIdMAX ",%" PRIdMAX "] 
size=%zu\n",
+fd, cache->fd, offset, *length,
+offset, offset + *length,
+cache->offset, cache->offset + cache->level,
+cache->file_size);
 
   if (*length > cache->size)
   {
@@ -172,10 +174,11 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache_t* cache,
 }
 
 if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))
-  printf ("rtl: cache: %2d: seek: offset=%d buffer_offset=%d read=%d 
cache=[%d,%d] dist=%d\n",
-  fd, (int) offset + buffer_offset, (int) buffer_offset, (int) 
buffer_read,
-  (int) offset, (int) offset + buffer_read,
-  (int) (cache->file_size - offset));
+  printf ("rtl: cache: %2d: seek: offset=%" PRIdMAX "buffer_offset=%zu"
+  "read=%zu cache=[%" PRIdMAX ",%" PRIdMAX "] dist=%" PRIdMAX "\n",
+  fd, offset + buffer_offset, buffer_offset, buffer_read,
+  offset, offset + buffer_read,
+  (cache->file_size - offset));
 
 if (lseek (fd, offset + buffer_offset, SEEK_SET) < 0)
 {
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/2] Using inttype macros fixes 39 format warnings

2017-04-07 Thread Cillian O'Donnell
---
 .../libcpu/powerpc/mpc5xx/vectors/vectors_init.c   | 80 +++---
 1 file changed, 41 insertions(+), 39 deletions(-)

diff --git a/c/src/lib/libcpu/powerpc/mpc5xx/vectors/vectors_init.c 
b/c/src/lib/libcpu/powerpc/mpc5xx/vectors/vectors_init.c
index 4a6c5be..ff34a21 100644
--- a/c/src/lib/libcpu/powerpc/mpc5xx/vectors/vectors_init.c
+++ b/c/src/lib/libcpu/powerpc/mpc5xx/vectors/vectors_init.c
@@ -17,6 +17,7 @@
  *  found in the file LICENSE in this distribution or at
  *  http://www.rtems.org/license/LICENSE.
  */
+#include 
 #include 
 #include 
 #include 
@@ -32,45 +33,46 @@ void C_default_exception_handler(CPU_Exception_frame* 
excPtr)
 {
   int recoverable = 0;
 
-  printk("exception handler called for exception %d\n", excPtr->_EXC_number);
-  printk("\t Next PC or Address of fault = %x\n", excPtr->EXC_SRR0);
-  printk("\t Saved MSR = %x\n", excPtr->EXC_SRR1);
-  printk("\t R0 = %x\n", excPtr->GPR0);
-  printk("\t R1 = %x\n", excPtr->GPR1);
-  printk("\t R2 = %x\n", excPtr->GPR2);
-  printk("\t R3 = %x\n", excPtr->GPR3);
-  printk("\t R4 = %x\n", excPtr->GPR4);
-  printk("\t R5 = %x\n", excPtr->GPR5);
-  printk("\t R6 = %x\n", excPtr->GPR6);
-  printk("\t R7 = %x\n", excPtr->GPR7);
-  printk("\t R8 = %x\n", excPtr->GPR8);
-  printk("\t R9 = %x\n", excPtr->GPR9);
-  printk("\t R10 = %x\n", excPtr->GPR10);
-  printk("\t R11 = %x\n", excPtr->GPR11);
-  printk("\t R12 = %x\n", excPtr->GPR12);
-  printk("\t R13 = %x\n", excPtr->GPR13);
-  printk("\t R14 = %x\n", excPtr->GPR14);
-  printk("\t R15 = %x\n", excPtr->GPR15);
-  printk("\t R16 = %x\n", excPtr->GPR16);
-  printk("\t R17 = %x\n", excPtr->GPR17);
-  printk("\t R18 = %x\n", excPtr->GPR18);
-  printk("\t R19 = %x\n", excPtr->GPR19);
-  printk("\t R20 = %x\n", excPtr->GPR20);
-  printk("\t R21 = %x\n", excPtr->GPR21);
-  printk("\t R22 = %x\n", excPtr->GPR22);
-  printk("\t R23 = %x\n", excPtr->GPR23);
-  printk("\t R24 = %x\n", excPtr->GPR24);
-  printk("\t R25 = %x\n", excPtr->GPR25);
-  printk("\t R26 = %x\n", excPtr->GPR26);
-  printk("\t R27 = %x\n", excPtr->GPR27);
-  printk("\t R28 = %x\n", excPtr->GPR28);
-  printk("\t R29 = %x\n", excPtr->GPR29);
-  printk("\t R30 = %x\n", excPtr->GPR30);
-  printk("\t R31 = %x\n", excPtr->GPR31);
-  printk("\t CR = %x\n", excPtr->EXC_CR);
-  printk("\t CTR = %x\n", excPtr->EXC_CTR);
-  printk("\t XER = %x\n", excPtr->EXC_XER);
-  printk("\t LR = %x\n", excPtr->EXC_LR);
+  printk("exception handler called for exception %" PRIu32 "\n",
+ excPtr->_EXC_number);
+  printk("\t Next PC or Address of fault = %" PRIx32 "\n", excPtr->EXC_SRR0);
+  printk("\t Saved MSR = %" PRIx32 "\n", excPtr->EXC_SRR1);
+  printk("\t R0 = %" PRIx32 "\n", excPtr->GPR0);
+  printk("\t R1 = %" PRIx32 "\n", excPtr->GPR1);
+  printk("\t R2 = %" PRIx32 "\n", excPtr->GPR2);
+  printk("\t R3 = %" PRIx32 "\n", excPtr->GPR3);
+  printk("\t R4 = %" PRIx32 "\n", excPtr->GPR4);
+  printk("\t R5 = %" PRIx32 "\n", excPtr->GPR5);
+  printk("\t R6 = %" PRIx32 "\n", excPtr->GPR6);
+  printk("\t R7 = %" PRIx32 "\n", excPtr->GPR7);
+  printk("\t R8 = %" PRIx32 "\n", excPtr->GPR8);
+  printk("\t R9 = %" PRIx32 "\n", excPtr->GPR9);
+  printk("\t R10 = %" PRIx32 "\n", excPtr->GPR10);
+  printk("\t R11 = %" PRIx32 "\n", excPtr->GPR11);
+  printk("\t R12 = %" PRIx32 "\n", excPtr->GPR12);
+  printk("\t R13 = %" PRIx32 "\n", excPtr->GPR13);
+  printk("\t R14 = %" PRIx32 "\n", excPtr->GPR14);
+  printk("\t R15 = %" PRIx32 "\n", excPtr->GPR15);
+  printk("\t R16 = %" PRIx32 "\n", excPtr->GPR16);
+  printk("\t R17 = %" PRIx32 "\n", excPtr->GPR17);
+  printk("\t R18 = %" PRIx32 "\n", excPtr->GPR18);
+  printk("\t R19 = %" PRIx32 "\n", excPtr->GPR19);
+  printk("\t R20 = %" PRIx32 "\n", excPtr->GPR20);
+  printk("\t R21 = %" PRIx32 "\n", excPtr->GPR21);
+  printk("\t R22 = %" PRIx32 "\n", excPtr->GPR22);
+  printk("\t R23 = %" PRIx32 "\n", excPtr->GPR23);
+  printk("\t R24 = %" PRIx32 "\n", excPtr->GPR24);
+  printk("\t R25 = %" PRIx32 "\n", excPtr->GPR25);
+  printk("\t R26 = %" PRIx32 "\n", excPtr->GPR26);
+  printk("\t R27 = %" PRIx32 "\n", excPtr->GPR27);
+  printk("\t R28 = %" PRIx32 "\n", excPtr->GPR28);
+  printk("\t R29 = %" PRIx32 "\n", excPtr->GPR29);
+  printk("\t R30 = %" PRIx32 "\n", excPtr->GPR30);
+  printk("\t R31 = %" PRIx32 "\n", excPtr->GPR31);
+  printk("\t CR = %" PRIx32 "\n", excPtr->EXC_CR);
+  printk("\t CTR = %" PRIx32 "\n", excPtr->EXC_CTR);
+  printk("\t XER = %" PRIx32 "\n", excPtr->EXC_XER);
+  printk("\t LR = %" PRIx32 "\n", excPtr->EXC_LR);
   if (excPtr->_EXC_number == ASM_DEC_VECTOR)
recoverable = 1;
   if (excPtr->_EXC_number == ASM_SYS_VECTOR)
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: RE:[PATCH] Update:Change format specifiers to fix 4 warnings.

2017-04-07 Thread Gedare Bloom
On Fri, Apr 7, 2017 at 10:05 AM, Joel Sherrill  wrote:
>
>
> On Fri, Apr 7, 2017 at 4:15 AM, Cillian O'Donnell 
> wrote:
>>
>> Great! That looks like a cleaner, more standardized solution. I was just
>> hacking away until the warnings stopped. So can I go ahead and #include
>>  or should I wait until  is defined before
>> doing any more? Does this work for printk() too?
>
>
> First the easy answer. printk() supports a subset of printf() formats. So
> as long as it is a supported printf format, then yes. But I just looked for
> printk() documentation and I don't see any. The code is in
> cpukit/libcsupport/src/vprintk.c for a double check. It is supposed to
> support everything required by any test.
>
> If a file only uses C99 standard PRI constants, then use 
>
> If a file needs the extra ones being collected into ,
> then it should include that.
>
> No need to introduce an unneeded dependency.
>
> Funny, how this simple set of warnings has rippled. It also makes me
> want to file a ticket for printk() documentation and adding code style
> rules about .
>
Please do.

Also we should consider converting our code style into a doc instead
of wiki page.

> --joel
>
>
>>
>>
>> Thanks Joel.
>>
>> ___
>> 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
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: RE:[PATCH] Update:Change format specifiers to fix 4 warnings.

2017-04-07 Thread Joel Sherrill
On Fri, Apr 7, 2017 at 9:58 AM, Gedare Bloom  wrote:

> On Fri, Apr 7, 2017 at 10:05 AM, Joel Sherrill  wrote:
> >
> >
> > On Fri, Apr 7, 2017 at 4:15 AM, Cillian O'Donnell  >
> > wrote:
> >>
> >> Great! That looks like a cleaner, more standardized solution. I was just
> >> hacking away until the warnings stopped. So can I go ahead and #include
> >>  or should I wait until  is defined before
> >> doing any more? Does this work for printk() too?
> >
> >
> > First the easy answer. printk() supports a subset of printf() formats. So
> > as long as it is a supported printf format, then yes. But I just looked
> for
> > printk() documentation and I don't see any. The code is in
> > cpukit/libcsupport/src/vprintk.c for a double check. It is supposed to
> > support everything required by any test.
> >
> > If a file only uses C99 standard PRI constants, then use 
> >
> > If a file needs the extra ones being collected into ,
> > then it should include that.
> >
> > No need to introduce an unneeded dependency.
> >
> > Funny, how this simple set of warnings has rippled. It also makes me
> > want to file a ticket for printk() documentation


#2985


> and adding code style
> > rules about .
> >
> Please do.
>

Done. https://devel.rtems.org/wiki/Developer/Coding/Conventions



>
> Also we should consider converting our code style into a doc instead
> of wiki page.
>

Beyond consider. I think it must happen. I think this is necessary artifact
for qualification reviews.

https://devel.rtems.org/ticket/2986

Please review my tickets and coding style change. :)

--joel


> > --joel
> >
> >
> >>
> >>
> >> Thanks Joel.
> >>
> >> ___
> >> 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
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH v2 5/7] Adding RTEMS support for FREEBSD TTY

2017-04-07 Thread Kevin Kirspel
---
 rtemsbsd/include/machine/rtems-bsd-commands.h |  2 +
 rtemsbsd/include/machine/rtems-bsd-kernel-space.h |  1 +
 rtemsbsd/include/rtems/bsd/local/opt_gdb.h|  1 +
 rtemsbsd/include/rtems/netcmds-config.h   |  2 +
 rtemsbsd/rtems/rtems-bsd-shell-stty.c | 40 +++
 rtemsbsd/sys/fs/devfs/devfs_devs.c| 86 +--
 6 files changed, 126 insertions(+), 6 deletions(-)
 create mode 100644 rtemsbsd/include/rtems/bsd/local/opt_gdb.h
 create mode 100644 rtemsbsd/rtems/rtems-bsd-shell-stty.c
 mode change 100755 => 100644 rtemsbsd/sys/fs/devfs/devfs_devs.c

diff --git a/rtemsbsd/include/machine/rtems-bsd-commands.h 
b/rtemsbsd/include/machine/rtems-bsd-commands.h
index c0524c8..9e9ed1c 100644
--- a/rtemsbsd/include/machine/rtems-bsd-commands.h
+++ b/rtemsbsd/include/machine/rtems-bsd-commands.h
@@ -70,6 +70,8 @@ int rtems_bsd_command_vmstat(int argc, char **argv);
 
 int rtems_bsd_command_wlanstats(int argc, char **argv);
 
+int rtems_bsd_command_stty(int argc, char **argv);
+
 __END_DECLS
 
 #endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_COMMANDS_H_ */
diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-space.h 
b/rtemsbsd/include/machine/rtems-bsd-kernel-space.h
index 10ce9d2..9d0484a 100644
--- a/rtemsbsd/include/machine/rtems-bsd-kernel-space.h
+++ b/rtemsbsd/include/machine/rtems-bsd-kernel-space.h
@@ -48,6 +48,7 @@
 #define__GLOBL(sym)__GLOBL1(sym)
 
 #define O_CLOEXEC 0
+#define IO_NDELAY O_NONBLOCK
 
 #define __FreeBSD__ 1
 
diff --git a/rtemsbsd/include/rtems/bsd/local/opt_gdb.h 
b/rtemsbsd/include/rtems/bsd/local/opt_gdb.h
new file mode 100644
index 000..936ffd8
--- /dev/null
+++ b/rtemsbsd/include/rtems/bsd/local/opt_gdb.h
@@ -0,0 +1 @@
+/* EMPTY */
diff --git a/rtemsbsd/include/rtems/netcmds-config.h 
b/rtemsbsd/include/rtems/netcmds-config.h
index b3bc66f..515b265 100644
--- a/rtemsbsd/include/rtems/netcmds-config.h
+++ b/rtemsbsd/include/rtems/netcmds-config.h
@@ -45,6 +45,8 @@ extern rtems_shell_cmd_t rtems_shell_VMSTAT_Command;
 
 extern rtems_shell_cmd_t rtems_shell_WLANSTATS_Command;
 
+extern rtems_shell_cmd_t rtems_shell_STTY_Command;
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/rtemsbsd/rtems/rtems-bsd-shell-stty.c 
b/rtemsbsd/rtems/rtems-bsd-shell-stty.c
new file mode 100644
index 000..530b442
--- /dev/null
+++ b/rtemsbsd/rtems/rtems-bsd-shell-stty.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2016 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  
+ *
+ * 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.
+ */
+
+#include 
+#include 
+
+rtems_shell_cmd_t rtems_shell_STTY_Command = {
+  .name = "stty",
+  .usage = "stty [args]",
+  .topic = "serial",
+  .command = rtems_bsd_command_stty
+};
diff --git a/rtemsbsd/sys/fs/devfs/devfs_devs.c 
b/rtemsbsd/sys/fs/devfs/devfs_devs.c
old mode 100755
new mode 100644
index 0ee71ff..a91a02e
--- a/rtemsbsd/sys/fs/devfs/devfs_devs.c
+++ b/rtemsbsd/sys/fs/devfs/devfs_devs.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -50,8 +51,16 @@
 
 const char rtems_cdev_directory[] = RTEMS_CDEV_DIRECTORY;
 
+/*
+ * The one true (but secret) list of active devices in the system.
+ * Locked by dev_lock()/devmtx
+ */
+struct cdev_priv_list cdevp_list = TAILQ_HEAD_INITIALIZER(cdevp_list);
+
 struct unrhdr *devfs_inos;
 
+static MALLOC_DEFINE(M_CDEVP, "DEVFS1", "DEVFS cdev_priv storage");
+
 static struct cdev *
 devfs_imfs_get_context_by_iop(rtems_libio_t *iop)
 {
@@ -62,11 +71,19 @@ static int
 devfs_imfs_open(rtems_libio_t *iop, const char *path, int oflag, mode_t mode)
 {
struct cdev *cdev = devfs_imfs_get_conte

[PATCH v2 6/7] Adding test cases for FREEBSD termios support through tty

2017-04-07 Thread Kevin Kirspel
---
 .../include/rtems/bsd/test/default-termios-init.h  | 158 
 testsuite/termios/test_main.c  | 856 +
 testsuite/termios/test_termios_driver.c| 136 
 testsuite/termios/test_termios_driver.h|  32 +
 testsuite/termios/test_termios_utilities.c | 233 ++
 testsuite/termios/test_termios_utilities.h |  33 +
 testsuite/termios01/test_main.c| 690 +
 testsuite/termios02/test_main.c| 140 
 testsuite/termios03/test_main.c|  73 ++
 testsuite/termios04/test_main.c|  69 ++
 testsuite/termios05/test_main.c|  65 ++
 testsuite/termios06/test_main.c| 492 
 12 files changed, 2977 insertions(+)
 create mode 100644 testsuite/include/rtems/bsd/test/default-termios-init.h
 create mode 100644 testsuite/termios/test_main.c
 create mode 100644 testsuite/termios/test_termios_driver.c
 create mode 100644 testsuite/termios/test_termios_driver.h
 create mode 100644 testsuite/termios/test_termios_utilities.c
 create mode 100644 testsuite/termios/test_termios_utilities.h
 create mode 100644 testsuite/termios01/test_main.c
 create mode 100644 testsuite/termios02/test_main.c
 create mode 100644 testsuite/termios03/test_main.c
 create mode 100644 testsuite/termios04/test_main.c
 create mode 100644 testsuite/termios05/test_main.c
 create mode 100644 testsuite/termios06/test_main.c

diff --git a/testsuite/include/rtems/bsd/test/default-termios-init.h 
b/testsuite/include/rtems/bsd/test/default-termios-init.h
new file mode 100644
index 000..16c7ad7
--- /dev/null
+++ b/testsuite/include/rtems/bsd/test/default-termios-init.h
@@ -0,0 +1,158 @@
+/*
+ *  Shared Network Test Initialization File
+ */
+
+#ifndef RTEMS_BSD_TEST_DEFAULT_INIT_H
+#define RTEMS_BSD_TEST_DEFAULT_INIT_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static void default_set_self_prio( rtems_task_priority prio )
+{
+  rtems_status_code sc;
+
+  sc = rtems_task_set_priority(RTEMS_SELF, prio, &prio);
+  assert(sc == RTEMS_SUCCESSFUL);
+}
+
+static void default_on_exit( int exit_code, void *arg )
+{
+  rtems_printer printer;
+
+  rtems_print_printer_printf(&printer);
+  rtems_stack_checker_report_usage_with_plugin(&printer);
+
+  if ( exit_code == 0 ) {
+puts( "*** END OF TEST " TEST_NAME " ***" );
+  }
+}
+
+rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  rtems_status_code sc;
+
+  /*
+   * Default the syslog priority to 'debug' to aid developers.
+   */
+  rtems_bsd_setlogpriority("debug");
+
+  puts( "*** " TEST_NAME " TEST ***" );
+
+  /*
+   *  BSD must support the new "shared IRQ PIC implementation" at this point.
+   *  BSPs must also provide rtems_interrupt_server_initialize() which
+   *  just requires including irq-server.[ch] in their build.
+   */
+
+  on_exit( default_on_exit, NULL );
+
+#ifdef DEFAULT_EARLY_INITIALIZATION
+  early_initialization();
+#endif
+
+  /* Let other tasks run to complete background work */
+  default_set_self_prio( RTEMS_MAXIMUM_PRIORITY - 2 );
+
+  rtems_bsd_initialize();
+
+  /* Let the callout timer allocate its resources */
+  sc = rtems_task_wake_after( 2 );
+  assert(sc == RTEMS_SUCCESSFUL);
+
+  test_main();
+  /* should not return */
+
+  assert( 0 );
+}
+
+/*
+ * Configure RTEMS.
+ */
+#define CONFIGURE_MICROSECONDS_PER_TICK 1000
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
+
+#define CONFIGURE_MAXIMUM_DRIVERS 32
+
+#define CONFIGURE_FILESYSTEM_DOSFS
+
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
+
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+
+#define CONFIGURE_UNLIMITED_OBJECTS
+#define CONFIGURE_UNIFIED_WORK_AREAS
+
+#define CONFIGURE_STACK_CHECKER_ENABLED
+
+#define CONFIGURE_BDBUF_BUFFER_MAX_SIZE (64 * 1024)
+#define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE (256 * 1024)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT_TASK_STACK_SIZE (32 * 1024)
+#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
+
+#define CONFIGURE_INIT
+
+#include 
+
+/*
+ * Configure LIBBSD device.
+ */
+ #include 
+
+/*
+ * Configure RTEMS Shell.
+ */
+#define CONFIGURE_SHELL_COMMANDS_INIT
+
+#include 
+
+#include 
+
+#define CONFIGURE_SHELL_USER_COMMANDS \
+  &bsp_interrupt_shell_command, \
+  &rtems_shell_STTY_Command, \
+  &rtems_shell_SYSCTL_Command
+
+#define CONFIGURE_SHELL_COMMAND_CPUUSE
+#define CONFIGURE_SHELL_COMMAND_PERIODUSE
+#define CONFIGURE_SHELL_COMMAND_STACKUSE
+#define CONFIGURE_SHELL_COMMAND_PROFREPORT
+
+#define CONFIGURE_SHELL_COMMAND_CP
+#define CONFIGURE_SHELL_COMMAND_PWD
+#define CONFIGURE_SHELL_COMMAND_LS
+#define CONFIGURE_SHELL_COMMAND_LN
+#define

[PATCH v2 4/7] Updating FREEBSD for tty support

2017-04-07 Thread Kevin Kirspel
---
 freebsd/sys/fs/devfs/devfs_int.h   |  2 +-
 freebsd/sys/fs/devfs/devfs_vnops.c | 18 ---
 freebsd/sys/kern/kern_conf.c   | 16 --
 freebsd/sys/kern/subr_taskqueue.c  | 10 --
 freebsd/sys/kern/tty.c | 62 ++
 freebsd/sys/kern/tty_ttydisc.c |  2 ++
 freebsd/sys/sys/conf.h |  2 ++
 freebsd/sys/sys/file.h |  4 +++
 freebsd/sys/sys/proc.h |  2 ++
 9 files changed, 93 insertions(+), 25 deletions(-)

diff --git a/freebsd/sys/fs/devfs/devfs_int.h b/freebsd/sys/fs/devfs/devfs_int.h
index 670aba1..9e16b40 100644
--- a/freebsd/sys/fs/devfs/devfs_int.h
+++ b/freebsd/sys/fs/devfs/devfs_int.h
@@ -63,13 +63,13 @@ struct cdev_priv {
u_int   cdp_maxdirent;
struct devfs_dirent **cdp_dirents;
struct devfs_dirent *cdp_dirent0;
+#endif /* __rtems__ */

TAILQ_ENTRY(cdev_priv)  cdp_dtr_list;
void(*cdp_dtr_cb)(void *);
void*cdp_dtr_cb_arg;

LIST_HEAD(, cdev_privdata) cdp_fdpriv;
-#endif /* __rtems__ */
 };

 #definecdev2priv(c)__containerof(c, struct cdev_priv, cdp_c)
diff --git a/freebsd/sys/fs/devfs/devfs_vnops.c 
b/freebsd/sys/fs/devfs/devfs_vnops.c
index 39ad0d4..eca2da6 100644
--- a/freebsd/sys/fs/devfs/devfs_vnops.c
+++ b/freebsd/sys/fs/devfs/devfs_vnops.c
@@ -64,6 +64,7 @@
 #include 
 #include 
 #include 
+#ifndef __rtems__
 #include 

 static struct vop_vector devfs_vnodeops;
@@ -71,23 +72,29 @@ static struct vop_vector devfs_specops;
 static struct fileops devfs_ops_f;

 #include 
+#endif /* __rtems__ */
 #include 

+#ifndef __rtems__
 #include 

 #include 
 #include 
 #include 
+#endif /* __rtems__ */

 static MALLOC_DEFINE(M_CDEVPDATA, "DEVFSP", "Metainfo for cdev-fp data");

+#ifndef __rtems__
 struct mtx devfs_de_interlock;
 MTX_SYSINIT(devfs_de_interlock, &devfs_de_interlock, "devfs interlock", 
MTX_DEF);
 struct sx  clone_drain_lock;
 SX_SYSINIT(clone_drain_lock, &clone_drain_lock, "clone events drain lock");
+#endif /* __rtems__ */
 struct mtx cdevpriv_mtx;
 MTX_SYSINIT(cdevpriv_mtx, &cdevpriv_mtx, "cdevpriv lock", MTX_DEF);

+#ifndef __rtems__
 SYSCTL_DECL(_vfs_devfs);

 static int devfs_dotimes;
@@ -132,6 +139,7 @@ devfs_fp_check(struct file *fp, struct cdev **devp, struct 
cdevsw **dswp,
curthread->td_fpop = fp;
return (0);
 }
+#endif /* __rtems__ */

 int
 devfs_get_cdevpriv(void **datap)
@@ -220,6 +228,7 @@ devfs_clear_cdevpriv(void)
devfs_fpdrop(fp);
 }

+#ifndef __rtems__
 /*
  * On success devfs_populate_vp() returns with dmp->dm_lock held.
  */
@@ -1929,3 +1938,4 @@ static struct vop_vector devfs_specops = {
  */
 CTASSERT(O_NONBLOCK == IO_NDELAY);
 CTASSERT(O_FSYNC == IO_SYNC);
+#endif /* __rtems__ */
diff --git a/freebsd/sys/kern/kern_conf.c b/freebsd/sys/kern/kern_conf.c
index fb43c24..20f2e2c 100644
--- a/freebsd/sys/kern/kern_conf.c
+++ b/freebsd/sys/kern/kern_conf.c
@@ -59,11 +59,9 @@ static MALLOC_DEFINE(M_DEVT, "cdev", "cdev storage");

 struct mtx devmtx;
 static void destroy_devl(struct cdev *dev);
-#ifndef __rtems__
 static int destroy_dev_sched_cbl(struct cdev *dev,
 void (*cb)(void *), void *arg);
 static void destroy_dev_tq(void *ctx, int pending);
-#endif /* __rtems__ */
 static int make_dev_credv(int flags, struct cdev **dres, struct cdevsw *devsw,
 int unit, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char 
*fmt,
 va_list ap);
@@ -164,7 +162,6 @@ dev_refl(struct cdev *dev)
dev->si_refcount++;
 }

-#ifndef __rtems__
 void
 dev_rel(struct cdev *dev)
 {
@@ -189,7 +186,6 @@ dev_rel(struct cdev *dev)
if (flag)
devfs_free(dev);
 }
-#endif /* __rtems__ */

 struct cdevsw *
 dev_refthread(struct cdev *dev, int *ref)
@@ -971,6 +967,7 @@ make_dev_p(int flags, struct cdev **cdev, struct cdevsw 
*devsw,
("make_dev_p: failed make_dev_credv (error=%d)", res));
return (res);
 }
+#endif /* __rtems__ */

 static void
 dev_dependsl(struct cdev *pdev, struct cdev *cdev)
@@ -1050,6 +1047,7 @@ make_dev_alias(struct cdev *pdev, const char *fmt, ...)
return (dev);
 }

+#ifndef __rtems__
 int
 make_dev_alias_p(int flags, struct cdev **cdev, struct cdev *pdev,
 const char *fmt, ...)
@@ -1156,7 +1154,6 @@ destroy_devl(struct cdev *dev)
/* Remove name marking */
dev->si_flags &= ~SI_NAMED;

-#ifndef __rtems__
/* If we are a child, remove us from the parents list */
if (dev->si_flags & SI_CHILD) {
LIST_REMOVE(dev, si_siblings);
@@ -1167,6 +1164,7 @@ destroy_devl(struct cdev *dev)
while (!LIST_EMPTY(&dev->si_children))
destroy_devl(LIST_FIRST(&dev->si_children));

+#ifndef __rtems__
/* Remove from clone list */
if (dev->si_flags & SI_CLONELIST) {
LIST_REMOVE(dev, si_clone);
@@ -1195,14 +1193,12 @@ destroy_devl(struct cdev *dev)
/* avoid

[PATCH v2 3/7] Updating STTY command for use in RTEMS shell

2017-04-07 Thread Kevin Kirspel
---
 freebsd/bin/stty/cchar.c |  9 ++
 freebsd/bin/stty/gfmt.c  |  6 
 freebsd/bin/stty/key.c   |  9 ++
 freebsd/bin/stty/modes.c |  9 ++
 freebsd/bin/stty/print.c |  9 ++
 freebsd/bin/stty/rtems-bsd-stty-cchar-data.h |  4 +++
 freebsd/bin/stty/rtems-bsd-stty-data.h   | 11 +++
 freebsd/bin/stty/rtems-bsd-stty-gfmt-data.h  |  4 +++
 freebsd/bin/stty/rtems-bsd-stty-key-data.h   |  5 +++
 freebsd/bin/stty/rtems-bsd-stty-modes-data.h |  4 +++
 freebsd/bin/stty/rtems-bsd-stty-namespace.h  | 34 
 freebsd/bin/stty/rtems-bsd-stty-print-data.h |  6 
 freebsd/bin/stty/rtems-bsd-stty-stty-data.h  |  4 +++
 freebsd/bin/stty/rtems-bsd-stty-util-data.h  |  4 +++
 freebsd/bin/stty/stty.c  | 48 
 freebsd/bin/stty/util.c  |  9 ++
 16 files changed, 175 insertions(+)
 create mode 100644 freebsd/bin/stty/rtems-bsd-stty-cchar-data.h
 create mode 100644 freebsd/bin/stty/rtems-bsd-stty-data.h
 create mode 100644 freebsd/bin/stty/rtems-bsd-stty-gfmt-data.h
 create mode 100644 freebsd/bin/stty/rtems-bsd-stty-key-data.h
 create mode 100644 freebsd/bin/stty/rtems-bsd-stty-modes-data.h
 create mode 100644 freebsd/bin/stty/rtems-bsd-stty-namespace.h
 create mode 100644 freebsd/bin/stty/rtems-bsd-stty-print-data.h
 create mode 100644 freebsd/bin/stty/rtems-bsd-stty-stty-data.h
 create mode 100644 freebsd/bin/stty/rtems-bsd-stty-util-data.h

diff --git a/freebsd/bin/stty/cchar.c b/freebsd/bin/stty/cchar.c
index 4a925da..7335cc3 100644
--- a/freebsd/bin/stty/cchar.c
+++ b/freebsd/bin/stty/cchar.c
@@ -1,5 +1,8 @@
 #include 
 
+#ifdef __rtems__
+#include "rtems-bsd-stty-namespace.h"
+#endif /* __rtems__ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  * The Regents of the University of California.  All rights reserved.
@@ -37,6 +40,9 @@ static char sccsid[] = "@(#)cchar.c   8.5 (Berkeley) 4/2/94";
 #include 
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtems__
+#include 
+#endif /* __rtems__ */
 #include 
 
 #include 
@@ -47,6 +53,9 @@ __FBSDID("$FreeBSD$");
 
 #include "stty.h"
 #include "extern.h"
+#ifdef __rtems__
+#include "rtems-bsd-stty-cchar-data.h"
+#endif /* __rtems__ */
 
 static int c_cchar(const void *, const void *);
 
diff --git a/freebsd/bin/stty/gfmt.c b/freebsd/bin/stty/gfmt.c
index 57adc1e..7ffaf95 100644
--- a/freebsd/bin/stty/gfmt.c
+++ b/freebsd/bin/stty/gfmt.c
@@ -1,5 +1,8 @@
 #include 
 
+#ifdef __rtems__
+#include "rtems-bsd-stty-namespace.h"
+#endif /* __rtems__ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  * The Regents of the University of California.  All rights reserved.
@@ -37,6 +40,9 @@ static char sccsid[] = "@(#)gfmt.c8.6 (Berkeley) 4/2/94";
 #include 
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtems__
+#include 
+#endif /* __rtems__ */
 #include 
 
 #include 
diff --git a/freebsd/bin/stty/key.c b/freebsd/bin/stty/key.c
index 1023fa6..cae0433 100644
--- a/freebsd/bin/stty/key.c
+++ b/freebsd/bin/stty/key.c
@@ -1,5 +1,8 @@
 #include 
 
+#ifdef __rtems__
+#include "rtems-bsd-stty-namespace.h"
+#endif /* __rtems__ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  * The Regents of the University of California.  All rights reserved.
@@ -37,6 +40,9 @@ static char sccsid[] = "@(#)key.c 8.3 (Berkeley) 4/2/94";
 #include 
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtems__
+#include 
+#endif /* __rtems__ */
 #include 
 
 #include 
@@ -96,6 +102,9 @@ static struct key {
{ "speed",  f_speed,0 },
{ "tty",f_tty,  0 },
 };
+#ifdef __rtems__
+#include "rtems-bsd-stty-key-data.h"
+#endif /* __rtems__ */
 
 static int
 c_key(const void *a, const void *b)
diff --git a/freebsd/bin/stty/modes.c b/freebsd/bin/stty/modes.c
index 79a0ed8..e1536d5 100644
--- a/freebsd/bin/stty/modes.c
+++ b/freebsd/bin/stty/modes.c
@@ -1,5 +1,8 @@
 #include 
 
+#ifdef __rtems__
+#include "rtems-bsd-stty-namespace.h"
+#endif /* __rtems__ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  * The Regents of the University of California.  All rights reserved.
@@ -37,10 +40,16 @@ static char sccsid[] = "@(#)modes.c 8.3 (Berkeley) 4/2/94";
 #include 
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtems__
+#include 
+#endif /* __rtems__ */
 #include 
 #include 
 #include 
 #include "stty.h"
+#ifdef __rtems__
+#include "rtems-bsd-stty-modes-data.h"
+#endif /* __rtems__ */
 
 int msearch(char ***, struct info *);
 
diff --git a/freebsd/bin/stty/print.c b/freebsd/bin/stty/print.c
index 770c5b5..d60f4ea 100644
--- a/freebsd/bin/stty/print.c
+++ b/freebsd/bin/stty/print.c
@@ -1,5 +1,8 @@
 #include 
 
+#ifdef __rtems__
+#include "rtems-bsd-stty-namespace.h"
+#endif /* __rtems__ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  * The Regents of the University of California.  All rights reserved.
@@ -37,6 +40,9 @@ static char sccsid[] = "@(#)print.c   8.6 (Berkeley) 4/16/94";
 #include 
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtem

[PATCH v2 7/7] Updating scripts for FREEBSD TTY support

2017-04-07 Thread Kevin Kirspel
---
 libbsd.py | 77 ---
 libbsd_waf.py | 97 +++
 2 files changed, 163 insertions(+), 11 deletions(-)
 mode change 100755 => 100644 libbsd.py

diff --git a/libbsd.py b/libbsd.py
old mode 100755
new mode 100644
index 90ba79e..3aa5610
--- a/libbsd.py
+++ b/libbsd.py
@@ -78,6 +78,7 @@ def rtems(mm):
 'rtems/rtems-bsd-shell-pfctl.c',
 'rtems/rtems-bsd-shell-ping.c',
 'rtems/rtems-bsd-shell-route.c',
+'rtems/rtems-bsd-shell-stty.c',
 'rtems/rtems-bsd-shell-sysctl.c',
 'rtems/rtems-bsd-shell-tcpdump.c',
 'rtems/rtems-bsd-shell-vmstat.c',
@@ -393,6 +394,7 @@ def base(mm):
 'sys/libkern/jenkins_hash.c',
 'sys/libkern/murmur3_32.c',
 'sys/libkern/random.c',
+'sys/fs/devfs/devfs_vnops.c',
 'sys/vm/uma_core.c',
 'sys/vm/uma_dbg.c',
 ],
@@ -439,6 +441,39 @@ def fdt(mm):
 return mod
 
 #
+# TTY
+#
+def tty(mm):
+mod = builder.Module('tty')
+mod.addKernelSpaceHeaderFiles(
+[
+'sys/sys/tty.h',
+'sys/sys/ttyqueue.h',
+'sys/sys/ttydisc.h',
+'sys/sys/ttydevsw.h',
+'sys/sys/ttyhook.h',
+'sys/sys/cons.h',
+'sys/sys/serial.h',
+]
+)
+mod.addKernelSpaceSourceFiles(
+[
+'sys/kern/tty.c',
+'sys/kern/tty_inq.c',
+'sys/kern/tty_outq.c',
+'sys/kern/tty_ttydisc.c',
+],
+mm.generator['source']()
+)
+#mod.addRTEMSSourceFiles(
+#[
+#'rtems/ofw_machdep.c',
+#],
+#mm.generator['source']()
+#)
+return mod
+
+#
 # MMC
 #
 def mmc(mm):
@@ -656,13 +691,7 @@ def dev_usb_mouse(mm):
 mod.addDependency(mm['dev_usb'])
 mod.addKernelSpaceHeaderFiles(
 [
-'sys/sys/tty.h',
 'sys/sys/mouse.h',
-'sys/sys/ttyqueue.h',
-'sys/sys/ttydefaults.h',
-'sys/sys/ttydisc.h',
-'sys/sys/ttydevsw.h',
-'sys/sys/ttyhook.h',
 ]
 )
 mod.addKernelSpaceSourceFiles(
@@ -1177,11 +1206,6 @@ def dev_nic(mm):
 'sys/isa/pnpvar.h',
 'sys/sys/buf.h',
 'sys/sys/mqueue.h',
-'sys/sys/tty.h',
-'sys/sys/ttyqueue.h',
-'sys/sys/ttydisc.h',
-'sys/sys/ttydevsw.h',
-'sys/sys/ttyhook.h',
 'sys/sys/user.h',
 ]
 )
@@ -2127,6 +2151,8 @@ def user_space(mm):
 mod = builder.Module('user_space')
 mod.addUserSpaceHeaderFiles(
 [
+'bin/stty/extern.h',
+'bin/stty/stty.h',
 'contrib/libxo/libxo/xo_buf.h',
 'contrib/libxo/libxo/xo_encoder.h',
 'contrib/libxo/libxo/xo.h',
@@ -2287,6 +2313,13 @@ def user_space(mm):
 mod.addUserSpaceSourceFiles(
 [
 'bin/hostname/hostname.c',
+'bin/stty/cchar.c',
+'bin/stty/gfmt.c',
+'bin/stty/key.c',
+'bin/stty/modes.c',
+'bin/stty/print.c',
+'bin/stty/stty.c',
+'bin/stty/util.c',
 'contrib/libxo/libxo/libxo.c',
 'contrib/libxo/libxo/xo_encoder.c',
 'lib/lib80211/lib80211_ioctl.c',
@@ -3005,6 +3038,27 @@ def tests(mm):
 mod.addTest(mm.generator['test']('cdev01', ['test_main', 'test_cdev']))
 mod.addTest(mm.generator['test']('pf01', ['test_main']))
 mod.addTest(mm.generator['test']('pf02', ['test_main'], runTest = False))
+mod.addTest(mm.generator['test']('termios', ['test_main',
+ 'test_termios_driver',
+ 'test_termios_utilities']))
+mod.addTest(mm.generator['test']('termios01', ['test_main',
+ '../termios/test_termios_driver',
+ '../termios/test_termios_utilities']))
+mod.addTest(mm.generator['test']('termios02', ['test_main',
+ '../termios/test_termios_driver',
+ '../termios/test_termios_utilities']))
+mod.addTest(mm.generator['test']('termios03', ['test_main',
+ '../termios/test_termios_driver',
+ '../termios/test_termios_utilities']))
+mod.addTest(mm.generator['test']('termios04', ['test_main',
+ '../termios/test_termios_driver',
+ '../termios/test_termios_utilities']))
+mod.addTest(mm.generator['test']('termios05', ['test_main',
+ '../termios/test_termios_driver',
+ '../termios/test_termios_utilities']))
+mod.addTest(mm.generator['test']('termios06', ['te

[PATCH v2 1/7] Adding stty command files from FREEBSD tree

2017-04-07 Thread Kevin Kirspel
---
 freebsd/bin/stty/cchar.c  | 142 ++
 freebsd/bin/stty/extern.h |  45 +++
 freebsd/bin/stty/gfmt.c   | 129 
 freebsd/bin/stty/key.c| 296 ++
 freebsd/bin/stty/modes.c  | 248 ++
 freebsd/bin/stty/print.c  | 283 
 freebsd/bin/stty/stty.c   | 169 ++
 freebsd/bin/stty/stty.h   |  55 +
 freebsd/bin/stty/util.c   |  66 +++
 9 files changed, 1433 insertions(+)
 create mode 100644 freebsd/bin/stty/cchar.c
 create mode 100644 freebsd/bin/stty/extern.h
 create mode 100644 freebsd/bin/stty/gfmt.c
 create mode 100644 freebsd/bin/stty/key.c
 create mode 100644 freebsd/bin/stty/modes.c
 create mode 100644 freebsd/bin/stty/print.c
 create mode 100644 freebsd/bin/stty/stty.c
 create mode 100644 freebsd/bin/stty/stty.h
 create mode 100644 freebsd/bin/stty/util.c

diff --git a/freebsd/bin/stty/cchar.c b/freebsd/bin/stty/cchar.c
new file mode 100644
index 000..4a925da
--- /dev/null
+++ b/freebsd/bin/stty/cchar.c
@@ -0,0 +1,142 @@
+#include 
+
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ * The Regents of the University of California.  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.
+ * 3. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)cchar.c8.5 (Berkeley) 4/2/94";
+#endif
+#endif /* not lint */
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "stty.h"
+#include "extern.h"
+
+static int c_cchar(const void *, const void *);
+
+/*
+ * Special control characters.
+ *
+ * Cchars1 are the standard names, cchars2 are the old aliases.
+ * The first are displayed, but both are recognized on the
+ * command line.
+ */
+struct cchar cchars1[] = {
+   { "discard",VDISCARD,   CDISCARD },
+   { "dsusp",  VDSUSP, CDSUSP },
+   { "eof",VEOF,   CEOF },
+   { "eol",VEOL,   CEOL },
+   { "eol2",   VEOL2,  CEOL },
+   { "erase",  VERASE, CERASE },
+   { "erase2", VERASE2,CERASE2 },
+   { "intr",   VINTR,  CINTR },
+   { "kill",   VKILL,  CKILL },
+   { "lnext",  VLNEXT, CLNEXT },
+   { "min",VMIN,   CMIN },
+   { "quit",   VQUIT,  CQUIT },
+   { "reprint",VREPRINT,   CREPRINT },
+   { "start",  VSTART, CSTART },
+   { "status", VSTATUS,CSTATUS },
+   { "stop",   VSTOP,  CSTOP },
+   { "susp",   VSUSP,  CSUSP },
+   { "time",   VTIME,  CTIME },
+   { "werase", VWERASE,CWERASE },
+   { NULL, 0,  0},
+};
+
+struct cchar cchars2[] = {
+   { "brk",VEOL,   CEOL },
+   { "flush",  VDISCARD,   CDISCARD },
+   { "rprnt",  VREPRINT,   CREPRINT },
+   { NULL, 0,  0 },
+};
+
+static int
+c_cchar(const void *a, const void *b)
+{
+
+return (strcmp(((const struct cchar *)a)->name, ((const struct cchar 
*)b)->name));
+}
+
+int
+csearch(char ***argvp, struct info *ip)
+{
+   struct cchar *cp, tmp;
+   long val;
+   char *arg, *ep, *name;
+
+   name = **argvp;
+
+   tmp.name = name;
+   if (!(cp = (struct cchar *)bsearch(&tmp, cchars1,
+   sizeof(cchars1)/sizeof(struct cchar) - 1, size

[PATCH 01/01] Undefine stdout in case a BSP includes stdio.h

2017-04-07 Thread Kevin Kirspel
---
 freebsd/sys/dev/ofw/openfirm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/freebsd/sys/dev/ofw/openfirm.c b/freebsd/sys/dev/ofw/openfirm.c
index 3e86d8d..9b39502 100644
--- a/freebsd/sys/dev/ofw/openfirm.c
+++ b/freebsd/sys/dev/ofw/openfirm.c
@@ -82,6 +82,9 @@ static void OF_putchar(int c, void *arg);

 MALLOC_DEFINE(M_OFWPROP, "openfirm", "Open Firmware properties");

+#ifdef __rtems__
+#undef stdout
+#endif /* __rtems__ */
 static ihandle_t stdout;

 #ifndef __rtems__
--
1.9.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 05/05] Updating scripts for USB Serial Drivers

2017-04-07 Thread Kevin Kirspel
---
 libbsd.py |  6 +-
 libbsd_waf.py | 30 ++
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/libbsd.py b/libbsd.py
index 3aa5610..3129266 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -796,7 +796,9 @@ def dev_usb_serial(mm):
 mod.addKernelSpaceHeaderFiles(
 [
 'sys/dev/usb/serial/uftdi_reg.h',
+'sys/dev/usb/serial/umcs.h',
 'sys/dev/usb/serial/usb_serial.h',
+'sys/dev/usb/uftdiio.h',
 ]
 )
 mod.addKernelSpaceSourceFiles(
@@ -812,6 +814,7 @@ def dev_usb_serial(mm):
 'sys/dev/usb/serial/ugensa.c',
 'sys/dev/usb/serial/uipaq.c',
 'sys/dev/usb/serial/ulpt.c',
+'sys/dev/usb/serial/umcs.c',
 'sys/dev/usb/serial/umct.c',
 'sys/dev/usb/serial/umodem.c',
 'sys/dev/usb/serial/umoscom.c',
@@ -3017,6 +3020,7 @@ def tests(mm):
 mod.addTest(mm.generator['test']('program01', ['test_main']))
 mod.addTest(mm.generator['test']('commands01', ['test_main']))
 mod.addTest(mm.generator['test']('usb01', ['init'], False))
+mod.addTest(mm.generator['test']('usbserial01', ['init'], False))
 mod.addTest(mm.generator['test']('loopback01', ['test_main']))
 mod.addTest(mm.generator['test']('netshell01', ['test_main', 
'shellconfig'], False))
 mod.addTest(mm.generator['test']('swi01', ['init', 'swi_test']))
@@ -3158,7 +3162,7 @@ def sources(mm):
 #mm.addModule(dev_usb_bluetooth(mm))
 #mm.addModule(dev_usb_input(mm))
 #mm.addModule(dev_usb_mouse(mm))
-#mm.addModule(dev_usb_serial(mm))
+mm.addModule(dev_usb_serial(mm))
 mm.addModule(dev_usb_net(mm))
 mm.addModule(dev_usb_wlan(mm))
 mm.addModule(dev_wlan_rtwn(mm))
diff --git a/libbsd_waf.py b/libbsd_waf.py
index 10a7ac9..c73f1dd 100644
--- a/libbsd_waf.py
+++ b/libbsd_waf.py
@@ -907,6 +907,26 @@ def build(bld):
   'freebsd/sys/dev/usb/net/ruephy.c',
   'freebsd/sys/dev/usb/net/usb_ethernet.c',
   'freebsd/sys/dev/usb/quirk/usb_quirk.c',
+  'freebsd/sys/dev/usb/serial/u3g.c',
+  'freebsd/sys/dev/usb/serial/uark.c',
+  'freebsd/sys/dev/usb/serial/ubsa.c',
+  'freebsd/sys/dev/usb/serial/ubser.c',
+  'freebsd/sys/dev/usb/serial/uchcom.c',
+  'freebsd/sys/dev/usb/serial/ucycom.c',
+  'freebsd/sys/dev/usb/serial/ufoma.c',
+  'freebsd/sys/dev/usb/serial/uftdi.c',
+  'freebsd/sys/dev/usb/serial/ugensa.c',
+  'freebsd/sys/dev/usb/serial/uipaq.c',
+  'freebsd/sys/dev/usb/serial/ulpt.c',
+  'freebsd/sys/dev/usb/serial/umcs.c',
+  'freebsd/sys/dev/usb/serial/umct.c',
+  'freebsd/sys/dev/usb/serial/umodem.c',
+  'freebsd/sys/dev/usb/serial/umoscom.c',
+  'freebsd/sys/dev/usb/serial/uplcom.c',
+  'freebsd/sys/dev/usb/serial/usb_serial.c',
+  'freebsd/sys/dev/usb/serial/uslcom.c',
+  'freebsd/sys/dev/usb/serial/uvisor.c',
+  'freebsd/sys/dev/usb/serial/uvscom.c',
   'freebsd/sys/dev/usb/storage/umass.c',
   'freebsd/sys/dev/usb/usb_busdma.c',
   'freebsd/sys/dev/usb/usb_core.c',
@@ -1902,6 +1922,16 @@ def build(bld):
 lib = ["m", "z"],
 install_path = None)

+test_usbserial01 = ['testsuite/usbserial01/init.c']
+bld.program(target = "usbserial01.exe",
+features = "cprogram",
+cflags = cflags,
+includes = includes,
+source = test_usbserial01,
+use = ["bsd"],
+lib = ["m", "z"],
+install_path = None)
+
 test_vlan01 = ['testsuite/vlan01/test_main.c']
 bld.program(target = "vlan01.exe",
 features = "cprogram",
--
1.9.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 02/05] Add USB headers to support USB Serial drivers

2017-04-07 Thread Kevin Kirspel
---
 freebsd/sys/dev/usb/uftdiio.h | 99 +++
 1 file changed, 99 insertions(+)
 create mode 100644 freebsd/sys/dev/usb/uftdiio.h

diff --git a/freebsd/sys/dev/usb/uftdiio.h b/freebsd/sys/dev/usb/uftdiio.h
new file mode 100644
index 000..b624483
--- /dev/null
+++ b/freebsd/sys/dev/usb/uftdiio.h
@@ -0,0 +1,99 @@
+/*-
+ * Copyright 2008-2012 - Symmetricom, Inc.
+ * 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$
+ */
+
+/*
+ * FTDI USB serial converter chip ioctl commands.
+ */
+
+#ifndef _USB_UFTDIIO_H_
+#define _USB_UFTDIIO_H_
+
+#include 
+
+enum uftdi_bitmodes
+{
+   UFTDI_BITMODE_ASYNC = 0,
+   UFTDI_BITMODE_MPSSE = 1,
+   UFTDI_BITMODE_SYNC = 2,
+   UFTDI_BITMODE_CPU_EMUL = 3,
+   UFTDI_BITMODE_FAST_SERIAL = 4,
+   UFTDI_BITMODE_CBUS = 5,
+   UFTDI_BITMODE_NONE = 0xff,  /* aka UART mode. */
+};
+
+/*
+ * For UFTDIIOC_SET_BITMODE:
+ *   mode   = One of the uftdi_bitmodes enum values.
+ *   iomask = Mask of bits enabled for bitbang output.
+ *
+ * For UFTDIIOC_GET_BITMODE:
+ *   mode   = Mode most recently set using UFTDIIOC_SET_BITMODE.
+ *   iomask = Returned snapshot of DBUS0..DBUS7 pin states at time of call.
+ *Pin states can be read in any mode, not just bitbang modes.
+ */
+struct uftdi_bitmode
+{
+   uint8_t mode;
+   uint8_t iomask;
+};
+
+/*
+ * For UFTDIIOC_READ_EEPROM, UFTDIIOC_WRITE_EEPROM:
+ *
+ * IO is done in 16-bit words at the chip level; offset and length are in 
bytes,
+ * but must each be evenly divisible by two.
+ *
+ * It is not necessary to erase before writing.  For the FT232R device (only)
+ * you must set the latency timer to 0x77 before doing a series of eeprom 
writes
+ * (and restore it to the prior value when done).
+ */
+struct uftdi_eeio
+{
+   uint16_t offset;
+   uint16_t length;
+   uint16_t data[64];
+};
+
+/* Pass this value to confirm that eeprom erase request is not accidental. */
+#defineUFTDI_CONFIRM_ERASE 0x26139108
+
+#defineUFTDIIOC_RESET_IO   _IO('c', 0) /* Reset config, flush 
fifos.*/
+#defineUFTDIIOC_RESET_RX   _IO('c', 1) /* Flush input fifo. */
+#defineUFTDIIOC_RESET_TX   _IO('c', 2) /* Flush output fifo. */
+#defineUFTDIIOC_SET_BITMODE_IOW('c', 3, struct uftdi_bitmode)
+#defineUFTDIIOC_GET_BITMODE_IOR('c', 4, struct uftdi_bitmode)
+#defineUFTDIIOC_SET_ERROR_CHAR _IOW('c', 5, int)   /* -1 to 
disable */
+#defineUFTDIIOC_SET_EVENT_CHAR _IOW('c', 6, int)   /* -1 to 
disable */
+#defineUFTDIIOC_SET_LATENCY_IOW('c', 7, int)   /* 1-255 ms */
+#defineUFTDIIOC_GET_LATENCY_IOR('c', 8, int)
+#defineUFTDIIOC_GET_HWREV  _IOR('c', 9, int)
+#defineUFTDIIOC_READ_EEPROM_IOWR('c', 10, struct uftdi_eeio)
+#defineUFTDIIOC_WRITE_EEPROM   _IOW('c', 11, struct uftdi_eeio)
+#defineUFTDIIOC_ERASE_EEPROM   _IOW('c', 12, int)
+
+#endif
--
1.9.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 03/05] Update USB Serial Driver for use with RTEMS

2017-04-07 Thread Kevin Kirspel
---
 freebsd/sys/dev/usb/serial/usb_serial.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/freebsd/sys/dev/usb/serial/usb_serial.c 
b/freebsd/sys/dev/usb/serial/usb_serial.c
index b5d7ef7..f494b10 100644
--- 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;
@@ -420,10 +424,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__ */

DPRINTF("ttycreate: %s\n", buf);

@@ -874,8 +880,10 @@ ucom_ioctl(struct tty *tp, u_long cmd, caddr_t data, 
struct thread *td)
} else {
error = ENOIOCTL;
}
+#ifndef __rtems__
if (error == ENOIOCTL)
error = pps_ioctl(cmd, data, &sc->sc_pps);
+#endif /* __rtems__ */
break;
}
return (error);
@@ -1082,7 +1090,9 @@ ucom_cfg_status_change(struct usb_proc_msg *_task)
uint8_t new_lsr;
uint8_t msr_delta;
uint8_t lsr_delta;
+#ifndef __rtems__
uint8_t pps_signal;
+#endif /* __rtems__ */

tp = sc->sc_tty;

@@ -,6 +1121,7 @@ ucom_cfg_status_change(struct usb_proc_msg *_task)
sc->sc_msr = new_msr;
sc->sc_lsr = new_lsr;

+#ifndef __rtems__
/*
 * 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_CAPTURECLEAR);
}
+#endif /* __rtems__ */

if (msr_delta & SER_DCD) {

--
1.9.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 04/05] Adding USB Serial test

2017-04-07 Thread Kevin Kirspel
---
 testsuite/usbserial01/init.c | 380 +++
 1 file changed, 380 insertions(+)
 create mode 100644 testsuite/usbserial01/init.c

diff --git a/testsuite/usbserial01/init.c b/testsuite/usbserial01/init.c
new file mode 100644
index 000..bbefb5f
--- /dev/null
+++ b/testsuite/usbserial01/init.c
@@ -0,0 +1,380 @@
+/*
+ * Copyright (c) 2010, 2016 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  
+ *
+ * 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.
+ */
+
+/*
+ * This test requires a USB serial adapater with a loopback plug attached to be
+ * plugged into a USB port.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define TEST_NAME "LIBBSD USB SERIAL"
+
+#define USB_SERIAL_TEST_BUFFER_SIZE 48
+#define PRIO_OPEN  (RTEMS_MAXIMUM_PRIORITY - 12)
+#define PRIO_READ  (RTEMS_MAXIMUM_PRIORITY - 11)
+#define PRIO_WRITE (RTEMS_MAXIMUM_PRIORITY - 10)
+
+typedef struct
+{
+  int fd;
+  char rbuf[USB_SERIAL_TEST_BUFFER_SIZE];
+  char wbuf[USB_SERIAL_TEST_BUFFER_SIZE];
+}usb_test_message_t;
+
+static rtems_id oid, rid, wid, omid, rmid, wmid;
+static volatile bool kill_otask, kill_rtask, kill_wtask;
+static volatile bool otask_active, rtask_active, wtask_active;
+
+static void
+usb_serial_read_task(rtems_task_argument arg)
+{
+  usb_test_message_t msg;
+  uint32_t size, end_time;
+  int bytes, index;
+
+  rtask_active = true;
+  kill_rtask = false;
+  while(!kill_rtask)
+  {
+rtems_message_queue_receive( rmid, &msg, &size, RTEMS_WAIT, 
RTEMS_NO_TIMEOUT );
+index = 0;
+msg.rbuf[0] = 0;
+end_time = rtems_clock_get_ticks_since_boot() + 
RTEMS_MILLISECONDS_TO_TICKS(500);
+while(( rtems_clock_get_ticks_since_boot() < end_time ) && ( index < 
sizeof(msg.rbuf)))
+{
+  bytes = read(msg.fd, &msg.rbuf[index], sizeof(msg.rbuf) - index - 1);
+  if( bytes < 0)
+  {
+msg.fd = -1;
+rtems_message_queue_send( omid, &msg, sizeof( msg ));
+printf( "serial device read error: %d\n", errno );
+  }
+  else if( bytes > 0)
+  {
+index += bytes;
+msg.rbuf[index] = 0;
+if( strcmp( msg.rbuf, msg.wbuf ) == 0 )
+{
+  break;
+}
+  }
+  rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(10));
+}
+printf( "serial device read: %s - %s\n", msg.rbuf, strcmp( msg.rbuf, 
msg.wbuf ) == 0 ? "PASS" : "FAIL" );
+  }
+  rtask_active = false;
+}
+
+static void
+usb_serial_write_task(rtems_task_argument arg)
+{
+  usb_test_message_t msg;
+  uint32_t size;
+  int bytes, write_len, count = 0;
+
+  wtask_active = true;
+  kill_wtask = false;
+  while(!kill_wtask)
+  {
+rtems_message_queue_receive( wmid, &msg, &size, RTEMS_WAIT, 
RTEMS_NO_TIMEOUT );
+count++;
+sprintf( msg.wbuf, "Hello World %d", count );
+write_len = strlen( msg.wbuf );
+bytes = write(msg.fd, msg.wbuf, write_len);
+if( bytes < 0)
+{
+  msg.fd = -1;
+  rtems_message_queue_send( omid, &msg, sizeof( msg ));
+  printf( "serial device write error: %d\n", errno );
+}
+else if( bytes != write_len)
+{
+  printf( "serial device failed to write all bytes: %d\n", bytes );
+}
+else
+{
+  printf( "serial device write: %s\n", msg.wbuf );
+  rtems_message_queue_send( rmid, &msg, sizeof( msg ));
+}
+  }
+  wtask_active = false;
+}
+
+static void
+usb_serial_open_task(rtems_task_argument arg)
+{
+  rtems_status_code sc;
+  usb_test_message_t msg;
+  struct termios t;
+  uint32_t size;
+  int fd, iret;
+
+  fd = -2;
+  otask_active = true;
+  kill_otask = false;
+  while(!kill_otask)
+  {
+sc = r

LIBBSD USB Serial Patch

2017-04-07 Thread Kirspel, Kevin
The LIBBSD USB Serial patch depends on the LIBBSD TTY patch I sent out earlier.

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

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 1/2] Using inttypes macros fixes 4 format warnings

2017-04-07 Thread Joel Sherrill
I'm OK with both these patches but not in a good
position to apply them right now.

Gedare/Chris.. can you apply these?

Thanks.

--joel

On Fri, Apr 7, 2017 at 9:11 AM, Cillian O'Donnell 
wrote:

> ---
>  cpukit/libdl/rtl-obj-cache.c | 21 -
>  1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/cpukit/libdl/rtl-obj-cache.c b/cpukit/libdl/rtl-obj-cache.c
> index a4676cf..c859f60 100644
> --- a/cpukit/libdl/rtl-obj-cache.c
> +++ b/cpukit/libdl/rtl-obj-cache.c
> @@ -22,6 +22,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include 
>  #include "rtl-obj-cache.h"
> @@ -78,11 +79,12 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache_t* cache,
>struct stat sb;
>
>if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))
> -printf ("rtl: cache: %2d: fd=%d offset=%d length=%d area=[%d,%d]
> cache=[%d,%d] size=%d\n",
> -fd, cache->fd, (int) offset, (int) *length,
> -(int) offset, (int) offset + *length,
> -(int) cache->offset, (int) cache->offset + cache->level,
> -(int) cache->file_size);
> +printf ("rtl: cache: %2d: fd=%d offset=%" PRIdMAX "length=%zu area=[%"
> +PRIdMAX ",%" PRIdMAX "] cache=[%" PRIdMAX ",%" PRIdMAX "]
> size=%zu\n",
> +fd, cache->fd, offset, *length,
> +offset, offset + *length,
> +cache->offset, cache->offset + cache->level,
> +cache->file_size);
>
>if (*length > cache->size)
>{
> @@ -172,10 +174,11 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache_t*
> cache,
>  }
>
>  if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))
> -  printf ("rtl: cache: %2d: seek: offset=%d buffer_offset=%d read=%d
> cache=[%d,%d] dist=%d\n",
> -  fd, (int) offset + buffer_offset, (int) buffer_offset,
> (int) buffer_read,
> -  (int) offset, (int) offset + buffer_read,
> -  (int) (cache->file_size - offset));
> +  printf ("rtl: cache: %2d: seek: offset=%" PRIdMAX
> "buffer_offset=%zu"
> +  "read=%zu cache=[%" PRIdMAX ",%" PRIdMAX "] dist=%" PRIdMAX
> "\n",
> +  fd, offset + buffer_offset, buffer_offset, buffer_read,
> +  offset, offset + buffer_read,
> +  (cache->file_size - offset));
>
>  if (lseek (fd, offset + buffer_offset, SEEK_SET) < 0)
>  {
> --
> 2.7.4
>
> ___
> 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 1/2] Using inttypes macros fixes 4 format warnings

2017-04-07 Thread Joel Sherrill
Thanks!

I just went ahead and pushed these. Testing will
hopefully occur over the weekend.

Good eye for going for a file with a lot of warnings. :)

--joel

On Fri, Apr 7, 2017 at 3:29 PM, Joel Sherrill  wrote:

> I'm OK with both these patches but not in a good
> position to apply them right now.
>
> Gedare/Chris.. can you apply these?
>
> Thanks.
>
> --joel
>
> On Fri, Apr 7, 2017 at 9:11 AM, Cillian O'Donnell 
> wrote:
>
>> ---
>>  cpukit/libdl/rtl-obj-cache.c | 21 -
>>  1 file changed, 12 insertions(+), 9 deletions(-)
>>
>> diff --git a/cpukit/libdl/rtl-obj-cache.c b/cpukit/libdl/rtl-obj-cache.c
>> index a4676cf..c859f60 100644
>> --- a/cpukit/libdl/rtl-obj-cache.c
>> +++ b/cpukit/libdl/rtl-obj-cache.c
>> @@ -22,6 +22,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>
>>  #include 
>>  #include "rtl-obj-cache.h"
>> @@ -78,11 +79,12 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache_t*
>> cache,
>>struct stat sb;
>>
>>if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))
>> -printf ("rtl: cache: %2d: fd=%d offset=%d length=%d area=[%d,%d]
>> cache=[%d,%d] size=%d\n",
>> -fd, cache->fd, (int) offset, (int) *length,
>> -(int) offset, (int) offset + *length,
>> -(int) cache->offset, (int) cache->offset + cache->level,
>> -(int) cache->file_size);
>> +printf ("rtl: cache: %2d: fd=%d offset=%" PRIdMAX "length=%zu
>> area=[%"
>> +PRIdMAX ",%" PRIdMAX "] cache=[%" PRIdMAX ",%" PRIdMAX "]
>> size=%zu\n",
>> +fd, cache->fd, offset, *length,
>> +offset, offset + *length,
>> +cache->offset, cache->offset + cache->level,
>> +cache->file_size);
>>
>>if (*length > cache->size)
>>{
>> @@ -172,10 +174,11 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache_t*
>> cache,
>>  }
>>
>>  if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))
>> -  printf ("rtl: cache: %2d: seek: offset=%d buffer_offset=%d read=%d
>> cache=[%d,%d] dist=%d\n",
>> -  fd, (int) offset + buffer_offset, (int) buffer_offset,
>> (int) buffer_read,
>> -  (int) offset, (int) offset + buffer_read,
>> -  (int) (cache->file_size - offset));
>> +  printf ("rtl: cache: %2d: seek: offset=%" PRIdMAX
>> "buffer_offset=%zu"
>> +  "read=%zu cache=[%" PRIdMAX ",%" PRIdMAX "] dist=%"
>> PRIdMAX "\n",
>> +  fd, offset + buffer_offset, buffer_offset, buffer_read,
>> +  offset, offset + buffer_read,
>> +  (cache->file_size - offset));
>>
>>  if (lseek (fd, offset + buffer_offset, SEEK_SET) < 0)
>>  {
>> --
>> 2.7.4
>>
>> ___
>> 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

[PATCH 08/11] Added inttype, fix 1 format warning

2017-04-07 Thread Cillian O'Donnell
---
 c/src/lib/libbsp/powerpc/mvme5500/pci/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/c/src/lib/libbsp/powerpc/mvme5500/pci/pci.c 
b/c/src/lib/libbsp/powerpc/mvme5500/pci/pci.c
index 8601721..bef0173 100644
--- a/c/src/lib/libbsp/powerpc/mvme5500/pci/pci.c
+++ b/c/src/lib/libbsp/powerpc/mvme5500/pci/pci.c
@@ -33,6 +33,7 @@
 
 #include 
 #include 
+#include 
 
 #define PCI_DEBUG 0
 #define PCI_PRINT 1
@@ -294,7 +295,7 @@ int pci_initialize(void)
  break;
default :
 #if PCI_PRINT
-  printk("BSP unlisted vendor, Bus%d Slot%d DeviceID 0x%x \n",
+  printk("BSP unlisted vendor, Bus%d Slot%d DeviceID 0x%" PRIx32 "\n",
  ucBusNumber,ucSlotNumber, ulDeviceID);
 #endif
  /* Kate Feng : device not supported by BSP needs to remap the IRQ 
line on mvme5500/mvme6100 */
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 05/11] Using inttype macro, fixes 1 format warning.

2017-04-07 Thread Cillian O'Donnell
---
 c/src/lib/libbsp/sparc64/shared/helenos/boot/sparc64/loader/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/c/src/lib/libbsp/sparc64/shared/helenos/boot/sparc64/loader/main.c 
b/c/src/lib/libbsp/sparc64/shared/helenos/boot/sparc64/loader/main.c
index f063ad7..f52c20b 100644
--- a/c/src/lib/libbsp/sparc64/shared/helenos/boot/sparc64/loader/main.c
+++ b/c/src/lib/libbsp/sparc64/shared/helenos/boot/sparc64/loader/main.c
@@ -40,6 +40,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -313,7 +314,7 @@ void bootstrap(void)
}
}

-  printk("\nMemory statistics (total %d MB, starting at %x)\n",
+  printk("\nMemory statistics (total %d MB, starting at %" PRIxPTR ")\n",
bootinfo.memmap.total >> 20, bootinfo.physmem_start);
printk(" %x: kernel entry point\n", KERNEL_VIRTUAL_ADDRESS);
printk(" %x: boot info structure\n", &bootinfo);
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 01/11] Using inttype macro, fix 1 format warning

2017-04-07 Thread Cillian O'Donnell
---
 c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c 
b/c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c
index fc2127e..423dc6f 100644
--- a/c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c
+++ b/c/src/lib/libbsp/powerpc/shared/pci/detect_raven_bridge.c
@@ -1,5 +1,6 @@
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -149,7 +150,7 @@ void detect_host_bridge(void)
   }
   pci_read_config_dword(0, 0, 0, 0, &id0);
 #ifdef SHOW_RAVEN_SETTINGS
-  printk("idreg 0 = 0x%x\n",id0);
+  printk("idreg 0 = 0x%" PRIu32 "\n",id0);
 #endif
   if((id0 == PCI_VENDOR_ID_MOTOROLA +
   (PCI_DEVICE_ID_MOTOROLA_RAVEN<<16)) ||
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 06/11] Inserted inttype macros, fix 11 format warnings.

2017-04-07 Thread Cillian O'Donnell
When I got rid of the casts I was left with char * and couldn't find an
inttype to fit it so I left the casts in.
---
 .../lib/libbsp/powerpc/virtex5/startup/bspstart.c  | 25 +++---
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c 
b/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
index 9d610e4..fef18d3 100644
--- a/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
@@ -69,6 +69,7 @@
 
 #include 
 #include 
+#include 
 
 #define DO_DOWN_ALIGN(x,a) ((x) & ~((a)-1))
 
@@ -227,20 +228,20 @@ void bsp_start(void)
 
   /* Let the user know what parameters we were compiled with */
   printk("  Base/Start End Size\n"
- "RAM:  0x%08x  0x%x\n"
- "RTEMS:0x%08x\n"
+ "RAM:  0x%08" PRIx32 " 0x%" PRIx32 "\n"
+ "RTEMS:0x%08" PRIx32 "\n"
  "Interrupt Stack:  0x%08x  0x%x\n"
- "Stack:0x%08x  0x%08x  0x%x\n"
- "Workspace:0x%08x  0x%08x\n"
- "MsgArea:  0x%08x  0x%x\n"
- "Physical RAM  0x%08x\n",
- (uint32_t)RamBase,   (uint32_t)RamSize,
- (uint32_t)__rtems_end,
+ "Stack:0x%08" PRIx32 "0x%08" PRIx32 "0x%" PRIx32 "\n"
+ "Workspace:0x%08" PRIx32 "0x%08" PRIx32 "\n"
+ "MsgArea:  0x%08" PRIx32 "0x%" PRIx32 "\n"
+ "Physical RAM  0x%08" PRIx32 "\n",
+ (uint32_t) RamBase,  (uint32_t) RamSize,
+ (uint32_t) __rtems_end,
  intrStackStart,  intrStackSize,
- (uint32_t)__stack_base, (uint32_t)_stack,(uint32_t)StackSize,
- (uint32_t)WorkAreaBase, (uint32_t)__bsp_ram_end,
- (uint32_t)MsgAreaBase,   
(uint32_t)MsgAreaSize,
- (uint32_t)__phy_ram_end);
+ (uint32_t) __stack_base, (uint32_t) _stack, (uint32_t) StackSize,
+ (uint32_t) WorkAreaBase, (uint32_t) __bsp_ram_end,
+ (uint32_t) MsgAreaBase, (uint32_t) MsgAreaSize,
+ (uint32_t) __phy_ram_end);
 
   /*
* Initialize RTEMS IRQ system
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 07/11] Inserted inttypes, fixes 11 format warnings.

2017-04-07 Thread Cillian O'Donnell
Like virtex5 I couldn't get rid of the casts.
---
 .../lib/libbsp/powerpc/virtex4/startup/bspstart.c  | 25 +++---
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c 
b/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
index f4a5ced..2284158 100644
--- a/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
@@ -68,6 +68,7 @@
 
 #include 
 #include 
+#include 
 
 #define DO_DOWN_ALIGN(x,a) ((x) & ~((a)-1))
 
@@ -206,20 +207,20 @@ void bsp_start(void)
 
   /* Let the user know what parameters we were compiled with */
   printk("  Base/Start End Size\n"
- "RAM:  0x%08x  0x%x\n"
- "RTEMS:0x%08x\n"
+ "RAM:  0x%08" PRIx32 "   0x%" PRIx32 "\n"
+ "RTEMS:0x%08x" PRIx32 "\n"
  "Interrupt Stack:  0x%08x  0x%x\n"
- "Stack:0x%08x  0x%08x  0x%x\n"
- "Workspace:0x%08x  0x%08x\n"
- "MsgArea:  0x%08x  0x%x\n"
- "Physical RAM  0x%08x\n",
- (uint32_t)RamBase,   (uint32_t)RamSize,
- (uint32_t)__rtems_end,
+ "Stack:0x%08" PRIx32 "0x%08" PRIx32 "  0x%" PRIx32 "\n"
+ "Workspace:0x%08" PRIx32 "0x%08" PRIx32 "\n"
+ "MsgArea:  0x%08" PRIx32 " 0x%" PRIx32 "\n"
+ "Physical RAM  0x%08" PRIx32 "\n",
+ (uint32_t) RamBase,  (uint32_t) RamSize,
+ (uint32_t) __rtems_end,
  intrStackStart,  intrStackSize,
- (uint32_t)__stack_base, (uint32_t)_stack,(uint32_t)StackSize,
- (uint32_t)WorkAreaBase, (uint32_t)__bsp_ram_end,
- (uint32_t)MsgAreaBase,   
(uint32_t)MsgAreaSize,
- (uint32_t)__phy_ram_end);
+ (uint32_t) __stack_base, (uint32_t) _stack,(uint32_t) StackSize,
+ (uint32_t) WorkAreaBase, (uint32_t) __bsp_ram_end,
+ (uint32_t) MsgAreaBase,  (uint32_t) MsgAreaSize,
+ (uint32_t) __phy_ram_end);
 
   /*
* Initialize RTEMS IRQ system
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 03/11] Using inttype macro, fix 1 format warning

2017-04-07 Thread Cillian O'Donnell
---
 cpukit/score/cpu/i386/cpu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cpukit/score/cpu/i386/cpu.c b/cpukit/score/cpu/i386/cpu.c
index d839f1e..447d8ae 100644
--- a/cpukit/score/cpu/i386/cpu.c
+++ b/cpukit/score/cpu/i386/cpu.c
@@ -104,7 +104,8 @@ void _CPU_Initialize(void)
   uint32_t cr4;
 __asm__ __volatile__("mov %%cr4, %0":"=r"(cr4));
 if ( 0x600 != (cr4 & 0x600) ) {
-  printk("PANIC: RTEMS was compiled for SSE but BSP did not enable it 
(CR4: 0x%08x)\n", cr4);
+  printk("PANIC: RTEMS was compiled for SSE but BSP did not enable it"
+ "(CR4: 0%" PRIu32 ")\n", cr4);
   while ( 1 ) {
 __asm__ __volatile__("hlt");
  }
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 02/11] Using inttype macro, fix 1 format warning

2017-04-07 Thread Cillian O'Donnell
---
 c/src/libchip/network/dec21140.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/c/src/libchip/network/dec21140.c b/c/src/libchip/network/dec21140.c
index 3bfc91d..b76c02a 100644
--- a/c/src/libchip/network/dec21140.c
+++ b/c/src/libchip/network/dec21140.c
@@ -36,6 +36,7 @@
  */
 
 #include 
+#include 
 
 /*
  *  This driver only supports architectures with the new style
@@ -1020,7 +1021,8 @@ rtems_dec21140_driver_attach (struct 
rtems_bsdnet_ifconfig *config, int attach)
 
 
 #ifdef DEC_DEBUG
-   printk("dec2114x : unit %d base address %08x.\n", unitNumber, sc->base );
+   printk("dec2114x : unit %d base address %" PRIu32PTR ".\n", unitNumber,
+  sc->base );
 #endif
 
 
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 04/11] Changes inttype used and adds casts, fixes 6 format warnings

2017-04-07 Thread Cillian O'Donnell
Unfortunately I couldn't figure how to do this without casts. Either
32 or 64 bit was unhappy one way or the other. Type time_t seems to
be particularly tricky.
---
 cpukit/rtems/src/ratemonreportstatistics.c | 36 +++---
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/cpukit/rtems/src/ratemonreportstatistics.c 
b/cpukit/rtems/src/ratemonreportstatistics.c
index a1bab4a..f3b4f36 100644
--- a/cpukit/rtems/src/ratemonreportstatistics.c
+++ b/cpukit/rtems/src/ratemonreportstatistics.c
@@ -112,15 +112,15 @@ ididididid  c mm X
 
   _Timespec_Divide_by_integer( total_cpu, the_stats.count, &cpu_average );
   rtems_printf( printer,
-"%" PRId32 "."  NANOSECONDS_FMT "/"/* min cpu time */
-"%" PRId32 "."  NANOSECONDS_FMT "/"/* max cpu time */
-"%" PRId32 "."  NANOSECONDS_FMT " ",   /* avg cpu time */
-_Timespec_Get_seconds( min_cpu ),
- _Timespec_Get_nanoseconds( min_cpu ) / NANOSECONDS_DIVIDER,
-_Timespec_Get_seconds( max_cpu ),
- _Timespec_Get_nanoseconds( max_cpu ) / NANOSECONDS_DIVIDER,
-_Timespec_Get_seconds( &cpu_average ),
- _Timespec_Get_nanoseconds( &cpu_average ) / NANOSECONDS_DIVIDER
+"%" PRIdMAX "."  NANOSECONDS_FMT "/"/* min cpu time */
+"%" PRIdMAX "."  NANOSECONDS_FMT "/"/* max cpu time */
+"%" PRIdMAX "."  NANOSECONDS_FMT " ",   /* avg cpu time */
+(intmax_t) _Timespec_Get_seconds( min_cpu ),
+ (int) _Timespec_Get_nanoseconds( min_cpu ) / NANOSECONDS_DIVIDER,
+(intmax_t) _Timespec_Get_seconds( max_cpu ),
+ (int) _Timespec_Get_nanoseconds( max_cpu ) / NANOSECONDS_DIVIDER,
+(intmax_t) _Timespec_Get_seconds( &cpu_average ),
+ (int) _Timespec_Get_nanoseconds( &cpu_average ) / NANOSECONDS_DIVIDER
);
 }
 
@@ -135,15 +135,15 @@ ididididid  c mm X
 
   _Timespec_Divide_by_integer(total_wall, the_stats.count, &wall_average);
   rtems_printf( printer,
-"%" PRId32 "." NANOSECONDS_FMT "/"/* min wall time */
-"%" PRId32 "." NANOSECONDS_FMT "/"/* max wall time */
-"%" PRId32 "." NANOSECONDS_FMT "\n",  /* avg wall time */
-_Timespec_Get_seconds( min_wall ),
-  _Timespec_Get_nanoseconds( min_wall ) / NANOSECONDS_DIVIDER,
-_Timespec_Get_seconds( max_wall ),
-  _Timespec_Get_nanoseconds( max_wall ) / NANOSECONDS_DIVIDER,
-_Timespec_Get_seconds( &wall_average ),
-  _Timespec_Get_nanoseconds( &wall_average ) / NANOSECONDS_DIVIDER
+"%" PRIdMAX "." NANOSECONDS_FMT "/"/* min wall time */
+"%" PRIdMAX "." NANOSECONDS_FMT "/"/* max wall time */
+"%" PRIdMAX "." NANOSECONDS_FMT "\n",  /* avg wall time */
+(intmax_t) _Timespec_Get_seconds( min_wall ),
+  (int) _Timespec_Get_nanoseconds( min_wall ) / NANOSECONDS_DIVIDER,
+(intmax_t) _Timespec_Get_seconds( max_wall ),
+  (int) _Timespec_Get_nanoseconds( max_wall ) / NANOSECONDS_DIVIDER,
+(intmax_t) _Timespec_Get_seconds( &wall_average ),
+  (int) _Timespec_Get_nanoseconds( &wall_average ) / 
NANOSECONDS_DIVIDER
   );
 }
   }
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 09/11] Added inttypes, fixes 11 format warnings.

2017-04-07 Thread Cillian O'Donnell
---
 c/src/lib/libbsp/powerpc/haleakala/mmu/mmu_405.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/haleakala/mmu/mmu_405.c 
b/c/src/lib/libbsp/powerpc/haleakala/mmu/mmu_405.c
index f57defb..38a0949 100644
--- a/c/src/lib/libbsp/powerpc/haleakala/mmu/mmu_405.c
+++ b/c/src/lib/libbsp/powerpc/haleakala/mmu/mmu_405.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include "mmu_405.h"
+#include 
 
 /* #define qLogTLB */
 /* #define qLogTLBDetails */
@@ -139,10 +140,13 @@ MakeTLBEntries(uint32_t startAt, uint32_t nBytes, bool 
EX, bool WR, bool I, uint
   mmu_set_processID(oldpid);
   
   if (tdex != index) {
-printk(" Add TLB %d: At %X for $%X sizecode %d tagWord $%X  ",index, 
startAt, mask+1,sizeCode,tagWord);
+printk(" Add TLB %d: At %" PRIx32 " for $%" PRIx32 
+   " sizecode %d tagWord $%" PRIx32 "  ",
+   index, startAt, mask+1,sizeCode,tagWord);
 printk(" -- find failed, %d/%d!\n",tdex,index);
 MMU_GetTLBEntry(index, &tagWord, &dataWord, &pid);
-printk(" -- reads back $%X : $%X, PID %d\n",tagWord,dataWord,pid);
+printk(" -- reads back $%" PRIx32 " : $%" PRIx32
+   ", PID %d\n",tagWord,dataWord,pid);
   } else {
 #ifdef qLogTLBDetails
 printk(" Add TLB %d: At %X for $%X sizecode %d tagWord $%X\n",index, 
startAt, mask+1,sizeCode,tagWord);
@@ -267,19 +271,23 @@ int DataMissException(BSP_Exception_frame *f, unsigned 
int vector)
   
   addr = PPC_SPECIAL_PURPOSE_REGISTER(SPR_DEAR);
   excSyn  = PPC_SPECIAL_PURPOSE_REGISTER(SPR_ESR);
-  if (excSyn & kESR_DST) printk("\n---Data write to $%X attempted at 
$%X\n",addr,f->EXC_SRR0);
-else printk("\n---Data read from $%X attempted at 
$%X\n",addr,f->EXC_SRR0);
+  if (excSyn & kESR_DST) printk("\n---Data write to $%" PRIx32 
+  " attempted at $%" PRIx32 "\n",addr,f->EXC_SRR0);
+else printk("\n---Data read from $%" PRIx32 " attempted at $%"
+PRIx32 "\n",addr,f->EXC_SRR0);
   return -1;
 }
 
 int InstructionMissException(BSP_Exception_frame *f, unsigned int vector)
 {
-  printk("\n---Instruction fetch attempted from $%X, no TLB 
exists\n",f->EXC_SRR0);
+  printk("\n---Instruction fetch attempted from $%" PRIx32 ", no TLB exists\n",
+ f->EXC_SRR0);
   return -1;
 }
 
 int InstructionFetchException(BSP_Exception_frame *f, unsigned int vector)
 {
-  printk("\n---Instruction fetch attempted from $%X, TLB is 
no-execute\n",f->EXC_SRR0);
+  printk("\n---Instruction fetch attempted from $%" PRIx32 
+ ", TLB is no-execute\n",f->EXC_SRR0);
   return -1;
 }
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 10/11] Added inttypes, fixes 6 format warnings

2017-04-07 Thread Cillian O'Donnell
---
 c/src/lib/libbsp/m68k/mrm332/console/sci.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/c/src/lib/libbsp/m68k/mrm332/console/sci.c 
b/c/src/lib/libbsp/m68k/mrm332/console/sci.c
index 1e92d6d..8e44f22 100644
--- a/c/src/lib/libbsp/m68k/mrm332/console/sci.c
+++ b/c/src/lib/libbsp/m68k/mrm332/console/sci.c
@@ -87,6 +87,7 @@
 #include 
 #include "sci.h"
 #include 
+#include 
 /*#include "../misc/include/cpu332.h" */
 
 /*
@@ -1576,12 +1577,12 @@ void SciPrintStats ( void )
 
 printk( "Current baud rate is %d bps or %d cps\r\n\n", SciBaud, SciBaud / 
10 );
 
-printk( "SCI Uart chars in   %8d\r\n", SciBytesIn   );
-printk( "SCI Uart chars out  %8d\r\n", SciBytesOut  );
-printk( "SCI Uart framing errors %8d\r\n", SciErrorsFraming );
-printk( "SCI Uart parity  errors %8d\r\n", SciErrorsParity  );
-printk( "SCI Uart overrun errors %8d\r\n", SciErrorsOverrun );
-printk( "SCI Uart noise   errors %8d\r\n", SciErrorsNoise   );
+printk( "SCI Uart chars in   %8" PRIu32 "\r\n", SciBytesIn   );
+printk( "SCI Uart chars out  %8" PRIu32 "\r\n", SciBytesOut  );
+printk( "SCI Uart framing errors %8" PRIu32 "\r\n", SciErrorsFraming );
+printk( "SCI Uart parity  errors %8" PRIu32 "\r\n", SciErrorsParity  );
+printk( "SCI Uart overrun errors %8" PRIu32 "\r\n", SciErrorsOverrun );
+printk( "SCI Uart noise   errors %8" PRIu32 "\r\n", SciErrorsNoise   );
 
 return;
 }
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 11/11] Change inttype used and add casts, fixes 6 format warnings.

2017-04-07 Thread Cillian O'Donnell
Unfortunately I couldn't figure out how to do this without casts. Either
32 or 64 bit was unhappy one way or the other. Type time_t seems to
be particularly tricky.
---
 cpukit/rtems/src/ratemonreportstatistics.c | 36 +++---
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/cpukit/rtems/src/ratemonreportstatistics.c 
b/cpukit/rtems/src/ratemonreportstatistics.c
index f3b4f36..a1bab4a 100644
--- a/cpukit/rtems/src/ratemonreportstatistics.c
+++ b/cpukit/rtems/src/ratemonreportstatistics.c
@@ -112,15 +112,15 @@ ididididid  c mm X
 
   _Timespec_Divide_by_integer( total_cpu, the_stats.count, &cpu_average );
   rtems_printf( printer,
-"%" PRIdMAX "."  NANOSECONDS_FMT "/"/* min cpu time */
-"%" PRIdMAX "."  NANOSECONDS_FMT "/"/* max cpu time */
-"%" PRIdMAX "."  NANOSECONDS_FMT " ",   /* avg cpu time */
-(intmax_t) _Timespec_Get_seconds( min_cpu ),
- (int) _Timespec_Get_nanoseconds( min_cpu ) / NANOSECONDS_DIVIDER,
-(intmax_t) _Timespec_Get_seconds( max_cpu ),
- (int) _Timespec_Get_nanoseconds( max_cpu ) / NANOSECONDS_DIVIDER,
-(intmax_t) _Timespec_Get_seconds( &cpu_average ),
- (int) _Timespec_Get_nanoseconds( &cpu_average ) / NANOSECONDS_DIVIDER
+"%" PRId32 "."  NANOSECONDS_FMT "/"/* min cpu time */
+"%" PRId32 "."  NANOSECONDS_FMT "/"/* max cpu time */
+"%" PRId32 "."  NANOSECONDS_FMT " ",   /* avg cpu time */
+_Timespec_Get_seconds( min_cpu ),
+ _Timespec_Get_nanoseconds( min_cpu ) / NANOSECONDS_DIVIDER,
+_Timespec_Get_seconds( max_cpu ),
+ _Timespec_Get_nanoseconds( max_cpu ) / NANOSECONDS_DIVIDER,
+_Timespec_Get_seconds( &cpu_average ),
+ _Timespec_Get_nanoseconds( &cpu_average ) / NANOSECONDS_DIVIDER
);
 }
 
@@ -135,15 +135,15 @@ ididididid  c mm X
 
   _Timespec_Divide_by_integer(total_wall, the_stats.count, &wall_average);
   rtems_printf( printer,
-"%" PRIdMAX "." NANOSECONDS_FMT "/"/* min wall time */
-"%" PRIdMAX "." NANOSECONDS_FMT "/"/* max wall time */
-"%" PRIdMAX "." NANOSECONDS_FMT "\n",  /* avg wall time */
-(intmax_t) _Timespec_Get_seconds( min_wall ),
-  (int) _Timespec_Get_nanoseconds( min_wall ) / NANOSECONDS_DIVIDER,
-(intmax_t) _Timespec_Get_seconds( max_wall ),
-  (int) _Timespec_Get_nanoseconds( max_wall ) / NANOSECONDS_DIVIDER,
-(intmax_t) _Timespec_Get_seconds( &wall_average ),
-  (int) _Timespec_Get_nanoseconds( &wall_average ) / 
NANOSECONDS_DIVIDER
+"%" PRId32 "." NANOSECONDS_FMT "/"/* min wall time */
+"%" PRId32 "." NANOSECONDS_FMT "/"/* max wall time */
+"%" PRId32 "." NANOSECONDS_FMT "\n",  /* avg wall time */
+_Timespec_Get_seconds( min_wall ),
+  _Timespec_Get_nanoseconds( min_wall ) / NANOSECONDS_DIVIDER,
+_Timespec_Get_seconds( max_wall ),
+  _Timespec_Get_nanoseconds( max_wall ) / NANOSECONDS_DIVIDER,
+_Timespec_Get_seconds( &wall_average ),
+  _Timespec_Get_nanoseconds( &wall_average ) / NANOSECONDS_DIVIDER
   );
 }
   }
-- 
2.7.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


RE:RE:Using inttypes macros fixes 4 format warnings

2017-04-07 Thread Cillian O'Donnell
Thanks Joel!

Plenty more were that came from below.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

RE:[PATCH 04/11] Changes inttype used and adds casts, fixes 6 format warnings

2017-04-07 Thread Cillian O'Donnell
IGNORE THIS ONE.

It's a duplicate, that still has warnings. I couldn't figure out how to get
rid of it. I'm new to git.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: RE:Using inttypes macros fixes 4 format warnings

2017-04-07 Thread Joel Sherrill
On Fri, Apr 7, 2017 at 5:43 PM, Cillian O'Donnell 
wrote:

> Thanks Joel!
>

No problem. The printf-format warnings are mostly easy to fix. But doing it
right can be tedious. I have had my share of them tossed away for missing
a detail.


>
> Plenty more were that came from below.
>

Nothing was attached but please start a new thread with new patches.

Also it is handy to note which file/BSP, was impacted in the short summary.
I didn't do a great job but I edited your commit message to reflect that.



>
> ___
> 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 06/11] Inserted inttype macros, fix 11 format warnings.

2017-04-07 Thread Joel Sherrill
On Fri, Apr 7, 2017 at 5:37 PM, Cillian O'Donnell 
wrote:

> When I got rid of the casts I was left with char * and couldn't find an
> inttype to fit it so I left the casts in.
>

char * can be printed with %p. printk() should support that but check.
Do a simple test on Linux to see but I don't think you have to put 0x%p,
it just prints an address correctly.

Another approach would be to cast it to a uintptr_t and (hopefully), there
is a PRI constant for that. but %p is preferable.

--joel


> ---
>  .../lib/libbsp/powerpc/virtex5/startup/bspstart.c  | 25
> +++---
>  1 file changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
> b/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
> index 9d610e4..fef18d3 100644
> --- a/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
> +++ b/c/src/lib/libbsp/powerpc/virtex5/startup/bspstart.c
> @@ -69,6 +69,7 @@
>
>  #include 
>  #include 
> +#include 
>
>  #define DO_DOWN_ALIGN(x,a) ((x) & ~((a)-1))
>
> @@ -227,20 +228,20 @@ void bsp_start(void)
>
>/* Let the user know what parameters we were compiled with */
>printk("  Base/Start End Size\n"
> - "RAM:  0x%08x  0x%x\n"
> - "RTEMS:0x%08x\n"
> + "RAM:  0x%08" PRIx32 " 0x%" PRIx32 "\n"
> + "RTEMS:0x%08" PRIx32 "\n"
>   "Interrupt Stack:  0x%08x  0x%x\n"
> - "Stack:0x%08x  0x%08x  0x%x\n"
> - "Workspace:0x%08x  0x%08x\n"
> - "MsgArea:  0x%08x  0x%x\n"
> - "Physical RAM  0x%08x\n",
> - (uint32_t)RamBase,
>  (uint32_t)RamSize,
> - (uint32_t)__rtems_end,
> + "Stack:0x%08" PRIx32 "0x%08" PRIx32 "0x%" PRIx32 "\n"
> + "Workspace:0x%08" PRIx32 "0x%08" PRIx32 "\n"
> + "MsgArea:  0x%08" PRIx32 "0x%" PRIx32 "\n"
> + "Physical RAM  0x%08" PRIx32 "\n",
> + (uint32_t) RamBase,  (uint32_t) RamSize,
> + (uint32_t) __rtems_end,
>   intrStackStart,  intrStackSize,
> - (uint32_t)__stack_base, (uint32_t)_stack,
> (uint32_t)StackSize,
> - (uint32_t)WorkAreaBase, (uint32_t)__bsp_ram_end,
> - (uint32_t)MsgAreaBase,
>  (uint32_t)MsgAreaSize,
> - (uint32_t)__phy_ram_end);
> + (uint32_t) __stack_base, (uint32_t) _stack, (uint32_t) StackSize,
> + (uint32_t) WorkAreaBase, (uint32_t) __bsp_ram_end,
> + (uint32_t) MsgAreaBase, (uint32_t) MsgAreaSize,
> + (uint32_t) __phy_ram_end);
>
>/*
> * Initialize RTEMS IRQ system
> --
> 2.7.4
>
> ___
> 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 07/11] Inserted inttypes, fixes 11 format warnings.

2017-04-07 Thread Joel Sherrill
Many of the values printed appear to be addresses. If they
are pointers, use %p.

--joel

On Fri, Apr 7, 2017 at 5:37 PM, Cillian O'Donnell 
wrote:

> Like virtex5 I couldn't get rid of the casts.
> ---
>  .../lib/libbsp/powerpc/virtex4/startup/bspstart.c  | 25
> +++---
>  1 file changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
> b/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
> index f4a5ced..2284158 100644
> --- a/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
> +++ b/c/src/lib/libbsp/powerpc/virtex4/startup/bspstart.c
> @@ -68,6 +68,7 @@
>
>  #include 
>  #include 
> +#include 
>
>  #define DO_DOWN_ALIGN(x,a) ((x) & ~((a)-1))
>
> @@ -206,20 +207,20 @@ void bsp_start(void)
>
>/* Let the user know what parameters we were compiled with */
>printk("  Base/Start End Size\n"
> - "RAM:  0x%08x  0x%x\n"
> - "RTEMS:0x%08x\n"
> + "RAM:  0x%08" PRIx32 "   0x%" PRIx32 "\n"
> + "RTEMS:0x%08x" PRIx32 "\n"
>   "Interrupt Stack:  0x%08x  0x%x\n"
> - "Stack:0x%08x  0x%08x  0x%x\n"
> - "Workspace:0x%08x  0x%08x\n"
> - "MsgArea:  0x%08x  0x%x\n"
> - "Physical RAM  0x%08x\n",
> - (uint32_t)RamBase,
>  (uint32_t)RamSize,
> - (uint32_t)__rtems_end,
> + "Stack:0x%08" PRIx32 "0x%08" PRIx32 "  0x%" PRIx32
> "\n"
> + "Workspace:0x%08" PRIx32 "0x%08" PRIx32 "\n"
> + "MsgArea:  0x%08" PRIx32 " 0x%" PRIx32 "\n"
> + "Physical RAM  0x%08" PRIx32 "\n",
> + (uint32_t) RamBase,  (uint32_t)
> RamSize,
> + (uint32_t) __rtems_end,
>   intrStackStart,  intrStackSize,
> - (uint32_t)__stack_base, (uint32_t)_stack,
> (uint32_t)StackSize,
> - (uint32_t)WorkAreaBase, (uint32_t)__bsp_ram_end,
> - (uint32_t)MsgAreaBase,
>  (uint32_t)MsgAreaSize,
> - (uint32_t)__phy_ram_end);
> + (uint32_t) __stack_base, (uint32_t) _stack,(uint32_t)
> StackSize,
> + (uint32_t) WorkAreaBase, (uint32_t) __bsp_ram_end,
> + (uint32_t) MsgAreaBase,  (uint32_t)
> MsgAreaSize,
> + (uint32_t) __phy_ram_end);
>
>/*
> * Initialize RTEMS IRQ system
> --
> 2.7.4
>
> ___
> 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 04/11] Changes inttype used and adds casts, fixes 6 format warnings

2017-04-07 Thread Joel Sherrill
On Fri, Apr 7, 2017 at 5:50 PM, Cillian O'Donnell 
wrote:

> IGNORE THIS ONE.
>
> It's a duplicate, that still has warnings. I couldn't figure out how to
> get rid of it. I'm new to git.
>
>
This might be one where PRItime_t needs to be defined in rtems/inttypes.h
and that
used. I think that's the type returned.

Also you should be working on a git branch and be able to do something like
"git rebase -i master" and follow the instructions to delete a single patch.

Before sending again:

+ Check all against my few comments
+ fix the short message so it is something like
"rtems/src/ratemonreportstatistics.c: Use inttypes.h constants to remove N
warnings"

That type of message makes it easier to spot what changed in the git web
view.
Use a it of judgement to shorten the filename. Often "BSP/XXX/YYY.c:
message"
is enough to point someone to the file.

The patches generally look good. Mastering printf() is a challenge. It is
complicated
and doing the format strings so they are portably warning free is tricky.

Heading home now. I should already be there. :)

--joel


> ___
> 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 04/11] Changes inttype used and adds casts, fixes 6 format warnings

2017-04-07 Thread Gedare Bloom
On Fri, Apr 7, 2017 at 7:05 PM, Joel Sherrill  wrote:
>
>
> On Fri, Apr 7, 2017 at 5:50 PM, Cillian O'Donnell 
> wrote:
>>
>> IGNORE THIS ONE.
>>
>> It's a duplicate, that still has warnings. I couldn't figure out how to
>> get rid of it. I'm new to git.
>>
>
> This might be one where PRItime_t needs to be defined in rtems/inttypes.h
> and that
> used. I think that's the type returned.
>
> Also you should be working on a git branch and be able to do something like
> "git rebase -i master" and follow the instructions to delete a single patch.
>
> Before sending again:
>
> + Check all against my few comments
> + fix the short message so it is something like
> "rtems/src/ratemonreportstatistics.c: Use inttypes.h constants to remove N
> warnings"
>
> That type of message makes it easier to spot what changed in the git web
> view.
> Use a it of judgement to shorten the filename. Often "BSP/XXX/YYY.c:
> message"
> is enough to point someone to the file.
>
Also, note you can use git format-patch -v2 to indicate the second
version of a patch. This is useful to help identify patches that have
been previously reviewed and commented on.

> The patches generally look good. Mastering printf() is a challenge. It is
> complicated
> and doing the format strings so they are portably warning free is tricky.
>
> Heading home now. I should already be there. :)
>
> --joel
>
>>
>> ___
>> 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
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel