SD driver status

2016-06-21 Thread Mudit Jain
Hi all,

This is what I get on minicom.
--
*** LIBBSD SDHCI 01 TEST ***
nexus0: 
bcm_dma0:  on nexus0
sdhci_bcm0:  on nexus0

RTEMS Shell on /dev/console. Use 'help' to list
commands.
[/] # ls
/dev
bpf bpf0console
ttyS0
[/] #

---
 The app code -
https://github.com/spark1729/rtems-libbsd/blob/ae67c8bf554b3d59ab5c8a0da70d244a5ffbbc4b/testsuite/sdhci01/test_main.c

Ideally an mmc device should be initialized. It would be great if someone
could direct me in the right direction here.

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

Re: SD driver status

2016-06-21 Thread Sebastian Huber

For an example see media01 test.

On 21/06/16 12:40, Mudit Jain wrote:

Hi all,

This is what I get on minicom.
--
*** LIBBSD SDHCI 01 TEST ***
nexus0: 
bcm_dma0:  on nexus0
sdhci_bcm0:  on nexus0

RTEMS Shell on /dev/console. Use 'help' to list commands.
[/] # ls /dev
bpf bpf0console ttyS0
[/] #

---
 The app code - 
https://github.com/spark1729/rtems-libbsd/blob/ae67c8bf554b3d59ab5c8a0da70d244a5ffbbc4b/testsuite/sdhci01/test_main.c


Ideally an mmc device should be initialized. It would be great if 
someone could direct me in the right direction here.


Thanks.
Mudit



--
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 05/10] Make rtems/print.h independent of rtems/bspIo.h

2016-06-21 Thread Sebastian Huber
---
 c/src/lib/libbsp/shared/src/irq-default-handler.c   |  2 +-
 c/src/libchip/rtc/ds1375.c  |  1 +
 cpukit/include/rtems/bspIo.h| 12 
 cpukit/include/rtems/print.h| 21 -
 cpukit/libcsupport/src/printk_plugin.c  |  1 +
 cpukit/libdrvmgr/drvmgr_translate_check.c   |  2 ++
 cpukit/libfs/src/devfs/devfs_show.c |  2 ++
 cpukit/libfs/src/jffs2/include/linux/kernel-rtems.h |  2 +-
 cpukit/libmisc/mouse/mouse_parser.c |  1 +
 cpukit/libmisc/mouse/serial_mouse.c |  1 +
 testsuites/libtests/block08/bdbuf_tests.h   |  1 +
 testsuites/samples/cdtest/main.cc   |  1 +
 testsuites/sptests/spprintk/init.c  |  1 -
 testsuites/support/include/buffer_test_io.h |  1 +
 14 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/c/src/lib/libbsp/shared/src/irq-default-handler.c 
b/c/src/lib/libbsp/shared/src/irq-default-handler.c
index f1d1e38..4f4b4be 100644
--- a/c/src/lib/libbsp/shared/src/irq-default-handler.c
+++ b/c/src/lib/libbsp/shared/src/irq-default-handler.c
@@ -14,7 +14,7 @@
 
 #include 
 
-#include 
+#include 
 
 #include 
 
diff --git a/c/src/libchip/rtc/ds1375.c b/c/src/libchip/rtc/ds1375.c
index f7e58f2..4a23a00 100644
--- a/c/src/libchip/rtc/ds1375.c
+++ b/c/src/libchip/rtc/ds1375.c
@@ -51,6 +51,7 @@
 #include  /* write, read, close */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/cpukit/include/rtems/bspIo.h b/cpukit/include/rtems/bspIo.h
index 4b5b2a2..d0d8f83 100644
--- a/cpukit/include/rtems/bspIo.h
+++ b/cpukit/include/rtems/bspIo.h
@@ -122,18 +122,6 @@ extern int putk(const char *s);
  */
 extern void rtems_putc(char c);
 
-/**
- * Type definition for function which can be plugged in to
- * certain reporting routines to redirect the output.
- *
- * Use the RTEMS Print interface to call these functions. Do not
- * directly use them.
- *
- * If the user provides their own "printf plugin", then they may
- * redirect those reports as they see fit.
- */
-typedef int (*rtems_print_plugin_t)(void *, const char *format, va_list ap);
-
 /**@}*/
 
 #ifdef __cplusplus
diff --git a/cpukit/include/rtems/print.h b/cpukit/include/rtems/print.h
index c4dacce..07e50d0 100644
--- a/cpukit/include/rtems/print.h
+++ b/cpukit/include/rtems/print.h
@@ -18,11 +18,10 @@
 #ifndef _RTEMS_PRINT_H
 #define _RTEMS_PRINT_H
 
-#include 
-#include 
-#include 
+#include 
 
-#include 
+#include 
+#include 
 
 #ifdef __cplusplus
 extern "C" {
@@ -36,12 +35,24 @@ extern "C" {
  */
 
 /**
+ * Type definition for function which can be plugged in to certain reporting
+ * routines to redirect the output.
+ *
+ * Use the RTEMS Print interface to call these functions. Do not directly use
+ * them.
+ *
+ * If the user provides their own printer, then they may redirect those reports
+ * as they see fit.
+ */
+typedef int (*rtems_print_printer)(void *, const char *format, va_list ap);
+
+/**
  * Type definition for the printer structure used to access the kernel print
  * support.
  */
 typedef struct rtems_printer {
   void*context;
-  rtems_print_plugin_t printer;
+  rtems_print_printer  printer;
 } rtems_printer;
 
 /**
diff --git a/cpukit/libcsupport/src/printk_plugin.c 
b/cpukit/libcsupport/src/printk_plugin.c
index 485346d..38214f8 100644
--- a/cpukit/libcsupport/src/printk_plugin.c
+++ b/cpukit/libcsupport/src/printk_plugin.c
@@ -19,6 +19,7 @@
 #endif
 
 #include 
+#include 
 
 static int printk_plugin(
   void *ignored,
diff --git a/cpukit/libdrvmgr/drvmgr_translate_check.c 
b/cpukit/libdrvmgr/drvmgr_translate_check.c
index e5f0b7a..5ee0930 100644
--- a/cpukit/libdrvmgr/drvmgr_translate_check.c
+++ b/cpukit/libdrvmgr/drvmgr_translate_check.c
@@ -9,6 +9,8 @@
 
 #include 
 
+#include 
+
 /* Calls drvmgr_translate() to translate an address range and check the result,
  * a printout is generated if the check fails. See paramters of
  * drvmgr_translate().
diff --git a/cpukit/libfs/src/devfs/devfs_show.c 
b/cpukit/libfs/src/devfs/devfs_show.c
index b5984bd..0ea1306 100644
--- a/cpukit/libfs/src/devfs/devfs_show.c
+++ b/cpukit/libfs/src/devfs/devfs_show.c
@@ -17,6 +17,8 @@
 
 #include "devfs.h"
 
+#include 
+
 void devFS_Show(void)
 {
   rtems_filesystem_location_info_t *rootloc = &rtems_filesystem_root->location;
diff --git a/cpukit/libfs/src/jffs2/include/linux/kernel-rtems.h 
b/cpukit/libfs/src/jffs2/include/linux/kernel-rtems.h
index 0852034..0550446 100644
--- a/cpukit/libfs/src/jffs2/include/linux/kernel-rtems.h
+++ b/cpukit/libfs/src/jffs2/include/linux/kernel-rtems.h
@@ -18,7 +18,7 @@
 #define __LINUX_RTEMS_IMPL_H__
 
 #include 
-#include 
+#include 
 
 static inline char *do_kmemdup(const char *s, size_t n)
 {
diff --git a/cpukit/libmisc/mouse/mouse_parser.c 
b/cpukit/libmisc/mouse/mouse_parser.c
index 2831f64..573e6cf 100644
--- a/cpukit/libmisc/mouse/mouse_parser.c
+++ b/c

[PATCH 01/10] Make printk_plugin() static

2016-06-21 Thread Sebastian Huber
---
 cpukit/include/rtems/bspIo.h   | 10 --
 cpukit/libcsupport/src/printk_plugin.c | 19 +--
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/cpukit/include/rtems/bspIo.h b/cpukit/include/rtems/bspIo.h
index a7fd959..958103a 100644
--- a/cpukit/include/rtems/bspIo.h
+++ b/cpukit/include/rtems/bspIo.h
@@ -142,16 +142,6 @@ extern void rtems_putc(char c);
 typedef int (*rtems_print_plugin_t)(void *, const char *format, va_list ap);
 
 /**
- * @brief Reporting Methods printk() Plugin
- *
- * @param[in] context Unused.
- * @param[in] fmt is a printf()-style format string
- *
- * @return The number of characters printed.
- */
-extern int printk_plugin(void *context, const char *fmt, va_list ap);
-
-/**
  * @brief Reporting Methods printf() Plugin
  *
  * This is a standard plug-in to support using printf() for output
diff --git a/cpukit/libcsupport/src/printk_plugin.c 
b/cpukit/libcsupport/src/printk_plugin.c
index 3ecacb8..485346d 100644
--- a/cpukit/libcsupport/src/printk_plugin.c
+++ b/cpukit/libcsupport/src/printk_plugin.c
@@ -18,18 +18,9 @@
 #include "config.h"
 #endif
 
-#include 
 #include 
 
-void rtems_print_printer_printk(
-  rtems_printer *printer
-)
-{
-  printer->context = NULL;
-  printer->printer = printk_plugin;
-}
-
-int printk_plugin(
+static int printk_plugin(
   void *ignored,
   const char *format,
   va_list ap
@@ -39,3 +30,11 @@ int printk_plugin(
   vprintk( format, ap );
   return 0;
 }
+
+void rtems_print_printer_printk(
+  rtems_printer *printer
+)
+{
+  printer->context = NULL;
+  printer->printer = printk_plugin;
+}
-- 
1.8.4.5

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


[PATCH 07/10] Avoid in

2016-06-21 Thread Sebastian Huber
---
 cpukit/rtems/include/rtems/rtems/ratemon.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h 
b/cpukit/rtems/include/rtems/rtems/ratemon.h
index 6e8fab6..3203eab 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -35,7 +35,8 @@
 #include 
 #include 
 #include 
-#include 
+
+struct rtems_printer;
 
 #ifdef __cplusplus
 extern "C" {
@@ -362,7 +363,7 @@ void rtems_rate_monotonic_reset_all_statistics( void );
  *  the Manager but actually uses other services of the Manager.
  */
 void rtems_rate_monotonic_report_statistics_with_plugin(
-  const rtems_printer *printer
+  const struct rtems_printer *printer
 );
 
 /**
-- 
1.8.4.5

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


[PATCH 09/10] Add printer task

2016-06-21 Thread Sebastian Huber
---
 cpukit/include/rtems/printer.h   |  99 +
 cpukit/libcsupport/Makefile.am   |   1 +
 cpukit/libcsupport/src/printertask.c | 203 +++
 3 files changed, 303 insertions(+)
 create mode 100644 cpukit/libcsupport/src/printertask.c

diff --git a/cpukit/include/rtems/printer.h b/cpukit/include/rtems/printer.h
index 2ed6b6a..545f122 100644
--- a/cpukit/include/rtems/printer.h
+++ b/cpukit/include/rtems/printer.h
@@ -19,6 +19,9 @@
 #define _RTEMS_PRINTER_H
 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 
@@ -110,6 +113,102 @@ extern void rtems_print_printer_printf(rtems_printer 
*printer);
  */
 extern void rtems_print_printer_fprintf(rtems_printer *printer, FILE *file);
 
+typedef struct {
+  rtems_id task;
+  RTEMS_INTERRUPT_LOCK_MEMBER( lock )
+  rtems_chain_control  free_buffers;
+  rtems_chain_control  todo_buffers;
+  size_t   task_stack_size;
+  rtems_task_priority  task_priority;
+  int  fd;
+  void*buffer_table;
+  size_t   buffer_count;
+  size_t   buffer_size;
+} rtems_printer_task_context;
+
+static inline void rtems_printer_task_initialize(
+  rtems_printer_task_context *context
+)
+{
+  memset( context, 0, sizeof( *context ) );
+}
+
+static inline void rtems_printer_task_set_stack_size(
+  rtems_printer_task_context *context,
+  size_tstack_size
+)
+{
+  context->task_stack_size = stack_size;
+}
+
+static inline void rtems_printer_task_set_priority(
+  rtems_printer_task_context *context,
+  rtems_task_priority   priority
+)
+{
+  context->task_priority = priority;
+}
+
+static inline void rtems_printer_task_set_file_descriptor(
+  rtems_printer_task_context *context,
+  int   fd
+)
+{
+  context->fd = fd;
+}
+
+static inline void rtems_printer_task_set_buffer_table(
+  rtems_printer_task_context *context,
+  void *buffer_table
+)
+{
+  context->buffer_table = buffer_table;
+}
+
+static inline void rtems_printer_task_set_buffer_count(
+  rtems_printer_task_context *context,
+  size_tbuffer_count
+)
+{
+  context->buffer_count = buffer_count;
+}
+
+static inline void rtems_printer_task_set_buffer_size(
+  rtems_printer_task_context *context,
+  size_tbuffer_size
+)
+{
+  context->buffer_size = buffer_size;
+}
+
+/**
+ * @brief Creates a printer task.
+ *
+ * @param[in] printer Pointer to the printer structure.
+ * @param[in] context The initialized printer task context.
+ *
+ * @retval 0 Successful operation.
+ * @retval EINVAL Invalid context parameters.
+ * @retval ENOMEM Not enough resources.
+ */
+int rtems_print_printer_task(
+  rtems_printer*printer,
+  rtems_printer_task_context *context
+);
+
+/**
+ * @brief Drains the work queue of the printer task.
+ *
+ * Waits until all output buffers in the work queue at the time of this
+ * function call are written to the file descriptor and an fsync() completed.
+ *
+ * @param[in] context The initialized printer task context.
+ *
+ * The printer task must be successfully started via rtems_print_printer_task()
+ * before this function can be used.  Otherwise, the behaviour is undefined.
+ */
+void rtems_printer_task_drain(rtems_printer_task_context *context);
+
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
index f047cfc..99dc2e1 100644
--- a/cpukit/libcsupport/Makefile.am
+++ b/cpukit/libcsupport/Makefile.am
@@ -128,6 +128,7 @@ libcsupport_a_SOURCES = src/gxx_wrappers.c src/getchark.c 
src/printk.c \
 src/resource_snapshot.c \
 $(BSD_LIBC_C_FILES) $(BASE_FS_C_FILES) $(MALLOC_C_FILES) \
 $(ERROR_C_FILES) $(ASSOCIATION_C_FILES)
+libcsupport_a_SOURCES += src/printertask.c
 
 libcsupport_a_SOURCES += $(LIBC_GLUE_C_FILES) $(PASSWORD_GROUP_C_FILES) \
 $(TERMINAL_IDENTIFICATION_C_FILES) $(SYSTEM_CALL_C_FILES) \
diff --git a/cpukit/libcsupport/src/printertask.c 
b/cpukit/libcsupport/src/printertask.c
new file mode 100644
index 000..825f1c2
--- /dev/null
+++ b/cpukit/libcsupport/src/printertask.c
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2016 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Obere Lagerstr. 30
+ *  82178 Puchheim
+ *  Germany
+ *  
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#define PRINT_TASK_WAKE_UP RTEMS_EVENT_0
+
+typedef struct {
+  rtems_chain_node node;
+
+  enum {
+ACTION_WRITE,
+ACTION_DRAIN
+  } action_kind;
+
+  union {
+size_t   size;
+rtems_id task;
+  } action_data;
+
+  char data[ RTEMS_ZERO_LENGTH_ARRAY ];
+} printer_task_buffer;
+
+static void pri

[PATCH 02/10] Make rtems_printf_plugin() static

2016-06-21 Thread Sebastian Huber
---
 cpukit/include/rtems/bspIo.h   | 13 -
 cpukit/libcsupport/src/printf_plugin.c | 12 ++--
 2 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/cpukit/include/rtems/bspIo.h b/cpukit/include/rtems/bspIo.h
index 958103a..fad4e9d 100644
--- a/cpukit/include/rtems/bspIo.h
+++ b/cpukit/include/rtems/bspIo.h
@@ -142,19 +142,6 @@ extern void rtems_putc(char c);
 typedef int (*rtems_print_plugin_t)(void *, const char *format, va_list ap);
 
 /**
- * @brief Reporting Methods printf() Plugin
- *
- * This is a standard plug-in to support using printf() for output
- * instead of printk().
- *
- * @param[in] context Unused.
- * @param[in] fmt is a printf()-style format string
- *
- * @return The number of characters printed.
- */
-extern int rtems_printf_plugin(void *context, const char *fmt, va_list ap);
-
-/**
  * @brief Reporting Methods fprintf() Plugin
  *
  * This is a standard plug-in to support using fprintf() for output
diff --git a/cpukit/libcsupport/src/printf_plugin.c 
b/cpukit/libcsupport/src/printf_plugin.c
index 097e412..23ac9f6 100644
--- a/cpukit/libcsupport/src/printf_plugin.c
+++ b/cpukit/libcsupport/src/printf_plugin.c
@@ -27,14 +27,14 @@
 
 #include 
 
-void rtems_print_printer_printf(rtems_printer *printer)
+static int rtems_printf_plugin(void *context, const char *format, va_list ap)
 {
-  printer->context = NULL;
-  printer->printer = rtems_printf_plugin;
+  (void) context;
+  return vprintf(format, ap);
 }
 
-int rtems_printf_plugin(void *context, const char *format, va_list ap)
+void rtems_print_printer_printf(rtems_printer *printer)
 {
-  (void) context;
-  return vprintf(format, ap);
+  printer->context = NULL;
+  printer->printer = rtems_printf_plugin;
 }
-- 
1.8.4.5

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


[PATCH 03/10] Make rtems_fprintf_plugin() static

2016-06-21 Thread Sebastian Huber
---
 cpukit/include/rtems/bspIo.h   | 13 -
 cpukit/libcsupport/src/print_fprintf.c |  2 +-
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/cpukit/include/rtems/bspIo.h b/cpukit/include/rtems/bspIo.h
index fad4e9d..112dde6 100644
--- a/cpukit/include/rtems/bspIo.h
+++ b/cpukit/include/rtems/bspIo.h
@@ -141,19 +141,6 @@ extern void rtems_putc(char c);
  */
 typedef int (*rtems_print_plugin_t)(void *, const char *format, va_list ap);
 
-/**
- * @brief Reporting Methods fprintf() Plugin
- *
- * This is a standard plug-in to support using fprintf() for output
- * instead of printk().
- *
- * @param[in] context The file stream.
- * @param[in] fmt is a printf()-style format string
- *
- * @return The number of characters printed.
- */
-extern int rtems_fprintf_plugin(void *context, const char *fmt, va_list ap);
-
 /**@}*/
 
 #ifdef __cplusplus
diff --git a/cpukit/libcsupport/src/print_fprintf.c 
b/cpukit/libcsupport/src/print_fprintf.c
index 757293e..3ff80f7 100644
--- a/cpukit/libcsupport/src/print_fprintf.c
+++ b/cpukit/libcsupport/src/print_fprintf.c
@@ -22,7 +22,7 @@
 
 #include 
 
-int rtems_fprintf_plugin(void *context, const char *fmt, va_list ap)
+static int rtems_fprintf_plugin(void *context, const char *fmt, va_list ap)
 {
   return vfprintf(context, fmt, ap);
 }
-- 
1.8.4.5

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


[PATCH 08/10] Rename rtems_test_print() into rtems_test_printf()

2016-06-21 Thread Sebastian Huber
---
 cpukit/libmisc/testsupport/test.h | 2 +-
 cpukit/libmisc/testsupport/testbeginend.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/libmisc/testsupport/test.h 
b/cpukit/libmisc/testsupport/test.h
index 94f917f..0afd3e9 100644
--- a/cpukit/libmisc/testsupport/test.h
+++ b/cpukit/libmisc/testsupport/test.h
@@ -86,7 +86,7 @@ int rtems_test_end(void);
  *
  * @returns As specified by printf().
  */
-int rtems_test_print(const char* format, ...) RTEMS_PRINTFLIKE(1, 2);
+int rtems_test_printf(const char* format, ...) RTEMS_PRINTFLIKE(1, 2);
 
 /**
  * @brief Internal context for parallel job execution.
diff --git a/cpukit/libmisc/testsupport/testbeginend.c 
b/cpukit/libmisc/testsupport/testbeginend.c
index 6bfc400..cc00c8f 100644
--- a/cpukit/libmisc/testsupport/testbeginend.c
+++ b/cpukit/libmisc/testsupport/testbeginend.c
@@ -34,7 +34,7 @@ int rtems_test_end(void)
   );
 }
 
-int rtems_test_print(
+int rtems_test_printf(
   const char* format,
   ...
 )
-- 
1.8.4.5

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


[PATCH 06/10] Move printer initialization to separate header

2016-06-21 Thread Sebastian Huber
The RTEMS print user need to know nothing about a particular printer
implementation.  In particular get rid of the  include which
would be visible via .
---
 c/src/lib/libbsp/shared/src/irq-info.c |   2 +-
 c/src/lib/libbsp/shared/src/irq-shell.c|   1 +
 cpukit/Makefile.am |   1 +
 cpukit/include/rtems/print.h   |  83 ++--
 cpukit/include/rtems/printer.h | 119 +
 cpukit/libcsupport/src/print_fprintf.c |   4 +-
 cpukit/libcsupport/src/print_printf.c  |   4 +-
 cpukit/libcsupport/src/printf_plugin.c |   4 +-
 cpukit/libcsupport/src/printk_plugin.c |   2 +-
 cpukit/libdl/rap.c |   1 +
 cpukit/libmisc/cpuuse/cpuusagereport.c |   1 +
 cpukit/libmisc/cpuuse/cpuusagetop.c|   1 +
 cpukit/libmisc/fb/mw_print.c   |   1 +
 cpukit/libmisc/shell/main_blkstats.c   |   1 +
 cpukit/libmisc/shell/main_cpuinfo.c|   1 +
 cpukit/libmisc/shell/main_cpuuse.c |   1 +
 cpukit/libmisc/shell/main_perioduse.c  |   1 +
 cpukit/libmisc/shell/main_profreport.c |   1 +
 cpukit/libmisc/shell/main_stackuse.c   |   1 +
 cpukit/libmisc/shell/main_top.c|   1 +
 cpukit/libmisc/stackchk/check.c|   1 +
 cpukit/libmisc/testsupport/test.h  |   2 +-
 cpukit/mghttpd/mongoose.c  |   2 +-
 cpukit/preinstall.am   |   4 +
 cpukit/rtems/src/ratemonreportstatistics.c |   2 +-
 cpukit/score/src/cpusetprintsupport.c  |   4 +-
 testsuites/samples/hello/init.c|   1 +
 27 files changed, 153 insertions(+), 94 deletions(-)
 create mode 100644 cpukit/include/rtems/printer.h

diff --git a/c/src/lib/libbsp/shared/src/irq-info.c 
b/c/src/lib/libbsp/shared/src/irq-info.c
index f5f2323..ef965d3 100644
--- a/c/src/lib/libbsp/shared/src/irq-info.c
+++ b/c/src/lib/libbsp/shared/src/irq-info.c
@@ -21,7 +21,7 @@
 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 
diff --git a/c/src/lib/libbsp/shared/src/irq-shell.c 
b/c/src/lib/libbsp/shared/src/irq-shell.c
index 512594c..ca936f8 100644
--- a/c/src/lib/libbsp/shared/src/irq-shell.c
+++ b/c/src/lib/libbsp/shared/src/irq-shell.c
@@ -21,6 +21,7 @@
 
 #include 
 
+#include 
 #include 
 
 #include 
diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index aae..ac97530 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -98,6 +98,7 @@ endif
 
 include_rtems_HEADERS += include/rtems/bspIo.h
 include_rtems_HEADERS += include/rtems/print.h
+include_rtems_HEADERS += include/rtems/printer.h
 include_rtems_HEADERS += include/rtems/userenv.h
 include_rtems_HEADERS += include/rtems/fs.h
 if !LIBPCI
diff --git a/cpukit/include/rtems/print.h b/cpukit/include/rtems/print.h
index 07e50d0..2fd744e 100644
--- a/cpukit/include/rtems/print.h
+++ b/cpukit/include/rtems/print.h
@@ -21,53 +21,21 @@
 #include 
 
 #include 
-#include 
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+typedef struct rtems_printer rtems_printer;
+
 /**
- * @defgroup RTEMS Print Support
+ * @defgroup RTEMSPrintSupport RTEMS Print Support
  *
  * This module contains all methods and support related to providing the user
  * with an interface to the kernel level print support.
  */
 
 /**
- * Type definition for function which can be plugged in to certain reporting
- * routines to redirect the output.
- *
- * Use the RTEMS Print interface to call these functions. Do not directly use
- * them.
- *
- * If the user provides their own printer, then they may redirect those reports
- * as they see fit.
- */
-typedef int (*rtems_print_printer)(void *, const char *format, va_list ap);
-
-/**
- * Type definition for the printer structure used to access the kernel print
- * support.
- */
-typedef struct rtems_printer {
-  void*context;
-  rtems_print_printer  printer;
-} rtems_printer;
-
-/**
- * @brief check if the printer is valid.
- *
- * @param[in] printer Pointer to the printer structure.
- *
- * @return true The printer is valid else false is returned.
- */
-static inline bool rtems_print_printer_valid(const rtems_printer *printer)
-{
-  return printer != NULL && printer->printer != NULL;
-}
-
-/**
  * @brief Print to the kernel plugin handler. This has to be a macro because
  * there is no vprint version of the plug in handlers.
  *
@@ -95,51 +63,10 @@ extern int rtems_vprintf(const rtems_printer *printer,
  const char  *format,
  va_list  ap);
 
-/**
- * @brief Intiialise the rtems_printer struct to empty.
- *
- * An empty printer prints nothing. You can use this to implement an enable and
- * disable type print implementation.
- *
- * @param[in] printer Pointer to the printer structure.
- */
-static inline void rtems_print_printer_empty(rtems_printer *printer)
-{
-  printer->context = NULL;
-  printer->printer = NULL;
-}
-
-/**
- * @brief Intiialise the rtems_printer struct to printk
- *
- * The

[PATCH 10/10] sptests/sp20: Use printer task

2016-06-21 Thread Sebastian Huber
This avoids test failures due to slow output devices.
---
 testsuites/sptests/sp20/init.c   | 30 +--
 testsuites/sptests/sp20/sp20.scn | 36 +++---
 testsuites/sptests/sp20/system.h |  4 ++-
 testsuites/sptests/sp20/task1.c  | 64 
 4 files changed, 88 insertions(+), 46 deletions(-)

diff --git a/testsuites/sptests/sp20/init.c b/testsuites/sptests/sp20/init.c
index e88c6c2..d3bdab8 100644
--- a/testsuites/sptests/sp20/init.c
+++ b/testsuites/sptests/sp20/init.c
@@ -28,14 +28,40 @@
 
 const char rtems_test_name[] = "SP 20";
 
+rtems_printer rtems_test_printer;
+
+#define BUFFER_COUNT 20
+
+#define BUFFER_SIZE 100
+
+static rtems_printer_task_context printer_task;
+
+static long buffers[ BUFFER_COUNT ][ BUFFER_SIZE / sizeof(long) ];
+
+void end_of_test( void )
+{
+  rtems_test_printf( TEST_END_STRING );
+  rtems_printer_task_drain( &printer_task );
+  rtems_test_exit( 0 );
+}
+
 rtems_task Init(
   rtems_task_argument argument
 )
 {
-  uint32_tindex;
+  int   error;
+  uint32_t  index;
   rtems_status_code status;
 
-  TEST_BEGIN();
+  rtems_printer_task_set_priority( &printer_task, 254 );
+  rtems_printer_task_set_file_descriptor( &printer_task, 1 );
+  rtems_printer_task_set_buffer_table( &printer_task, &buffers[ 0 ][ 0 ] );
+  rtems_printer_task_set_buffer_count( &printer_task, BUFFER_COUNT );
+  rtems_printer_task_set_buffer_size( &printer_task, BUFFER_SIZE );
+  error = rtems_print_printer_task( &rtems_test_printer, &printer_task );
+  rtems_test_assert( error == 0 );
+
+  rtems_test_printf( TEST_BEGIN_STRING );
 
   Task_name[ 1 ] =  rtems_build_name( 'T', 'A', '1', ' ' );
   Task_name[ 2 ] =  rtems_build_name( 'T', 'A', '2', ' ' );
diff --git a/testsuites/sptests/sp20/sp20.scn b/testsuites/sptests/sp20/sp20.scn
index d0726f7..f3d7afb 100644
--- a/testsuites/sptests/sp20/sp20.scn
+++ b/testsuites/sptests/sp20/sp20.scn
@@ -1,40 +1,40 @@
-*** TEST 20 ***
+*** BEGIN OF TEST SP 20 ***
 TA1 - rtems_rate_monotonic_create id = 0x42010001
 TA1 - rtems_rate_monotonic_ident id = 0x42010001
-TA1 - (0x2c010001) period 2
+TA1 - (0x42010001) period 2
 TA2 - rtems_rate_monotonic_create id = 0x42010002
 TA2 - rtems_rate_monotonic_ident id = 0x42010002
-TA2 - (0x2c010002) period 2
+TA2 - (0x42010002) period 2
 TA3 - rtems_rate_monotonic_create id = 0x42010003
 TA3 - rtems_rate_monotonic_ident id = 0x42010003
-TA3 - (0x2c010003) period 2
+TA3 - (0x42010003) period 2
 TA4 - rtems_rate_monotonic_create id = 0x42010004
 TA4 - rtems_rate_monotonic_ident id = 0x42010004
-TA4 - (0x2c010004) period 2
+TA4 - (0x42010004) period 2
 TA5 - rtems_rate_monotonic_create id = 0x42010005
 TA5 - rtems_rate_monotonic_ident id = 0x42010005
-TA5 - (0x2c010005) period 100
+TA5 - (0x42010005) period 100
 TA6 - rtems_rate_monotonic_create id = 0x42010006
 TA6 - rtems_rate_monotonic_ident id = 0x42010006
-TA6 - (0x2c010006) period 0
+TA6 - (0x42010006) period 0
 TA5 - PERIODS CHECK OK (1)
 TA5 - PERIODS CHECK OK (2)
 TA5 - PERIODS CHECK OK (3)
 TA5 - PERIODS CHECK OK (4)
 TA5 - PERIODS CHECK OK (5)
-TA6 - Actual: 10  Expected: 10 - OK
-TA6 - Actual: 20  Expected: 20 - OK
-TA6 - Actual: 30  Expected: 30 - OK
-TA6 - Actual: 40  Expected: 40 - OK
-TA6 - Actual: 50  Expected: 50 - OK
-TA6 - Actual: 60  Expected: 60 - OK
-TA6 - Actual: 70  Expected: 70 - OK
-TA6 - Actual: 80  Expected: 80 - OK
-TA6 - Actual: 90  Expected: 90 - OK
-TA6 - Actual: 100  Expected: 100 - OK
+TA6 - Actual: 10 Expected: 10 - OK
+TA6 - Actual: 20 Expected: 20 - OK
+TA6 - Actual: 30 Expected: 30 - OK
+TA6 - Actual: 40 Expected: 40 - OK
+TA6 - Actual: 50 Expected: 50 - OK
+TA6 - Actual: 60 Expected: 60 - OK
+TA6 - Actual: 70 Expected: 70 - OK
+TA6 - Actual: 80 Expected: 80 - OK
+TA6 - Actual: 90 Expected: 90 - OK
+TA6 - Actual: 100 Expected: 100 - OK
 TA5 - PERIODS CHECK OK (6)
 TA5 - PERIODS CHECK OK (7)
 TA5 - PERIODS CHECK OK (8)
 TA5 - PERIODS CHECK OK (9)
 TA5 - PERIODS CHECK OK (10)
-*** END OF TEST 20 ***
+*** END OF TEST SP 20 ***
diff --git a/testsuites/sptests/sp20/system.h b/testsuites/sptests/sp20/system.h
index 33d07f7..dfefe4b 100644
--- a/testsuites/sptests/sp20/system.h
+++ b/testsuites/sptests/sp20/system.h
@@ -38,7 +38,7 @@ void Get_all_counters( void );
 
 #define CONFIGURE_MICROSECONDS_PER_TICK 10
 
-#define CONFIGURE_MAXIMUM_TASKS   7
+#define CONFIGURE_MAXIMUM_TASKS   8
 #define CONFIGURE_MAXIMUM_PERIODS 10
 
 #define CONFIGURE_INIT_TASK_PRIORITY  10
@@ -58,4 +58,6 @@ TEST_EXTERN struct counters Count;   /* iteration 
counters */
 TEST_EXTERN struct counters Temporary_count;
 extern rtems_task_priority Priorities[ 7 ];
 
+void end_of_test( void );
+
 /* end of include file */
diff --git a/testsuites/sptests/sp20/task1.c b/testsuites/sptests/sp20/task1.c
index 6edfd23..497b4f0 100644
--- a/testsuites/sptests/sp20/task1.c
+++ b/testsuites/sptests/sp20/task1.c
@@ -25,6 +25,19 @@ uint32_t  Periods[7]= { 0, 

[PATCH 04/10] Rename and move RTEMS_PRINTF_ATTRIBUTE()

2016-06-21 Thread Sebastian Huber
Rename RTEMS_PRINTF_ATTRIBUTE() into RTEMS_PRINTFLIKE() (similar to
 __printflike()) and move it to .
---
 cpukit/include/rtems/bspIo.h| 17 +
 cpukit/include/rtems/print.h|  2 +-
 cpukit/libmisc/testsupport/test.h   |  2 +-
 cpukit/score/include/rtems/score/basedefs.h | 11 +++
 testsuites/sptests/spprintk/init.c  |  8 +---
 5 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/cpukit/include/rtems/bspIo.h b/cpukit/include/rtems/bspIo.h
index 112dde6..4b5b2a2 100644
--- a/cpukit/include/rtems/bspIo.h
+++ b/cpukit/include/rtems/bspIo.h
@@ -18,6 +18,10 @@
 #ifndef _RTEMS_BSPIO_H
 #define _RTEMS_BSPIO_H
 
+#include 
+
+#include 
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -37,15 +41,6 @@ extern "C" {
  */
 
 /**
- * Print format function attribute for warning checks. Can be defined if
- * checking needs to be disabled.
- */
-#ifndef RTEMS_PRINTF_ATTRIBUTE
-#define RTEMS_PRINTF_ATTRIBUTE(_format_pos, _ap_pos) \
-  __attribute__((format(__printf__, _format_pos, _ap_pos)))
-#endif
-
-/**
  * This type defines the prototype for the BSP provided method to
  * print a single character. It is assumed to be polled.
  */
@@ -69,8 +64,6 @@ externBSP_output_char_function_type   
BSP_output_char;
  */
 extern BSP_polling_getchar_function_type   BSP_poll_char;
 
-#include 
-
 /**
  * @brief Get Character (kernel I/O)
  *
@@ -107,7 +100,7 @@ extern int vprintk(const char *fmt, va_list ap);
  *
  * @return The number of characters output.
  */
-extern int printk(const char *fmt, ...) RTEMS_PRINTF_ATTRIBUTE(1, 2);
+extern int printk(const char *fmt, ...) RTEMS_PRINTFLIKE(1, 2);
 
 /**
  * @brief Kernel Put String
diff --git a/cpukit/include/rtems/print.h b/cpukit/include/rtems/print.h
index 91c4515..c4dacce 100644
--- a/cpukit/include/rtems/print.h
+++ b/cpukit/include/rtems/print.h
@@ -68,7 +68,7 @@ static inline bool rtems_print_printer_valid(const 
rtems_printer *printer)
  */
 extern int rtems_printf(const rtems_printer *printer,
 const char  *format,
-...) RTEMS_PRINTF_ATTRIBUTE(2, 3);
+...) RTEMS_PRINTFLIKE(2, 3);
 
 /**
  * @brief Print to the kernel plugin handler. This has to be a macro because
diff --git a/cpukit/libmisc/testsupport/test.h 
b/cpukit/libmisc/testsupport/test.h
index 980ab66..ce5172f 100644
--- a/cpukit/libmisc/testsupport/test.h
+++ b/cpukit/libmisc/testsupport/test.h
@@ -86,7 +86,7 @@ int rtems_test_end(void);
  *
  * @returns As specified by printf().
  */
-int rtems_test_print(const char* format, ...) RTEMS_PRINTF_ATTRIBUTE(1, 2);
+int rtems_test_print(const char* format, ...) RTEMS_PRINTFLIKE(1, 2);
 
 /**
  * @brief Internal context for parallel job execution.
diff --git a/cpukit/score/include/rtems/score/basedefs.h 
b/cpukit/score/include/rtems/score/basedefs.h
index 24a56f2..7e691b5 100644
--- a/cpukit/score/include/rtems/score/basedefs.h
+++ b/cpukit/score/include/rtems/score/basedefs.h
@@ -210,6 +210,17 @@
   #define RTEMS_UNREACHABLE() _Assert_Unreachable()
 #endif
 
+/**
+ * @brief Tells the compiler that this function expects printf()-like
+ * arguments.
+ */
+#if defined(__GNUC__)
+  #define RTEMS_PRINTFLIKE( _format_pos, _ap_pos ) \
+__attribute__((__format__(__printf__, _format_pos, _ap_pos)))
+#else
+  #define RTEMS_PRINTFLIKE( _format_pos, _ap_pos )
+#endif
+
 #if __cplusplus >= 201103L
   #define RTEMS_STATIC_ASSERT(cond, msg) \
 static_assert(cond, # msg)
diff --git a/testsuites/sptests/spprintk/init.c 
b/testsuites/sptests/spprintk/init.c
index 4b45450..55e132d 100644
--- a/testsuites/sptests/spprintk/init.c
+++ b/testsuites/sptests/spprintk/init.c
@@ -13,12 +13,14 @@
 #include "config.h"
 #endif
 
+#include 
+
 /*
- * Undefined the RTEMS_PRINTF_ATTRIBUTE and make it nothing. The test code
+ * Undefined the RTEMS_PRINTFLIKE and make it nothing. The test code
  * contained in the file is suppose to be wrong.
  */
-#undef RTEMS_PRINTF_ATTRIBUTE
-#define RTEMS_PRINTF_ATTRIBUTE(_a, _b)
+#undef RTEMS_PRINTFLIKE
+#define RTEMS_PRINTFLIKE(_a, _b)
 
 #define TESTS_USE_PRINTK
 #include 
-- 
1.8.4.5

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


RTEMS Printer Changes

2016-06-21 Thread Sebastian Huber
The goal of this patch set is to avoid visiblity of RTEMS printer
implementation details via .  Additionally, a specialized printer is
added to output via a dedicated task with a defined priority, see sptests/sp20.

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


Re: [PATCH 10/16] score: Introduce map priority scheduler operation

2016-06-21 Thread Sebastian Huber



On 20/06/16 18:00, Gedare Bloom wrote:

diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h 
b/cpukit/score/include/rtems/score/schedulerimpl.h
>index 50061fb..fad7ecc 100644
>--- a/cpukit/score/include/rtems/score/schedulerimpl.h
>+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
>@@ -420,6 +420,45 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority(
>  }
>
>  /**
>+ * @brief Maps a thread priority from the user domain to the scheduler domain.
>+ *
>+ * The mapping must be injective.  A scheduler domain value must exist for all
>+ * user domain values from 0 up to and including the maximum scheduler
>+ * priority.
>+ *
>+ * @param[in] scheduler The scheduler instance.
>+ * @param[in, out] priority The thread priority.
>+ *
>+ * @retval true The thread priority in the scheduler domain exists for the 
user
>+ *   specified thread priority.  In this case the corresponding thread 
priority
>+ *   of the scheduler domain is returned.
>+ * @retval false Otherwise.
>+ */
>+RTEMS_INLINE_ROUTINE bool _Scheduler_Map_priority(
>+  const Scheduler_Control *scheduler,
>+  Priority_Control*priority
>+)
>+{
>+  return ( *scheduler->Operations.map_priority )( scheduler, priority );
>+}
>+

I am a bit confused about why this function returns a bool. Usually I
expect something that "maps" to return a mapped value. The @retval
true is incomplete about "the corresponding thread priority of the
scheduler domain is returned" and should indicate "is returned in
@priority."


Thanks for the review. I will change it to return the priority directly 
and move the validation to a dedicated function, e.g. 
_POSIX_Priority_To_core() and a new _RTEMS_Priority_To_core().


--
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: Fwd: [PATCH 1/2] score: Add and use Watchdog_Clock for clock types.

2016-06-21 Thread Gedare Bloom
On Tue, Jun 21, 2016 at 1:48 AM, Sebastian Huber
 wrote:
>
>
> On 16/06/16 08:09, Sebastian Huber wrote:
>>>
>>> diff --git a/cpukit/score/include/rtems/score/threadqimpl.h
>>> b/cpukit/score/include/rtems/score/threadqimpl.h
>>> index 73d4de2..f59a334 100644
>>> --- a/cpukit/score/include/rtems/score/threadqimpl.h
>>> +++ b/cpukit/score/include/rtems/score/threadqimpl.h
>>> @@ -349,6 +349,7 @@ Thread_Control *_Thread_queue_Do_dequeue(
>>>*   executing,
>>>*   STATES_WAITING_FOR_MUTEX,
>>>*   WATCHDOG_NO_TIMEOUT,
>>> + *   WATCHDOG_RELATIVE,
>>>*   0,
>>>*   &queue_context
>>>* );
>>> @@ -362,6 +363,7 @@ Thread_Control *_Thread_queue_Do_dequeue(
>>>* @param[in] state The new state of the thread.
>>>* @param[in] timeout Interval to wait.  Use WATCHDOG_NO_TIMEOUT to
>>> block
>>>* potentially forever.
>>> + * @param[in] clock The kind of clock used for the interval.
>>>* @param[in] queue_context The thread queue context of the lock
>>> acquire.
>>>*/
>>>   void _Thread_queue_Enqueue_critical(
>>> @@ -370,6 +372,7 @@ void _Thread_queue_Enqueue_critical(
>>> Thread_Control*the_thread,
>>> States_Control state,
>>> Watchdog_Interval  timeout,
>>> +  Watchdog_Clock clock,
>>> Thread_queue_Context  *queue_context
>>>   );
>>
>>
>> We already have a lot of parameters for the
>> _Thread_queue_Enqueue_critical(). I would rather move the timeout parameters
>> to the queue_context, since this is more efficient.
>>
>> The Watchdog_Interval is 32-bit, thus not suitable for the absolute
>> timeouts.
>>
>> A value of 0 is valid for absolute timeouts, see what happens if you get
>> that wrong
>>
>>
>> https://www.wired.com/2016/02/dont-set-your-iphone-back-to-1970-no-matter-what/
>>
>> So, I would move the WATCHDOG_NO_TIMEOUT to your new Watchdog_Clock.
>>
>> [...]
>
>
> From IRC log:
>
> [19:44]  sebhub: Does it make sense to you to redefine
> Watchdog_Interval as a struct containing a union for the interval and an
> enum for the Clock "Discipline" (relative/absolute)?
> [19:45]  ^the union for uint32_t relative, uint64_t absolute--or
> else we make all intervals 64-bit
>
> No, I would not change Watchdog_Interval. We should keep the ticks based
> services as is. The problem is that _Thread_queue_Enqueue_critical() doesn't
> support absolute timeouts currently. I would do something like the attached.
>
> We have
>
> void _Thread_queue_Enqueue_critical(
>   Thread_queue_Queue*queue,
>   const Thread_queue_Operations *operations,
>   Thread_Control*the_thread,
>   States_Control state,
>   Thread_queue_Context  *queue_context
> )
> {
>   Per_CPU_Control *cpu_self;
>   bool success;
>
> #if defined(RTEMS_MULTIPROCESSING)
>   if ( _Thread_MP_Is_receive( the_thread ) && the_thread->receive_packet ) {
> the_thread = _Thread_MP_Allocate_proxy( state );
>   }
> #endif
>
>   _Thread_Lock_set( the_thread, &queue->Lock );
>
>   the_thread->Wait.return_code = STATUS_SUCCESSFUL;
>   _Thread_Wait_set_queue( the_thread, queue );
>   _Thread_Wait_set_operations( the_thread, operations );
>
>   ( *operations->enqueue )( queue, the_thread );
>
> Thus, we would have to store the timeout related parameters to the stack
> anyway, since ( *operations->enqueue )( queue, the_thread ) is a function
> call which cannot be optimized way (except maybe through link-time
> optimization). So, there is no overhead due to the use of the queue context.
>
Thanks, that makes sense. I mocked together the changes to put the
timeout parameters into the context. I will work on adding the little
bit needed to use 64-bit intervals for absolute.

Do you have a preference between "Watchdog_Discipline" and
"Watchdog_Clock"? I think Discipline may be nicer.

I did not put the initialization of the timeout parameters to a
default, instead I made each producer of a threadq_enqueue to
explicitly set the parameters. Perhaps a sane default of NO_TIMEOUT is
good, and will reduce the size of my patch.

Tomorrow I'll work on cleaning this up some more. Wrapping the
WATCHDOG_NO_TIMEOUT in the Watchdog_Discipline makes the structure no
longer match with the Per_CPU_Watchdog_index values. So a little bit
of massaging has to be done there.
From dc0eda684c9cde7132ea82f58209b8a3fb241901 Mon Sep 17 00:00:00 2001
From: Gedare Bloom 
Date: Mon, 20 Jun 2016 15:43:53 -0400
Subject: [PATCH 3/3] score: move timeout parameters into Thread_queue_Context.

updates #2732.
---
 cpukit/libnetworking/rtems/rtems_glue.c|  3 +-
 cpukit/posix/src/condwaitsupp.c|  4 +-
 cpukit/posix/src/mqueuerecvsupp.c  |  3 +-
 cpukit/posix/src/mqueuesendsupp.c  |  3 +-
 cpukit/posix/src/mutexlocksupp.c   |  5 +--
 cpukit/posix/src/pbarrierwait.c|  3 +-
 cpukit/posix/src/prwlockrdlock.c 

[PATCH] Subject: Add PWM driver for beagle bone black

2016-06-21 Thread Punit Vara
This patch adds required definitions, registers definitions and 
testsuit to
test pwm driver for beagle bone black.
---
 c/src/lib/libbsp/arm/beagle/Makefile.am  |   3 +
 c/src/lib/libbsp/arm/beagle/pwm/bbb-pwm.c| 345 ++
 c/src/lib/libbsp/shared/include/gpio.h   |  11 +
 c/src/lib/libcpu/arm/shared/include/am335x.h | 349 ++-
 testsuites/samples/Makefile.am   |   2 +-
 testsuites/samples/configure.ac  |   1 +
 testsuites/samples/pwm/Makefile.am   |  19 ++
 testsuites/samples/pwm/init.c|  70 ++
 testsuites/samples/pwm/pwm.doc   |   9 +
 testsuites/samples/pwm/pwm.scn   |   3 +
 10 files changed, 810 insertions(+), 2 deletions(-)
 create mode 100644 c/src/lib/libbsp/arm/beagle/pwm/bbb-pwm.c
 create mode 100644 testsuites/samples/pwm/Makefile.am
 create mode 100644 testsuites/samples/pwm/init.c
 create mode 100644 testsuites/samples/pwm/pwm.doc
 create mode 100644 testsuites/samples/pwm/pwm.scn

diff --git a/c/src/lib/libbsp/arm/beagle/Makefile.am 
b/c/src/lib/libbsp/arm/beagle/Makefile.am
index 20d3092..68bdbd4 100644
--- a/c/src/lib/libbsp/arm/beagle/Makefile.am
+++ b/c/src/lib/libbsp/arm/beagle/Makefile.am
@@ -117,6 +117,9 @@ libbsp_a_SOURCES += misc/i2c.c
 # GPIO
 libbsp_a_SOURCES += gpio/bbb-gpio.c
 
+#pwm
+libbsp_a_SOURCES += pwm/bbb-pwm.c
+
 #RTC
 libbsp_a_SOURCES += rtc.c
 libbsp_a_SOURCES += ../../shared/tod.c
diff --git a/c/src/lib/libbsp/arm/beagle/pwm/bbb-pwm.c 
b/c/src/lib/libbsp/arm/beagle/pwm/bbb-pwm.c
new file mode 100644
index 000..a2f1107
--- /dev/null
+++ b/c/src/lib/libbsp/arm/beagle/pwm/bbb-pwm.c
@@ -0,0 +1,345 @@
+/* This file is based on following licence  
+ * Copyright (c) 2015, Shabaz, VegetableAvenger
+ * Copyright (c) 2016, Punit Vara
+ * Added clock functions and improved pwm_enable function   
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+
+ * 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.
+ *
+ * Neither the name of BBBIOlib 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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
+#include
+#include
+#include
+
+#define BASE_CLOCK 1
+/**
+ * @brief This function intilize clock and pinmuxing for pwm sub system.
+ *
+ * @param PWMSS_ID It is the instance number of EPWM of pwm sub system.
+ **/
+void pwm_init(unsigned int baseAddr, unsigned int PWMSS_ID)
+{
+  module_clk_config(PWMSS_ID);
+  EPWMPinMuxSetup();
+  EPWM_clock_enable(baseAddr);
+  pwmss_tbclk_enable(PWMSS_ID);
+
+}   
+
+
+/**
+ * \brief   This function Enables TBCLK(Time Base Clock) for specific
+ *  EPWM instance of pwmsubsystem.
+ *
+ * \param   instance  It is the instance number of EPWM of pwmsubsystem.
+ *
+ **/
+void pwmss_tbclk_enable(unsigned int instance)
+{
+   switch(instance)
+   {
+
+   case 0:
+   REG(AM335X_PADCONF_BASE + CONTROL_PWMSS_CTRL) |=
+   BBBIO_PWMSS_CTRL_PWMSS0_TBCLKEN;
+   break;
+
+   case 1:
+   REG(AM335X_PADCONF_BASE + CONTROL_PWMSS_CTRL) |=
+   BBBIO_PWMSS_CTRL_PWMSS1_TBCLKEN;
+   break;
+
+   case 2:
+   REG(AM335X_PADCONF_BASE + CONTROL_PWMSS_CTRL) |=
+   BBBIO_PWMSS_CTRL_PWMSS2_TBCLKEN;
+   break;
+
+   default:
+   break;
+   }
+}
+
+/**
+ * \brief   This function Enables pinmuxing for PWM module.
+ *  
+ *
+ * \param   instance  It is the instance number of EPWM of pwmsubsystem.
+ *
+

Re: Subject: Add PWM driver for beagle bone black

2016-06-21 Thread Martin Galvan
Hi Punit, thanks for sending this. If I understood correctly this is the BBBIO 
code
plus some changes of your own, right? If so, I think it would be best to send a 
patch
with the BBBIO code as is, and then another with your changes on top of it. I 
think
that was what we were going for with StarterWare, too.

For imported code we usually stick to the coding style of whatever we're 
importing.
However, I see that bbb-pwm.c isn't actually that much code. If you feel like it
you could reformat it to follow a more standard coding style. The core RTEMS 
files
follow https://devel.rtems.org/wiki/Developer/Coding/Conventions, though BSP 
code
can have a bit more leeway.

I prefer using stdint types such as uint32_t for driver code. Also, 
const-correctness
is always great to have.

Additional comments are below. I don't know for certain which code is yours and 
which
comes from BBBIO, so I'll give a quick look at everything, then when you send 
your
changes alone I'll take a deeper look at those.

On Tue, Jun 21, 2016 at 1:26 PM, Punit Vara  wrote:
> This patch adds required definitions, registers definitions and 
> testsuit to
> test pwm driver for beagle bone black.

Overall I think a slightly more detailed log message is required. Where did you
get the code from, what testing did you perform, why we used BBBIO instead of 
StarterWare
(license + bugs), and so on. Anything that a future maintainer might find 
useful.

>  testsuites/samples/Makefile.am   |   2 +-
>  testsuites/samples/configure.ac  |   1 +
>  testsuites/samples/pwm/Makefile.am   |  19 ++
>  testsuites/samples/pwm/init.c|  70 ++
>  testsuites/samples/pwm/pwm.doc   |   9 +
>  testsuites/samples/pwm/pwm.scn   |   3 +

Unless I've missed something, right now RTEMS doesn't have BSP-specific tests. 
You *could*,
however, add some sort of README with an example of how to use the BBBIO API, 
as documentation.

> diff --git a/c/src/lib/libbsp/arm/beagle/Makefile.am 
> b/c/src/lib/libbsp/arm/beagle/Makefile.am
> index 20d3092..68bdbd4 100644
> --- a/c/src/lib/libbsp/arm/beagle/Makefile.am
> +++ b/c/src/lib/libbsp/arm/beagle/Makefile.am
> @@ -117,6 +117,9 @@ libbsp_a_SOURCES += misc/i2c.c
>  # GPIO
>  libbsp_a_SOURCES += gpio/bbb-gpio.c
>
> +#pwm
> +libbsp_a_SOURCES += pwm/bbb-pwm.c

IIRC only the GPIO-related files have the name of the BSP prepended to them to 
help
the build system distinguish them from the ones belonging to the generic API. 
That is,
this could probably be named pwm.c.

> diff --git a/c/src/lib/libbsp/arm/beagle/pwm/bbb-pwm.c 
> b/c/src/lib/libbsp/arm/beagle/pwm/bbb-pwm.c
> new file mode 100644
> index 000..a2f1107
> --- /dev/null
> +++ b/c/src/lib/libbsp/arm/beagle/pwm/bbb-pwm.c
> @@ -0,0 +1,345 @@
> +/* This file is based on following licence
> + * Copyright (c) 2015, Shabaz, VegetableAvenger

I'm not sure about this. I think it would be best if we didn't add such aliases 
to
copyright notices, and instead linked to the repository URL saying something 
like
"This code is based on the BBBIO sources, available at...". But maybe there's a 
better
way to go about this. What does the rest of you guys think?

> + * Added clock functions and improved pwm_enable function

I don't think these kind of messages should go here. If you want to make clear 
that you changed
imported code, do so in a more detailed way in the commit log or maybe atop the 
function
you changed.

> +#include
> +#include
> +#include
> +#include
> +#include

Add a space between #include and the file you're including.

> +#define BASE_CLOCK 1

We probably need a better name for this. We could name it SYSCLKOUT (since 
that's the name the
manual uses), and add a prominent comment explaining why we're using that value 
(remember that
the manual seldom mentions what the actual value is, save for a note below 
table 15-something).
It would also be nice to link to 
https://groups.google.com/forum/#!topic/beagleboard/Ed2J9Txe_E4
since there we can find a good explanation of why that value is safe to use.

> +void pwm_init(unsigned int baseAddr, unsigned int PWMSS_ID)

PWMSS_ID sounds like a macro name; regular variable names are lowercase.

I think this API could be improved. Correct me if I'm wrong, but it seems that 
a given PWMSS
instance must have its clock enabled twice: first from the Clock Module 
(through the CM_PER register)
and then from the PWM module itself (through its CLKCONFIG register). In any 
case, you'll always want
to enable the same instance, so having two separate arguments for it is 
confusing and error-prone.
Additionally, the user shouldn't have to know about hardware addresses; I think 
you could use an enum
or something similar here and according to its value use the appropriate 
addresses and offsets.
Of course, don't forget to check if the value you're getting is actually valid.

A comment explaining what the function does is always welcome, espec

Re: Raspberry pi not working with latest compiler and rtems-git

2016-06-21 Thread Pavel Pisa
Hello Alan,

On Tuesday 21 of June 2016 20:41:43 Alan Cudmore wrote:
> Hi Pavel,
> I compiled your branch, and it stopped on after the last line below ( on
> the Pi Model A+ )
>
> Now I think it may be the options I use to compile the BSP. What configure
> options do you use for the Pi?

My RPi1 config is

../../../git/rtems/configure --target=arm-rtems4.12 --prefix=/opt/rtems4.12 \
  --enable-rtems-inlines --disable-multiprocessing --enable-cxx \
  --enable-rdbg --enable-maintainer-mode --enable-tests=samples \
  --disable-networking --enable-posix --disable-itron --disable-ada \
  --disable-expada --disable-multilib --disable-docs \
  --enable-rtemsbsp="raspberrypi"

RPi2 (tested only on QEMU)

../../../git/rtems/configure --target=arm-rtems4.12 --prefix=/opt/rtems4.12 \
  --enable-rtems-inlines --disable-multiprocessing --enable-cxx \
  --enable-rdbg --enable-maintainer-mode --enable-tests=samples \
  --enable-networking --enable-posix --disable-itron --disable-ada \
  --disable-expada --disable-multilib --disable-docs \
  --enable-rtemsbsp="raspberrypi2"

May it be, that some options are historical reminiscences
to previous RTEMS versions.
I think that --enable-rtems-inlines is ignored/not recognized
by actual version.


As for the output, if it is not simplified then there is something strange

> bsp_console_select:
>
>   rpi_video_is_initialized OK
...
>  _Thread_Start_multitasking ...
>
> _Thread_Start_multitasking:
>
>  printk test ...

should be followed by " printk test OK" in the hacked
version

https://github.com/ppisa/rtems/blob/rtems-rpi-devel/cpukit/score/src/threadstartmultitasking.c#L31

  ll_strout("_Thread_Start_multitasking:\n");
  ll_strout(" printk test ...\n");
  printk(" printk test OK\n");

if the printk output does not appear then it can be redirected to HDMI
output or something else is broken in console driver or related setup.

>  _Thread_Get_heir_and_make_it_executing ...
>
>  _Profiling_Thread_dispatch_disable ...

Is it possible that you have left console redirection to HDMI
in config.txt ? The line is not checked for '#' comment leading
character so you need to rename file or remove/alter option.

To ensure that there is not some error hidden on my side
by use of U-boot, I have checked actual RTME GIT master
build on RPi1 B+ with direct boot through config.txt
kernel option in addition to TFTP load test and both
seems to work OK with both, serial and HDMI console.

Please, can you test version with HACK applied on RPi2?

I have (force) updated my GitHub rtems-rpi-devel branch
to actual mainline + HACK. But there should not be
a difference.

Best wishes,

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


Re: Raspberry pi not working with latest compiler and rtems-git

2016-06-21 Thread Alan Cudmore
Hi Pavel,
The HDMI Console! I do have it enabled, so I’m sure that’s it. 
You saved me a lot of time.
Thanks,
Alan

> On Jun 21, 2016, at 4:53 PM, Pavel Pisa  wrote:
> 
> Hello Alan,
> 
> On Tuesday 21 of June 2016 20:41:43 Alan Cudmore wrote:
>> Hi Pavel,
>> I compiled your branch, and it stopped on after the last line below ( on
>> the Pi Model A+ )
>> 
>> Now I think it may be the options I use to compile the BSP. What configure
>> options do you use for the Pi?
> 
> My RPi1 config is
> 
> ../../../git/rtems/configure --target=arm-rtems4.12 --prefix=/opt/rtems4.12 \
>  --enable-rtems-inlines --disable-multiprocessing --enable-cxx \
>  --enable-rdbg --enable-maintainer-mode --enable-tests=samples \
>  --disable-networking --enable-posix --disable-itron --disable-ada \
>  --disable-expada --disable-multilib --disable-docs \
>  --enable-rtemsbsp="raspberrypi"
> 
> RPi2 (tested only on QEMU)
> 
> ../../../git/rtems/configure --target=arm-rtems4.12 --prefix=/opt/rtems4.12 \
>  --enable-rtems-inlines --disable-multiprocessing --enable-cxx \
>  --enable-rdbg --enable-maintainer-mode --enable-tests=samples \
>  --enable-networking --enable-posix --disable-itron --disable-ada \
>  --disable-expada --disable-multilib --disable-docs \
>  --enable-rtemsbsp="raspberrypi2"
> 
> May it be, that some options are historical reminiscences
> to previous RTEMS versions.
> I think that --enable-rtems-inlines is ignored/not recognized
> by actual version.
> 
> 
> As for the output, if it is not simplified then there is something strange
> 
>> bsp_console_select:
>> 
>>  rpi_video_is_initialized OK
> ...
>> _Thread_Start_multitasking ...
>> 
>> _Thread_Start_multitasking:
>> 
>> printk test ...
> 
> should be followed by " printk test OK" in the hacked
> version
> 
> https://github.com/ppisa/rtems/blob/rtems-rpi-devel/cpukit/score/src/threadstartmultitasking.c#L31
> 
>  ll_strout("_Thread_Start_multitasking:\n");
>  ll_strout(" printk test ...\n");
>  printk(" printk test OK\n");
> 
> if the printk output does not appear then it can be redirected to HDMI
> output or something else is broken in console driver or related setup.
> 
>> _Thread_Get_heir_and_make_it_executing ...
>> 
>> _Profiling_Thread_dispatch_disable ...
> 
> Is it possible that you have left console redirection to HDMI
> in config.txt ? The line is not checked for '#' comment leading
> character so you need to rename file or remove/alter option.
> 
> To ensure that there is not some error hidden on my side
> by use of U-boot, I have checked actual RTME GIT master
> build on RPi1 B+ with direct boot through config.txt
> kernel option in addition to TFTP load test and both
> seems to work OK with both, serial and HDMI console.
> 
> Please, can you test version with HACK applied on RPi2?
> 
> I have (force) updated my GitHub rtems-rpi-devel branch
> to actual mainline + HACK. But there should not be
> a difference.
> 
> Best wishes,
> 
> Pavel

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

Re: Raspberry pi not working with latest compiler and rtems-git

2016-06-21 Thread Pavel Pisa
Hello Alan,

On Wednesday 22 of June 2016 01:00:39 Alan Cudmore wrote:
> Hi Pavel,
> The HDMI Console! I do have it enabled, so I’m sure that’s it.
> You saved me a lot of time.
> Thanks,
> Alan

but at least on my board/setup when RPi HDMI connector
is not connected to monitor then console is not switches/
ticker output continues on the serial port.

The detection is little hacky/comparison with know default
width/height.

So if you do not have connected monitor output should
work. Or your board reports different state/resolution
in disconnected case.

It would be much better if some firmware function
is know to explicitly report monitor is/is not connected.
But Get EDID block functions describes that it returns
one block unconditionally

https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface

If it could report error if monitor is not connected
then it would be better. It would worth to test that
wit different firmwares and monitors connected/disconnected
in future.

Best wishes,

  Pavel

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

Re: LibBSD nexus bus IRQ unique or shared?

2016-06-21 Thread Chris Johns

On 21/06/2016 15:22, Sebastian Huber wrote:

On 21/06/16 03:43, Chris Johns wrote:

Hi,

Currently the LibBSD nexus bus passes the unique option to the
interrupt server when attaching a fast interrupt and I have a PC
(Beckhoff CX2030) where sharing interrupts gets me past a
configuration where NIC irqs are the same.

Is there any reason unique is being used?


Older versions of the interrupt server didn't support shared interrupts.



Ah ok, this now makes sense.


Can this be changed?


I added support for shared interrupts to the interrupt server recently.
So, it can be changed.



Excellent, I will push the change soon.

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


Re: [PATCH 07/10] Avoid in

2016-06-21 Thread Chris Johns

On 21/06/2016 23:57, Sebastian Huber wrote:

---
  cpukit/rtems/include/rtems/rtems/ratemon.h | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h 
b/cpukit/rtems/include/rtems/rtems/ratemon.h
index 6e8fab6..3203eab 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -35,7 +35,8 @@
  #include 
  #include 
  #include 
-#include 
+
+struct rtems_printer;

  #ifdef __cplusplus
  extern "C" {
@@ -362,7 +363,7 @@ void rtems_rate_monotonic_reset_all_statistics( void );
   *  the Manager but actually uses other services of the Manager.
   */
  void rtems_rate_monotonic_report_statistics_with_plugin(
-  const rtems_printer *printer
+  const struct rtems_printer *printer
  );



Why this way rather than the header?

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


Re: RTEMS Printer Changes

2016-06-21 Thread Chris Johns

On 21/06/2016 23:57, Sebastian Huber wrote:

The goal of this patch set is to avoid visiblity of RTEMS printer
implementation details via .  Additionally, a specialized printer is
added to output via a dedicated task with a defined priority, see sptests/sp20.


Really nice change. This is turning into a nice feature.

I wonder if this is improving the size of the small executables?

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


Re: Raspberry pi not working with latest compiler and rtems-git

2016-06-21 Thread Alan Cudmore
Hi Pavel,
I can confirm that your branch and the RTEMS git head work on my Pi A+ and Pi 
Zero now. 

The console works when connected. For me, it will not automatically switch to 
the serial port if the HDMI cable is not connected. I have to comment out the 
cmdline.txt console switches. 

The Pi 2 works too, but with the older firmware. I still need to debug that. 

At least I can get back to trying the recently submitted SPI code.

Thanks,
Alan


> On Jun 21, 2016, at 7:24 PM, Pavel Pisa  wrote:
> 
> Hello Alan,
> 
> On Wednesday 22 of June 2016 01:00:39 Alan Cudmore wrote:
>> Hi Pavel,
>> The HDMI Console! I do have it enabled, so I’m sure that’s it.
>> You saved me a lot of time.
>> Thanks,
>> Alan
> 
> but at least on my board/setup when RPi HDMI connector
> is not connected to monitor then console is not switches/
> ticker output continues on the serial port.
> 
> The detection is little hacky/comparison with know default
> width/height.
> 
> So if you do not have connected monitor output should
> work. Or your board reports different state/resolution
> in disconnected case.
> 
> It would be much better if some firmware function
> is know to explicitly report monitor is/is not connected.
> But Get EDID block functions describes that it returns
> one block unconditionally
> 
> https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface
> 
> If it could report error if monitor is not connected
> then it would be better. It would worth to test that
> wit different firmwares and monitors connected/disconnected
> in future.
> 
> Best wishes,
> 
>  Pavel
> 

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

RE: [PATCH] pc386: Add virtio network driver

2016-06-21 Thread Jinhyun
Thanks for the comments.
We are trying to either use the compiler memory barrier as you people suggested 
or simply define the variables as volatile.
We plan to repost the revised patch in a week.
 
Since new patch would be no longer architecture-independent, we are thinking to 
locate the files at c/src/lib/ilbbsp/shared/.
Hope this makes sense.
 
Thanks,
Jin-Hyun

From: Joel Sherrill [mailto:j...@rtems.org] 
Sent: Tuesday, June 14, 2016 11:55 PM
To: Gedare Bloom 
Cc: Jinhyun ; j...@konkuk.ac.kr; devel@rtems.org
Subject: Re: [PATCH] pc386: Add virtio network driver

Does the virtio.h file need to be in the BSP or is it independent and can move
to shared?

I am glad to see this code being BSP and architecture independent. :)

On Tue, Jun 14, 2016 at 9:37 AM, Gedare Bloom  wrote:
Or maybe just the RTEMS_COMPILER_MEMORY_BARRIER()?

On Tue, Jun 14, 2016 at 10:37 AM, Gedare Bloom  wrote:
> Does _CPU_atomic_Fence() work for you? It is defined in
> cpukit/score/cpu/*/rtems/score/cpuatomic.h
>
> On Sat, Jun 11, 2016 at 3:12 AM, Jinhyun  wrote:
>> Hi All,
>>
>> Thanks for your comments and suggestions. For a better decision, we like to
>> give a bit of background of our patch.
>>
>> Initially, we got a comment from Joel that the pc386 BSP might be a suitable
>> path for our patch as follows:
>> https://lists.rtems.org/pipermail/devel/2016-March/014157.html
>> Though we didn’t discuss more about this issue at that time, he suggested
>> the pc386 path maybe simply because our implementation only worked with
>> pc386. In fact, however, most of our codes are architecture-independent, but
>> the codes for memory barrier are troublesome. If there are
>> architecture-independent wrapper functions for memory barrier in RTEMS, we
>> can simply avoid the architecture dependency by exploiting those. However,
>> we couldn’t find such wrapper functions; thus, our patch includes few lines
>> of assembly instructions of pc386. Now we are working on memory barrier for
>> Sparc. Please let us know if we are missing something here.
>>
>> Based on Pavel’s suggestions, we think that the files of our patch can be
>> placed as follows:
>> libbsp/i386/pc386/virtio: virtio.h
>> libbsp/shared: virtio.c, virtio_pci.c, virtio_pci.h, virtqueue.c,
>> virtqueue.h, virtio_ring.h
>> libchip/network: if_vtnet.c, if_vtnetvar.h, virtio_net.h
>> However, in FreeBSD, all files to implement virtio are placed in the same
>> directory, sys/dev/virtio.
>>
>> In addition, we are not familiar with libbsd yet. Thus, if our patch can be
>> included in the mainline, it will be easier to continuously contribute to
>> the virtio implementation from our side.
>>
>> Jin-Hyun
>>
>> -Original Message-
>> From: devel [mailto:mailto:devel-boun...@rtems.org] On Behalf Of Sebastian 
>> Huber
>> Sent: Wednesday, June 01, 2016 2:30 PM
>> To: Chris Johns ; mailto:devel@rtems.org
>> Subject: Re: [PATCH] pc386: Add virtio network driver
>>
>>
>>
>>
>> On 01/06/16 06:42, Chris Johns wrote:
 The RTEMS driver infrastructure is not capable enough to deal with a
 plug-and-play architecture like x86.
>>>
>>> This does not make sense to me and I fail to see how it relates to the
>>> previous statement. The original classic API for RTEMS is based on a
>>> VME bus standard and while not a hot swap bus architecture it did
>>> allow a plug in architecture based on a huge range of slave boards.
>>> The fact an architecture or bus has plug-and-play support does not
>>> mean RTEMS has to provide such support nor a BSP has reached a dead
>>> end because it does not.
>>
>> The standard RTEMS driver infrastructure offers no support for
>> auto-configuration, power-management, hot-plug and so on. The FreeBSD newbus
>> infrastructure offers all of this. I don't think it make sense to add or
>> event develop on our own such a functionality on a per-BSP basis.
>>
>> --
>> Sebastian Huber, embedded brains GmbH
>>
>> Address : Dornierstr. 4, D-82178 Puchheim, Germany
>> Phone   : tel:%2B49%2089%20189%2047%2041-16
>> Fax : tel:%2B49%2089%20189%2047%2041-09
>> E-Mail  : mailto: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
>> mailto:devel@rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
>>
>>
>>
>>
>> ___
>> devel mailing list
>> mailto:devel@rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
mailto:devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel



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

Re: Subject: Add PWM driver for beagle bone black

2016-06-21 Thread punit vara
Thank you very much for detailed review. I will do each changes you
suggested. Though I have some specific doubt I would like to ask as
following.

On Wed, Jun 22, 2016 at 1:07 AM, Martin Galvan
 wrote:
> Hi Punit, thanks for sending this. If I understood correctly this is the 
> BBBIO code
> plus some changes of your own, right? If so, I think it would be best to send 
> a patch
> with the BBBIO code as is, and then another with your changes on top of it. I 
> think
> that was what we were going for with StarterWare, too.
>

I would like to confirm it once again. Should I send a patch even if
it breaks the build right ?

> For imported code we usually stick to the coding style of whatever we're 
> importing.
> However, I see that bbb-pwm.c isn't actually that much code. If you feel like 
> it
> you could reformat it to follow a more standard coding style. The core RTEMS 
> files
> follow https://devel.rtems.org/wiki/Developer/Coding/Conventions, though BSP 
> code
> can have a bit more leeway.
>
> I prefer using stdint types such as uint32_t for driver code. Also, 
> const-correctness
> is always great to have.
>
> Additional comments are below. I don't know for certain which code is yours 
> and which
> comes from BBBIO, so I'll give a quick look at everything, then when you send 
> your
> changes alone I'll take a deeper look at those.
>
> On Tue, Jun 21, 2016 at 1:26 PM, Punit Vara  wrote:
>> This patch adds required definitions, registers definitions and 
>> testsuit to
>> test pwm driver for beagle bone black.
>
> Overall I think a slightly more detailed log message is required. Where did 
> you
> get the code from, what testing did you perform, why we used BBBIO instead of 
> StarterWare
> (license + bugs), and so on. Anything that a future maintainer might find 
> useful.
>
>>  testsuites/samples/Makefile.am   |   2 +-
>>  testsuites/samples/configure.ac  |   1 +
>>  testsuites/samples/pwm/Makefile.am   |  19 ++
>>  testsuites/samples/pwm/init.c|  70 ++
>>  testsuites/samples/pwm/pwm.doc   |   9 +
>>  testsuites/samples/pwm/pwm.scn   |   3 +
>
> Unless I've missed something, right now RTEMS doesn't have BSP-specific 
> tests. You *could*,
> however, add some sort of README with an example of how to use the BBBIO API, 
> as documentation.
>
>> diff --git a/c/src/lib/libbsp/arm/beagle/Makefile.am 
>> b/c/src/lib/libbsp/arm/beagle/Makefile.am
>> index 20d3092..68bdbd4 100644
>> --- a/c/src/lib/libbsp/arm/beagle/Makefile.am
>> +++ b/c/src/lib/libbsp/arm/beagle/Makefile.am
>> @@ -117,6 +117,9 @@ libbsp_a_SOURCES += misc/i2c.c
>>  # GPIO
>>  libbsp_a_SOURCES += gpio/bbb-gpio.c
>>
>> +#pwm
>> +libbsp_a_SOURCES += pwm/bbb-pwm.c
>
> IIRC only the GPIO-related files have the name of the BSP prepended to them 
> to help
> the build system distinguish them from the ones belonging to the generic API. 
> That is,
> this could probably be named pwm.c.

Sure I will do it.

>> diff --git a/c/src/lib/libbsp/arm/beagle/pwm/bbb-pwm.c 
>> b/c/src/lib/libbsp/arm/beagle/pwm/bbb-pwm.c
>> new file mode 100644
>> index 000..a2f1107
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/arm/beagle/pwm/bbb-pwm.c
>> @@ -0,0 +1,345 @@
>> +/* This file is based on following licence
>> + * Copyright (c) 2015, Shabaz, VegetableAvenger
>
> I'm not sure about this. I think it would be best if we didn't add such 
> aliases to
> copyright notices, and instead linked to the repository URL saying something 
> like
> "This code is based on the BBBIO sources, available at...". But maybe there's 
> a better
> way to go about this. What does the rest of you guys think?
>
>> + * Added clock functions and improved pwm_enable function
>
> I don't think these kind of messages should go here. If you want to make 
> clear that you changed
> imported code, do so in a more detailed way in the commit log or maybe atop 
> the function
> you changed.
>
>> +#include
>> +#include
>> +#include
>> +#include
>> +#include
>
> Add a space between #include and the file you're including.
>
>> +#define BASE_CLOCK 1
>
> We probably need a better name for this. We could name it SYSCLKOUT (since 
> that's the name the
> manual uses), and add a prominent comment explaining why we're using that 
> value (remember that
> the manual seldom mentions what the actual value is, save for a note below 
> table 15-something).
> It would also be nice to link to 
> https://groups.google.com/forum/#!topic/beagleboard/Ed2J9Txe_E4
> since there we can find a good explanation of why that value is safe to use.

Right now I am not using this BASE_CLOCK but IMHO we should keep it
here so that in future maintainer can know which system clock should
be used for BBB. Sure I will link it to TRM as well.

>
>> +void pwm_init(unsigned int baseAddr, unsigned int PWMSS_ID)
>
> PWMSS_ID sounds like a macro name; regular variable names are lowercase.
>
> I think this API could be improved. Correct me if

LibBSD /etc/rc.conf changes

2016-06-21 Thread Chris Johns

Hi,

The implementation I added to LibBSD parses the rc.conf file and invokes 
handers for each directive in the file. The approach has exposed a few 
issues and I have decided to re-implement the code to better follow the 
FreeBSD approach.


Specially the network start up automatically sets up the lo0 interface. 
With DHCP initialisation waits defaultroute_delay seconds for the 
default route to be set before moving on once all interfaces are set up. 
These cannot be implemented with the current way the rc.conf parsing is 
done.


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


Re: [PATCH 07/10] Avoid in

2016-06-21 Thread Sebastian Huber



On 22/06/16 02:26, Chris Johns wrote:

On 21/06/2016 23:57, Sebastian Huber wrote:

---
  cpukit/rtems/include/rtems/rtems/ratemon.h | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h 
b/cpukit/rtems/include/rtems/rtems/ratemon.h

index 6e8fab6..3203eab 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -35,7 +35,8 @@
  #include 
  #include 
  #include 
-#include 
+
+struct rtems_printer;

  #ifdef __cplusplus
  extern "C" {
@@ -362,7 +363,7 @@ void rtems_rate_monotonic_reset_all_statistics( 
void );

   *  the Manager but actually uses other services of the Manager.
   */
  void rtems_rate_monotonic_report_statistics_with_plugin(
-  const rtems_printer *printer
+  const struct rtems_printer *printer
  );



Why this way rather than the header? 


This would pull in  via  via  
via . I would really like to make  as 
independent from external header files as possible


--
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] Subject: Add original BBBIO PWM driver to BBB BSP

2016-06-21 Thread Punit Vara
This patch perform following things:
- adds original BBBIO PWM code as it is.
- not added to Makefile otherwise it will break build
- adds required registers
- adds declarations to BSP_HEADERS

This code is added from

https://github.com/VegetableAvenger/BBBIOlib/blob/master/BBBio_lib/BBBiolib_PWMSS.c
---
 c/src/lib/libbsp/arm/beagle/include/bbb-pwm.h |  46 +++
 c/src/lib/libbsp/arm/beagle/pwm/pwm.c | 407 ++
 c/src/lib/libcpu/arm/shared/include/am335x.h  |  11 +-
 3 files changed, 463 insertions(+), 1 deletion(-)
 create mode 100644 c/src/lib/libbsp/arm/beagle/include/bbb-pwm.h
 create mode 100644 c/src/lib/libbsp/arm/beagle/pwm/pwm.c

diff --git a/c/src/lib/libbsp/arm/beagle/include/bbb-pwm.h 
b/c/src/lib/libbsp/arm/beagle/include/bbb-pwm.h
new file mode 100644
index 000..bd70385
--- /dev/null
+++ b/c/src/lib/libbsp/arm/beagle/include/bbb-pwm.h
@@ -0,0 +1,46 @@
+/**
+ * @file
+ *
+ * @ingroup arm_beagle
+ *
+ * @brief BeagleBone Black BSP definitions.
+ */
+
+/**
+ * Copyright (c) 2016 Punit Vara 
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef LIBBSP_ARM_BEAGLE_BBB_PWM_H
+#define LIBBSP_ARM_BEAGLE_BBB_PWM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief  BeagleBone Black PWM functions.
+ */
+#define BBBIO_PWMSS_COUNT   3
+#define BBBIO_PWMSS0   0
+#define BBBIO_PWMSS1   1  
+#define BBBIO_PWMSS2   2
+
+/**
+ * @brief  BeagleBone Black PWM API.
+ */
+int BBBIO_PWMSS_Setting(unsigned int PWMID , float HZ ,float dutyA ,float 
dutyB);   
+int BBBIO_PWM_Init();
+void BBBIO_PWM_Release();
+int BBBIO_PWMSS_Status(unsigned int PWMID);
+void BBBIO_ehrPWM_Enable(unsigned int PWMSS_ID);
+void BBBIO_ehrPWM_Disable(unsigned int PWMSS_ID);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LIBBSP_ARM_BEAGLE_BBB_PWM_H */
diff --git a/c/src/lib/libbsp/arm/beagle/pwm/pwm.c 
b/c/src/lib/libbsp/arm/beagle/pwm/pwm.c
new file mode 100644
index 000..f65ff89
--- /dev/null
+++ b/c/src/lib/libbsp/arm/beagle/pwm/pwm.c
@@ -0,0 +1,407 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "BBBiolib.h"
+/*---*/
+/*
+ * PWMSS Registers
+ *
+ * @Source : AM335x Technical Reference Manual ,page 1991
+ *   Table 15-5. PWMSS REGISTERS
+ *
+*/
+
+#define PWMSS0_MMAP_ADDR   0x4830
+#define PWMSS1_MMAP_ADDR   0x48302000
+#define PWMSS2_MMAP_ADDR   0x48304000
+#define PWMSS_MMAP_LEN 0x1000
+
+#define PWMSS_IDVER0x0
+#define PWMSS_SYSCONFIG0x4
+#define PWMSS_CLKCONFIG0x8
+#define PWMSS_CLKSTATUS0xC
+
+/* EPWM Registers
+ *
+ * @Source : AM335x Technical Reference Manual ,page 2084
+ *   Table 15-58. EPWM REGISTERS
+ *
+*/
+#define EPWM_TBCTL 0x0
+#define EPWM_TBSTS 0x2
+#define EPWM_TBPHSHR   0x4
+#define EPWM_TBPHS 0x6
+#define EPWM_TBCNT 0x8
+#define EPWM_TBPRD 0xA
+#define EPWM_CMPCTL0xE
+#define EPWM_CMPAHR0x10
+#define EPWM_CMPA  0x12
+#define EPWM_CMPB  0x14
+#define EPWM_AQCTLA0x16
+#define EPWM_AQCTLB0x18
+#define EPWM_AQSFRC0x1A
+#define EPWM_AQCSFRC   0x1C
+#define EPWM_DBCTL 0x1E
+#define EPWM_DBRED 0x20
+#define EPWM_DBFED 0x22
+/*---*/
+extern int memh;
+extern volatile unsigned int *CM_ptr;  /*c ontrol module */
+volatile unsigned int *cm_per_addr;
+
+
+const unsigned int PWMSS_AddressOffset[]={PWMSS0_MMAP_ADDR,
+ PWMSS1_MMAP_ADDR,
+ PWMSS2_MMAP_ADDR};
+volatile unsigned int *pwmss_ptr[3] ={NULL, NULL, NULL} ;
+volatile unsigned int *epwm_ptr[3]  ={NULL, NULL, NULL} ;
+volatile unsigned int *ecap_ptr[3]  ={NULL, NULL, NULL} ;
+volatile unsigned int *eqep_ptr[3]  ={NULL, NULL, NULL} ;
+
+#define TBCTL_CTRMODE_UP0x0
+#define TBCTL_CTRMODE_DOWN  0x1
+#define TBCTL_CTRMODE_UPDOWN0x2
+#define TBCTL_CTRMODE_FREEZE0x3
+/* 
---
 */
+/* PWMSS Timebase clock check
+ * check the timenase clock enable or not
+ *
+ * @param PWMSS_ID :  PWM sumsystem ID (BBBIO_PWMSS0 ,BBBIO_PWMSS1, 
BBBIO_PWMSS2)
+ *
+ * @return : 0 for disable timebase clock , 1 for enable for timebase clock
+ */
+static int PWMSS_TB_clock_check(unsigned int PWMSS_ID)
+{
+   volatile unsigned int* reg;
+   unsigned int reg_value ;
+
+   /* Control module check */
+   reg =(void *)CM_ptr + BBBIO_PWMSS_CTRL;
+   reg_value = *reg ;
+
+   return (reg_value & (1 << PWMSS_ID)) ;
+}
+
+/* 
-