BeagleBoneBlack how to enable UART1

2014-11-12 Thread Eduardo Sanchez
Hi,
   The Beagle BSP from Ben Gras has only enabled the UART0 for console.
   Since I need another available UART; I wrote the code and I successfully
enabled the UART1 (Rx pin: P9_26 and Tx pin: P9_24) for the Beaglebone
Black.
   Attached you will find the patch code for this.
If you have any questions, please let me know.
Thanks and regards,
Eduardo.-



Eduardo Sanchez

Software Engineer

Taller Technologies Argentina

San Lorenzo 47, 3rd floor, Office 9

Cordoba, Argentina

Phone: +54 351 4217888 / +54 351 4218211

Skype:  sanchez.taller
diff --git a/c/src/lib/libbsp/arm/beagle/console/console-config.c 
b/c/src/lib/libbsp/arm/beagle/console/console-config.c
index 63c7ba7..b773d76 100644
--- a/c/src/lib/libbsp/arm/beagle/console/console-config.c
+++ b/c/src/lib/libbsp/arm/beagle/console/console-config.c
@@ -32,37 +32,127 @@
 
 #define CONSOLE_UART_THR (*(volatile unsigned int *)BSP_CONSOLE_UART_BASE)
 #define CONSOLE_UART_RHR (*(volatile unsigned int *)BSP_CONSOLE_UART_BASE)
-#define CONSOLE_UART_LSR (*(volatile unsigned int 
*)(BSP_CONSOLE_UART_BASE+0x14))
-#define CONSOLE_SYSC (*(volatile uint32_t *) (BSP_CONSOLE_UART_BASE + 0x54))
-#define CONSOLE_SYSS (*(volatile uint32_t *) (BSP_CONSOLE_UART_BASE + 0x58))
+#define CONSOLE_SYSC (*(volatile uint32_t *) (BSP_CONSOLE_UART_BASE + 
BEAGLE_UART_SYSC))
+#define CONSOLE_SYSS (*(volatile uint32_t *) (BSP_CONSOLE_UART_BASE + 
BEAGLE_UART_SYSS))
 
 #define TX_FIFO_E (1<<5)
 #define RX_FIFO_E (1<<0)
 
-static uint8_t beagle_uart_get_register(uintptr_t addr, uint8_t i)
+static bool beagle_uart2_probe(int minor); /* Prototype for warning 
suppression  */
+
+static uint8_t beagle_uart_get_register(uintptr_t addr, uint8_t offset)
 {
-  uint8_t v;
-  volatile uint32_t *reg_r = (volatile uint32_t *) addr + i;
+  volatile uint32_t *reg = (volatile uint32_t *) addr;
 
-  if(reg_r == (uint32_t*) BSP_CONSOLE_UART_BASE /* reading RHR */ ) {
-/* check there should be anything in the RHR before accessing it */
-if(!(CONSOLE_UART_LSR & 0x01)) {
-  return 0;
-}
-  }
+  return (uint8_t) reg [offset];
+}
 
-  v = (uint8_t) *reg_r;
+static void beagle_uart_set_register(uintptr_t addr, uint8_t offset, uint8_t 
val)
+{
+  volatile uint32_t *reg = (volatile uint32_t *) addr;
 
-  return v;
+  reg [offset] = val;
 }
 
-static void beagle_uart_set_register(uintptr_t addr, uint8_t i, uint8_t val)
+#if IS_AM335X
+
+/**
+ * @brief Enable clock for UART 2 module
+ *  Use when enabling UART2 in BeagleBone Black.
+*/
+
+static void beagle_uart2_enable_module(void)
+{
+   /* * * * * * * * * * * * * * * * * * * */
+   /* Enabling clock for UART2 Module */
+   /* * * * * * * * * * * * * * * * * * * */
+
+   /* Writing to MODULEMODE field of CM_PER_UART2_CLKCTRL register. */
+REG(CM_PER_BASE + BEAGLE_CM_PER_UART2_CLKCTRL) |=
+  CM_MODULEMODE_ENABLE;
+
+/* Waiting for MODULEMODE field to reflect the written value. */
+while(CM_MODULEMODE_ENABLE !=
+  (REG(CM_PER_BASE + BEAGLE_CM_PER_UART2_CLKCTRL) &
+  CM_MODULEMODE_MASK));
+}
+
+/**
+ * @brief Change GPIO pins to UART (Rx and Tx)
+ *  Use when enabling UART2 in BeagleBone Black.
+*/
+
+static void beagle_uart2_pinmux(void)
+{
+   /* * * * * * * * * * * * * * * * * * * */
+   /*   Set pinmux for UART2  */
+   /* * * * * * * * * * * * * * * * * * * */
+
+  /* RXD Pin: select pull-up and set pin as rx active */
+REG(BEAGLE_CONTROL_MODULE_BASE_REG + BEAGLE_CONF_UART2_RXD) =
+ (BEAGLE_CONF_UART2_RXD_PUTYPESEL |
+  BEAGLE_CONF_UART2_RXD_RXACTIVE);
+
+   /* TXD Pin: select pull-up */
+REG(BEAGLE_CONTROL_MODULE_BASE_REG + BEAGLE_CONF_UART2_TXD) =
+  BEAGLE_CONF_UART2_TXD_PUTYPESEL;
+}
+
+/**
+ * @brief Reset module
+ *  Use when enabling UART2 in BeagleBone Black.
+*/
+
+static void beagle_uart2_reset_module(void)
+{
+/* Performing Software Reset of the module. */
+REG(BEAGLE_BASE_UART_2 + BEAGLE_UART_SYSC) |= (BEAGLE_UART_SYSC_SOFTRESET);
+
+/* Wait until the process of Module Reset is complete. */
+while(!(REG(BEAGLE_BASE_UART_2 + BEAGLE_UART_SYSS) & 
BEAGLE_UART_SYSS_RESETDONE));
+
+}
+
+/**
+ * @brief Switch operating mode to "UART16x"
+ *  Use when enabling UART2 in BeagleBone Black.
+*/
+
+static void beagle_uart2_UART16x_operating_mode(void)
+{
+   /* Clearing the MODESELECT field in MDR1. */
+
+REG(BEAGLE_BASE_UART_2 + BEAGLE_UART_MDR1) &= 
~(BEAGLE_UART_MDR1_MODE_SELECT);
+/* Programming the MODESELECT field in MDR1. */
+REG(BEAGLE_BASE_UART_2 + BEAGLE_UART_MDR1) |= (BEAGLE_UART16x_OPER_MODE & 
BEAGLE_UART_MDR1_MODE_SELECT);
+
+}
+
+/**
+ * @brief Enable UART2 in BeagleBone Black.
+ *  Enable clock, pin setup, reset module and set operating mode.
+*/
+
+static bool beagle_uart2_probe(int minor)
 {
-  volatile uint32_t *reg = (volatile uint32_t *) addr;
 
-  reg [i] = val;
+  /* Enabling clock for UART2 Module */
+  beagle_uart2_enable_module();
+
+  /* Set pinmux for UART2 */
+  beagle_uart2_pinmux();
+
+  /* Reset UAR

[PATCH] ARM removed shared/abort from several ARM BSPs

2014-11-12 Thread Alan Cudmore
---
 c/src/lib/libbsp/arm/beagle/Makefile.am  |  1 -
 c/src/lib/libbsp/arm/gdbarmsim/Makefile.am   |  2 -
 c/src/lib/libbsp/arm/raspberrypi/Makefile.am |  1 -
 c/src/lib/libbsp/arm/shared/abort/abort.c| 29 +
 c/src/lib/libbsp/arm/shared/abort/abort.h| 52 
 c/src/lib/libbsp/arm/shared/abort/simple_abort.c | 24 +--
 6 files changed, 55 insertions(+), 54 deletions(-)
 create mode 100644 c/src/lib/libbsp/arm/shared/abort/abort.h

diff --git a/c/src/lib/libbsp/arm/beagle/Makefile.am 
b/c/src/lib/libbsp/arm/beagle/Makefile.am
index c6cf9e79..abef8ba 100644
--- a/c/src/lib/libbsp/arm/beagle/Makefile.am
+++ b/c/src/lib/libbsp/arm/beagle/Makefile.am
@@ -85,7 +85,6 @@ libbsp_a_SOURCES += ../../shared/src/stackalloc.c
 libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
 libbsp_a_SOURCES += ../../shared/timerstub.c
 libbsp_a_SOURCES += ../../shared/cpucounterread.c
-libbsp_a_SOURCES += ../shared/abort/simple_abort.c
 libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
 libbsp_a_SOURCES += ../shared/arm-cp15-set-exception-handler.c
 
diff --git a/c/src/lib/libbsp/arm/gdbarmsim/Makefile.am 
b/c/src/lib/libbsp/arm/gdbarmsim/Makefile.am
index f13ad7d..3265494 100644
--- a/c/src/lib/libbsp/arm/gdbarmsim/Makefile.am
+++ b/c/src/lib/libbsp/arm/gdbarmsim/Makefile.am
@@ -45,8 +45,6 @@ libbsp_a_SOURCES += ../../shared/console-polled.c 
console/console-io.c
 libbsp_a_SOURCES += ../../shared/clock_driver_simidle.c
 # timer
 libbsp_a_SOURCES += ../../shared/timerstub.c
-# above
-libbsp_a_SOURCES += ../shared/abort/abort.c
 # start hooks
 libbsp_a_SOURCES += startup/bspstarthooks.c
 libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
diff --git a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am 
b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
index 839c8de..ed134fa 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
+++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
@@ -86,7 +86,6 @@ libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
 libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
 libbsp_a_SOURCES += ../../shared/sbrk.c
 libbsp_a_SOURCES += ../../shared/src/stackalloc.c
-libbsp_a_SOURCES += ../shared/abort/simple_abort.c
 libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
 libbsp_a_SOURCES += ../shared/arm-cp15-set-ttb-entries.c
 
diff --git a/c/src/lib/libbsp/arm/shared/abort/abort.c 
b/c/src/lib/libbsp/arm/shared/abort/abort.c
index d509a2a..657b2f4 100644
--- a/c/src/lib/libbsp/arm/shared/abort/abort.c
+++ b/c/src/lib/libbsp/arm/shared/abort/abort.c
@@ -23,34 +23,7 @@
 #include 
 #include 
 #include 
-
-#define INSN_MASK 0xc5
-
-#define INSN_STM1 0x80
-#define INSN_STM2 0x84
-#define INSN_STR  0x40
-#define INSN_STRB 0x44
-
-#define INSN_LDM1 0x81
-#define INSN_LDM230x85
-#define INSN_LDR  0x41
-#define INSN_LDRB 0x45
-
-#define GET_RD(x) ((x & 0xf000) >> 12)
-#define GET_RN(x) ((x & 0x000f) >> 16)
-
-#define GET_U(x)  ((x & 0x0080) >> 23)
-#define GET_I(x)  ((x & 0x0200) >> 25)
-
-#define GET_REG(r, ctx)  (((uint32_t   *)ctx)[r])
-#define SET_REG(r, ctx, v)   (((uint32_t   *)ctx)[r] = v)
-#define GET_OFFSET(insn) (insn & 0xfff)
-
-/*
- * Prototypes
- */
-void _print_full_context(uint32_t);
-void do_data_abort(uint32_t, uint32_t, Context_Control *);
+#include "abort.h"
 
 uint32_t g_data_abort_cnt = 0;
 /*this is a big overhead for MCU only got 16K RAM*/
diff --git a/c/src/lib/libbsp/arm/shared/abort/abort.h 
b/c/src/lib/libbsp/arm/shared/abort/abort.h
new file mode 100644
index 000..6d8704f
--- /dev/null
+++ b/c/src/lib/libbsp/arm/shared/abort/abort.h
@@ -0,0 +1,52 @@
+/*
+ *  COPYRIGHT (c) 2007 Ray Xu.
+ *  mailto: Rayx at gmail dot com
+ *
+ *  COPYRIGHT (c) 2000 Canon Research Centre France SA.
+ *  Emmanuel Raguet, mailto:rag...@crf.canon.fr
+ *
+ *  Copyright (c) 2002 Advent Networks, Inc
+ *  Jay Monkman 
+ *
+ *  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 _BSPABORT_H
+#define _BSPABORT_H
+
+#include 
+#include 
+#include 
+
+#define INSN_MASK 0xc5
+
+#define INSN_STM1 0x80
+#define INSN_STM2 0x84
+#define INSN_STR  0x40
+#define INSN_STRB 0x44
+
+#define INSN_LDM1 0x81
+#define INSN_LDM230x85
+#define INSN_LDR  0x41
+#define INSN_LDRB 0x45
+
+#define GET_RD(x) ((x & 0xf000) >> 12)
+#define GET_RN(x) ((x & 0x000f) >> 16)
+
+#define GET_U(x)  ((x & 0x0080) >> 23)
+#define GET_I(x)  ((x & 0x0200) >> 25)
+
+#define GET_REG(r, ctx)  (((uint32_t   *)ctx)[r])
+#define SET_REG(r, ctx, v)   (((uint32_t   *)ctx)[r] = v)
+#define GET_OFFSET(insn) (insn & 0xfff)
+
+/*
+ * Prototypes
+ */
+void _print_full_context(uint32_t);
+void do_data

Re: Proposed RTEMS Community Code of Conduct

2014-11-12 Thread Ralf Corsepius

On 11/10/2014 06:11 PM, Joel Sherrill wrote:


While at the GSOC Mentor Summit, I heard a story from another
organization about some inappropriate behavior by someone.
They were fairly easily able to deal with this because their
organization had an agreed upon Community Code of Conduct (CCoC).
This provides guidelines on expected behavior as well as what
will occur if these are violated.


As you may know, I am opposed to any such Code of Conducts, as well as I 
do not see any need for the RTEMS list to implement one.



Why?

a) The issues you mention have never been a problem to the RTEMS list.
That said I feel you trying to implement problems to a current non-issue.

b) I for one consider "Code of Conducts" to an ongoing fashion/hype, 
which as I feel probably, originates from certain tendencies in US-society.


c) I have seen many occassions, where "Code of Conducts" have been 
applied as a means of censorship to silence and suppress oppositions in 
case of disagreement or dispute.


d) Some of these project who are proud to have implemented a "Code of 
Conduct" wonder about loosing users. Why? cf. c)


Ralf


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


[PATCH 1/3] smpschedaffinity02: Change semaphore attributes.

2014-11-12 Thread Jennifer Averett
Change semaphore attributes to prevent semaphore from being
locked and never released upon a context switch.
---
 testsuites/smptests/smpschedaffinity02/init.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/testsuites/smptests/smpschedaffinity02/init.c 
b/testsuites/smptests/smpschedaffinity02/init.c
index a3e0ddf..43efc99 100644
--- a/testsuites/smptests/smpschedaffinity02/init.c
+++ b/testsuites/smptests/smpschedaffinity02/init.c
@@ -140,11 +140,8 @@ static void test(void)
   sc = rtems_semaphore_create(  
 rtems_build_name('S', 'E', 'M', '0'),
 1,
-RTEMS_LOCAL   |
-RTEMS_SIMPLE_BINARY_SEMAPHORE |
-RTEMS_NO_INHERIT_PRIORITY |
-RTEMS_NO_PRIORITY_CEILING |
-RTEMS_FIFO,
+RTEMS_BINARY_SEMAPHORE |
+RTEMS_MULTIPROCESSOR_RESOURCE_SHARING, 
 0,
 &task_sem
   );  
-- 
1.8.1.4

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


[PATCH 2/3] smpschedaffinity04: Change semaphore attributes.

2014-11-12 Thread Jennifer Averett
Change semaphore attributes to prevent semaphore from being
locked and never released upon a context switch.
---
 testsuites/smptests/smpschedaffinity04/init.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/testsuites/smptests/smpschedaffinity04/init.c 
b/testsuites/smptests/smpschedaffinity04/init.c
index bdfc56c..3c860a8 100644
--- a/testsuites/smptests/smpschedaffinity04/init.c
+++ b/testsuites/smptests/smpschedaffinity04/init.c
@@ -85,11 +85,8 @@ static void test(void)
   sc = rtems_semaphore_create(  
 rtems_build_name('S', 'E', 'M', '0'),
 1,   /* initial count = 1 */
-RTEMS_LOCAL   |
-RTEMS_SIMPLE_BINARY_SEMAPHORE |
-RTEMS_NO_INHERIT_PRIORITY |
-RTEMS_NO_PRIORITY_CEILING |
-RTEMS_FIFO,
+RTEMS_BINARY_SEMAPHORE |
+RTEMS_MULTIPROCESSOR_RESOURCE_SHARING, 
 0,
 &task_sem
   );  
-- 
1.8.1.4

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


[PATCH 3/3] smpschedaffinity05: Change semaphore attributes.

2014-11-12 Thread Jennifer Averett
Change semaphore attributes to resolve problem where semaphore is not
released upon a context switch.
---
 testsuites/smptests/smpschedaffinity05/init.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/testsuites/smptests/smpschedaffinity05/init.c 
b/testsuites/smptests/smpschedaffinity05/init.c
index 754c226..9fddb58 100644
--- a/testsuites/smptests/smpschedaffinity05/init.c
+++ b/testsuites/smptests/smpschedaffinity05/init.c
@@ -145,14 +145,11 @@ static void test(void)
   sc = rtems_semaphore_create(  
 rtems_build_name('S', 'E', 'M', '0'),
 1,   /* initial count = 1 */
-RTEMS_LOCAL   |
-RTEMS_SIMPLE_BINARY_SEMAPHORE |
-RTEMS_NO_INHERIT_PRIORITY |
-RTEMS_NO_PRIORITY_CEILING |
-RTEMS_FIFO,
+RTEMS_BINARY_SEMAPHORE |
+RTEMS_MULTIPROCESSOR_RESOURCE_SHARING, 
 0,
 &task_sem
-  );  
+  );
   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
 
 
-- 
1.8.1.4

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


Re: Proposed RTEMS Community Code of Conduct

2014-11-12 Thread Gedare Bloom
On Wed, Nov 12, 2014 at 8:47 AM, Ralf Corsepius
 wrote:
> On 11/10/2014 06:11 PM, Joel Sherrill wrote:
>
>> While at the GSOC Mentor Summit, I heard a story from another
>> organization about some inappropriate behavior by someone.
>> They were fairly easily able to deal with this because their
>> organization had an agreed upon Community Code of Conduct (CCoC).
>> This provides guidelines on expected behavior as well as what
>> will occur if these are violated.
>
>
> As you may know, I am opposed to any such Code of Conducts, as well as I do
> not see any need for the RTEMS list to implement one.
>
>
> Why?
>
> a) The issues you mention have never been a problem to the RTEMS list.
> That said I feel you trying to implement problems to a current non-issue.
>
It is better to be prepared and to make the community's intentions obvious.

> b) I for one consider "Code of Conducts" to an ongoing fashion/hype, which
> as I feel probably, originates from certain tendencies in US-society.
>
This comment is a violation of our community code of conduct. Please
try to be more respectful of cultures other than your own.

> c) I have seen many occassions, where "Code of Conducts" have been applied
> as a means of censorship to silence and suppress oppositions in case of
> disagreement or dispute.
>
Our code of conduct intends to suppress aggressive behavior.
Disagreement is expected in the nature of open-source development, but
any disputes should be civil, as outlined in the document.

> d) Some of these project who are proud to have implemented a "Code of
> Conduct" wonder about loosing users. Why? cf. c)
>
The problem of a user or developer feeling repressed by our code of
conduct must be addressed if it arises. However, if an individual is
repressed simply by the fact we have a code of conduct, I question the
value of that individual as a member of an open and tolerant
community.

Gedare

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


[PATCH 4/6] i386/shared/int16: real mode interrupt interface

2014-11-12 Thread Jan Dolezal
---
 c/src/lib/libbsp/i386/pc386/Makefile.am|   2 +
 c/src/lib/libbsp/i386/pc386/preinstall.am  |   4 +
 c/src/lib/libbsp/i386/shared/int16/int16.c | 397 +
 c/src/lib/libbsp/i386/shared/int16/int16.h |  93 +++
 4 files changed, 496 insertions(+)
 create mode 100644 c/src/lib/libbsp/i386/shared/int16/int16.c
 create mode 100644 c/src/lib/libbsp/i386/shared/int16/int16.h

diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am 
b/c/src/lib/libbsp/i386/pc386/Makefile.am
index 9c901df..6042b5b 100644
--- a/c/src/lib/libbsp/i386/pc386/Makefile.am
+++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
@@ -29,6 +29,7 @@ SUBDIRS = . tools
 include_bsp_HEADERS  = ../../i386/shared/irq/irq.h
 include_bsp_HEADERS += ../../i386/shared/irq/irq_asm.h
 include_bsp_HEADERS += ../../i386/shared/comm/tty_drv.h
+include_bsp_HEADERS += ../../i386/shared/int16/int16.h
 include_bsp_HEADERS += ../../shared/include/irq-generic.h
 include_bsp_HEADERS += ../../shared/include/irq-info.h
 include_bsp_HEADERS += console/rtd316.h
@@ -94,6 +95,7 @@ libbsp_a_SOURCES += console/kbd_parser.c
 libbsp_a_SOURCES += console/serial_mouse_config.c
 libbsp_a_SOURCES += ../../i386/shared/comm/uart.c
 libbsp_a_SOURCES += ../../i386/shared/comm/tty_drv.c
+libbsp_a_SOURCES += ../../i386/shared/int16/int16.c
 libbsp_a_SOURCES += ../../shared/console.c
 libbsp_a_SOURCES += console/console_select.c
 libbsp_a_SOURCES += ../../shared/console_read.c
diff --git a/c/src/lib/libbsp/i386/pc386/preinstall.am 
b/c/src/lib/libbsp/i386/pc386/preinstall.am
index aff01dc..1ff9fb8 100644
--- a/c/src/lib/libbsp/i386/pc386/preinstall.am
+++ b/c/src/lib/libbsp/i386/pc386/preinstall.am
@@ -69,6 +69,10 @@ $(PROJECT_INCLUDE)/bsp/tty_drv.h: 
../../i386/shared/comm/tty_drv.h $(PROJECT_INC
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/tty_drv.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/tty_drv.h
 
+$(PROJECT_INCLUDE)/bsp/int16.h: ../../i386/shared/int16/int16.h 
$(PROJECT_INCLUDE)/bsp/$(dirstamp)
+   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/int16.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/int16.h
+
 $(PROJECT_INCLUDE)/bsp/irq-generic.h: ../../shared/include/irq-generic.h 
$(PROJECT_INCLUDE)/bsp/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-generic.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-generic.h
diff --git a/c/src/lib/libbsp/i386/shared/int16/int16.c 
b/c/src/lib/libbsp/i386/shared/int16/int16.c
new file mode 100644
index 000..380188f
--- /dev/null
+++ b/c/src/lib/libbsp/i386/shared/int16/int16.c
@@ -0,0 +1,397 @@
+/*
+ *  Realmode interrupt call implementation.
+ *
+ *
+ *  Copyright (c) 2014 - CTU in Prague
+ *   Jan Doležal ( dolez...@fel.cvut.cz )
+ *
+ *  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 
+
+#define IR_EAX_OFF  "0x00"
+#define IR_EBX_OFF  "0x04"
+#define IR_ECX_OFF  "0x08"
+#define IR_EDX_OFF  "0x0C"
+#define IR_ESI_OFF  "0x10"
+#define IR_EDI_OFF  "0x14"
+#define IR_DS_OFF   "0x18"
+#define IR_ES_OFF   "0x1A"
+#define IR_FS_OFF   "0x1C"
+#define IR_GS_OFF   "0x1E"
+
+#define BKP_ESP_OFF "0x20"
+#define BKP_SS_OFF  "0x24"
+#define BKP_DS_OFF  "0x26"
+#define RM_ENTRY"0x28"
+#define PM_ENTRY"0x2C"
+
+/* parameters, results, backup values accessible in real mode */
+struct rm_int_regs_bkp_param {
+struct interrupt_registers inoutregs;
+uint32_t pm_esp_bkp;
+uint16_t pm_ss_bkp;
+uint16_t ds_bkp;
+uint16_t rm_entry;
+uint16_t rm_code_segment;
+uint32_t pm_entry;
+uint16_t pm_code_selector;
+/* if modifying update offset definitions as well */
+}__attribute__((__packed__));
+
+#define BKP_IDTR_LIM"0x00"
+#define BKP_IDTR_BASE   "0x02"
+#define BKP_ES_OFF  "0x06"
+#define BKP_FS_OFF  "0x08"
+#define BKP_GS_OFF  "0x0A"
+#define RML_ENTRY   "0x0C"
+#define RML_D_SEL   "0x12"
+#define RM_SS   "0x14"
+#define RM_SP   "0x16"
+#define RM_DS   "0x18"
+/* backup values, pointers/parameters accessible in protected mode */
+struct pm_bkp_and_param {
+uint16_t idtr_lim_bkp;
+uint32_t idtr_base_bkp;
+uint16_t es_bkp;
+uint16_t fs_bkp;
+uint16_t gs_bkp;
+uint32_t rml_entry;
+uint16_t rml_code_selector;
+uint16_t rml_data_selector;
+uint16_t rm_stack_segment;
+uint16_t rm_stack_pointer;
+uint16_t rm_data_segment;
+}__attribute__((__packed__));
+
+/* addresses where we are going to put Interrupt buffer,
+ * parameter/returned/preserved values, stack and copy code
+ * for calling BIOS interrupt real mode interface
+ * The value is chosen arbitrarily in the first 640kB
+ * to be accessible for real mode. It should be out of range
+ * used by RTEMS because its base address is above 1MB.
+ * It has to be above first 4kB (or better 64kB) which could

[PATCH 3/6] i386: global descriptor table manipulation functions

2014-11-12 Thread Jan Dolezal
---
 c/src/lib/libbsp/i386/shared/irq/idt.c | 147 +
 c/src/lib/libcpu/i386/cpu.h|  83 ++-
 2 files changed, 194 insertions(+), 36 deletions(-)

diff --git a/c/src/lib/libbsp/i386/shared/irq/idt.c 
b/c/src/lib/libbsp/i386/shared/irq/idt.c
index b79c60a..e6f1d57 100644
--- a/c/src/lib/libbsp/i386/shared/irq/idt.c
+++ b/c/src/lib/libbsp/i386/shared/irq/idt.c
@@ -229,50 +229,33 @@ int i386_get_idt_config (rtems_raw_irq_global_settings** 
config)
   return 1;
 }
 
-/*
- * Caution this function assumes the GDTR has been already set.
- */
-int i386_set_gdt_entry (unsigned short segment_selector, unsigned base,
-   unsigned limit)
+int i386_raw_gdt_entry (unsigned short segment_selector_index, 
segment_descriptors* sd)
 {
-unsigned   gdt_limit;
+unsignedgdt_limit;
 unsigned short  tmp_segment = 0;
-unsigned intlimit_adjusted;
-segment_descriptors*   gdt_entry_tbl;
+segment_descriptors*gdt_entry_tbl;
+unsigned int present;
 
 i386_get_info_from_GDTR (&gdt_entry_tbl, &gdt_limit);
 
-if (segment_selector > limit) {
+if (segment_selector_index >= (gdt_limit+1)/8) {
+  /* index to GDT table out of bounds */
   return 0;
 }
-/*
- * set up limit first
- */
-limit_adjusted = limit;
-if ( limit > 4095 ) {
-  gdt_entry_tbl[segment_selector].granularity = 1;
-  limit_adjusted /= 4096;
+if (segment_selector_index == 0) {
+  /* index 0 is not usable */
+  return 0;
 }
-gdt_entry_tbl[segment_selector].limit_15_0  = limit_adjusted & 0x;
-gdt_entry_tbl[segment_selector].limit_19_16 = (limit_adjusted >> 16) & 0xf;
-/*
- * set up base
- */
-gdt_entry_tbl[segment_selector].base_address_15_0  = base & 0x;
-gdt_entry_tbl[segment_selector].base_address_23_16 = (base >> 16) & 0xff;
-gdt_entry_tbl[segment_selector].base_address_31_24 = (base >> 24) & 0xff;
-/*
- * set up descriptor type (this may well becomes a parameter if needed)
- */
-gdt_entry_tbl[segment_selector].type   = 2;/* Data R/W */
-gdt_entry_tbl[segment_selector].descriptor_type= 1;/* Code or Data 
*/
-gdt_entry_tbl[segment_selector].privilege  = 0;/* ring 0 */
-gdt_entry_tbl[segment_selector].present= 1;/* not present 
*/
 
+/* put prepared descriptor into the GDT */
+present = sd->present;
+sd->present = 0;
+gdt_entry_tbl[segment_selector_index] = *sd;
+sd->present = present;
+gdt_entry_tbl[segment_selector_index].present = present;
 /*
- * Now, reload all segment registers so the limit takes effect.
+ * Now, reload all segment registers so that the possible changes takes 
effect.
  */
-
 __asm__ volatile( "movw %%ds,%0 ; movw %0,%%ds\n\t"
   "movw %%es,%0 ; movw %0,%%es\n\t"
   "movw %%fs,%0 ; movw %0,%%fs\n\t"
@@ -280,7 +263,101 @@ int i386_set_gdt_entry (unsigned short segment_selector, 
unsigned base,
   "movw %%ss,%0 ; movw %0,%%ss"
: "=r" (tmp_segment)
: "0"  (tmp_segment)
- );
-
+ );
 return 1;
 }
+
+inline void i386_fill_segment_desc_base(unsigned base, segment_descriptors* sd)
+{
+sd->base_address_15_0  = base & 0x;
+sd->base_address_23_16 = (base >> 16) & 0xff;
+sd->base_address_31_24 = (base >> 24) & 0xff;
+}
+
+inline void i386_fill_segment_desc_limit(unsigned limit, segment_descriptors* 
sd)
+{
+sd->granularity = 0;
+if (limit > 65535) {
+  sd->granularity = 1;
+  limit /= 4096;
+}
+sd->limit_15_0  = limit & 0x;
+sd->limit_19_16 = (limit >> 16) & 0xf;
+}
+
+/*
+ * Caution this function assumes the GDTR has been already set.
+ */
+int i386_set_gdt_entry (unsigned short segment_selector_index, unsigned base,
+unsigned limit)
+{
+segment_descriptors gdt_entry;
+memset(&gdt_entry, 0, sizeof(gdt_entry));
+
+i386_fill_segment_desc_limit(limit, &gdt_entry);
+i386_fill_segment_desc_base(base, &gdt_entry);
+/*
+ * set up descriptor type (this may well becomes a parameter if needed)
+ */
+gdt_entry.type  = 2;/* Data R/W */
+gdt_entry.descriptor_type   = 1;/* Code or Data */
+gdt_entry.privilege = 0;/* ring 0 */
+gdt_entry.present   = 1;/* not present */
+
+/*
+ * Now, reload all segment registers so the limit takes effect.
+ */
+return i386_raw_gdt_entry(segment_selector_index, &gdt_entry);
+}
+
+unsigned short i386_next_empty_gdt_entry ()
+{
+unsignedgdt_limit;
+segment_descriptors*gdt_entry_tbl;
+/* initial amount of filled descriptors */
+static unsigned short   segment_selector_index = 2;
+
+segment_sele

[PATCH 2/6] score: i386: functions converting real mode pointer to physical address and back

2014-11-12 Thread Jan Dolezal
---
 cpukit/score/cpu/i386/cpu_asm.S  | 63 
 cpukit/score/cpu/i386/rtems/score/i386.h | 29 +++
 2 files changed, 92 insertions(+)

diff --git a/cpukit/score/cpu/i386/cpu_asm.S b/cpukit/score/cpu/i386/cpu_asm.S
index 9b39567..c9e366d 100644
--- a/cpukit/score/cpu/i386/cpu_asm.S
+++ b/cpukit/score/cpu/i386/cpu_asm.S
@@ -327,6 +327,69 @@ SYM (i386_Physical_to_logical):
 movlecx,eax/* eax = ecx */
 ret
 
+/*
+ *  void *i386_Real_mode_ptr_to_physical(
+ * void *ptr
+ *  );
+ *
+ *  Returns thirty-two bit physical address for segment:offset realmode 
pointer.
+ */
+
+.set RM_PTR_ARG, 4
+
+   PUBLIC (i386_Real_mode_ptr_to_physical)
+
+SYM (i386_Real_mode_ptr_to_physical):
+movlRM_PTR_ARG(esp),eax
+xorlecx, ecx
+movwax, cx
+shrl$12, eax
+andl$0x0, eax
+addlecx, eax
+ret
+
+/*
+ *  int i386_Physical_to_real_mode_ptr(
+ * void *address,
+ * unsigned short *segment,
+ * unsigned short *offset
+ *  );
+ *
+ *  Fills segment:offest realmode pointer counted from thirty-two bit physical
+ *  address.
+ *  Returns 0 if unconvertible, 1 if successfuly converted.
+ */
+
+.set RM_PTR_SEG_ARG, 8
+.set RM_PTR_OFF_ARG, 12
+
+   PUBLIC (i386_Physical_to_real_mode_ptr)
+
+SYM (i386_Physical_to_real_mode_ptr):
+movlRM_PTR_ARG(esp),eax
+cmpl$0x10FFF0, eax
+js  cvtbl
+movl$0, eax
+ret
+cvtbl:  cmpl$0x10, eax
+js  lowmem
+subl$0x0, eax
+movlRM_PTR_OFF_ARG(esp), ecx
+movwax, (ecx)
+movlRM_PTR_SEG_ARG(esp), ecx
+movw$0x, (ecx)
+movl$1, eax
+ret
+lowmem: movleax, edx
+and $0xF, ax
+movlRM_PTR_OFF_ARG(esp), ecx
+movwax, (ecx)
+shrl$4, edx
+movlRM_PTR_SEG_ARG(esp), ecx
+movwdx, (ecx)
+movl$1, eax
+ret
+
 END_CODE
 
 END
diff --git a/cpukit/score/cpu/i386/rtems/score/i386.h 
b/cpukit/score/cpu/i386/rtems/score/i386.h
index 57569fc..a59e0cf 100644
--- a/cpukit/score/cpu/i386/rtems/score/i386.h
+++ b/cpukit/score/cpu/i386/rtems/score/i386.h
@@ -186,6 +186,35 @@ void *i386_Physical_to_logical(
 );
 
 /*
+ *  i386_Real_mode_ptr_to_physical
+ *
+ *  Converts real mode pointer {segment, offset} to physical address.
+ */
+void *i386_Real_mode_ptr_to_physical(
+  void *ptr
+);
+
+/*
+ *  i386_Physical_to_real_mode_ptr
+ *  Retreives real mode pointer elements {segmnet, offset} from physical 
address
+ *  Function returns the highest segment (base) address possible.
+ *  Example:input   address - 0x4B3A2
+ *  output  segment - 0x4B3A
+ *  offset  - 0x2
+ *  input   address - 0x10F12E
+ *  output  segment - 0x
+ *  offset  - 0xF13E
+ *
+ *  return  0 address not convertible, must be less than 0x10FFEF
+ *  1 segment and offset extracted
+ */
+int i386_Physical_to_real_mode_ptr(
+  void *address,
+  unsigned short *segment,
+  unsigned short *offset
+);
+
+/*
  *  "Simpler" names for a lot of the things defined in this file
  */
 
-- 
1.9.1

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


[PATCH 1/6] i386/pc386: configurable size of descriptor tables

2014-11-12 Thread Jan Dolezal
---
 c/src/lib/libbsp/i386/pc386/Makefile.am   |  1 +
 c/src/lib/libbsp/i386/pc386/configure.ac  |  5 +
 c/src/lib/libbsp/i386/pc386/include/bsp.h |  6 ++
 c/src/lib/libbsp/i386/pc386/include/bsptblsizes.h | 25 ++
 c/src/lib/libbsp/i386/pc386/preinstall.am |  4 
 c/src/lib/libbsp/i386/pc386/startup/ldsegs.S  | 26 +++
 6 files changed, 59 insertions(+), 8 deletions(-)
 create mode 100644 c/src/lib/libbsp/i386/pc386/include/bsptblsizes.h

diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am 
b/c/src/lib/libbsp/i386/pc386/Makefile.am
index 22ba5e9..9c901df 100644
--- a/c/src/lib/libbsp/i386/pc386/Makefile.am
+++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
@@ -15,6 +15,7 @@ include_bspdir = $(includedir)/bsp
 dist_project_lib_DATA = bsp_specs
 
 include_HEADERS = include/bsp.h
+include_HEADERS += include/bsptblsizes.h
 include_HEADERS += include/tm27.h
 
 nodist_include_HEADERS = include/bspopts.h
diff --git a/c/src/lib/libbsp/i386/pc386/configure.ac 
b/c/src/lib/libbsp/i386/pc386/configure.ac
index 1125c7c..ecec056 100644
--- a/c/src/lib/libbsp/i386/pc386/configure.ac
+++ b/c/src/lib/libbsp/i386/pc386/configure.ac
@@ -82,6 +82,11 @@ RTEMS_BSPOPTS_HELP([USE_CIRRUS_GD5446],
  NOTE: This has only been tested on Qemu.])
 AM_CONDITIONAL(USE_CIRRUS_GD5446,test "$USE_CIRRUS_GD5446" = "1")
 
+RTEMS_BSPOPTS_SET([NUM_APP_DRV_GDT_DESCRIPTORS],[*],[0])
+RTEMS_BSPOPTS_HELP([NUM_APP_DRV_GDT_DESCRIPTORS],
+[Defines how many descriptors in GDT may be allocated for application or
+ driver usage.])
+
 if test X${CLOCK_DRIVER_USE_TSC} = X1 -a X${CLOCK_DRIVER_USE_8254} = X1 ; then
   AC_MSG_ERROR([pc386 both TSC and 8254 specified for clock driver])
 fi
diff --git a/c/src/lib/libbsp/i386/pc386/include/bsp.h 
b/c/src/lib/libbsp/i386/pc386/include/bsp.h
index 21aa054..3425a6d 100644
--- a/c/src/lib/libbsp/i386/pc386/include/bsp.h
+++ b/c/src/lib/libbsp/i386/pc386/include/bsp.h
@@ -51,6 +51,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -166,11 +167,8 @@ extern int rtems_3c509_driver_attach(struct 
rtems_bsdnet_ifconfig *config);
 /*-+
 | External Variables.
 +--*/
-#define IDT_SIZE 256
-#define GDT_SIZE 3
-
 extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE];
-extern segment_descriptors Global_descriptor_table   [GDT_SIZE];
+extern segment_descriptors _Global_descriptor_table   [GDT_SIZE];
 
 /*-+
 | Function Prototypes.
diff --git a/c/src/lib/libbsp/i386/pc386/include/bsptblsizes.h 
b/c/src/lib/libbsp/i386/pc386/include/bsptblsizes.h
new file mode 100644
index 000..ef51ae7
--- /dev/null
+++ b/c/src/lib/libbsp/i386/pc386/include/bsptblsizes.h
@@ -0,0 +1,25 @@
+/**
+ * @file
+ *
+ * @ingroup i386_pc386
+ *
+ * @brief Sizes of Global and Interrupt descriptor tables.
+ */
+
+/*
+ * Definitions related to the PC386 BSP.
+ * This header file is also used in assembler modules.
+ *
+ * Copyright (C) 2014  Jan Doležal (dolez...@fel.cvut.cz)
+ * CTU in Prague.
+ *
+ *  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 
+
+#define IDT_SIZE (256)
+#define GDT_SIZE (3 + NUM_APP_DRV_GDT_DESCRIPTORS)
+
diff --git a/c/src/lib/libbsp/i386/pc386/preinstall.am 
b/c/src/lib/libbsp/i386/pc386/preinstall.am
index 182f564..aff01dc 100644
--- a/c/src/lib/libbsp/i386/pc386/preinstall.am
+++ b/c/src/lib/libbsp/i386/pc386/preinstall.am
@@ -41,6 +41,10 @@ $(PROJECT_INCLUDE)/bsp.h: include/bsp.h 
$(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
 
+$(PROJECT_INCLUDE)/bsptblsizes.h: include/bsptblsizes.h 
$(PROJECT_INCLUDE)/$(dirstamp)
+   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsptblsizes.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsptblsizes.h
+
 $(PROJECT_INCLUDE)/tm27.h: include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
diff --git a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S 
b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S
index 495d68a..8f2220d 100644
--- a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S
+++ b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S
@@ -34,6 +34,15 @@
 +--*/
 
 #include 
+#include  /* contains sizes of GDT and IDT */
+
+#ifndef GDT_SIZE
+#define GDT_SIZE (3)
+#endif
+
+#ifndef IDT_SIZE
+#define IDT_SIZE (256)
+#endif
 
 /*+
 | CODE section
@@ -167,6 +176,9 @@ next_step:
 /*

[PATCH 5/6] i386/pc386/include: header files for VESA BIOS EXTENSIONS and VESA Extended Display Identification Data

2014-11-12 Thread Jan Dolezal
---
 c/src/lib/libbsp/i386/pc386/Makefile.am|   2 +
 c/src/lib/libbsp/i386/pc386/include/edid.h | 759 +
 c/src/lib/libbsp/i386/pc386/include/vbe3.h | 461 ++
 c/src/lib/libbsp/i386/pc386/preinstall.am  |   8 +
 4 files changed, 1230 insertions(+)
 create mode 100644 c/src/lib/libbsp/i386/pc386/include/edid.h
 create mode 100644 c/src/lib/libbsp/i386/pc386/include/vbe3.h

diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am 
b/c/src/lib/libbsp/i386/pc386/Makefile.am
index 6042b5b..2e60947 100644
--- a/c/src/lib/libbsp/i386/pc386/Makefile.am
+++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
@@ -106,6 +106,8 @@ libbsp_a_SOURCES += console/printk_support.c
 libbsp_a_SOURCES += console/vgacons.c
 libbsp_a_SOURCES += console/exar17d15x.c
 libbsp_a_SOURCES += console/rtd316.c
+include_HEADERS += include/vbe3.h
+include_HEADERS += include/edid.h
 if USE_CIRRUS_GD5446
 libbsp_a_SOURCES += console/fb_cirrus.c
 else
diff --git a/c/src/lib/libbsp/i386/pc386/include/edid.h 
b/c/src/lib/libbsp/i386/pc386/include/edid.h
new file mode 100644
index 000..937976e
--- /dev/null
+++ b/c/src/lib/libbsp/i386/pc386/include/edid.h
@@ -0,0 +1,759 @@
+/**
+ * @file edid.h
+ *
+ * @ingroup i386_pc386
+ *
+ * @brief VESA EDID definitions.
+ */
+
+/*
+ * edid.h  - This file contains definitions for constants related to
+ *   VESA Extended Display Identification Data.
+ *  More information can be found at
+ *  
+ *  VESA public standards may be found at
+ *  
+ *
+ * Copyright (C) 2014  Jan Doležal (dolez...@fel.cvut.cz)
+ * CTU in Prague.
+ *
+ *  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 _EDID_H
+#define _EDID_H
+
+#ifndef ASM /* ASM */
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/*  VESA Extended Display Identification Data (EDID) Standard
+Version 3, Revision Date: November 13, 1997 */
+/*  VESA Enhanced Extended Display Identification Data (E-EDID) Standard
+Release A, Revision 2, September 25, 2006 */
+/*  VESA Enhanced Extended Display Identification Data (E-EDID) Proposed
+Release A, March 27, 2007 */
+
+/ structs and defines shared by both EDIDv1 and EDIDv2 /
+
+/* Video Input Definition */
+/* Analog Interface Data Format - Signal Level Standard */
+#define EDIDx_SLS_0700_0300_1000Vpp 0x0
+#define EDIDx_SLS_0714_0286_1000Vpp 0x1
+#define EDIDx_SLS_1000_0400_1400Vpp 0x2
+#define EDIDx_SLS_0700__0700Vpp 0x3
+
+struct DetailedTimingDescriptor{
+uint16_t PixelClock_div1;
+uint8_t HorizontalActiveLow;
+uint8_t HorizontalBlankingLow;
+uint8_t HorizontalBlankingHigh  : 4;
+uint8_t HorizontalActiveHigh: 4;
+uint8_t VerticalActiveLow;
+uint8_t VerticalBlankingLow;
+uint8_t VerticalBlankingHigh: 4;
+uint8_t VerticalActiveHigh  : 4;
+uint8_t HorizontalSyncOffsetLow;
+uint8_t HorizontalSyncPulseWidthLow;
+uint8_t VerticalSyncPulseWidthLow   : 4;
+uint8_t VerticalSyncOffsetLow   : 4;
+uint8_t VerticalSyncPulseWidthHigh  : 2;
+uint8_t VerticalSyncOffsetHigh  : 2;
+uint8_t HorizontalSyncPulseWidthHigh: 2;
+uint8_t HorizontalSyncOffsetHigh: 2;
+uint8_t HorizontalImageSizeLow;
+uint8_t VerticalImageSizeLow;
+uint8_t VerticalImageSizeHigh   : 4;
+uint8_t HorizontalImageSizeHigh : 4;
+uint8_t HorizontalBorder;
+uint8_t VerticalBorder;
+uint8_t Flag_StereoMode0: 1;
+/* next four flags has different purpose with analog
+   and digital interfaces for EDID version 2; first
+   goes analog, after underscore there is digital name of bit */
+uint8_t Flag_SyncPolarity_LPPolarity: 1;
+uint8_t Flag_Serration_FLMPolarity  : 1;
+uint8_t Flag_Composition_Serration  : 1;
+uint8_t Flag_Composition_ShiftClockUse  : 1;
+
+uint8_t Flag_StereoMode1: 2;
+uint8_t Flag_Interlaced : 1;
+}__attribute__((__packed__));
+
+struct ColorPointData {
+uint8_t ColorPointWhitePointIndexNumber;
+uint8_t ColorPointWhiteLowBits;
+uint8_t ColorPointWhite_x;
+uint8_t ColorPointWhite_y;
+uint8_t ColorPointWhiteGamma;
+}__attribute__((__packed__));
+
+/ structs and defines for EDIDv1 /
+
+/* Basic Display Parameters */
+/* Feature Support */
+/* analog - Display Color Type */
+#define EDID_DisplayType_Monochrome 0
+#define EDID_DisplayType_RGBcolor   1
+#define EDID_DisplayType_nonRGBcolor2
+#define EDID_DisplayType_undef  3
+/* digital - Supported Color Encoding Formats */
+#defin

[PATCH/RFC 0/6] i386 VESA framebuffer support

2014-11-12 Thread Jan Dolezal
Framebuffer driver for i386 PC686BSP utilizing VESA BIOS EXTENSIONS
to initialize graphics mode during startup of RTEMS executive.
Temporary switch to realmode is used for Video BIOS invocation. 

The implementation has been tested with microwindows from RTEMS Graphics
Toolkit using QEMU {cirrus, std} and on real hardware - Intel integrated
graphic, NVidia GeForce 6600GT and some other cards.

Jan Dolezal (6):
  i386/pc386: configurable size of descriptor tables
  score: i386: functions converting real mode pointer to physical
address and back
  i386: global descriptor table manipulation functions
  i386/shared/int16: real mode interrupt interface
  i386/pc386/include: header files for VESA BIOS EXTENSIONS and VESA
Extended Display Identification Data
  i386/pc386: VESA based frame buffer utilizing real mode interrupt 10h

 c/src/lib/libbsp/i386/pc386/Makefile.am   |  10 +
 c/src/lib/libbsp/i386/pc386/configure.ac  |  18 +
 c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c  | 851 ++
 c/src/lib/libbsp/i386/pc386/include/bsp.h |   6 +-
 c/src/lib/libbsp/i386/pc386/include/bsptblsizes.h |  25 +
 c/src/lib/libbsp/i386/pc386/include/edid.h| 759 +++
 c/src/lib/libbsp/i386/pc386/include/fb_vesa.h | 131 
 c/src/lib/libbsp/i386/pc386/include/vbe3.h| 461 
 c/src/lib/libbsp/i386/pc386/preinstall.am |  22 +
 c/src/lib/libbsp/i386/pc386/start/start.S |   8 +
 c/src/lib/libbsp/i386/pc386/startup/ldsegs.S  |  26 +-
 c/src/lib/libbsp/i386/shared/int16/int16.c| 397 ++
 c/src/lib/libbsp/i386/shared/int16/int16.h|  93 +++
 c/src/lib/libbsp/i386/shared/irq/idt.c| 147 +++-
 c/src/lib/libcpu/i386/cpu.h   |  83 ++-
 cpukit/score/cpu/i386/cpu_asm.S   |  63 ++
 cpukit/score/cpu/i386/rtems/score/i386.h  |  29 +
 17 files changed, 3085 insertions(+), 44 deletions(-)
 create mode 100644 c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c
 create mode 100644 c/src/lib/libbsp/i386/pc386/include/bsptblsizes.h
 create mode 100644 c/src/lib/libbsp/i386/pc386/include/edid.h
 create mode 100644 c/src/lib/libbsp/i386/pc386/include/fb_vesa.h
 create mode 100644 c/src/lib/libbsp/i386/pc386/include/vbe3.h
 create mode 100644 c/src/lib/libbsp/i386/shared/int16/int16.c
 create mode 100644 c/src/lib/libbsp/i386/shared/int16/int16.h

-- 
1.9.1

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


[PATCH 6/6] i386/pc386: VESA based frame buffer utilizing real mode interrupt 10h

2014-11-12 Thread Jan Dolezal
---
 c/src/lib/libbsp/i386/pc386/Makefile.am  |   5 +
 c/src/lib/libbsp/i386/pc386/configure.ac |  13 +
 c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c | 851 +++
 c/src/lib/libbsp/i386/pc386/include/fb_vesa.h| 131 
 c/src/lib/libbsp/i386/pc386/preinstall.am|   6 +
 c/src/lib/libbsp/i386/pc386/start/start.S|   8 +
 6 files changed, 1014 insertions(+)
 create mode 100644 c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c
 create mode 100644 c/src/lib/libbsp/i386/pc386/include/fb_vesa.h

diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am 
b/c/src/lib/libbsp/i386/pc386/Makefile.am
index 2e60947..7fb6747 100644
--- a/c/src/lib/libbsp/i386/pc386/Makefile.am
+++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
@@ -106,13 +106,18 @@ libbsp_a_SOURCES += console/printk_support.c
 libbsp_a_SOURCES += console/vgacons.c
 libbsp_a_SOURCES += console/exar17d15x.c
 libbsp_a_SOURCES += console/rtd316.c
+if USE_VBE_RM
 include_HEADERS += include/vbe3.h
 include_HEADERS += include/edid.h
+include_HEADERS += include/fb_vesa.h
+libbsp_a_SOURCES += console/fb_vesa_rm.c
+else
 if USE_CIRRUS_GD5446
 libbsp_a_SOURCES += console/fb_cirrus.c
 else
 libbsp_a_SOURCES += console/fb_vga.c
 endif
+endif
 
 # gdb
 libbsp_a_SOURCES += ../../i386/shared/comm/i386-stub.c
diff --git a/c/src/lib/libbsp/i386/pc386/configure.ac 
b/c/src/lib/libbsp/i386/pc386/configure.ac
index ecec056..a74d6cb 100644
--- a/c/src/lib/libbsp/i386/pc386/configure.ac
+++ b/c/src/lib/libbsp/i386/pc386/configure.ac
@@ -82,6 +82,19 @@ RTEMS_BSPOPTS_HELP([USE_CIRRUS_GD5446],
  NOTE: This has only been tested on Qemu.])
 AM_CONDITIONAL(USE_CIRRUS_GD5446,test "$USE_CIRRUS_GD5446" = "1")
 
+RTEMS_BSPOPTS_SET([USE_VBE_RM],[*],[0])
+RTEMS_BSPOPTS_HELP([USE_VBE_RM],
+[If defined, enables use of the Vesa Bios Extensions - real mode interface,
+ which enables graphical mode and introduce it upon bootup.])
+AM_CONDITIONAL(USE_VBE_RM,test "$USE_VBE_RM" = "1")
+
+if test "${USE_VBE_RM}" = "1" ; then
+  if test -z "${NUM_APP_DRV_GDT_DESCRIPTORS}"; then
+  NUM_APP_DRV_GDT_DESCRIPTORS=2 ;
+  else
+  NUM_APP_DRV_GDT_DESCRIPTORS+=2 ;
+  fi
+fi
 RTEMS_BSPOPTS_SET([NUM_APP_DRV_GDT_DESCRIPTORS],[*],[0])
 RTEMS_BSPOPTS_HELP([NUM_APP_DRV_GDT_DESCRIPTORS],
 [Defines how many descriptors in GDT may be allocated for application or
diff --git a/c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c 
b/c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c
new file mode 100644
index 000..0087c82
--- /dev/null
+++ b/c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c
@@ -0,0 +1,851 @@
+/*
+ *  FB driver for graphic hardware compatible with VESA Bios Extension
+ *  Real mode interface utilized
+ *  Tested on real HW.
+ *
+ *  Copyright (c) 2014 - CTU in Prague
+ *   Jan Doležal ( dolez...@fel.cvut.cz )
+ *
+ *  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.
+ *
+ *  The code is based on following information sources:
+ *- doc/bsp_howto/bsp_howto.pdf
+ *- VESA BIOS EXTENSION (VBE) Core Function Standard, Ver: 3.0, Sep 16, 
1998
+ *- RTEMS fb_vga.c - Rosimildo da Silva ( rdasi...@connecttel.com )
+ *- RTEMS fb_cirrus.c - Alexandru-Sever Horin (alex.seve...@gmail.com)
+ */
+
+/*
+ *  Hardware is completely initialized upon boot of the system.
+ *  Therefore there is no way to change graphics mode later.
+ *
+ *  Interrupt 0x10 is used for entering graphics BIOS.
+ */
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#define FB_VESA_NAME"FB_VESA_RM"
+
+void vesa_realmode_bootup_init(void);
+
+/* mutex for protection against multiple opens, when called frame_buffer_open 
*/
+static pthread_mutex_t vesa_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/* screen information for the VGA driver
+ * standard structures - from RTEMS fb interface
+ */
+static struct fb_var_screeninfo fb_var;
+static struct fb_fix_screeninfo fb_fix;
+
+static uint16_t vbe_usedMode;
+
+inline uint32_t VBEControllerInformation(   struct VBE_VbeInfoBlock *infoBlock,
+uint16_t queriedVBEVersion)
+{
+struct VBE_VbeInfoBlock *VBE_buffer =
+(struct VBE_VbeInfoBlock *)i386_get_primary_rm_buffer();
+struct interrupt_registers parret;
+parret.reg_eax = VBE_RetVBEConInf;
+unsigned short seg, off;
+i386_Physical_to_real_mode_ptr(VBE_buffer, &seg, &off);
+parret.reg_edi = (uint32_t)off;
+parret.reg_es = seg;
+/* indicate to graphic's bios that VBE2.0 extended information is desired 
*/
+if (queriedVBEVersion >= 0x200)
+{
+strncpy(
+(char *)&VBE_buffer->VbeSignature,
+VBE20plus_SIGNATURE,
+4*sizeof(size_t)
+);
+}
+if (i386_real_interrupt_call(INTERRUPT_NO_VIDEO_SERVICES, &parret) == 0)
+return -1;
+if ((parret.reg_eax & 0x) ==
+

Re: [PATCH 3/3] smpschedaffinity05: Change semaphore attributes.

2014-11-12 Thread Gedare Bloom
Are there still tests for when the lock would be held despite the
context switch? Just want to make sure we're not removing some
test-case.

On Wed, Nov 12, 2014 at 9:48 AM, Jennifer Averett
 wrote:
> Change semaphore attributes to resolve problem where semaphore is not
> released upon a context switch.
> ---
>  testsuites/smptests/smpschedaffinity05/init.c | 9 +++--
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/testsuites/smptests/smpschedaffinity05/init.c 
> b/testsuites/smptests/smpschedaffinity05/init.c
> index 754c226..9fddb58 100644
> --- a/testsuites/smptests/smpschedaffinity05/init.c
> +++ b/testsuites/smptests/smpschedaffinity05/init.c
> @@ -145,14 +145,11 @@ static void test(void)
>sc = rtems_semaphore_create(
>  rtems_build_name('S', 'E', 'M', '0'),
>  1,   /* initial count = 1 */
> -RTEMS_LOCAL   |
> -RTEMS_SIMPLE_BINARY_SEMAPHORE |
> -RTEMS_NO_INHERIT_PRIORITY |
> -RTEMS_NO_PRIORITY_CEILING |
> -RTEMS_FIFO,
> +RTEMS_BINARY_SEMAPHORE |
> +RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
>  0,
>  &task_sem
> -  );
> +  );
>rtems_test_assert(sc == RTEMS_SUCCESSFUL);
>
>
> --
> 1.8.1.4
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 1/3] smpschedaffinity02: Change semaphore attributes.

2014-11-12 Thread Sebastian Huber

On 12/11/14 15:48, Jennifer Averett wrote:

Change semaphore attributes to prevent semaphore from being
locked and never released upon a context switch.
---
  testsuites/smptests/smpschedaffinity02/init.c | 7 ++-
  1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/testsuites/smptests/smpschedaffinity02/init.c 
b/testsuites/smptests/smpschedaffinity02/init.c
index a3e0ddf..43efc99 100644
--- a/testsuites/smptests/smpschedaffinity02/init.c
+++ b/testsuites/smptests/smpschedaffinity02/init.c
@@ -140,11 +140,8 @@ static void test(void)
sc = rtems_semaphore_create(
  rtems_build_name('S', 'E', 'M', '0'),
  1,
-RTEMS_LOCAL   |
-RTEMS_SIMPLE_BINARY_SEMAPHORE |
-RTEMS_NO_INHERIT_PRIORITY |
-RTEMS_NO_PRIORITY_CEILING |
-RTEMS_FIFO,
+RTEMS_BINARY_SEMAPHORE |
+RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
  0,
  &task_sem
);


Why do you use RTEMS_MULTIPROCESSOR_RESOURCE_SHARING here?

--
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/6] i386/pc386: configurable size of descriptor tables

2014-11-12 Thread Gedare Bloom
On Wed, Nov 12, 2014 at 10:07 AM, Jan Dolezal  wrote:
> ---
>  c/src/lib/libbsp/i386/pc386/Makefile.am   |  1 +
>  c/src/lib/libbsp/i386/pc386/configure.ac  |  5 +
>  c/src/lib/libbsp/i386/pc386/include/bsp.h |  6 ++
>  c/src/lib/libbsp/i386/pc386/include/bsptblsizes.h | 25 ++
>  c/src/lib/libbsp/i386/pc386/preinstall.am |  4 
>  c/src/lib/libbsp/i386/pc386/startup/ldsegs.S  | 26 
> +++
>  6 files changed, 59 insertions(+), 8 deletions(-)
>  create mode 100644 c/src/lib/libbsp/i386/pc386/include/bsptblsizes.h
>
> diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am 
> b/c/src/lib/libbsp/i386/pc386/Makefile.am
> index 22ba5e9..9c901df 100644
> --- a/c/src/lib/libbsp/i386/pc386/Makefile.am
> +++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
> @@ -15,6 +15,7 @@ include_bspdir = $(includedir)/bsp
>  dist_project_lib_DATA = bsp_specs
>
>  include_HEADERS = include/bsp.h
> +include_HEADERS += include/bsptblsizes.h
This header should probably be nested under bsp at least.

>  include_HEADERS += include/tm27.h
>
>  nodist_include_HEADERS = include/bspopts.h
> diff --git a/c/src/lib/libbsp/i386/pc386/configure.ac 
> b/c/src/lib/libbsp/i386/pc386/configure.ac
> index 1125c7c..ecec056 100644
> --- a/c/src/lib/libbsp/i386/pc386/configure.ac
> +++ b/c/src/lib/libbsp/i386/pc386/configure.ac
> @@ -82,6 +82,11 @@ RTEMS_BSPOPTS_HELP([USE_CIRRUS_GD5446],
>   NOTE: This has only been tested on Qemu.])
>  AM_CONDITIONAL(USE_CIRRUS_GD5446,test "$USE_CIRRUS_GD5446" = "1")
>
> +RTEMS_BSPOPTS_SET([NUM_APP_DRV_GDT_DESCRIPTORS],[*],[0])
> +RTEMS_BSPOPTS_HELP([NUM_APP_DRV_GDT_DESCRIPTORS],
> +[Defines how many descriptors in GDT may be allocated for application or
> + driver usage.])
> +
>  if test X${CLOCK_DRIVER_USE_TSC} = X1 -a X${CLOCK_DRIVER_USE_8254} = X1 ; 
> then
>AC_MSG_ERROR([pc386 both TSC and 8254 specified for clock driver])
>  fi
> diff --git a/c/src/lib/libbsp/i386/pc386/include/bsp.h 
> b/c/src/lib/libbsp/i386/pc386/include/bsp.h
> index 21aa054..3425a6d 100644
> --- a/c/src/lib/libbsp/i386/pc386/include/bsp.h
> +++ b/c/src/lib/libbsp/i386/pc386/include/bsp.h
> @@ -51,6 +51,7 @@
>
>  #include 
>  #include 
> +#include 
>
>  #include 
>  #include 
> @@ -166,11 +167,8 @@ extern int rtems_3c509_driver_attach(struct 
> rtems_bsdnet_ifconfig *config);
>  /*-+
>  | External Variables.
>  +--*/
> -#define IDT_SIZE 256
> -#define GDT_SIZE 3
> -
Why not just update these #defines with the new  ones you have in bsptblsizes.h?

>  extern interrupt_gate_descriptor Interrupt_descriptor_table[IDT_SIZE];
> -extern segment_descriptors Global_descriptor_table   [GDT_SIZE];
> +extern segment_descriptors _Global_descriptor_table   [GDT_SIZE];
>
>  /*-+
>  | Function Prototypes.
> diff --git a/c/src/lib/libbsp/i386/pc386/include/bsptblsizes.h 
> b/c/src/lib/libbsp/i386/pc386/include/bsptblsizes.h
> new file mode 100644
> index 000..ef51ae7
> --- /dev/null
> +++ b/c/src/lib/libbsp/i386/pc386/include/bsptblsizes.h
> @@ -0,0 +1,25 @@
> +/**
> + * @file
> + *
> + * @ingroup i386_pc386
> + *
> + * @brief Sizes of Global and Interrupt descriptor tables.
> + */
> +
> +/*
> + * Definitions related to the PC386 BSP.
> + * This header file is also used in assembler modules.
> + *
> + * Copyright (C) 2014  Jan Doležal (dolez...@fel.cvut.cz)
> + * CTU in Prague.
> + *
> + *  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 
> +
> +#define IDT_SIZE (256)
> +#define GDT_SIZE (3 + NUM_APP_DRV_GDT_DESCRIPTORS)
> +
> diff --git a/c/src/lib/libbsp/i386/pc386/preinstall.am 
> b/c/src/lib/libbsp/i386/pc386/preinstall.am
> index 182f564..aff01dc 100644
> --- a/c/src/lib/libbsp/i386/pc386/preinstall.am
> +++ b/c/src/lib/libbsp/i386/pc386/preinstall.am
> @@ -41,6 +41,10 @@ $(PROJECT_INCLUDE)/bsp.h: include/bsp.h 
> $(PROJECT_INCLUDE)/$(dirstamp)
> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
>
> +$(PROJECT_INCLUDE)/bsptblsizes.h: include/bsptblsizes.h 
> $(PROJECT_INCLUDE)/$(dirstamp)
> +   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsptblsizes.h
> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsptblsizes.h
> +
>  $(PROJECT_INCLUDE)/tm27.h: include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
> diff --git a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S 
> b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S
> index 495d68a..8f2220d 100644
> --- a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S
> +++ b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S
> @@ -34,6 +34,15 @@
>  +--

Re: [PATCH 2/6] score: i386: functions converting real mode pointer to physical address and back

2014-11-12 Thread Gedare Bloom
On Wed, Nov 12, 2014 at 10:07 AM, Jan Dolezal  wrote:
> ---
>  cpukit/score/cpu/i386/cpu_asm.S  | 63 
> 
>  cpukit/score/cpu/i386/rtems/score/i386.h | 29 +++
>  2 files changed, 92 insertions(+)
>
> diff --git a/cpukit/score/cpu/i386/cpu_asm.S b/cpukit/score/cpu/i386/cpu_asm.S
> index 9b39567..c9e366d 100644
> --- a/cpukit/score/cpu/i386/cpu_asm.S
> +++ b/cpukit/score/cpu/i386/cpu_asm.S
> @@ -327,6 +327,69 @@ SYM (i386_Physical_to_logical):
>  movlecx,eax/* eax = ecx */
>  ret
>
> +/*
> + *  void *i386_Real_mode_ptr_to_physical(
> + * void *ptr
> + *  );
> + *
> + *  Returns thirty-two bit physical address for segment:offset realmode 
> pointer.
> + */
> +
I suggest using the names i386_Real_to_physical() and
i386_Physical_to_real() to be consistent with other functions like
this in the same code.

> +.set RM_PTR_ARG, 4
> +
> +   PUBLIC (i386_Real_mode_ptr_to_physical)
> +
> +SYM (i386_Real_mode_ptr_to_physical):
> +movlRM_PTR_ARG(esp),eax
> +xorlecx, ecx
> +movwax, cx
> +shrl$12, eax
> +andl$0x0, eax
> +addlecx, eax
> +ret
> +

My x86 assembly is not good enough to verify the following code. Joel?

> +/*
> + *  int i386_Physical_to_real_mode_ptr(
> + * void *address,
> + * unsigned short *segment,
> + * unsigned short *offset
> + *  );
> + *
> + *  Fills segment:offest realmode pointer counted from thirty-two bit 
> physical
> + *  address.
> + *  Returns 0 if unconvertible, 1 if successfuly converted.
> + */
> +
> +.set RM_PTR_SEG_ARG, 8
> +.set RM_PTR_OFF_ARG, 12
> +
> +   PUBLIC (i386_Physical_to_real_mode_ptr)
> +
> +SYM (i386_Physical_to_real_mode_ptr):
> +movlRM_PTR_ARG(esp),eax
> +cmpl$0x10FFF0, eax
> +js  cvtbl
> +movl$0, eax
> +ret
> +cvtbl:  cmpl$0x10, eax
> +js  lowmem
> +subl$0x0, eax
> +movlRM_PTR_OFF_ARG(esp), ecx
> +movwax, (ecx)
> +movlRM_PTR_SEG_ARG(esp), ecx
> +movw$0x, (ecx)
> +movl$1, eax
> +ret
> +lowmem: movleax, edx
> +and $0xF, ax
> +movlRM_PTR_OFF_ARG(esp), ecx
> +movwax, (ecx)
> +shrl$4, edx
> +movlRM_PTR_SEG_ARG(esp), ecx
> +movwdx, (ecx)
> +movl$1, eax
> +ret
> +
>  END_CODE
>
>  END
> diff --git a/cpukit/score/cpu/i386/rtems/score/i386.h 
> b/cpukit/score/cpu/i386/rtems/score/i386.h
> index 57569fc..a59e0cf 100644
> --- a/cpukit/score/cpu/i386/rtems/score/i386.h
> +++ b/cpukit/score/cpu/i386/rtems/score/i386.h
> @@ -186,6 +186,35 @@ void *i386_Physical_to_logical(
>  );
>
>  /*
> + *  i386_Real_mode_ptr_to_physical
> + *
> + *  Converts real mode pointer {segment, offset} to physical address.
> + */
> +void *i386_Real_mode_ptr_to_physical(
> +  void *ptr
> +);
> +
> +/*
> + *  i386_Physical_to_real_mode_ptr
> + *  Retreives real mode pointer elements {segmnet, offset} from physical 
> address
> + *  Function returns the highest segment (base) address possible.
> + *  Example:input   address - 0x4B3A2
> + *  output  segment - 0x4B3A
> + *  offset  - 0x2
> + *  input   address - 0x10F12E
> + *  output  segment - 0x
> + *  offset  - 0xF13E
> + *
> + *  return  0 address not convertible, must be less than 0x10FFEF
> + *  1 segment and offset extracted
> + */
> +int i386_Physical_to_real_mode_ptr(
> +  void *address,
> +  unsigned short *segment,
> +  unsigned short *offset
> +);
> +
> +/*
>   *  "Simpler" names for a lot of the things defined in this file
>   */
>
> --
> 1.9.1
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 3/3] smpschedaffinity05: Change semaphore attributes.

2014-11-12 Thread Joel Sherrill

On 11/12/2014 9:10 AM, Gedare Bloom wrote:
> Are there still tests for when the lock would be held despite the
> context switch? Just want to make sure we're not removing some
> test-case.
That wasn't the purpose of this test. It was to abuse the affinity
algorithm and cause migrations. Daniel Cederman found a bug
in the semaphore used to protect the data used to control the
threads and migration.

If you have another scenario in mind, please post it so we
can at least file a PR to add the case.

--joel
> On Wed, Nov 12, 2014 at 9:48 AM, Jennifer Averett
>  wrote:
>> Change semaphore attributes to resolve problem where semaphore is not
>> released upon a context switch.
>> ---
>>  testsuites/smptests/smpschedaffinity05/init.c | 9 +++--
>>  1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/testsuites/smptests/smpschedaffinity05/init.c 
>> b/testsuites/smptests/smpschedaffinity05/init.c
>> index 754c226..9fddb58 100644
>> --- a/testsuites/smptests/smpschedaffinity05/init.c
>> +++ b/testsuites/smptests/smpschedaffinity05/init.c
>> @@ -145,14 +145,11 @@ static void test(void)
>>sc = rtems_semaphore_create(
>>  rtems_build_name('S', 'E', 'M', '0'),
>>  1,   /* initial count = 1 */
>> -RTEMS_LOCAL   |
>> -RTEMS_SIMPLE_BINARY_SEMAPHORE |
>> -RTEMS_NO_INHERIT_PRIORITY |
>> -RTEMS_NO_PRIORITY_CEILING |
>> -RTEMS_FIFO,
>> +RTEMS_BINARY_SEMAPHORE |
>> +RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
>>  0,
>>  &task_sem
>> -  );
>> +  );
>>rtems_test_assert(sc == RTEMS_SUCCESSFUL);
>>
>>
>> --
>> 1.8.1.4
>>
>> ___
>> devel mailing list
>> devel@rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel

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

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


Re: [PATCH 3/3] smpschedaffinity05: Change semaphore attributes.

2014-11-12 Thread Sebastian Huber

On 12/11/14 16:39, Joel Sherrill wrote:

Daniel Cederman found a bug
in the semaphore used to protect the data used to control the
threads and migration.


What is this for a bug?

--
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 3/6] i386: global descriptor table manipulation functions

2014-11-12 Thread Gedare Bloom
On Wed, Nov 12, 2014 at 10:07 AM, Jan Dolezal  wrote:
> ---
>  c/src/lib/libbsp/i386/shared/irq/idt.c | 147 
> +
>  c/src/lib/libcpu/i386/cpu.h|  83 ++-
>  2 files changed, 194 insertions(+), 36 deletions(-)
>
> diff --git a/c/src/lib/libbsp/i386/shared/irq/idt.c 
> b/c/src/lib/libbsp/i386/shared/irq/idt.c
> index b79c60a..e6f1d57 100644
> --- a/c/src/lib/libbsp/i386/shared/irq/idt.c
> +++ b/c/src/lib/libbsp/i386/shared/irq/idt.c
> @@ -229,50 +229,33 @@ int i386_get_idt_config 
> (rtems_raw_irq_global_settings** config)
>return 1;
>  }
>
> -/*
> - * Caution this function assumes the GDTR has been already set.
> - */
> -int i386_set_gdt_entry (unsigned short segment_selector, unsigned base,
> -   unsigned limit)
> +int i386_raw_gdt_entry (unsigned short segment_selector_index, 
> segment_descriptors* sd)

Break apart lines > 80 characters, or shorten the line (by shortening
variable names).

>  {
> -unsigned   gdt_limit;
> +unsignedgdt_limit;
>  unsigned short  tmp_segment = 0;
> -unsigned intlimit_adjusted;
> -segment_descriptors*   gdt_entry_tbl;
> +segment_descriptors*gdt_entry_tbl;
> +unsigned int present;
>
>  i386_get_info_from_GDTR (&gdt_entry_tbl, &gdt_limit);
>
> -if (segment_selector > limit) {
> +if (segment_selector_index >= (gdt_limit+1)/8) {
> +  /* index to GDT table out of bounds */
>return 0;
>  }
> -/*
> - * set up limit first
> - */
> -limit_adjusted = limit;
> -if ( limit > 4095 ) {
> -  gdt_entry_tbl[segment_selector].granularity = 1;
> -  limit_adjusted /= 4096;
> +if (segment_selector_index == 0) {
> +  /* index 0 is not usable */
> +  return 0;
>  }
> -gdt_entry_tbl[segment_selector].limit_15_0  = limit_adjusted & 0x;
> -gdt_entry_tbl[segment_selector].limit_19_16 = (limit_adjusted >> 16) & 
> 0xf;
> -/*
> - * set up base
> - */
> -gdt_entry_tbl[segment_selector].base_address_15_0  = base & 0x;
> -gdt_entry_tbl[segment_selector].base_address_23_16 = (base >> 16) & 0xff;
> -gdt_entry_tbl[segment_selector].base_address_31_24 = (base >> 24) & 0xff;
> -/*
> - * set up descriptor type (this may well becomes a parameter if needed)
> - */
> -gdt_entry_tbl[segment_selector].type   = 2;/* Data R/W */
> -gdt_entry_tbl[segment_selector].descriptor_type= 1;/* Code or 
> Data */
> -gdt_entry_tbl[segment_selector].privilege  = 0;/* ring 0 */
> -gdt_entry_tbl[segment_selector].present= 1;/* not 
> present */
>
> +/* put prepared descriptor into the GDT */
> +present = sd->present;
> +sd->present = 0;
> +gdt_entry_tbl[segment_selector_index] = *sd;
> +sd->present = present;
> +gdt_entry_tbl[segment_selector_index].present = present;
Why write the present field separately from the rest?

>  /*
> - * Now, reload all segment registers so the limit takes effect.
> + * Now, reload all segment registers so that the possible changes takes 
> effect.
>   */
> -
>  __asm__ volatile( "movw %%ds,%0 ; movw %0,%%ds\n\t"
>"movw %%es,%0 ; movw %0,%%es\n\t"
>"movw %%fs,%0 ; movw %0,%%fs\n\t"
> @@ -280,7 +263,101 @@ int i386_set_gdt_entry (unsigned short 
> segment_selector, unsigned base,
>"movw %%ss,%0 ; movw %0,%%ss"
> : "=r" (tmp_segment)
> : "0"  (tmp_segment)
> - );
> -
> + );
>  return 1;
>  }
> +
> +inline void i386_fill_segment_desc_base(unsigned base, segment_descriptors* 
> sd)
> +{
> +sd->base_address_15_0  = base & 0x;
> +sd->base_address_23_16 = (base >> 16) & 0xff;
> +sd->base_address_31_24 = (base >> 24) & 0xff;
> +}
> +
> +inline void i386_fill_segment_desc_limit(unsigned limit, 
> segment_descriptors* sd)

Anytime you use inline, you should use static. If the function should
be available to other files, it should go in a header. The same goes
for any non-static function, they should have prototypes declared in a
header.

> +{
> +sd->granularity = 0;
> +if (limit > 65535) {
> +  sd->granularity = 1;
> +  limit /= 4096;
> +}
> +sd->limit_15_0  = limit & 0x;
> +sd->limit_19_16 = (limit >> 16) & 0xf;
> +}
> +
> +/*
> + * Caution this function assumes the GDTR has been already set.
> + */
> +int i386_set_gdt_entry (unsigned short segment_selector_index, unsigned base,
> +unsigned limit)
> +{
> +segment_descriptors gdt_entry;
> +memset(&gdt_entry, 0, sizeof(gdt_entry));
> +
> +i386_fill_segment_desc_limit(limit, &gdt_entry);
> +i386_fill_segment_desc_base(base, &gdt_entry);
> +/*
> + * set up descriptor type (this may well becomes a parameter if needed)

Re: [PATCH 4/6] i386/shared/int16: real mode interrupt interface

2014-11-12 Thread Gedare Bloom
On Wed, Nov 12, 2014 at 10:07 AM, Jan Dolezal  wrote:
> ---
>  c/src/lib/libbsp/i386/pc386/Makefile.am|   2 +
>  c/src/lib/libbsp/i386/pc386/preinstall.am  |   4 +
>  c/src/lib/libbsp/i386/shared/int16/int16.c | 397 
> +
>  c/src/lib/libbsp/i386/shared/int16/int16.h |  93 +++
>  4 files changed, 496 insertions(+)
>  create mode 100644 c/src/lib/libbsp/i386/shared/int16/int16.c
>  create mode 100644 c/src/lib/libbsp/i386/shared/int16/int16.h
These new files should probably go under i386/shared/irq  ?

>
> diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am 
> b/c/src/lib/libbsp/i386/pc386/Makefile.am
> index 9c901df..6042b5b 100644
> --- a/c/src/lib/libbsp/i386/pc386/Makefile.am
> +++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
> @@ -29,6 +29,7 @@ SUBDIRS = . tools
>  include_bsp_HEADERS  = ../../i386/shared/irq/irq.h
>  include_bsp_HEADERS += ../../i386/shared/irq/irq_asm.h
>  include_bsp_HEADERS += ../../i386/shared/comm/tty_drv.h
> +include_bsp_HEADERS += ../../i386/shared/int16/int16.h
>  include_bsp_HEADERS += ../../shared/include/irq-generic.h
>  include_bsp_HEADERS += ../../shared/include/irq-info.h
>  include_bsp_HEADERS += console/rtd316.h
> @@ -94,6 +95,7 @@ libbsp_a_SOURCES += console/kbd_parser.c
>  libbsp_a_SOURCES += console/serial_mouse_config.c
>  libbsp_a_SOURCES += ../../i386/shared/comm/uart.c
>  libbsp_a_SOURCES += ../../i386/shared/comm/tty_drv.c
> +libbsp_a_SOURCES += ../../i386/shared/int16/int16.c
>  libbsp_a_SOURCES += ../../shared/console.c
>  libbsp_a_SOURCES += console/console_select.c
>  libbsp_a_SOURCES += ../../shared/console_read.c
> diff --git a/c/src/lib/libbsp/i386/pc386/preinstall.am 
> b/c/src/lib/libbsp/i386/pc386/preinstall.am
> index aff01dc..1ff9fb8 100644
> --- a/c/src/lib/libbsp/i386/pc386/preinstall.am
> +++ b/c/src/lib/libbsp/i386/pc386/preinstall.am
> @@ -69,6 +69,10 @@ $(PROJECT_INCLUDE)/bsp/tty_drv.h: 
> ../../i386/shared/comm/tty_drv.h $(PROJECT_INC
> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/tty_drv.h
>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/tty_drv.h
>
> +$(PROJECT_INCLUDE)/bsp/int16.h: ../../i386/shared/int16/int16.h 
> $(PROJECT_INCLUDE)/bsp/$(dirstamp)
> +   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/int16.h
> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/int16.h
> +
>  $(PROJECT_INCLUDE)/bsp/irq-generic.h: ../../shared/include/irq-generic.h 
> $(PROJECT_INCLUDE)/bsp/$(dirstamp)
> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-generic.h
>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-generic.h
> diff --git a/c/src/lib/libbsp/i386/shared/int16/int16.c 
> b/c/src/lib/libbsp/i386/shared/int16/int16.c
> new file mode 100644
> index 000..380188f
> --- /dev/null
> +++ b/c/src/lib/libbsp/i386/shared/int16/int16.c
> @@ -0,0 +1,397 @@
> +/*
> + *  Realmode interrupt call implementation.
> + *
> + *
> + *  Copyright (c) 2014 - CTU in Prague
> + *   Jan Doležal ( dolez...@fel.cvut.cz )
> + *
> + *  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 
Why include string.h?

I have more comments below in the .h file. I am not reviewing this .c
file due to time constraints and my lack of confidence in x86
assembly, but I will say if the below macros and struct defines are
useful outside this file, then they should go into a header file
instead. Also, I think we use __volatile__ for declaring ASM blocks.
(We ought to have an RTEMS macro for this, e.g. RTEMS_INLINE_ASM(),
but I don't think we do.)

> +#include 
> +
> +#define IR_EAX_OFF  "0x00"
> +#define IR_EBX_OFF  "0x04"
> +#define IR_ECX_OFF  "0x08"
> +#define IR_EDX_OFF  "0x0C"
> +#define IR_ESI_OFF  "0x10"
> +#define IR_EDI_OFF  "0x14"
> +#define IR_DS_OFF   "0x18"
> +#define IR_ES_OFF   "0x1A"
> +#define IR_FS_OFF   "0x1C"
> +#define IR_GS_OFF   "0x1E"
> +
> +#define BKP_ESP_OFF "0x20"
> +#define BKP_SS_OFF  "0x24"
> +#define BKP_DS_OFF  "0x26"
> +#define RM_ENTRY"0x28"
> +#define PM_ENTRY"0x2C"
> +
> +/* parameters, results, backup values accessible in real mode */
> +struct rm_int_regs_bkp_param {
> +struct interrupt_registers inoutregs;
> +uint32_t pm_esp_bkp;
> +uint16_t pm_ss_bkp;
> +uint16_t ds_bkp;
> +uint16_t rm_entry;
> +uint16_t rm_code_segment;
> +uint32_t pm_entry;
> +uint16_t pm_code_selector;
> +/* if modifying update offset definitions as well */
> +}__attribute__((__packed__));
> +
> +#define BKP_IDTR_LIM"0x00"
> +#define BKP_IDTR_BASE   "0x02"
> +#define BKP_ES_OFF  "0x06"
> +#define BKP_FS_OFF  "0x08"
> +#define BKP_GS_OFF  "0x0A"
> +#define RML_ENTRY   "0x0C"
> +#define RML_D_SEL   "0x12"
> +#define RM_SS   "0x14"
> +#define RM_SP   "0x16"
> +#define RM_DS   "0x18"
> +/* backup values, pointers/parameters accessible 

Re: [PATCH 5/6] i386/pc386/include: header files for VESA BIOS EXTENSIONS and VESA Extended Display Identification Data

2014-11-12 Thread Gedare Bloom
Just a couple high-level comments:

Is this code entirely written by you?

If the code is i386-specific, I'd like to see it put into i386 namespace.

The use of bitfields worries me, especially if the code might be
ported to other architectures. I can see now why you put __packed__ on
all your structs, as it is necessary to get anywhere close to the
right behavior from the compiler when using bit fields.

-Gedare


On Wed, Nov 12, 2014 at 10:07 AM, Jan Dolezal  wrote:
> ---
>  c/src/lib/libbsp/i386/pc386/Makefile.am|   2 +
>  c/src/lib/libbsp/i386/pc386/include/edid.h | 759 
> +
>  c/src/lib/libbsp/i386/pc386/include/vbe3.h | 461 ++
>  c/src/lib/libbsp/i386/pc386/preinstall.am  |   8 +
>  4 files changed, 1230 insertions(+)
>  create mode 100644 c/src/lib/libbsp/i386/pc386/include/edid.h
>  create mode 100644 c/src/lib/libbsp/i386/pc386/include/vbe3.h
>
> diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am 
> b/c/src/lib/libbsp/i386/pc386/Makefile.am
> index 6042b5b..2e60947 100644
> --- a/c/src/lib/libbsp/i386/pc386/Makefile.am
> +++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
> @@ -106,6 +106,8 @@ libbsp_a_SOURCES += console/printk_support.c
>  libbsp_a_SOURCES += console/vgacons.c
>  libbsp_a_SOURCES += console/exar17d15x.c
>  libbsp_a_SOURCES += console/rtd316.c
> +include_HEADERS += include/vbe3.h
> +include_HEADERS += include/edid.h
>  if USE_CIRRUS_GD5446
>  libbsp_a_SOURCES += console/fb_cirrus.c
>  else
> diff --git a/c/src/lib/libbsp/i386/pc386/include/edid.h 
> b/c/src/lib/libbsp/i386/pc386/include/edid.h
> new file mode 100644
> index 000..937976e
> --- /dev/null
> +++ b/c/src/lib/libbsp/i386/pc386/include/edid.h
> @@ -0,0 +1,759 @@
> +/**
> + * @file edid.h
> + *
> + * @ingroup i386_pc386
> + *
> + * @brief VESA EDID definitions.
> + */
> +
> +/*
> + * edid.h  - This file contains definitions for constants related to
> + *   VESA Extended Display Identification Data.
> + *  More information can be found at
> + *  
> + *  VESA public standards may be found at
> + *  
> + *
> + * Copyright (C) 2014  Jan Doležal (dolez...@fel.cvut.cz)
> + * CTU in Prague.
> + *
> + *  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 _EDID_H
> +#define _EDID_H
> +
> +#ifndef ASM /* ASM */
> +
> +#include 
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif /* __cplusplus */
> +
> +
> +/*  VESA Extended Display Identification Data (EDID) Standard
> +Version 3, Revision Date: November 13, 1997 */
> +/*  VESA Enhanced Extended Display Identification Data (E-EDID) Standard
> +Release A, Revision 2, September 25, 2006 */
> +/*  VESA Enhanced Extended Display Identification Data (E-EDID) Proposed
> +Release A, March 27, 2007 */
> +
> +/ structs and defines shared by both EDIDv1 and EDIDv2 /
> +
> +/* Video Input Definition */
> +/* Analog Interface Data Format - Signal Level Standard */
> +#define EDIDx_SLS_0700_0300_1000Vpp 0x0
> +#define EDIDx_SLS_0714_0286_1000Vpp 0x1
> +#define EDIDx_SLS_1000_0400_1400Vpp 0x2
> +#define EDIDx_SLS_0700__0700Vpp 0x3
> +
> +struct DetailedTimingDescriptor{
> +uint16_t PixelClock_div1;
> +uint8_t HorizontalActiveLow;
> +uint8_t HorizontalBlankingLow;
> +uint8_t HorizontalBlankingHigh  : 4;
> +uint8_t HorizontalActiveHigh: 4;
> +uint8_t VerticalActiveLow;
> +uint8_t VerticalBlankingLow;
> +uint8_t VerticalBlankingHigh: 4;
> +uint8_t VerticalActiveHigh  : 4;
> +uint8_t HorizontalSyncOffsetLow;
> +uint8_t HorizontalSyncPulseWidthLow;
> +uint8_t VerticalSyncPulseWidthLow   : 4;
> +uint8_t VerticalSyncOffsetLow   : 4;
> +uint8_t VerticalSyncPulseWidthHigh  : 2;
> +uint8_t VerticalSyncOffsetHigh  : 2;
> +uint8_t HorizontalSyncPulseWidthHigh: 2;
> +uint8_t HorizontalSyncOffsetHigh: 2;
> +uint8_t HorizontalImageSizeLow;
> +uint8_t VerticalImageSizeLow;
> +uint8_t VerticalImageSizeHigh   : 4;
> +uint8_t HorizontalImageSizeHigh : 4;
> +uint8_t HorizontalBorder;
> +uint8_t VerticalBorder;
> +uint8_t Flag_StereoMode0: 1;
> +/* next four flags has different purpose with analog
> +   and digital interfaces for EDID version 2; first
> +   goes analog, after underscore there is digital name of bit */
> +uint8_t Flag_SyncPolarity_LPPolarity: 1;
> +uint8_t Flag_Serration_FLMPolarity  : 1;
> +uint8_t Flag_Composition_Serration  : 1;
> +uint8_t Flag_Composition_ShiftClockUse  : 1;
> +
> +uint8_t Flag_StereoMode1: 2;
> +uint8_t Fl

Re: [PATCH 6/6] i386/pc386: VESA based frame buffer utilizing real mode interrupt 10h

2014-11-12 Thread Gedare Bloom
On Wed, Nov 12, 2014 at 10:07 AM, Jan Dolezal  wrote:
> ---
>  c/src/lib/libbsp/i386/pc386/Makefile.am  |   5 +
>  c/src/lib/libbsp/i386/pc386/configure.ac |  13 +
>  c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c | 851 
> +++
>  c/src/lib/libbsp/i386/pc386/include/fb_vesa.h| 131 
>  c/src/lib/libbsp/i386/pc386/preinstall.am|   6 +
>  c/src/lib/libbsp/i386/pc386/start/start.S|   8 +
>  6 files changed, 1014 insertions(+)
>  create mode 100644 c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c
>  create mode 100644 c/src/lib/libbsp/i386/pc386/include/fb_vesa.h
>
> diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am 
> b/c/src/lib/libbsp/i386/pc386/Makefile.am
> index 2e60947..7fb6747 100644
> --- a/c/src/lib/libbsp/i386/pc386/Makefile.am
> +++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
> @@ -106,13 +106,18 @@ libbsp_a_SOURCES += console/printk_support.c
>  libbsp_a_SOURCES += console/vgacons.c
>  libbsp_a_SOURCES += console/exar17d15x.c
>  libbsp_a_SOURCES += console/rtd316.c
> +if USE_VBE_RM
>  include_HEADERS += include/vbe3.h
>  include_HEADERS += include/edid.h
> +include_HEADERS += include/fb_vesa.h
> +libbsp_a_SOURCES += console/fb_vesa_rm.c
> +else
>  if USE_CIRRUS_GD5446
>  libbsp_a_SOURCES += console/fb_cirrus.c
>  else
>  libbsp_a_SOURCES += console/fb_vga.c
>  endif
> +endif
>
>  # gdb
>  libbsp_a_SOURCES += ../../i386/shared/comm/i386-stub.c
> diff --git a/c/src/lib/libbsp/i386/pc386/configure.ac 
> b/c/src/lib/libbsp/i386/pc386/configure.ac
> index ecec056..a74d6cb 100644
> --- a/c/src/lib/libbsp/i386/pc386/configure.ac
> +++ b/c/src/lib/libbsp/i386/pc386/configure.ac
> @@ -82,6 +82,19 @@ RTEMS_BSPOPTS_HELP([USE_CIRRUS_GD5446],
>   NOTE: This has only been tested on Qemu.])
>  AM_CONDITIONAL(USE_CIRRUS_GD5446,test "$USE_CIRRUS_GD5446" = "1")
>
> +RTEMS_BSPOPTS_SET([USE_VBE_RM],[*],[0])
> +RTEMS_BSPOPTS_HELP([USE_VBE_RM],
> +[If defined, enables use of the Vesa Bios Extensions - real mode interface,
> + which enables graphical mode and introduce it upon bootup.])
> +AM_CONDITIONAL(USE_VBE_RM,test "$USE_VBE_RM" = "1")
> +
> +if test "${USE_VBE_RM}" = "1" ; then
> +  if test -z "${NUM_APP_DRV_GDT_DESCRIPTORS}"; then
> +  NUM_APP_DRV_GDT_DESCRIPTORS=2 ;
> +  else
> +  NUM_APP_DRV_GDT_DESCRIPTORS+=2 ;
> +  fi
> +fi
>  RTEMS_BSPOPTS_SET([NUM_APP_DRV_GDT_DESCRIPTORS],[*],[0])
>  RTEMS_BSPOPTS_HELP([NUM_APP_DRV_GDT_DESCRIPTORS],
>  [Defines how many descriptors in GDT may be allocated for application or
> diff --git a/c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c 
> b/c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c
> new file mode 100644
> index 000..0087c82
> --- /dev/null
> +++ b/c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c
> @@ -0,0 +1,851 @@
> +/*
> + *  FB driver for graphic hardware compatible with VESA Bios Extension
> + *  Real mode interface utilized
> + *  Tested on real HW.
> + *
> + *  Copyright (c) 2014 - CTU in Prague
> + *   Jan Doležal ( dolez...@fel.cvut.cz )
> + *
> + *  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.
> + *
> + *  The code is based on following information sources:
> + *- doc/bsp_howto/bsp_howto.pdf
> + *- VESA BIOS EXTENSION (VBE) Core Function Standard, Ver: 3.0, Sep 16, 
> 1998
> + *- RTEMS fb_vga.c - Rosimildo da Silva ( rdasi...@connecttel.com )
> + *- RTEMS fb_cirrus.c - Alexandru-Sever Horin (alex.seve...@gmail.com)
> + */
Based on is fine if you just read some things, but if you actually
copied code from other sources, you need to also copy the copyrights
and license info. Please make the distinction more clear, as saying
"based on" is too vague.

I don't have time right now to review this code. Some quick notes though:
* assuming pthreads, make sure there is a compile-time check.
* use typedefs for struct and union types.
* check that your code is consistent with the RTEMS coding conventions
(http://wiki.rtems.org/wiki/index.php/Coding_Conventions)

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

RE: [PATCH 3/3] smpschedaffinity05: Change semaphore attributes.

2014-11-12 Thread Jennifer Averett
Daniel found a bug in smpschedaffinity05 where the semaphore was being
held by a task that was being switched out and the semaphore was not released
because the task wasn't being switched back in at any point. This would cause 
the
test to lock waiting on the semaphore and not finish.   This set of tasks 
request the
semaphore with a no wait option.   I think the same thing can happen in 
smpschedaffinity02, and smpschedaffinity04.  That is the reason for the three 
patches.

> -Original Message-
> From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de]
> Sent: Wednesday, November 12, 2014 9:41 AM
> To: Joel Sherrill; Gedare Bloom; Jennifer Averett
> Cc: rtems-de...@rtems.org
> Subject: Re: [PATCH 3/3] smpschedaffinity05: Change semaphore attributes.
> 
> On 12/11/14 16:39, Joel Sherrill wrote:
> > Daniel Cederman found a bug
> > in the semaphore used to protect the data used to control the threads
> > and migration.
> 
> What is this for a bug?
> 
> --
> 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 3/3] smpschedaffinity05: Change semaphore attributes.

2014-11-12 Thread Joel Sherrill
Jennifer can you send Daniel a patch using just priority inheritance (with 
priority blocking)/and let him retest?

On November 12, 2014 10:14:10 AM CST, Jennifer Averett 
 wrote:
>Daniel found a bug in smpschedaffinity05 where the semaphore was being
>held by a task that was being switched out and the semaphore was not
>released
>because the task wasn't being switched back in at any point. This would
>cause the
>test to lock waiting on the semaphore and not finish.   This set of
>tasks request the
>semaphore with a no wait option.   I think the same thing can happen in
>
>smpschedaffinity02, and smpschedaffinity04.  That is the reason for the
>three patches.
>
>> -Original Message-
>> From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de]
>> Sent: Wednesday, November 12, 2014 9:41 AM
>> To: Joel Sherrill; Gedare Bloom; Jennifer Averett
>> Cc: rtems-de...@rtems.org
>> Subject: Re: [PATCH 3/3] smpschedaffinity05: Change semaphore
>attributes.
>> 
>> On 12/11/14 16:39, Joel Sherrill wrote:
>> > Daniel Cederman found a bug
>> > in the semaphore used to protect the data used to control the
>threads
>> > and migration.
>> 
>> What is this for a bug?
>> 
>> --
>> 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] smpschedaffinity02: Change semaphore attributes.

2014-11-12 Thread Jennifer Averett


> -Original Message-
> From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de]
> Sent: Wednesday, November 12, 2014 9:16 AM
> To: Jennifer Averett; rtems-de...@rtems.org
> Subject: Re: [PATCH 1/3] smpschedaffinity02: Change semaphore attributes.
> 
> On 12/11/14 15:48, Jennifer Averett wrote:
> > Change semaphore attributes to prevent semaphore from being locked
> and
> > never released upon a context switch.
> > ---
> >   testsuites/smptests/smpschedaffinity02/init.c | 7 ++-
> >   1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/testsuites/smptests/smpschedaffinity02/init.c
> > b/testsuites/smptests/smpschedaffinity02/init.c
> > index a3e0ddf..43efc99 100644
> > --- a/testsuites/smptests/smpschedaffinity02/init.c
> > +++ b/testsuites/smptests/smpschedaffinity02/init.c
> > @@ -140,11 +140,8 @@ static void test(void)
> > sc = rtems_semaphore_create(
> >   rtems_build_name('S', 'E', 'M', '0'),
> >   1,
> > -RTEMS_LOCAL   |
> > -RTEMS_SIMPLE_BINARY_SEMAPHORE |
> > -RTEMS_NO_INHERIT_PRIORITY |
> > -RTEMS_NO_PRIORITY_CEILING |
> > -RTEMS_FIFO,
> > +RTEMS_BINARY_SEMAPHORE |
> > +RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
> >   0,
> >   &task_sem
> > );
> 
> Why do you use RTEMS_MULTIPROCESSOR_RESOURCE_SHARING here?

It just needed to use a binary instead of a simple binary.  I think it could 
also
have been resolved with the following settings:

RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY

> --
> 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 3/3] smpschedaffinity05: Change semaphore attributes.

2014-11-12 Thread Jennifer Averett


> -Original Message-
> From: Joel Sherrill [mailto:joel.sherr...@oarcorp.com]
> Sent: Wednesday, November 12, 2014 10:16 AM
> To: Jennifer Averett; Sebastian Huber; Gedare Bloom
> Cc: rtems-de...@rtems.org
> Subject: RE: [PATCH 3/3] smpschedaffinity05: Change semaphore attributes.
> 
> Jennifer can you send Daniel a patch using just priority inheritance (with
> priority blocking)/and let him retest?
> 

Working on it :-)


> On November 12, 2014 10:14:10 AM CST, Jennifer Averett
>  wrote:
> >Daniel found a bug in smpschedaffinity05 where the semaphore was being
> >held by a task that was being switched out and the semaphore was not
> >released because the task wasn't being switched back in at any point.
> >This would cause the
> >test to lock waiting on the semaphore and not finish.   This set of
> >tasks request the
> >semaphore with a no wait option.   I think the same thing can happen in
> >
> >smpschedaffinity02, and smpschedaffinity04.  That is the reason for the
> >three patches.
> >
> >> -Original Message-
> >> From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de]
> >> Sent: Wednesday, November 12, 2014 9:41 AM
> >> To: Joel Sherrill; Gedare Bloom; Jennifer Averett
> >> Cc: rtems-de...@rtems.org
> >> Subject: Re: [PATCH 3/3] smpschedaffinity05: Change semaphore
> >attributes.
> >>
> >> On 12/11/14 16:39, Joel Sherrill wrote:
> >> > Daniel Cederman found a bug
> >> > in the semaphore used to protect the data used to control the
> >threads
> >> > and migration.
> >>
> >> What is this for a bug?
> >>
> >> --
> >> 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: Proposed RTEMS Community Code of Conduct

2014-11-12 Thread Thomas Doerfler
Hi Ralf,

you are right when you mention, that we cooperated quite well the last
15 or so years without a CCoC, although some past discussions went
definitively beyond both proper personal conduct and the now formulated
CCoC.

The CCoC itself will not ensure proper behaviour, but it may help in
certain discussions. Remember that our community has members from many
different cultures all over the world. People from these cultures may
have different looks at "proper behaviour", so the few points listed in
the CCoC may help. Just in case.

What I don't understand in your posting: On the one hand you mention,
that the topics of the proposed CCoC have never been an issue on the
RTEMS list and on the other hand you point out, that other CCoCs on
other lists may have made some users leave the list.

Do you think one of the porposed CCoC's topics would make people leave
this project?

I see no harm in the CCoC, and always appreciate clear words.

wkr,

Thomas.


Am 12.11.2014 14:47, schrieb Ralf Corsepius:
> On 11/10/2014 06:11 PM, Joel Sherrill wrote:
> 
>> While at the GSOC Mentor Summit, I heard a story from another
>> organization about some inappropriate behavior by someone.
>> They were fairly easily able to deal with this because their
>> organization had an agreed upon Community Code of Conduct (CCoC).
>> This provides guidelines on expected behavior as well as what
>> will occur if these are violated.
> 
> As you may know, I am opposed to any such Code of Conducts, as well as I
> do not see any need for the RTEMS list to implement one.
> 
> 
> Why?
> 
> a) The issues you mention have never been a problem to the RTEMS list.
> That said I feel you trying to implement problems to a current non-issue.
> 
> b) I for one consider "Code of Conducts" to an ongoing fashion/hype,
> which as I feel probably, originates from certain tendencies in US-society.
> 
> c) I have seen many occassions, where "Code of Conducts" have been
> applied as a means of censorship to silence and suppress oppositions in
> case of disagreement or dispute.
> 
> d) Some of these project who are proud to have implemented a "Code of
> Conduct" wonder about loosing users. Why? cf. c)
> 
> Ralf
> 
> 
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


-- 

embedded brains GmbH
Thomas Doerfler
Dornierstr. 4
D-82178 Puchheim
Germany
email: thomas.doerf...@embedded-brains.de
Phone: +49-89-18 94 741-12
Fax:   +49-89-18 94 741-09
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] smpschedaffinity02: Change semaphore attributes.

2014-11-12 Thread Sebastian Huber

On 12/11/14 17:17, Jennifer Averett wrote:



>-Original Message-
>From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de]
>Sent: Wednesday, November 12, 2014 9:16 AM
>To: Jennifer Averett;rtems-de...@rtems.org
>Subject: Re: [PATCH 1/3] smpschedaffinity02: Change semaphore attributes.
>
>On 12/11/14 15:48, Jennifer Averett wrote:

> >Change semaphore attributes to prevent semaphore from being locked

>and

> >never released upon a context switch.
> >---
> >   testsuites/smptests/smpschedaffinity02/init.c | 7 ++-
> >   1 file changed, 2 insertions(+), 5 deletions(-)
> >
> >diff --git a/testsuites/smptests/smpschedaffinity02/init.c
> >b/testsuites/smptests/smpschedaffinity02/init.c
> >index a3e0ddf..43efc99 100644
> >--- a/testsuites/smptests/smpschedaffinity02/init.c
> >+++ b/testsuites/smptests/smpschedaffinity02/init.c
> >@@ -140,11 +140,8 @@ static void test(void)
> > sc = rtems_semaphore_create(
> >   rtems_build_name('S', 'E', 'M', '0'),
> >   1,
> >-RTEMS_LOCAL   |
> >-RTEMS_SIMPLE_BINARY_SEMAPHORE |
> >-RTEMS_NO_INHERIT_PRIORITY |
> >-RTEMS_NO_PRIORITY_CEILING |
> >-RTEMS_FIFO,
> >+RTEMS_BINARY_SEMAPHORE |
> >+RTEMS_MULTIPROCESSOR_RESOURCE_SHARING,
> >   0,
> >   &task_sem
> > );

>
>Why do you use RTEMS_MULTIPROCESSOR_RESOURCE_SHARING here?

It just needed to use a binary instead of a simple binary.  I think it could 
also
have been resolved with the following settings:

RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY



The MrsP semaphores are broken with the affinity scheduler.

--
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