GCC Head Gives C++ Compile Error with RTEMS

2014-08-07 Thread Joel Sherrill
Hi

SMP was enabled.

sparc-rtems4.11-g++ -B../../.././lib/ -B../../.././sis/lib/ -specs
bsp_specs -qrtems -DPACKAGE_NAME=\"rtems-c-src-librtems++\"
-DPACKAGE_TARNAME=\"rtems-c-src-librtems++\"
-DPACKAGE_VERSION=\"4.10.99.0\"
-DPACKAGE_STRING=\"rtems-c-src-librtems++\ 4.10.99.0\"
-DPACKAGE_BUGREPORT=\"http://www.rtems.org/bugzilla\"; -DPACKAGE_URL=\"\"
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1
-DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_STRINGS_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -I.
-I../../../../../rtems/c/src/librtems++  -isystem
../../.././sis/lib/include   -mcpu=cypress -O2 -g -ffunction-sections
-fdata-sections -Wall -Wmissing-prototypes
-Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -MT
src/librtems___a-rtemsEvent.o -MD -MP -MF
src/.deps/librtems___a-rtemsEvent.Tpo -c -o
src/librtems___a-rtemsEvent.o `test -f 'src/rtemsEvent.cc' || echo
'../../../../../rtems/c/src/librtems++/'`src/rtemsEvent.cc
cc1plus: warning: command line option '-Wmissing-prototypes' is valid
for C/ObjC but not for C++
cc1plus: warning: command line option '-Wimplicit-function-declaration'
is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for
C/ObjC but not for C++
cc1plus: warning: command line option '-Wnested-externs' is valid for
C/ObjC but not for C++
In file included from
/users/joel/test-gcc/install-head/lib/gcc/sparc-rtems4.11/4.10.0/include/c++/atomic:38:0,
 from
../../.././sis/lib/include/rtems/score/cpustdatomic.h:31,
 from ../../.././sis/lib/include/rtems/score/cpuatomic.h:12,
 from ../../.././sis/lib/include/rtems/score/atomic.h:20,
 from ../../.././sis/lib/include/rtems/score/smplock.h:27,
 from ../../.././sis/lib/include/rtems/score/percpu.h:28,
 from ../../.././sis/lib/include/rtems/system.h:23,
 from ../../.././sis/lib/include/rtems.h:29,
 from
../../.././sis/lib/include/rtems++/rtemsStatusCode.h:22,
 from ../../.././sis/lib/include/rtems++/rtemsEvent.h:23,
 from
../../../../../rtems/c/src/librtems++/src/rtemsEvent.cc:19:
/users/joel/test-gcc/install-head/lib/gcc/sparc-rtems4.11/4.10.0/include/c++/bits/c++0x_warning.h:32:2:
error: #error This file requires compiler and library support for the
ISO C++ 2011 standard. This support is currently experimental, and must
be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \

-- 
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherr...@oarcorp.comOn-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available(256) 722-9985

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


Re: GCC Head Gives C++ Compile Error with RTEMS

2014-08-07 Thread Sebastian Huber

This is a known problem:

http://lists.rtems.org/pipermail/devel/2014-June/007224.html

I don't know how to add this flag to the CXXFLAGS in our build system.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

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


[PATCH] rtems_termios_puts: Copy and write more than one char at once

2014-08-07 Thread Kolja Waschk
Hi,

I'd like to send some work upstream that I've made for a Blackfin BF537 based 
device. The following patch was necessary for a DMA-based high speed UART
driver(*) for Blackfin - it allows to start transmission on serial interfaces 
with
more than just one char at a time.

Notes:

This already reworked patch obsoletes the one attached to
https://www.rtems.org/bugzilla/show_bug.cgi?id=2185

I'm unsure if the amount of bytes to sent, given as an argument to the final
call of (*tty->handler.write)(), is properly chosen. It was always fixed to one 
before. 

(*)The UART driver itself is not yet ready for upstream, because it lives still
in my BSP only and has some specific mechanisms which are not really suited
for general use (such as using an extra GPIO for end-of-transfer signalling).

Kolja


Kolja Waschk (1):
  rtems_termios_puts: Copy and write more than one char at once

 cpukit/libcsupport/src/termios.c | 74 +++-
 1 file changed, 51 insertions(+), 23 deletions(-)

-- 
1.9.1

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


[PATCH] rtems_termios_puts: Copy and write more than one char at once

2014-08-07 Thread Kolja Waschk
---
 cpukit/libcsupport/src/termios.c | 74 +++-
 1 file changed, 51 insertions(+), 23 deletions(-)

diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index 2448ea1..d32ab74 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -879,7 +879,7 @@ rtems_termios_ioctl (void *arg)
   tty->rawInBufSemaphoreTimeout = RTEMS_NO_TIMEOUT;
   tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT;
 } else {
-  tty->vtimeTicks = tty->termios.c_cc[VTIME] * 
+  tty->vtimeTicks = tty->termios.c_cc[VTIME] *
 rtems_clock_get_ticks_per_second() / 10;
   if (tty->termios.c_cc[VTIME]) {
 tty->rawInBufSemaphoreOptions = RTEMS_WAIT;
@@ -984,26 +984,19 @@ rtems_termios_puts (
   unsigned int newHead;
   rtems_interrupt_lock_context lock_context;
   rtems_status_code sc;
+  size_t partlen;
 
   if (tty->handler.mode == TERMIOS_POLLED) {
 (*tty->handler.write)(tty, buf, len);
 return;
   }
-  newHead = tty->rawOutBuf.Head;
+
   while (len) {
-/*
- * Performance improvement could be made here.
- * Copy multiple bytes to raw buffer:
- * if (len > 1) && (space to buffer end, or tail > 1)
- *  ncopy = MIN (len, space to buffer end or tail)
- *  memcpy (raw buffer, buf, ncopy)
- *  buf += ncopy
- *  len -= ncopy
- *
- * To minimize latency, the memcpy should be done
- * with interrupts enabled.
- */
-newHead = (newHead + 1) % tty->rawOutBuf.Size;
+/* Check space for at least one char */
+newHead = tty->rawOutBuf.Head + 1;
+if (newHead >= tty->rawOutBuf.Size)
+  newHead -= tty->rawOutBuf.Size;
+
 rtems_termios_interrupt_lock_acquire (tty, &lock_context);
 while (newHead == tty->rawOutBuf.Tail) {
   tty->rawOutBufState = rob_wait;
@@ -1014,21 +1007,56 @@ rtems_termios_puts (
 rtems_fatal_error_occurred (sc);
   rtems_termios_interrupt_lock_acquire (tty, &lock_context);
 }
-tty->rawOutBuf.theBuf[tty->rawOutBuf.Head] = *buf++;
+
+/* Copy as much chars as fit until current tail or end of ring buffer */
+partlen = len;
+if (tty->rawOutBuf.Tail > tty->rawOutBuf.Head) {
+  /* Available space is contiguous from Head to Tail */
+  size_t available = tty->rawOutBuf.Tail - tty->rawOutBuf.Head - 1;
+  if (partlen > available)
+partlen = available;
+} else {
+  /* Available space wraps at buffer end. To keep code simple, utilize
+ only the part from Head to end during this iteration */
+  size_t available = tty->rawOutBuf.Size - tty->rawOutBuf.Head;
+  if (partlen > available)
+partlen = available;
+}
+
+/* To minimize latency, the memcpy should be done
+ * with interrupts enabled (TBD) */
+memcpy(&tty->rawOutBuf.theBuf[tty->rawOutBuf.Head], buf, partlen);
+newHead = tty->rawOutBuf.Head + partlen;
+if (newHead >= tty->rawOutBuf.Size)
+  newHead -= tty->rawOutBuf.Size;
 tty->rawOutBuf.Head = newHead;
+buf += partlen;
+
 if (tty->rawOutBufState == rob_idle) {
-  /* check, whether XOFF has been received */
-  if (!(tty->flow_ctrl & FL_ORCVXOF)) {
-(*tty->handler.write)(
-  tty, &tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail],1);
+  if (tty->flow_ctrl & FL_MDXOF) {
+/* Write only one byte at a time if using XON/XOFF flow ctrl */
+/* check, whether XOFF has been received */
+if (!(tty->flow_ctrl & FL_ORCVXOF)) {
+  (*tty->handler.write)(
+tty, &tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail], 1);
+} else {
+  /* remember that output has been stopped due to flow ctrl*/
+  tty->flow_ctrl |= FL_OSTOP;
+}
   } else {
-/* remember that output has been stopped due to flow ctrl*/
-tty->flow_ctrl |= FL_OSTOP;
+size_t nwaiting;
+if (tty->rawOutBuf.Head > tty->rawOutBuf.Tail)
+  nwaiting = tty->rawOutBuf.Head - tty->rawOutBuf.Tail;
+else
+  nwaiting = tty->rawOutBuf.Size - tty->rawOutBuf.Tail;
+
+(*tty->handler.write)(
+  tty, &tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail], nwaiting);
   }
   tty->rawOutBufState = rob_busy;
 }
 rtems_termios_interrupt_lock_release (tty, &lock_context);
-len--;
+len -= partlen;
   }
 }
 
-- 
1.9.1

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