[PATCH 1/3] arm: Select the TLB invalidate based on the core's Id variant.

2019-07-26 Thread chrisj
From: Chris Johns 

Closes #3760
---
 bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c 
b/bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
index c2be0f566e..cf2d555d18 100644
--- a/bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
+++ b/bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
@@ -65,12 +65,16 @@ static uint32_t set_translation_table_entries(
 
   for ( i = istart; i != iend; i = (i + 1U) & index_mask ) {
 void *mva = (void *) (i << ARM_MMU_SECT_BASE_SHIFT);
-#if defined(__ARM_ARCH_7A__)
-arm_cp15_tlb_invalidate_entry_all_asids(mva);
-#else
-arm_cp15_tlb_instruction_invalidate_entry(mva);
-arm_cp15_tlb_data_invalidate_entry(mva);
-#endif
+#if defined(__ARM_ARCH_7A__)
+if ((arm_cp15_get_multiprocessor_affinity() & (1 << 30)) == 0) {
+  arm_cp15_tlb_invalidate_entry_all_asids(mva);
+}
+else
+#endif
+{
+  arm_cp15_tlb_instruction_invalidate_entry(mva);
+  arm_cp15_tlb_data_invalidate_entry(mva);
+}
   }
 
   _ARM_Data_synchronization_barrier();
-- 
2.20.1 (Apple Git-117)

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


[PATCH] Beagleboneblack libdebugger support

2019-07-26 Thread chrisj
These patches add libdebugger support for the beagleboneblack.

Special JTAG based BBB BSP probe and configure code is needed to enable
the debug hardware in the ARM. The code requires a small hardware mod
to work as the BBB hardware by default does not enable software
debugging.

The libdebugger ARM backend has been extended to support memory mapped
modes to access the debug hardware. Special BSP hooks have been added
to aid hardware like the BBB SOC that do not provide any on chip
support to determine the memory map of SOC resources.

RPi2 crashes the debugger01.exe test which is an improvement with
these patches as it shows the ARM debugger hw is being detected and
located. There has been no testing of the code on the RPi2.

Chris

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


[PATCH 3/3] arm/beagle: Add libdebugger support.

2019-07-26 Thread chrisj
From: Chris Johns 

- Port the jbang code from C++ to C to enable DBGEN.
- Hook the libdebugger ARM backend support to return the base address
  of the debug register set.
---
 bsps/arm/beagle/start/bspdebug.c| 734 
 bsps/arm/beagle/start/bspdebug.h|  38 ++
 bsps/arm/beagle/start/bspstart.c|   3 +
 c/src/lib/libbsp/arm/beagle/Makefile.am |   1 +
 4 files changed, 776 insertions(+)
 create mode 100644 bsps/arm/beagle/start/bspdebug.c
 create mode 100644 bsps/arm/beagle/start/bspdebug.h

diff --git a/bsps/arm/beagle/start/bspdebug.c b/bsps/arm/beagle/start/bspdebug.c
new file mode 100644
index 00..d57fe97d49
--- /dev/null
+++ b/bsps/arm/beagle/start/bspdebug.c
@@ -0,0 +1,734 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2019 Chris Johns .  All rights reserved.
+ * Copyright (C) 2015, Dutch & Dutch.  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 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 OWNER 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 is a C version of the jbang code found in the jbang repo:
+ *
+ *   https://github.com/dutchanddutch/jbang.git
+ *
+ * Dutch & Dutch is 'zmatt' on the #beagle IRC channel. This work is all based
+ * on zmatt's research and solution.
+ *
+ * Hardware Modification
+ * -
+ *
+ * The TI designers did not bring the ARM signal DBGEN to a system control
+ * register so software can not directly control it. The BBB has a pull down
+ * resister (R25) on the TRSTn JTAG signal which means software cannot
+ * reconfigure the TRSTn pin and control it. As a result software access to the
+ * ARM's debug registers is locked out. You can access the registers if you
+ * want too but hardware breakpoints and watchpoints are ignored. ARM uses
+ * hardware breakpoints to single step instructions.
+ *
+ * You need to add at least one wire for this code to work and optionally a
+ * second wire if you need to test this code to make sure it is working. The
+ * wires are small and require a small amount of soldering and soldering skill.
+ *
+ * If you add the TDO link change 'has_tdo' to '1' to enable support. This
+ * setting defaults to '0' to disable support.
+ *
+ * Steps:
+ *
+ *  1. Locate P2 on the bottom side of the board. It is the JTAG connector
+ * pads. If you look at the underside of the board with the SD card holder
+ * to the right the pads are top center left. There are 20 pads in two
+ * columns. The pads are numbered 1 at the top left then 2 top right, 3 is
+ * second top on the left, 4 is second top to the right, then the pin
+ * number increments as you move left then right down the pads.
+ *
+ *  2. Connect P2 to P5.
+ *
+ *  3. Optionally connect P7 to P13.
+ *
+ * The resulting wiring is:
+ *
+ *   1 ===  /--=== 2
+ *   3 ===  |  === 4
+ *   5 ===--/  === 6
+ *   7 ===--\  === 8
+ *   9 ===  |  === 10
+ *  11 ===  |  === 12
+ *  13 ===--/  === 14
+ *  15 === === 16
+ *  17 === === 18
+ *  19 === === 20
+ */
+
+#include 
+
+#include 
+#include 
+
+#include "bspdebug.h"
+
+/*
+ * Set to '1' to enable the traces.
+ */
+#define trace 0
+#define trace_reg 0
+
+/*
+ * TDO provided feedback for testing via EMU0.
+ */
+#define has_tdo 0
+
+/*
+ * Pins of interest.
+ */
+#define AM335x_PIN_CONF_TMS   116
+#define AM335x_PIN_CONF_TDI   117
+#define AM335x_PIN_CONF_TDO   118
+#define AM335x_PIN_CONF_TCK   119
+#define AM335x_PIN_CONF_TRSTN 120
+#define AM335x_PIN_CONF_EMU0  121
+
+/*
+ * Register base addresses.
+ */
+#define AM335x_PRCM_CM_PER (0x44E0)
+#define AM335x_PRCM_WKUP   (AM335x_PRCM_CM_PER + 0x400)
+#define AM335x_CONTROL_MODULE  (0x44E1)
+#define AM335x_CONF_PIN

[PATCH 2/3] libdebugger: ARM fixes for Cortex-A8 and ARM mode.

2019-07-26 Thread chrisj
From: Chris Johns 

- Fix destorying the target and thread parts.
- Fix the ARM backend to support Cortex-A8 and ARM mode code.
- Use the DBGDSCR interrupt mask when single stepping.
- Use the DBGDSCR method of entry to debug mode to filter the
  execptions.
- Add support for BSPs to control the ARM backend.
---
 cpukit/Makefile.am|   1 +
 .../rtems/debugger/rtems-debugger-bsp.h   |  66 ++
 cpukit/libdebugger/rtems-debugger-arm.c   | 849 +-
 cpukit/libdebugger/rtems-debugger-bsp.c   |  46 +
 cpukit/libdebugger/rtems-debugger-server.c|   4 +-
 cpukit/libdebugger/rtems-debugger-threads.c   |  11 +-
 6 files changed, 730 insertions(+), 247 deletions(-)
 create mode 100644 cpukit/include/rtems/debugger/rtems-debugger-bsp.h
 create mode 100644 cpukit/libdebugger/rtems-debugger-bsp.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 8573f8fb64..3522916d8f 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -1882,6 +1882,7 @@ project_lib_LIBRARIES += libdebugger.a
 
 libdebugger_a_SOURCES =
 libdebugger_a_SOURCES += libdebugger/rtems-debugger-block.c
+libdebugger_a_SOURCES += libdebugger/rtems-debugger-bsp.c
 libdebugger_a_SOURCES += libdebugger/rtems-debugger-cmd.c
 libdebugger_a_SOURCES += libdebugger/rtems-debugger-remote.c
 libdebugger_a_SOURCES += libdebugger/rtems-debugger-remote-tcp.c
diff --git a/cpukit/include/rtems/debugger/rtems-debugger-bsp.h 
b/cpukit/include/rtems/debugger/rtems-debugger-bsp.h
new file mode 100644
index 00..be79912a80
--- /dev/null
+++ b/cpukit/include/rtems/debugger/rtems-debugger-bsp.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019 Chris Johns .
+ * 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.
+ */
+
+/*
+ * Debugger BSP support.
+ */
+
+#ifndef _RTEMS_DEBUGGER_BSP_h
+#define _RTEMS_DEBUGGER_BSP_h
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * ARM
+ */
+
+/**
+ * Debug registers
+ *
+ * Return the debugger registers for you BSP if the SoC requires memory mapped
+ * registers and the DBGDRAR and DBGDSAR are not support or return 0. This
+ * function is provided in the ARM backend and declared weak.
+ */
+void* rtems_debugger_arm_debug_registers(void);
+
+/**
+ * Configure the debug interface.
+ *
+ * Some ARM devices need special configurations to enable the debugging
+ * hardware. The device are often locked down for securty reasons and
+ * the debug hardware in the ARM needs to be enabled (asserting DBGEN).
+ */
+bool rtems_debugger_arm_debug_configure(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
diff --git a/cpukit/libdebugger/rtems-debugger-arm.c 
b/cpukit/libdebugger/rtems-debugger-arm.c
index 9e6650886f..72e67aed96 100644
--- a/cpukit/libdebugger/rtems-debugger-arm.c
+++ b/cpukit/libdebugger/rtems-debugger-arm.c
@@ -37,6 +37,8 @@
 #include 
 #include 
 
+#include 
+
 #include "rtems-debugger-target.h"
 #include "rtems-debugger-threads.h"
 
@@ -76,12 +78,16 @@
  *
  * If the variant only supports thumb insturctions disable the support.
  */
-#define ARM_SWITCH_REG uint32_t arm_switch_reg
-#define ARM_SWITCH_REG_ASM [arm_switch_reg] "=" (arm_switch_reg)
 #if !ARM_THUMB_ONLY && defined(__thumb__)
-  #define ASM_ARM_MODE   ".align 2\nbx pc\n.arm\n"
-  #define ASM_THUMB_MODE "add %[arm_switch_reg], pc, #1\nbx 
%[arm_switch_reg]\n.thumb\n"
+  #define ARM_SWITCH_REG   uint32_t arm_switch_reg
+  #define ARM_SWITCH_REG_ASM   [arm_switch_reg] "=" (arm_switch_reg)
+  #define ARM_SWITCH_REG_ASM_L ARM_SWITCH_REG_ASM,
+  #define ASM_ARM_MODE ".align 2\nbx pc\n.arm\n"
+  #define ASM_THUMB_MODE   "add %[arm_switch_reg], pc, #1\nbx 
%[arm_switch_reg]\n.thumb\n"
 #else
+  

Re: [PATCH] Add framebuffer in BBB

2019-07-26 Thread Chris Johns
On 26/7/19 9:41 pm, Christian Mauderer wrote:
> I hadn't had a look at most patches yet and most likely that will need a
> bit of time. It's a lot of stuff. Most likely the bigger patches won't
> reach the mailing list so maybe adding a link to a branch on your github
> repo would be good.

There are no oversize posts in the thread.

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


Re: Incompatible rpcUdpInit() and nfsInit() in rtems-libbsd

2019-07-26 Thread Joel Sherrill
On Fri, Jul 26, 2019 at 1:48 PM Peter Dufault  wrote:

> The follwing commit below in libbsd added “verbose” flags to both
> rpcUdpInit() and nfsInit().  Code using libbsd needs a change to compile.
> I don’t like adding a compile time check.
>
> Shall I change the RTEMS ones to match even if the flag doesn’t do
> anything?
>

I think changing the legacy version to match the signature of the libbsd
one is a good idea.

--joel

>
> [dufault@fubar rtems-libbsd]$ git log ./rtemsbsd/include/librtemsNfs.h
> commit 761ae78e0528ac5c1f46df11e9bea453ac6c82dd
> Author: Chris Johns 
> Date:   Thu Jun 30 13:32:29 2016 +1000
>
> Make the license message viewable with a verbose option.
>
> The license details can be viewed if you mount with a -v option:
>
>  # mount -i nfs -o "-v" 1.2.3.4:/mnt /mnt
>
> [dufault@fubar rtems-libbsd]$ grep rpcUdpInit
> ./rtemsbsd/include/librtemsNfs.h
> /** Priority of daemon; may be setup prior to calling rpcUdpInit();
> /** CPU affinity of daemon; may be setup prior to calling rpcUdpInit();
> rpcUdpInit(bool verbose);
> [dufault@fubar rtems-libbsd]$
>
> Peter
> -
> Peter Dufault
> HD Associates, Inc.  Software and System Engineering
>
> This email is delivered through the public internet using protocols
> subject to interception and tampering.
>
> ___
> 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

Incompatible rpcUdpInit() and nfsInit() in rtems-libbsd

2019-07-26 Thread Peter Dufault
The follwing commit below in libbsd added “verbose” flags to both rpcUdpInit() 
and nfsInit().  Code using libbsd needs a change to compile.
I don’t like adding a compile time check.

Shall I change the RTEMS ones to match even if the flag doesn’t do anything?

[dufault@fubar rtems-libbsd]$ git log ./rtemsbsd/include/librtemsNfs.h
commit 761ae78e0528ac5c1f46df11e9bea453ac6c82dd
Author: Chris Johns 
Date:   Thu Jun 30 13:32:29 2016 +1000

Make the license message viewable with a verbose option.

The license details can be viewed if you mount with a -v option:

 # mount -i nfs -o "-v" 1.2.3.4:/mnt /mnt

[dufault@fubar rtems-libbsd]$ grep rpcUdpInit ./rtemsbsd/include/librtemsNfs.h
/** Priority of daemon; may be setup prior to calling rpcUdpInit();
/** CPU affinity of daemon; may be setup prior to calling rpcUdpInit();
rpcUdpInit(bool verbose);
[dufault@fubar rtems-libbsd]$ 

Peter
-
Peter Dufault
HD Associates, Inc.  Software and System Engineering

This email is delivered through the public internet using protocols subject to 
interception and tampering.

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

Re: GSoC Project | Basic Support for Trace Compass

2019-07-26 Thread Sebastian Huber
- Am 26. Jul 2019 um 14:56 schrieb Ravindra Kumar Meena rmeena...@gmail.com:

>>
>> Ok, very good. This look all right. It is amazing how much information
>> Trace Compass can display with only sched_switch events.
>>
> Great!! We have something working very useful. :) :)
> 
>>
>> Please figure out how the state member values are defined. I think this
>> is important to improve the diagrams.
>>
> Here is the response from lltng:
> https://lists.lttng.org/pipermail/lttng-dev/2019-July/029121.html
> 
> What I understand from here is that _prev_state is the previous state of
> the thread(TID)).

Yes, but what is the meaning of these state values? We have to figure this out 
since we need a mapping from RTEMS thread states to these Linux thread states. 
Could you use an example trace from Linux to check if the information 
referenced in this email answer makes sense?

> 
> 
>> It would be good to get task names for the IDs. Do you have an idea how
>> we can do this?
>>
> With task name do you mean RTEMS_RECORD_THREAD_SWITCH_IN
> and RTEMS_RECORD_THREAD_SWITCH_OUT?
> 
> if so this can be done by calling:
> rtems_record_event_text( item->event )

Attached is a patch for RTEMS. The record server sends all thread names to the 
client after the header.

For thread name changes and new threads we have to think about.
From 05b8722d2db2dbc316b2b4d77a7f42399e68 Mon Sep 17 00:00:00 2001
From: Sebastian Huber 
Date: Fri, 26 Jul 2019 16:36:10 +0200
Subject: [PATCH] record: Add support for thread names

---
 cpukit/include/rtems/recorddata.h  |  4 +-
 cpukit/libtrace/record/record-server.c | 70 ++
 cpukit/libtrace/record/record-text.c   |  2 +-
 testsuites/libtests/record01/init.c| 30 +++
 4 files changed, 103 insertions(+), 3 deletions(-)

diff --git a/cpukit/include/rtems/recorddata.h b/cpukit/include/rtems/recorddata.h
index 61a6311735..607955c596 100644
--- a/cpukit/include/rtems/recorddata.h
+++ b/cpukit/include/rtems/recorddata.h
@@ -55,7 +55,7 @@ extern "C" {
  * The record version reflects the record event definitions.  It is reported by
  * the RTEMS_RECORD_VERSION event.
  */
-#define RTEMS_RECORD_THE_VERSION 4
+#define RTEMS_RECORD_THE_VERSION 5
 
 /**
  * @brief The items are in 32-bit little-endian format.
@@ -291,6 +291,7 @@ typedef enum {
   RTEMS_RECORD_THREAD_EXIT,
   RTEMS_RECORD_THREAD_EXITTED,
   RTEMS_RECORD_THREAD_ID,
+  RTEMS_RECORD_THREAD_NAME,
   RTEMS_RECORD_THREAD_PRIO_CURRENT_HIGH,
   RTEMS_RECORD_THREAD_PRIO_CURRENT_LOW,
   RTEMS_RECORD_THREAD_PRIO_REAL_HIGH,
@@ -607,7 +608,6 @@ typedef enum {
   RTEMS_RECORD_SYSTEM_508,
   RTEMS_RECORD_SYSTEM_509,
   RTEMS_RECORD_SYSTEM_510,
-  RTEMS_RECORD_SYSTEM_511,
 
   /* There are 512 events reserved for the user */
   RTEMS_RECORD_USER_0,
diff --git a/cpukit/libtrace/record/record-server.c b/cpukit/libtrace/record/record-server.c
index 840924a24a..f84852d226 100644
--- a/cpukit/libtrace/record/record-server.c
+++ b/cpukit/libtrace/record/record-server.c
@@ -30,6 +30,7 @@
 #endif
 
 #include 
+#include 
 #include 
 
 #include 
@@ -165,6 +166,74 @@ static void send_header( int fd )
   (void) write( fd, , sizeof( header ) );
 }
 
+typedef struct {
+  int fd;
+  size_t index;
+  rtems_record_item items[ 128 ];
+} thread_names_context;
+
+static void thread_names_produce(
+  thread_names_context *ctx,
+  rtems_record_eventevent,
+  rtems_record_data data
+)
+{
+  size_t i;
+
+  i = ctx->index;
+  ctx->items[ i ].event = RTEMS_RECORD_TIME_EVENT( 0, event );
+  ctx->items[ i ].data = data;
+
+  if (i == RTEMS_ARRAY_SIZE(ctx->items) - 2) {
+ctx->index = 0;
+(void) write( ctx->fd, ctx->items, sizeof( ctx->items ) );
+  } else {
+ctx->index = i + 1;
+  }
+}
+
+static bool thread_names_visitor( rtems_tcb *tcb, void *arg )
+{
+  thread_names_context *ctx;
+  char  buf[ 16 ];
+  size_tn;
+  size_ti;
+  rtems_record_data data;
+
+  ctx = arg;
+  thread_names_produce( ctx, RTEMS_RECORD_THREAD_ID, tcb->Object.id );
+  n = _Thread_Get_name( tcb, buf, sizeof( buf ) );
+  i = 0;
+
+  while ( i < n ) {
+size_t j;
+
+data = 0;
+
+for ( j = 0; i < n && j < sizeof( data ); ++j ) {
+  data = ( data << 8 ) | buf[ i ];
+  ++i;
+}
+
+thread_names_produce( ctx, RTEMS_RECORD_THREAD_NAME, data );
+  }
+
+  return false;
+}
+
+static void send_thread_names( int fd )
+{
+  thread_names_context ctx;
+
+  ctx.fd = fd;
+  ctx.index = 0;
+  rtems_task_iterate( thread_names_visitor,  );
+
+  if ( ctx.index > 0 ) {
+(void) write( ctx.fd, ctx.items, ctx.index * sizeof( ctx.items[ 0 ] ) );
+  }
+}
+
 void rtems_record_server( uint16_t port, rtems_interval period )
 {
   rtems_status_code sc;
@@ -216,6 +285,7 @@ void rtems_record_server( uint16_t port, rtems_interval period )
 wait( RTEMS_NO_WAIT );
 (void) rtems_timer_fire_after( timer, period, wakeup_timer,  );
 send_header( cd );
+send_thread_names( cd );
 
 

Re: [PATCH] Add framebuffer in BBB

2019-07-26 Thread Vijay Kumar Banerjee
On Fri, Jul 26, 2019 at 6:42 PM Vijay Kumar Banerjee <
vijaykumar9...@gmail.com> wrote:

>
>
>
> On Fri, Jul 26, 2019 at 5:11 PM Christian Mauderer <
> christian.maude...@embedded-brains.de> wrote:
>
>> On 26/07/2019 13:22, Vijay Kumar Banerjee wrote:
>> > Hello everyone!
>> >
>> > I'm excited to post the following patchset. With this patchset
>> > I have the framebuffer working in BBB and have tested it with a
>> > BBB revC with HDMI connected Screen.
>> >
>> > This patchset uses mmap and hence it's necessary to apply the
>> > patche ON TOP OF mmap patch to avoid merge conflict.
>> >
>> > In reply to this mail, I'll be attaching a picture of the screen
>> > where my rectangle drawing application made a nice red rectangle
>> > on the screen just like in FreeBSD.
>> >
>> > Thanks and regards,
>> > Vijay
>> >
>>
>> Hello Vijay,
>>
>> it's great that you now have a working driver. Well done.
>>
>> I hadn't had a look at most patches yet and most likely that will need a
>> bit of time. It's a lot of stuff. Most likely the bigger patches won't
>> reach the mailing list so maybe adding a link to a branch on your github
>> repo would be good.
>>
>> I'll reorder them and push to remote today and add it in this thread.
>
Pushed it here:
https://github.com/thelunatic/rtems-libbsd/tree/framebuffer

> Note: Please don't send a v2 right now. I'm sure there are more comments
>> (maybe not only from me). Collect comments for at least one or two days
>> and create an update afterwards.
>>
>> Some notes reading the patch overview:
>>
>> > [PATCH 01/10] TDA19988 : Import from FreeBSD
>> > [PATCH 02/10] TDA19988 : port to RTEMS
>> > [PATCH 03/10] am335x display drivers: Import from FreeBSD
>> > [PATCH 04/10] am335x display drivers : Port to RTEMS
>> > [PATCH 05/10] fbd : Import from FreeBSD
>> > [PATCH 06/10] fbd : Port to RTEMS
>>
>> Is fbd a prerequisite of am335x_lcd? In that case it would have been
>> better to reorder the patches. As long as every version compiles (to
>> allow git bisect) I would accept that order too. But as a general rule
>> prerequisites should be prior to the parts that use it.
>>
>> am335x_lcd is the prerequisite for fbd.
>
>> > [PATCH 07/10] VT : Import from FreeBSD
>> > [PATCH 08/10] VT : Port to RTEMS
>>
>> Is the vt still necessary? I think it was an intermediate step to try
>> whether it's initializing the display. Did you try without it?
>>
>> I tried without it, it's giving some noise in the screen and the the open
> call to framebuffer is returning error without vt. I guess the vt
> initialization
> is necessary.
>
>> > [PATCH 09/10] TI Pinmux : Import from FreeBSD
>> > [PATCH 10/10] TI Pinmux : Port to RTEMS
>>
>> Again: prerequisite. So they should be one of the first.
>>
>> OK. I'll put it in the first.
>
>> Best regards
>>
>> Christian
>> --
>> 
>> embedded brains GmbH
>> Herr Christian Mauderer
>> Dornierstr. 4
>> D-82178 Puchheim
>> Germany
>> email: christian.maude...@embedded-brains.de
>> Phone: +49-89-18 94 741 - 18
>> Fax:   +49-89-18 94 741 - 08
>> PGP: Public key available on request.
>>
>> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] Add framebuffer in BBB

2019-07-26 Thread Vijay Kumar Banerjee
On Fri, Jul 26, 2019 at 5:11 PM Christian Mauderer <
christian.maude...@embedded-brains.de> wrote:

> On 26/07/2019 13:22, Vijay Kumar Banerjee wrote:
> > Hello everyone!
> >
> > I'm excited to post the following patchset. With this patchset
> > I have the framebuffer working in BBB and have tested it with a
> > BBB revC with HDMI connected Screen.
> >
> > This patchset uses mmap and hence it's necessary to apply the
> > patche ON TOP OF mmap patch to avoid merge conflict.
> >
> > In reply to this mail, I'll be attaching a picture of the screen
> > where my rectangle drawing application made a nice red rectangle
> > on the screen just like in FreeBSD.
> >
> > Thanks and regards,
> > Vijay
> >
>
> Hello Vijay,
>
> it's great that you now have a working driver. Well done.
>
> I hadn't had a look at most patches yet and most likely that will need a
> bit of time. It's a lot of stuff. Most likely the bigger patches won't
> reach the mailing list so maybe adding a link to a branch on your github
> repo would be good.
>
> I'll reorder them and push to remote today and add it in this thread.

> Note: Please don't send a v2 right now. I'm sure there are more comments
> (maybe not only from me). Collect comments for at least one or two days
> and create an update afterwards.
>
> Some notes reading the patch overview:
>
> > [PATCH 01/10] TDA19988 : Import from FreeBSD
> > [PATCH 02/10] TDA19988 : port to RTEMS
> > [PATCH 03/10] am335x display drivers: Import from FreeBSD
> > [PATCH 04/10] am335x display drivers : Port to RTEMS
> > [PATCH 05/10] fbd : Import from FreeBSD
> > [PATCH 06/10] fbd : Port to RTEMS
>
> Is fbd a prerequisite of am335x_lcd? In that case it would have been
> better to reorder the patches. As long as every version compiles (to
> allow git bisect) I would accept that order too. But as a general rule
> prerequisites should be prior to the parts that use it.
>
> am335x_lcd is the prerequisite for fbd.

> > [PATCH 07/10] VT : Import from FreeBSD
> > [PATCH 08/10] VT : Port to RTEMS
>
> Is the vt still necessary? I think it was an intermediate step to try
> whether it's initializing the display. Did you try without it?
>
> I tried without it, it's giving some noise in the screen and the the open
call to framebuffer is returning error without vt. I guess the vt
initialization
is necessary.

> > [PATCH 09/10] TI Pinmux : Import from FreeBSD
> > [PATCH 10/10] TI Pinmux : Port to RTEMS
>
> Again: prerequisite. So they should be one of the first.
>
> OK. I'll put it in the first.

> Best regards
>
> Christian
> --
> 
> embedded brains GmbH
> Herr Christian Mauderer
> Dornierstr. 4
> D-82178 Puchheim
> Germany
> email: christian.maude...@embedded-brains.de
> Phone: +49-89-18 94 741 - 18
> Fax:   +49-89-18 94 741 - 08
> 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: GSoC Project | Basic Support for Trace Compass

2019-07-26 Thread Ravindra Kumar Meena
>
> Ok, very good. This look all right. It is amazing how much information
> Trace Compass can display with only sched_switch events.
>
Great!! We have something working very useful. :) :)

>
> Please figure out how the state member values are defined. I think this
> is important to improve the diagrams.
>
Here is the response from lltng:
https://lists.lttng.org/pipermail/lttng-dev/2019-July/029121.html

What I understand from here is that _prev_state is the previous state of
the thread(TID)).


> It would be good to get task names for the IDs. Do you have an idea how
> we can do this?
>
With task name do you mean RTEMS_RECORD_THREAD_SWITCH_IN
and RTEMS_RECORD_THREAD_SWITCH_OUT?

if so this can be done by calling:
rtems_record_event_text( item->event )


-- 
*Ravindra Kumar Meena*,
B. Tech. Computer Science and Engineering,
Indian Institute of Technology (Indian School of Mines)
, Dhanbad
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] Add framebuffer in BBB

2019-07-26 Thread Christian Mauderer
On 26/07/2019 13:22, Vijay Kumar Banerjee wrote:
> Hello everyone!
> 
> I'm excited to post the following patchset. With this patchset
> I have the framebuffer working in BBB and have tested it with a 
> BBB revC with HDMI connected Screen. 
> 
> This patchset uses mmap and hence it's necessary to apply the
> patche ON TOP OF mmap patch to avoid merge conflict.
> 
> In reply to this mail, I'll be attaching a picture of the screen
> where my rectangle drawing application made a nice red rectangle
> on the screen just like in FreeBSD.
> 
> Thanks and regards,
> Vijay
> 

Hello Vijay,

it's great that you now have a working driver. Well done.

I hadn't had a look at most patches yet and most likely that will need a
bit of time. It's a lot of stuff. Most likely the bigger patches won't
reach the mailing list so maybe adding a link to a branch on your github
repo would be good.

Note: Please don't send a v2 right now. I'm sure there are more comments
(maybe not only from me). Collect comments for at least one or two days
and create an update afterwards.

Some notes reading the patch overview:

> [PATCH 01/10] TDA19988 : Import from FreeBSD
> [PATCH 02/10] TDA19988 : port to RTEMS
> [PATCH 03/10] am335x display drivers: Import from FreeBSD
> [PATCH 04/10] am335x display drivers : Port to RTEMS
> [PATCH 05/10] fbd : Import from FreeBSD
> [PATCH 06/10] fbd : Port to RTEMS

Is fbd a prerequisite of am335x_lcd? In that case it would have been
better to reorder the patches. As long as every version compiles (to
allow git bisect) I would accept that order too. But as a general rule
prerequisites should be prior to the parts that use it.

> [PATCH 07/10] VT : Import from FreeBSD
> [PATCH 08/10] VT : Port to RTEMS

Is the vt still necessary? I think it was an intermediate step to try
whether it's initializing the display. Did you try without it?

> [PATCH 09/10] TI Pinmux : Import from FreeBSD
> [PATCH 10/10] TI Pinmux : Port to RTEMS

Again: prerequisite. So they should be one of the first.

Best regards

Christian
-- 

embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] Add framebuffer in BBB

2019-07-26 Thread Vijay Kumar Banerjee
On Fri, Jul 26, 2019 at 4:53 PM Vijay Kumar Banerjee <
vijaykumar9...@gmail.com> wrote:

> Hello everyone!
>
> I'm excited to post the following patchset. With this patchset
> I have the framebuffer working in BBB and have tested it with a
> BBB revC with HDMI connected Screen.
>
> This patchset uses mmap and hence it's necessary to apply the
> patche ON TOP OF mmap patch to avoid merge conflict.
>
> In reply to this mail, I'll be attaching a picture of the screen
> where my rectangle drawing application made a nice red rectangle
> on the screen just like in FreeBSD.
>
> I've uploaded the image to drive and it can be seen by anyone with the
following link :
https://drive.google.com/file/d/1yTsYs61JqZ0-QS2YvcQDdzAKEgcrdDW4/view?usp=sharing


> Thanks and regards,
> Vijay
>
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 09/10] TI Pinmux : Import from FreeBSD

2019-07-26 Thread Vijay Kumar Banerjee
---
 .../sys/arm/ti/am335x/am335x_scm_padconf.c| 305 
 .../sys/arm/ti/am335x/am335x_scm_padconf.h|  47 ++
 freebsd/sys/arm/ti/omap4/omap4_scm_padconf.h  |  83 
 freebsd/sys/arm/ti/ti_pinmux.c| 463 ++
 freebsd/sys/arm/ti/ti_pinmux.h|  80 +++
 freebsd/sys/dev/fdt/fdt_pinctrl.c | 160 ++
 6 files changed, 1138 insertions(+)
 create mode 100644 freebsd/sys/arm/ti/am335x/am335x_scm_padconf.c
 create mode 100644 freebsd/sys/arm/ti/am335x/am335x_scm_padconf.h
 create mode 100644 freebsd/sys/arm/ti/omap4/omap4_scm_padconf.h
 create mode 100644 freebsd/sys/arm/ti/ti_pinmux.c
 create mode 100644 freebsd/sys/arm/ti/ti_pinmux.h
 create mode 100644 freebsd/sys/dev/fdt/fdt_pinctrl.c

diff --git a/freebsd/sys/arm/ti/am335x/am335x_scm_padconf.c 
b/freebsd/sys/arm/ti/am335x/am335x_scm_padconf.c
new file mode 100644
index ..8823b6af
--- /dev/null
+++ b/freebsd/sys/arm/ti/am335x/am335x_scm_padconf.c
@@ -0,0 +1,305 @@
+#include 
+
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2012 Damjan Marion 
+ * 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#define _PIN(r, b, gp, gm, m0, m1, m2, m3, m4, m5, m6, m7) \
+   {   .reg_off = r, \
+   .gpio_pin = gp, \
+   .gpio_mode = gm, \
+   .ballname = b, \
+   .muxmodes[0] = m0, \
+   .muxmodes[1] = m1, \
+   .muxmodes[2] = m2, \
+   .muxmodes[3] = m3, \
+   .muxmodes[4] = m4, \
+   .muxmodes[5] = m5, \
+   .muxmodes[6] = m6, \
+   .muxmodes[7] = m7, \
+   }
+
+const static struct ti_pinmux_padstate ti_padstate_devmap[] = {
+   {"output",  PADCONF_OUTPUT },
+   {"output_pullup",   PADCONF_OUTPUT_PULLUP },
+   {"input",   PADCONF_INPUT },
+   {"input_pulldown",  PADCONF_INPUT_PULLDOWN },
+   {"input_pullup",PADCONF_INPUT_PULLUP },
+   {"i2c", PADCONF_INPUT_PULLUP_SLOW },
+   { .state = NULL }
+};
+
+const static struct ti_pinmux_padconf ti_padconf_devmap[] = {
+   _PIN(0x000, "GPMC_AD0", 32, 7,"gpmc_ad0", "mmc1_dat0", NULL, 
NULL, NULL, NULL, NULL, "gpio1_0"),
+   _PIN(0x004, "GPMC_AD1", 33, 7,"gpmc_ad1", "mmc1_dat1", NULL, 
NULL, NULL, NULL, NULL, "gpio1_1"),
+   _PIN(0x008, "GPMC_AD2", 34, 7,"gpmc_ad2", "mmc1_dat2", NULL, 
NULL, NULL, NULL, NULL, "gpio1_2"),
+   _PIN(0x00C, "GPMC_AD3", 35, 7,"gpmc_ad3", "mmc1_dat3", NULL, 
NULL, NULL, NULL, NULL, "gpio1_3"),
+   _PIN(0x010, "GPMC_AD4", 36, 7,"gpmc_ad4", "mmc1_dat4", NULL, 
NULL, NULL, NULL, NULL, "gpio1_4"),
+   _PIN(0x014, "GPMC_AD5", 37, 7,"gpmc_ad5", "mmc1_dat5", NULL, 
NULL, NULL, NULL, NULL, "gpio1_5"),
+   _PIN(0x018, "GPMC_AD6", 38, 7,"gpmc_ad6", "mmc1_dat6", NULL, 
NULL, NULL, NULL, NULL, "gpio1_6"),
+   _PIN(0x01C, "GPMC_AD7", 39, 7,"gpmc_ad7", "mmc1_dat7", NULL, 
NULL, NULL, NULL, NULL, "gpio1_7"),
+   _PIN(0x020, "GPMC_AD8", 22, 7, "gpmc_ad8", "lcd_data23", 
"mmc1_dat0", "mmc2_dat4", "ehrpwm2A", NULL, NULL, "gpio0_22"),
+   _PIN(0x024, "GPMC_AD9", 23, 7, "gpmc_ad9", "lcd_data22", 
"mmc1_dat1", "mmc2_dat5", "ehrpwm2B", NULL, NULL, "gpio0_23"),
+   _PIN(0x028, "GPMC_AD10",26, 7, "gpmc_ad10", "lcd_data21", 
"mmc1_dat2", "mmc2_dat6", "ehrpwm2_tripzone_in", NULL, NULL, 

[PATCH 10/10] TI Pinmux : Port to RTEMS

2019-07-26 Thread Vijay Kumar Banerjee
---
 Makefile.todo | 13 ++
 buildset/default.ini  |  1 +
 libbsd.py | 33 +++
 rtemsbsd/include/bsp/nexus-devices.h  |  1 +
 .../machine/rtems-bsd-kernel-namespace.h  |  9 +
 .../include/rtems/bsd/local/fdt_pinctrl_if.h  | 40 +++
 rtemsbsd/local/fdt_pinctrl_if.c   | 27 +
 7 files changed, 124 insertions(+)
 create mode 100644 rtemsbsd/local/fdt_pinctrl_if.c

diff --git a/Makefile.todo b/Makefile.todo
index ed1e428e..1bf61432 100644
--- a/Makefile.todo
+++ b/Makefile.todo
@@ -53,6 +53,8 @@ GENERATED += $(LOCAL_INC)/hdmi_if.h
 GENERATED += $(LOCAL_SRC)/hdmi_if.c
 GENERATED += $(LOCAL_INC)/fb_if.h
 GENERATED += $(LOCAL_SRC)/fb_if.c
+GENERATED += $(LOCAL_INC)/fdt_pinctrl_if.h
+GENERATED += $(LOCAL_SRC)/fdt_pinctrl_if.c
 GENERATED += rtemsbsd/include/machine/rtems-bsd-regdomain.h
 GENERATED += rtemsbsd/rtems/rtems-bsd-regdomain.c
 
@@ -279,6 +281,17 @@ $(LOCAL_SRC)/fb_if.c: $(FREEBSD_SRC)/sys/dev/fb/fb_if.m
-e 's|#include "fb_if.h"|#include |'
mv fb_if.c $@
 
+$(LOCAL_INC)/fdt_pinctrl_if.h: $(FREEBSD_SRC)/sys/dev/fdt/fdt_pinctrl_if.m
+   awk -f $(TOOLS)/makeobjops.awk $< -h
+   mv fdt_pinctrl_if.h $@
+
+$(LOCAL_SRC)/fdt_pinctrl_if.c: $(FREEBSD_SRC)/sys/dev/fdt/fdt_pinctrl_if.m
+   awk -f $(TOOLS)/makeobjops.awk $< -c
+   sed -i fdt_pinctrl_if.c \
+   -e '1 i\#include \n' \
+   -e 's|#include "fdt_pinctrl_if.h"|#include 
|'
+   mv fdt_pinctrl_if.c $@
+
 $(LOCAL_SRC)/gpio_if.c: $(FREEBSD_SRC)/sys/dev/gpio/gpio_if.m
awk -f $(TOOLS)/makeobjops.awk $< -c
mv gpio_if.c $@
diff --git a/buildset/default.ini b/buildset/default.ini
index 1d052a48..eed5cb75 100644
--- a/buildset/default.ini
+++ b/buildset/default.ini
@@ -38,6 +38,7 @@ dev_usb_wlan = off
 dev_wlan_rtwn = off
 iic = on
 display = on
+ti_pinmux = on
 dhcpcd = on
 dpaa = on
 evdev = on
diff --git a/libbsd.py b/libbsd.py
index 775eeeac..cdd97010 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -840,6 +840,38 @@ class display(builder.Module):
 mm.generator['source']()
 )
 
+#
+# TI PINMUX
+#
+class ti_pinmux(builder.Module):
+
+def __init__(self, manager):
+super(ti_pinmux, self).__init__(manager, type(self).__name__)
+
+def generate(self):
+mm = self.manager
+self.addKernelSpaceHeaderFiles(
+[
+'sys/arm/ti/ti_pinmux.h',
+'sys/arm/ti/omap4/omap4_scm_padconf.h',
+'sys/arm/ti/am335x/am335x_scm_padconf.h',
+]
+)
+self.addKernelSpaceSourceFiles(
+[
+'sys/arm/ti/ti_pinmux.c',
+'sys/dev/fdt/fdt_pinctrl.c',
+'sys/arm/ti/am335x/am335x_scm_padconf.c',
+],
+mm.generator['source']()
+)
+self.addRTEMSSourceFiles(
+[
+'local/fdt_pinctrl_if.c',
+],
+mm.generator['source']()
+)
+
 #
 # USB
 #
@@ -5198,6 +5230,7 @@ def load(mm):
 mm.addModule(evdev(mm))
 mm.addModule(iic(mm))
 mm.addModule(display(mm))
+mm.addModule(ti_pinmux(mm))
 
 mm.addModule(dev_usb(mm))
 mm.addModule(dev_usb_controller(mm))
diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index 313c40d4..a22102c8 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -54,6 +54,7 @@ RTEMS_BSD_DRIVER_SMC0(0x4e00,  RVPBXA9_IRQ_ETHERNET);
 RTEMS_BSD_DEFINE_NEXUS_DEVICE(ofwbus, 0, 0, NULL);
 SYSINIT_DRIVER_REFERENCE(simplebus, ofwbus);
 SYSINIT_DRIVER_REFERENCE(ti_scm, simplebus);
+SYSINIT_DRIVER_REFERENCE(ti_pinmux, simplebus);
 SYSINIT_DRIVER_REFERENCE(am335x_prcm, simplebus);
 SYSINIT_DRIVER_REFERENCE(usbss, simplebus);
 SYSINIT_DRIVER_REFERENCE(musbotg, usbss);
diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h 
b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
index d796d3d1..96ca6a7c 100644
--- a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
+++ b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
@@ -1294,6 +1294,10 @@
 #definefdt_immr_va _bsd_fdt_immr_va
 #definefdt_is_compatible_strict _bsd_fdt_is_compatible_strict
 #definefdt_parent_addr_cells _bsd_fdt_parent_addr_cells
+#definefdt_pinctrl_configure _bsd_fdt_pinctrl_configure
+#definefdt_pinctrl_configure_by_name _bsd_fdt_pinctrl_configure_by_name
+#definefdt_pinctrl_configure_tree _bsd_fdt_pinctrl_configure_tree
+#definefdt_pinctrl_register _bsd_fdt_pinctrl_register
 #definefdt_regsize _bsd_fdt_regsize
 #definefib4_free_nh_ext _bsd_fib4_free_nh_ext
 #definefib4_lookup_nh_basic _bsd_fib4_lookup_nh_basic
@@ -5038,6 +5042,7 @@
 #definet_functions _bsd_t_functions
 #definet_functions_inited _bsd_t_functions_inited
 

[PATCH 06/10] fbd : Port to RTEMS

2019-07-26 Thread Vijay Kumar Banerjee
---
 freebsd/sys/dev/fb/fbd.c  |  3 ++
 libbsd.py |  4 +++
 rtemsbsd/include/bsp/nexus-devices.h  |  3 ++
 .../machine/rtems-bsd-kernel-namespace.h  | 35 +++
 rtemsbsd/include/rtems/bsd/local/opt_fb.h |  0
 5 files changed, 45 insertions(+)
 create mode 100644 rtemsbsd/include/rtems/bsd/local/opt_fb.h

diff --git a/freebsd/sys/dev/fb/fbd.c b/freebsd/sys/dev/fb/fbd.c
index 60ce4bc3..33cdc348 100644
--- a/freebsd/sys/dev/fb/fbd.c
+++ b/freebsd/sys/dev/fb/fbd.c
@@ -59,6 +59,9 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#ifdef __rtems__
+#define vtophys(a) (a)
+#endif /* __rtems__ */
 
 LIST_HEAD(fb_list_head_t, fb_list_entry) fb_list_head =
 LIST_HEAD_INITIALIZER(fb_list_head);
diff --git a/libbsd.py b/libbsd.py
index 4808105b..71eb3577 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -807,6 +807,8 @@ class display(builder.Module):
 'sys/sys/fbio.h',
 'sys/sys/consio.h',
 'sys/sys/terminal.h',
+'sys/dev/vt/hw/fb/vt_fb.h',
+'sys/dev/vt/colors/vt_termcolors.h',
 ]
 )
 self.addKernelSpaceSourceFiles(
@@ -821,6 +823,8 @@ class display(builder.Module):
 'sys/arm/ti/am335x/am335x_lcd.c',
 'sys/arm/ti/am335x/am335x_pwmss.c',
 'sys/arm/ti/am335x/am335x_ecap.c',
+'sys/dev/fb/fb.c',
+'sys/dev/fb/fbd.c',
 ],
 mm.generator['source']()
 )
diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index 2c718295..313c40d4 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -68,6 +68,9 @@ SYSINIT_DRIVER_REFERENCE(ofw_iicbus, rtems_i2c);
 SYSINIT_DRIVER_REFERENCE(iic, iicbus);
 SYSINIT_DRIVER_REFERENCE(tda, iicbus);
 SYSINIT_DRIVER_REFERENCE(iicbus, rtems_i2c);
+SYSINIT_DRIVER_REFERENCE(fbd, fb);
+SYSINIT_DRIVER_REFERENCE(fb, fb_mod);
+SYSINIT_MODULE_REFERENCE(fb_mod);
 #ifdef RTEMS_BSD_MODULE_NET80211
 SYSINIT_DRIVER_REFERENCE(rtwn_usb, uhub);
 SYSINIT_MODULE_REFERENCE(wlan_ratectl_none);
diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h 
b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
index 3951da79..d796d3d1 100644
--- a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
+++ b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
@@ -1266,6 +1266,16 @@
 #defineeventhandler_find_list _bsd_eventhandler_find_list
 #defineeventhandler_prune_list _bsd_eventhandler_prune_list
 #defineeventhandler_register _bsd_eventhandler_register
+#definefb_commonioctl _bsd_fb_commonioctl
+#definefbd_devclass _bsd_fbd_devclass
+#definefbd_driver _bsd_fbd_driver
+#definefbd_list _bsd_fbd_list
+#definefbd_register _bsd_fbd_register
+#definefb_dump_adp_info _bsd_fb_dump_adp_info
+#definefb_dump_mode_info _bsd_fb_dump_mode_info
+#definefbd_unregister _bsd_fbd_unregister
+#definefb_list_head _bsd_fb_list_head
+#definefb_type _bsd_fb_type
 #definefdt_addrsize_cells _bsd_fdt_addrsize_cells
 #definefdt_data_get _bsd_fdt_data_get
 #definefdt_data_to_res _bsd_fdt_data_to_res
@@ -5515,8 +5525,18 @@
 #definevht80_chan_ranges _bsd_vht80_chan_ranges
 #definevesagtf_mode _bsd_vesagtf_mode
 #definevesagtf_mode_params _bsd_vesagtf_mode_params
+#definevid_allocate _bsd_vid_allocate
+#definevid_configure _bsd_vid_configure
 #definevideomode_count _bsd_videomode_count
 #definevideomode_list _bsd_videomode_list
+#definevid_find_adapter _bsd_vid_find_adapter
+#definevid_get_adapter _bsd_vid_get_adapter
+#definevid_get_switch _bsd_vid_get_switch
+#definevid_init_struct _bsd_vid_init_struct
+#definevid_register _bsd_vid_register
+#definevid_release _bsd_vid_release
+#definevidsw _bsd_vidsw
+#definevid_unregister _bsd_vid_unregister
 #definevlan_cookie_p _bsd_vlan_cookie_p
 #definevlan_devat_p _bsd_vlan_devat_p
 #definevlan_input_p _bsd_vlan_input_p
@@ -5533,6 +5553,21 @@
 #definevsnprintf _bsd_vsnprintf
 #definevsnrprintf _bsd_vsnrprintf
 #definevsprintf _bsd_vsprintf
+#definevt_fb_attach _bsd_vt_fb_attach
+#definevt_fb_bitblt_bitmap _bsd_vt_fb_bitblt_bitmap
+#definevt_fb_bitblt_text _bsd_vt_fb_bitblt_text
+#definevt_fb_blank _bsd_vt_fb_blank
+#definevt_fb_detach _bsd_vt_fb_detach
+#definevt_fb_drawrect _bsd_vt_fb_drawrect
+#definevt_fb_fini _bsd_vt_fb_fini
+#definevt_fb_init _bsd_vt_fb_init
+#definevt_fb_invalidate_text _bsd_vt_fb_invalidate_text
+#definevt_fb_ioctl _bsd_vt_fb_ioctl
+#definevt_fb_mmap _bsd_vt_fb_mmap
+#definevt_fb_postswitch _bsd_vt_fb_postswitch
+#define  

[PATCH 04/10] am335x display drivers : Port to RTEMS

2019-07-26 Thread Vijay Kumar Banerjee
---
 Makefile.todo | 13 ++
 libbsd.py | 12 +
 rtemsbsd/include/bsp/nexus-devices.h  |  2 +
 .../machine/rtems-bsd-kernel-namespace.h  |  2 +
 rtemsbsd/include/rtems/bsd/local/fb_if.h  | 45 +++
 rtemsbsd/include/rtems/bsd/local/opt_splash.h |  0
 .../include/rtems/bsd/local/opt_syscons.h |  0
 rtemsbsd/include/rtems/bsd/local/opt_teken.h  |  0
 rtemsbsd/local/fb_if.c| 30 +
 9 files changed, 104 insertions(+)
 create mode 100644 rtemsbsd/include/rtems/bsd/local/fb_if.h
 create mode 100644 rtemsbsd/include/rtems/bsd/local/opt_splash.h
 create mode 100644 rtemsbsd/include/rtems/bsd/local/opt_syscons.h
 create mode 100644 rtemsbsd/include/rtems/bsd/local/opt_teken.h
 create mode 100644 rtemsbsd/local/fb_if.c

diff --git a/Makefile.todo b/Makefile.todo
index 358d6956..ed1e428e 100644
--- a/Makefile.todo
+++ b/Makefile.todo
@@ -51,6 +51,8 @@ GENERATED += $(LOCAL_INC)/clknode_if.h
 GENERATED += $(LOCAL_SRC)/clknode_if.c
 GENERATED += $(LOCAL_INC)/hdmi_if.h
 GENERATED += $(LOCAL_SRC)/hdmi_if.c
+GENERATED += $(LOCAL_INC)/fb_if.h
+GENERATED += $(LOCAL_SRC)/fb_if.c
 GENERATED += rtemsbsd/include/machine/rtems-bsd-regdomain.h
 GENERATED += rtemsbsd/rtems/rtems-bsd-regdomain.c
 
@@ -266,6 +268,17 @@ $(LOCAL_SRC)/hdmi_if.c: 
$(FREEBSD_SRC)/sys/dev/hdmi/hdmi_if.m
-e 's|#include "hdmi_if.h"|#include |'
mv hdmi_if.c $@
 
+$(LOCAL_INC)/fb_if.h: $(FREEBSD_SRC)/sys/dev/fb/fb_if.m
+   awk -f $(TOOLS)/makeobjops.awk $< -h
+   mv fb_if.h $@
+
+$(LOCAL_SRC)/fb_if.c: $(FREEBSD_SRC)/sys/dev/fb/fb_if.m
+   awk -f $(TOOLS)/makeobjops.awk $< -c
+   sed -i fb_if.c \
+   -e '1 i\#include \n' \
+   -e 's|#include "fb_if.h"|#include |'
+   mv fb_if.c $@
+
 $(LOCAL_SRC)/gpio_if.c: $(FREEBSD_SRC)/sys/dev/gpio/gpio_if.m
awk -f $(TOOLS)/makeobjops.awk $< -c
mv gpio_if.c $@
diff --git a/libbsd.py b/libbsd.py
index bb4f27e1..4808105b 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -799,6 +799,14 @@ class display(builder.Module):
 'sys/dev/videomode/ediddevs.h',
 'sys/dev/videomode/ediddevs_data.h',
 'sys/dev/videomode/vesagtf.h',
+'sys/arm/ti/am335x/am335x_lcd.h',
+'sys/arm/ti/am335x/am335x_pwm.h',
+'sys/dev/fb/fbreg.h',
+'sys/dev/vt/vt.h',
+'sys/teken/teken.h',
+'sys/sys/fbio.h',
+'sys/sys/consio.h',
+'sys/sys/terminal.h',
 ]
 )
 self.addKernelSpaceSourceFiles(
@@ -810,6 +818,9 @@ class display(builder.Module):
 'sys/dev/videomode/edid.c',
 'sys/dev/videomode/vesagtf.c',
 'sys/dev/videomode/videomode.c',
+'sys/arm/ti/am335x/am335x_lcd.c',
+'sys/arm/ti/am335x/am335x_pwmss.c',
+'sys/arm/ti/am335x/am335x_ecap.c',
 ],
 mm.generator['source']()
 )
@@ -817,6 +828,7 @@ class display(builder.Module):
 [
 'local/clknode_if.c',
 'local/hdmi_if.c',
+'local/fb_if.c',
 ],
 mm.generator['source']()
 )
diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index 3ec136ae..2c718295 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -61,6 +61,8 @@ SYSINIT_DRIVER_REFERENCE(sdhci_ti, simplebus);
 SYSINIT_DRIVER_REFERENCE(mmcsd, mmc);
 SYSINIT_DRIVER_REFERENCE(cpsw, cpswss);
 SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
+SYSINIT_DRIVER_REFERENCE(am335x_lcd, simplebus);
+SYSINIT_DRIVER_REFERENCE(am335x_pwmss, simplebus);
 SYSINIT_DRIVER_REFERENCE(rtems_i2c, simplebus);
 SYSINIT_DRIVER_REFERENCE(ofw_iicbus, rtems_i2c);
 SYSINIT_DRIVER_REFERENCE(iic, iicbus);
diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h 
b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
index bef9f411..3951da79 100644
--- a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
+++ b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
@@ -46,6 +46,8 @@
 #definealtq_remove _bsd_altq_remove
 #definealtq_remove_queue _bsd_altq_remove_queue
 #definealtqs_inactive_open _bsd_altqs_inactive_open
+#defineam335x_pwm_config_ecap _bsd_am335x_pwm_config_ecap
+#defineam335x_pwmss_driver _bsd_am335x_pwmss_driver
 #definearp_announce_ifaddr _bsd_arp_announce_ifaddr
 #definearp_ifinit _bsd_arp_ifinit
 #definearprequest _bsd_arprequest
diff --git a/rtemsbsd/include/rtems/bsd/local/fb_if.h 
b/rtemsbsd/include/rtems/bsd/local/fb_if.h
new file mode 100644
index ..7b97028f
--- /dev/null
+++ b/rtemsbsd/include/rtems/bsd/local/fb_if.h
@@ -0,0 +1,45 @@
+/*
+ * This file is @generated automatically.
+ * Do not modify 

[PATCH 02/10] TDA19988 : port to RTEMS

2019-07-26 Thread Vijay Kumar Banerjee
---
 Makefile.todo | 27 ++
 buildset/default.ini  |  1 +
 libbsd.py | 45 +
 rtemsbsd/include/bsp/nexus-devices.h  |  1 +
 .../machine/rtems-bsd-kernel-namespace.h  | 65 +
 rtemsbsd/include/rtems/bsd/local/clknode_if.h | 92 +++
 rtemsbsd/include/rtems/bsd/local/hdmi_if.h| 71 ++
 .../include/rtems/bsd/local/opt_videomode.h   |  0
 rtemsbsd/local/clknode_if.c   | 40 
 rtemsbsd/local/hdmi_if.c  | 35 +++
 10 files changed, 377 insertions(+)
 create mode 100644 rtemsbsd/include/rtems/bsd/local/clknode_if.h
 create mode 100644 rtemsbsd/include/rtems/bsd/local/hdmi_if.h
 create mode 100644 rtemsbsd/include/rtems/bsd/local/opt_videomode.h
 create mode 100644 rtemsbsd/local/clknode_if.c
 create mode 100644 rtemsbsd/local/hdmi_if.c

diff --git a/Makefile.todo b/Makefile.todo
index 42bedc15..358d6956 100644
--- a/Makefile.todo
+++ b/Makefile.todo
@@ -47,6 +47,10 @@ GENERATED += $(LOCAL_INC)/gpiobus_if.h
 GENERATED += $(LOCAL_SRC)/gpiobus_if.c
 GENERATED += $(LOCAL_INC)/iicbus_if.h
 GENERATED += $(LOCAL_SRC)/iicbus_if.c
+GENERATED += $(LOCAL_INC)/clknode_if.h
+GENERATED += $(LOCAL_SRC)/clknode_if.c
+GENERATED += $(LOCAL_INC)/hdmi_if.h
+GENERATED += $(LOCAL_SRC)/hdmi_if.c
 GENERATED += rtemsbsd/include/machine/rtems-bsd-regdomain.h
 GENERATED += rtemsbsd/rtems/rtems-bsd-regdomain.c
 
@@ -239,6 +243,29 @@ $(LOCAL_SRC)/sdhci_if.c: 
$(FREEBSD_SRC)/sys/dev/sdhci/sdhci_if.m
-e 's|#include "sdhci_if.h"|#include |'
mv sdhci_if.c $@
 
+
+$(LOCAL_INC)/clknode_if.h: $(FREEBSD_SRC)/sys/dev/extres/clk/clknode_if.m
+   awk -f $(TOOLS)/makeobjops.awk $< -h
+   mv clknode_if.h $@
+
+$(LOCAL_SRC)/clknode_if.c: $(FREEBSD_SRC)/sys/dev/extres/clk/clknode_if.m
+   awk -f $(TOOLS)/makeobjops.awk $< -c
+   sed -i clknode_if.c \
+   -e '1 i\#include \n' \
+   -e 's|#include "clknode_if.h"|#include 
|'
+   mv clknode_if.c $@
+
+$(LOCAL_INC)/hdmi_if.h: $(FREEBSD_SRC)/sys/dev/hdmi/hdmi_if.m
+   awk -f $(TOOLS)/makeobjops.awk $< -h
+   mv hdmi_if.h $@
+
+$(LOCAL_SRC)/hdmi_if.c: $(FREEBSD_SRC)/sys/dev/hdmi/hdmi_if.m
+   awk -f $(TOOLS)/makeobjops.awk $< -c
+   sed -i hdmi_if.c \
+   -e '1 i\#include \n' \
+   -e 's|#include "hdmi_if.h"|#include |'
+   mv hdmi_if.c $@
+
 $(LOCAL_SRC)/gpio_if.c: $(FREEBSD_SRC)/sys/dev/gpio/gpio_if.m
awk -f $(TOOLS)/makeobjops.awk $< -c
mv gpio_if.c $@
diff --git a/buildset/default.ini b/buildset/default.ini
index 4acb2368..1d052a48 100644
--- a/buildset/default.ini
+++ b/buildset/default.ini
@@ -37,6 +37,7 @@ dev_usb_storage = on
 dev_usb_wlan = off
 dev_wlan_rtwn = off
 iic = on
+display = on
 dhcpcd = on
 dpaa = on
 evdev = on
diff --git a/libbsd.py b/libbsd.py
index 12d4c2ed..bb4f27e1 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -777,6 +777,50 @@ class iic(builder.Module):
 mm.generator['source']()
 )
 
+
+#
+# DISPLAY
+#
+class display(builder.Module):
+
+def __init__(self, manager):
+super(display, self).__init__(manager, type(self).__name__)
+
+def generate(self):
+mm = self.manager
+self.addKernelSpaceHeaderFiles(
+[
+'sys/dev/extres/clk/clk.h',
+'sys/dev/hdmi/dwc_hdmi.h',
+'sys/dev/hdmi/dwc_hdmireg.h',
+'sys/dev/videomode/videomode.h',
+'sys/dev/videomode/edidvar.h',
+'sys/dev/videomode/edidreg.h',
+'sys/dev/videomode/ediddevs.h',
+'sys/dev/videomode/ediddevs_data.h',
+'sys/dev/videomode/vesagtf.h',
+]
+)
+self.addKernelSpaceSourceFiles(
+[
+'sys/arm/ti/am335x/tda19988.c',
+'sys/dev/hdmi/dwc_hdmi.c',
+'sys/dev/hdmi/dwc_hdmi_fdt.c',
+'sys/dev/videomode/pickmode.c',
+'sys/dev/videomode/edid.c',
+'sys/dev/videomode/vesagtf.c',
+'sys/dev/videomode/videomode.c',
+],
+mm.generator['source']()
+)
+self.addRTEMSSourceFiles(
+[
+'local/clknode_if.c',
+'local/hdmi_if.c',
+],
+mm.generator['source']()
+)
+
 #
 # USB
 #
@@ -5134,6 +5178,7 @@ def load(mm):
 mm.addModule(dev_input(mm))
 mm.addModule(evdev(mm))
 mm.addModule(iic(mm))
+mm.addModule(display(mm))
 
 mm.addModule(dev_usb(mm))
 mm.addModule(dev_usb_controller(mm))
diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index 97f6d2b2..3ec136ae 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -64,6 +64,7 @@ SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
 SYSINIT_DRIVER_REFERENCE(rtems_i2c, 

[PATCH 07/10] VT : Import from FreeBSD

2019-07-26 Thread Vijay Kumar Banerjee
---
 freebsd/sys/dev/vt/colors/vt_termcolors.c |  181 ++
 freebsd/sys/dev/vt/hw/fb/vt_fb.c  |  528 
 freebsd/sys/dev/vt/vt_core.c  | 2933 +
 3 files changed, 3642 insertions(+)
 create mode 100644 freebsd/sys/dev/vt/colors/vt_termcolors.c
 create mode 100644 freebsd/sys/dev/vt/hw/fb/vt_fb.c
 create mode 100644 freebsd/sys/dev/vt/vt_core.c

diff --git a/freebsd/sys/dev/vt/colors/vt_termcolors.c 
b/freebsd/sys/dev/vt/colors/vt_termcolors.c
new file mode 100644
index ..c7ef4b80
--- /dev/null
+++ b/freebsd/sys/dev/vt/colors/vt_termcolors.c
@@ -0,0 +1,181 @@
+#include 
+
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2013 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Aleksandr Rybalko under sponsorship from the
+ * FreeBSD Foundation.
+ *
+ * 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 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+
+#include 
+
+static struct {
+   unsigned char r;/* Red percentage value. */
+   unsigned char g;/* Green percentage value. */
+   unsigned char b;/* Blue percentage value. */
+} color_def[NCOLORS] = {
+   {0, 0,  0}, /* black */
+   {50,0,  0}, /* dark red */
+   {0, 50, 0}, /* dark green */
+   {77,63, 0}, /* dark yellow */
+   {20,40, 64},/* dark blue */
+   {50,0,  50},/* dark magenta */
+   {0, 50, 50},/* dark cyan */
+   {75,75, 75},/* light gray */
+
+   {18,20, 21},/* dark gray */
+   {100,   0,  0}, /* light red */
+   {0, 100,0}, /* light green */
+   {100,   100,0}, /* light yellow */
+   {45,62, 81},/* light blue */
+   {100,   0,  100},   /* light magenta */
+   {0, 100,100},   /* light cyan */
+   {100,   100,100},   /* white */
+};
+
+static int
+vt_parse_rgb_triplet(const char *rgb, unsigned char *r,
+unsigned char *g, unsigned char *b)
+{
+   unsigned long v;
+   const char *ptr;
+   char *endptr;
+
+   ptr = rgb;
+
+   /* Handle #rrggbb case */
+   if (*ptr == '#') {
+   if (strlen(ptr) != 7)
+   return (-1);
+   v = strtoul(ptr + 1, , 16);
+   if (*endptr != '\0')
+   return (-1);
+
+   *r = (v >> 16) & 0xff;
+   *g = (v >>  8) & 0xff;
+   *b = v & 0xff;
+
+   return (0);
+   }
+
+   /* "r, g, b" case */
+   v = strtoul(ptr, , 10);
+   if (ptr == endptr)
+   return (-1);
+   if (v > 255)
+   return (-1);
+   *r = v & 0xff;
+   ptr = endptr;
+
+   /* skip separator */
+   while (*ptr == ',' || *ptr == ' ')
+   ptr++;
+
+   v = strtoul(ptr, , 10);
+   if (ptr == endptr)
+   return (-1);
+   if (v > 255)
+   return (-1);
+   *g = v & 0xff;
+   ptr = endptr;
+
+   /* skip separator */
+   while (*ptr == ',' || *ptr == ' ')
+   ptr++;
+
+   v = strtoul(ptr, , 10);
+   if (ptr == endptr)
+   return (-1);
+   if (v > 255)
+   return (-1);
+   *b = v & 0xff;
+   ptr = endptr;
+
+   /* skip trailing spaces */
+   while (*ptr == ' ')
+   ptr++;
+
+   /* unexpected characters at the end of the string */
+   if (*ptr != 0)
+   return (-1);
+
+   return (0);
+}
+
+static void
+vt_palette_init(void)
+{
+   int i;
+   char rgb[32];
+   char tunable[32];
+ 

[PATCH 05/10] fbd : Import from FreeBSD

2019-07-26 Thread Vijay Kumar Banerjee
---
 freebsd/sys/dev/fb/fb.c   | 762 ++
 freebsd/sys/dev/fb/fbd.c  | 372 +++
 freebsd/sys/dev/vt/colors/vt_termcolors.h |  63 ++
 freebsd/sys/dev/vt/hw/fb/vt_fb.h  |  54 ++
 4 files changed, 1251 insertions(+)
 create mode 100644 freebsd/sys/dev/fb/fb.c
 create mode 100644 freebsd/sys/dev/fb/fbd.c
 create mode 100644 freebsd/sys/dev/vt/colors/vt_termcolors.h
 create mode 100644 freebsd/sys/dev/vt/hw/fb/vt_fb.h

diff --git a/freebsd/sys/dev/fb/fb.c b/freebsd/sys/dev/fb/fb.c
new file mode 100644
index ..a3263c91
--- /dev/null
+++ b/freebsd/sys/dev/fb/fb.c
@@ -0,0 +1,762 @@
+#include 
+
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1999 Kazutaka YOKOTA 
+ * 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 as
+ *the first lines of this file unmodified.
+ * 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. The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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 
+__FBSDID("$FreeBSD$");
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+SET_DECLARE(videodriver_set, const video_driver_t);
+
+/* local arrays */
+
+/*
+ * We need at least one entry each in order to initialize a video card
+ * for the kernel console.  The arrays will be increased dynamically
+ * when necessary.
+ */
+
+static int vid_malloc;
+static int adapters = 1;
+static video_adapter_t *adp_ini;
+static video_adapter_t **adapter = _ini;
+static video_switch_t  *vidsw_ini;
+   video_switch_t  **vidsw = _ini;
+
+#ifdef FB_INSTALL_CDEV
+static struct cdevsw   *vidcdevsw_ini;
+static struct cdevsw   **vidcdevsw = _ini;
+#endif
+
+#define ARRAY_DELTA4
+
+static int
+vid_realloc_array(void)
+{
+   video_adapter_t **new_adp;
+   video_switch_t **new_vidsw;
+#ifdef FB_INSTALL_CDEV
+   struct cdevsw **new_cdevsw;
+#endif
+   int newsize;
+   int s;
+
+   if (!vid_malloc)
+   return ENOMEM;
+
+   s = spltty();
+   newsize = rounddown(adapters + ARRAY_DELTA, ARRAY_DELTA);
+   new_adp = malloc(sizeof(*new_adp)*newsize, M_DEVBUF, M_WAITOK | M_ZERO);
+   new_vidsw = malloc(sizeof(*new_vidsw)*newsize, M_DEVBUF,
+   M_WAITOK | M_ZERO);
+#ifdef FB_INSTALL_CDEV
+   new_cdevsw = malloc(sizeof(*new_cdevsw)*newsize, M_DEVBUF,
+   M_WAITOK | M_ZERO);
+#endif
+   bcopy(adapter, new_adp, sizeof(*adapter)*adapters);
+   bcopy(vidsw, new_vidsw, sizeof(*vidsw)*adapters);
+#ifdef FB_INSTALL_CDEV
+   bcopy(vidcdevsw, new_cdevsw, sizeof(*vidcdevsw)*adapters);
+#endif
+   if (adapters > 1) {
+   free(adapter, M_DEVBUF);
+   free(vidsw, M_DEVBUF);
+#ifdef FB_INSTALL_CDEV
+   free(vidcdevsw, M_DEVBUF);
+#endif
+   }
+   adapter = new_adp;
+   vidsw = new_vidsw;
+#ifdef FB_INSTALL_CDEV
+   vidcdevsw = new_cdevsw;
+#endif
+   adapters = newsize;
+   splx(s);
+
+   if (bootverbose)
+   printf("fb: new array size %d\n", adapters);
+
+   return 0;
+}
+
+static void
+vid_malloc_init(void *arg)
+{
+   vid_malloc = TRUE;
+}
+
+SYSINIT(vid_mem, SI_SUB_KMEM, SI_ORDER_ANY, vid_malloc_init, NULL);
+
+/*
+ * Low-level frame buffer driver functions
+ * frame buffer subdrivers, such as the VGA driver, call these functions
+ * to initialize the video_adapter structure and register it to the virtual
+ * frame buffer driver `fb'.
+ */
+
+/* initialize the video_adapter_t structure */
+void
+vid_init_struct(video_adapter_t *adp, char *name, int type, int unit)
+{
+   adp->va_flags = 0;
+   

[PATCH] Add framebuffer in BBB

2019-07-26 Thread Vijay Kumar Banerjee
Hello everyone!

I'm excited to post the following patchset. With this patchset
I have the framebuffer working in BBB and have tested it with a 
BBB revC with HDMI connected Screen. 

This patchset uses mmap and hence it's necessary to apply the
patche ON TOP OF mmap patch to avoid merge conflict.

In reply to this mail, I'll be attaching a picture of the screen
where my rectangle drawing application made a nice red rectangle
on the screen just like in FreeBSD.

Thanks and regards,
Vijay


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


Patch review process

2019-07-26 Thread Sebastian Huber

Hello,

Joel asked me to document the normal patch review process. Should this 
be in a "Contributing" chapter in the user manual or should this stuff 
be in the RTEMS Software Engineering manual?


--
Sebastian Huber, embedded brains GmbH

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

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 1/3] bsps/arm: Remove register init for ARMv7-M

2019-07-26 Thread Chris Johns
I have tested hello.exe on RPi2, BBB, and Zedboard and all are OK.

Please push.

I will run the full test suite after.

Thank you for the fix.
Chris

On 26/7/19 4:17 pm, Sebastian Huber wrote:
> There are no known ARMv7-M chips with a dual lockstep mode.
> 
> Update #3773.
> ---
>  bsps/arm/shared/start/start.S | 13 +
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/bsps/arm/shared/start/start.S b/bsps/arm/shared/start/start.S
> index 80b7d44dbe..a7fd7eda62 100644
> --- a/bsps/arm/shared/start/start.S
> +++ b/bsps/arm/shared/start/start.S
> @@ -369,12 +369,7 @@ bsp_start_vector_table_end:
>  
>  _start:
>  
> -#ifdef BSP_START_NEEDS_REGISTER_INITIALIZATION
> - bl bsp_start_init_registers_core
> -#endif
> -
> -#ifdef ARM_MULTILIB_VFP
> -#ifdef ARM_MULTILIB_HAS_CPACR
> +#if defined(ARM_MULTILIB_VFP) && defined(ARM_MULTILIB_HAS_CPACR)
>   /*
>* Enable CP10 and CP11 coprocessors for privileged and user mode in
>* CPACR (bits 20-23).  Ensure that write to register completes.
> @@ -387,12 +382,6 @@ _start:
>   isb
>  #endif
>  
> -#ifdef BSP_START_NEEDS_REGISTER_INITIALIZATION
> - bl bsp_start_init_registers_vfp
> -#endif
> -
> -#endif /* ARM_MULTILIB_VFP */
> -
>   ldr sp, =_ISR_Stack_area_end
>   ldr lr, =.Lstart_hook_0_done + 1
>   b   bsp_start_hook_0
> 
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] arm/start.S: Do not use a scratch register to hold the stack pointer

2019-07-26 Thread Chris Johns
On 26/7/19 4:23 pm, Sebastian Huber wrote:
> On 26/07/2019 07:41, Chris Johns wrote:
>> On 26/7/19 3:07 pm, Sebastian Huber wrote:
>>> On 26/07/2019 07:06, Sebastian Huber wrote:
 Hello Chris,

 I am not sure, if using r8 is the right thing to do since r8..r14 are 
 banked
 in FIQ mode. I think the bsp_start_arm_drop_hyp_mode needs to be changed to
 not touch r3, it can use r1 instead.
>>> I think the code should move to start.S also.
>> Sure, if you would like to do that. I have no time to spend on that sort of
>> change. I am happy to test a change.
> 
> I sent three patches to the mailing list. Would you mind testing them on top 
> of
> the master.
> 

Doing that now and thanks. :)

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


Re: [PATCH] arm/start.S: Do not use a scratch register to hold the stack pointer

2019-07-26 Thread Sebastian Huber

On 26/07/2019 07:41, Chris Johns wrote:

On 26/7/19 3:07 pm, Sebastian Huber wrote:

On 26/07/2019 07:06, Sebastian Huber wrote:

Hello Chris,

I am not sure, if using r8 is the right thing to do since r8..r14 are banked
in FIQ mode. I think the bsp_start_arm_drop_hyp_mode needs to be changed to
not touch r3, it can use r1 instead.

I think the code should move to start.S also.

Sure, if you would like to do that. I have no time to spend on that sort of
change. I am happy to test a change.


I sent three patches to the mailing list. Would you mind testing them on 
top of the master.


--
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 1/3] bsps/arm: Remove register init for ARMv7-M

2019-07-26 Thread Sebastian Huber
There are no known ARMv7-M chips with a dual lockstep mode.

Update #3773.
---
 bsps/arm/shared/start/start.S | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/bsps/arm/shared/start/start.S b/bsps/arm/shared/start/start.S
index 80b7d44dbe..a7fd7eda62 100644
--- a/bsps/arm/shared/start/start.S
+++ b/bsps/arm/shared/start/start.S
@@ -369,12 +369,7 @@ bsp_start_vector_table_end:
 
 _start:
 
-#ifdef BSP_START_NEEDS_REGISTER_INITIALIZATION
-   bl bsp_start_init_registers_core
-#endif
-
-#ifdef ARM_MULTILIB_VFP
-#ifdef ARM_MULTILIB_HAS_CPACR
+#if defined(ARM_MULTILIB_VFP) && defined(ARM_MULTILIB_HAS_CPACR)
/*
 * Enable CP10 and CP11 coprocessors for privileged and user mode in
 * CPACR (bits 20-23).  Ensure that write to register completes.
@@ -387,12 +382,6 @@ _start:
isb
 #endif
 
-#ifdef BSP_START_NEEDS_REGISTER_INITIALIZATION
-   bl bsp_start_init_registers_vfp
-#endif
-
-#endif /* ARM_MULTILIB_VFP */
-
ldr sp, =_ISR_Stack_area_end
ldr lr, =.Lstart_hook_0_done + 1
b   bsp_start_hook_0
-- 
2.16.4

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


[PATCH 2/3] bsps/arm: Move register init to start.S

2019-07-26 Thread Sebastian Huber
This makes it easier to review changes in start.S.

Update #3773.
---
 bsps/arm/shared/start/bsp-start-init-registers.S | 105 ---
 bsps/arm/shared/start/start.S|  59 -
 c/src/lib/libbsp/arm/tms570/Makefile.am  |   1 -
 3 files changed, 55 insertions(+), 110 deletions(-)
 delete mode 100644 bsps/arm/shared/start/bsp-start-init-registers.S

diff --git a/bsps/arm/shared/start/bsp-start-init-registers.S 
b/bsps/arm/shared/start/bsp-start-init-registers.S
deleted file mode 100644
index 961d3172bf..00
--- a/bsps/arm/shared/start/bsp-start-init-registers.S
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * @file
- *
- * @brief ARM register initialization routines.
- */
-
-/*
- * Copyright (c) 2015 Taller Technologies.  All rights reserved.
- *
- * @author Martin Galvan 
- *
- * 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.
- */
-
-/*
- * These routines initialize the core and VFP registers of ARM CPUs.
- * This is necessary for boards that operate in a 1oo1D fashion,
- * such as the TMS570.
- */
-
-#include 
-
-.section .text
-.syntax unified
-.cpu cortex-r4
-.arm
-
-/* Initialization of the ARM core registers. */
-FUNCTION_ENTRY(bsp_start_init_registers_core)
-   mov r0, #0
-   mov r1, #0
-   mov r2, #0
-   mov r3, #0
-   mov r4, #0
-   mov r5, #0
-   mov r6, #0
-   mov r7, #0
-   mov r8, #0
-   mov r9, #0
-   mov r10, #0
-   mov r11, #0
-   mov r12, #0
-   mov r13, #0
-
-   bx lr
-FUNCTION_END(bsp_start_init_registers_core)
-
-/* Initialization of the FIQ mode banked registers. */
-FUNCTION_ENTRY(bsp_start_init_registers_banked_fiq)
-   mov r8, #0
-   mov r9, #0
-   mov r10, #0
-   mov r11, #0
-   mov r12, #0
-
-   bx lr
-FUNCTION_END(bsp_start_init_registers_banked_fiq)
-
-#ifdef ARM_MULTILIB_VFP
-
-/* Initialization of the FPU registers. */
-FUNCTION_ENTRY(bsp_start_init_registers_vfp)
-   mov r0, #0
-   vmov d0, r0, r0
-   vmov d1, r0, r0
-   vmov d2, r0, r0
-   vmov d3, r0, r0
-   vmov d4, r0, r0
-   vmov d5, r0, r0
-   vmov d6, r0, r0
-   vmov d7, r0, r0
-   vmov d8, r0, r0
-   vmov d9, r0, r0
-   vmov d10, r0, r0
-   vmov d11, r0, r0
-   vmov d12, r0, r0
-   vmov d13, r0, r0
-   vmov d14, r0, r0
-   vmov d15, r0, r0
-
-#ifdef ARM_MULTILIB_VFP_D32
-   vmov d16, r0, r0
-   vmov d17, r0, r0
-   vmov d18, r0, r0
-   vmov d19, r0, r0
-   vmov d20, r0, r0
-   vmov d21, r0, r0
-   vmov d22, r0, r0
-   vmov d23, r0, r0
-   vmov d24, r0, r0
-   vmov d25, r0, r0
-   vmov d26, r0, r0
-   vmov d27, r0, r0
-   vmov d28, r0, r0
-   vmov d29, r0, r0
-   vmov d30, r0, r0
-   vmov d31, r0, r0
-#endif /* ARM_MULTILIB_VFP_D32 */
-
-   bx lr
-FUNCTION_END(bsp_start_init_registers_vfp)
-
-#endif /* ARM_MULTILIB_VFP */
diff --git a/bsps/arm/shared/start/start.S b/bsps/arm/shared/start/start.S
index a7fd7eda62..1f6d38f564 100644
--- a/bsps/arm/shared/start/start.S
+++ b/bsps/arm/shared/start/start.S
@@ -146,7 +146,20 @@ _start:
mov r5, r1  /* machine type number or ~0 for DT boot */
mov r6, r2  /* physical address of ATAGs or DTB */
 #else /* BSP_START_NEEDS_REGISTER_INITIALIZATION */
-   bl bsp_start_init_registers_core
+   mov r0, #0
+   mov r1, #0
+   mov r2, #0
+   mov r3, #0
+   mov r4, #0
+   mov r5, #0
+   mov r6, #0
+   mov r7, #0
+   mov r8, #0
+   mov r9, #0
+   mov r10, #0
+   mov r11, #0
+   mov r12, #0
+   mov r13, #0
 #endif
 
 #ifdef RTEMS_SMP
@@ -204,7 +217,11 @@ _start:
sub r3, r3, r1
 
 #ifdef BSP_START_NEEDS_REGISTER_INITIALIZATION
-   bl bsp_start_init_registers_banked_fiq
+   mov r8, #0
+   mov r9, #0
+   mov r10, #0
+   mov r11, #0
+   mov r12, #0
 #endif
 
/* Enter ABT mode and set up the ABT stack pointer */
@@ -271,8 +288,42 @@ _start:
vmsr FPEXC, r0
 
 #ifdef BSP_START_NEEDS_REGISTER_INITIALIZATION
-   bl bsp_start_init_registers_vfp
-#endif
+   mov r0, #0
+   vmovd0, r0, r0
+   vmovd1, r0, r0
+   vmovd2, r0, r0
+   vmovd3, r0, r0
+   vmovd4, r0, r0
+   vmovd5, r0, r0
+   vmovd6, r0, r0
+   vmovd7, r0, r0
+   vmovd8, r0, r0
+   vmovd9, r0, r0
+   vmovd10, r0, r0
+   vmovd11, r0, r0
+   vmovd12, r0, r0
+   vmovd13, r0, r0
+   vmovd14, r0, r0
+   vmovd15, r0, r0
+#ifdef ARM_MULTILIB_VFP_D32
+   vmovd16, r0, r0
+   vmovd17, r0, r0
+   vmovd18, r0, r0
+   vmovd19, r0, r0
+   vmovd20, r0, r0
+   vmovd21, r0, r0
+   

[PATCH 3/3] bsps/arm: Move HYP to SVC change to start.S

2019-07-26 Thread Sebastian Huber
This fixes the corruption of r3 by the call to
bsp_start_arm_drop_hyp_mode().

Moving the code makes it easier to review changes in start.S.

Close #3773.
---
 bsps/arm/shared/start/bsp-start-in-hyp-support.S | 76 
 bsps/arm/shared/start/start.S| 42 -
 c/src/lib/libbsp/arm/raspberrypi/Makefile.am |  3 -
 3 files changed, 40 insertions(+), 81 deletions(-)
 delete mode 100644 bsps/arm/shared/start/bsp-start-in-hyp-support.S

diff --git a/bsps/arm/shared/start/bsp-start-in-hyp-support.S 
b/bsps/arm/shared/start/bsp-start-in-hyp-support.S
deleted file mode 100644
index 5d3d5921c5..00
--- a/bsps/arm/shared/start/bsp-start-in-hyp-support.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * @file
- *
- * @brief Boot and system start code.
- */
-
- /*
- * Copyright (c) 2016 Pavel Pisa 
- *
- * Czech Technical University in Prague
- * Zikova 1903/4
- * 166 36 Praha 6
- * Czech Republic
- *
- * 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.
- */
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
-   .extern bsp_start_hyp_vector_table_begin
-   .globl  bsp_start_arm_drop_hyp_mode
-   .globl  bsp_arm_drop_hyp_mode_only
-
-.arm
-
-/*
- * The routine is called from startup code and it should
- * preserve all registers except r2 and r3. r0 can be used
- * as pass though argument in some cases, a1 is used for
- * CPU stack offset during startup and r4 to r6 to preserve
- * booloader arguments
- */
-
-bsp_start_arm_drop_hyp_mode:
-   ldr r2, bsp_start_hyp_vector_table_begin_addr
-   mcr p15, 4, r2, c12, c0, 0
-
-   mov r2, #0
-   mcr p15, 4, r2, c1, c1, 0
-   mcr p15, 4, r2, c1, c1, 2
-   mcr p15, 4, r2, c1, c1, 3
-/*
- * HSCTLR.TE
- * optional start of hypervisor handlers in Thumb mode
- * orr r0, #(1 << 30)
- */
-   mcr p15, 4, r2, c1, c0, 0   /* HSCTLR */
-   mrc p15, 4, r2, c1, c1, 1   /* HDCR */
-   and r2, #0x1f   /* Preserve HPMN */
-   mcr p15, 4, r2, c1, c1, 1   /* HDCR */
-
-bsp_arm_drop_hyp_mode_only:
-   /* Prepare SVC mode for eret */
-   mrs r2, cpsr
-   bic r2, r2, #ARM_PSR_M_MASK
-   orr r2, r2, #ARM_PSR_M_SVC
-   msr spsr_cxsf, r2
-
-   adr r2, 1f
-   .inst 0xe12ef302/* msr ELR_hyp, r2 */
-   mov r2, sp
-   mov r3, lr
-   .inst 0xe160006e/* eret */
-1: mov sp, r2
-   mov lr, r3
-   bx  lr
-
-bsp_start_hyp_vector_table_begin_addr:
-   .word   bsp_start_hyp_vector_table_begin
diff --git a/bsps/arm/shared/start/start.S b/bsps/arm/shared/start/start.S
index 1f6d38f564..0e9e6a0cde 100644
--- a/bsps/arm/shared/start/start.S
+++ b/bsps/arm/shared/start/start.S
@@ -13,6 +13,13 @@
  *  Germany
  *  
  *
+ * Copyright (c) 2016 Pavel Pisa 
+ *
+ *  Czech Technical University in Prague
+ *  Zikova 1903/4
+ *  166 36 Praha 6
+ *  Czech Republic
+ *
  * 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.
@@ -200,13 +207,44 @@ _start:
bne .L_skip_hyp_svc_switch
 
/* Boot loader starts kernel in HYP mode, switch to SVC necessary */
+
ldr r1, =bsp_stack_hyp_size
mov sp, r3
sub r3, r3, r1
-   bl  bsp_start_arm_drop_hyp_mode
+
+   ldr r2, =bsp_start_hyp_vector_table_begin
+   mcr p15, 4, r2, c12, c0, 0
+
+   mov r2, #0
+   mcr p15, 4, r2, c1, c1, 0
+   mcr p15, 4, r2, c1, c1, 2
+   mcr p15, 4, r2, c1, c1, 3
+/*
+ * HSCTLR.TE
+ * optional start of hypervisor handlers in Thumb mode
+ * orr r0, #(1 << 30)
+ */
+   mcr p15, 4, r2, c1, c0, 0   /* HSCTLR */
+   mrc p15, 4, r2, c1, c1, 1   /* HDCR */
+   and r2, #0x1f   /* Preserve HPMN */
+   mcr p15, 4, r2, c1, c1, 1   /* HDCR */
+
+   /* Prepare SVC mode for eret */
+   mrs r2, cpsr
+   bic r2, r2, #ARM_PSR_M_MASK
+   orr r2, r2, #ARM_PSR_M_SVC
+   msr spsr_cxsf, r2
+
+   adr r2, .L_hyp_to_svc_return
+   .inst 0xe12ef302/* msr ELR_hyp, r2 */
+   mov r2, sp
+   .inst 0xe160006e/* eret */
+.L_hyp_to_svc_return:
+   mov sp, r2
 
 .L_skip_hyp_svc_switch:
-#endif
+#endif /* BSP_START_IN_HYP_SUPPORT */
+
/* Initialize stack pointer registers for the various modes */
 
/* Enter FIQ mode and set up the FIQ stack pointer */
diff --git a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am 
b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
index 14a348411d..11a22f89e3 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
+++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
@@ -45,9 +45,6 @@ librtemsbsp_a_SOURCES +=