Re: [PATCH] Add the i2c driver for Beaglebone Black:

2017-05-24 Thread Christian Mauderer
Hi Sichen,

Am 24.05.2017 um 05:50 schrieb Sichen Zhao:
> Hi Christian,
> 
> 
> I got you, and there are some advice i don't understand:
> 
> 
>> +static void am335x_i2c_continue_write(bbb_i2c_bus *bus,
>> +   volatile bbb_i2c_regs *regs)
>> +{
>> +
>> +
> 
> 
> Why the two empty lines? And again: Indentation. 
> 
> 
> You mean the Indentation is parameter volatile bbb_i2c_regs
> *regs Indentation?

Sorry that comment hasn't been placed at a good location. The
indentation is for the lines below the comment:

+if (bus->already_transferred == bus->msg_todo) {
+  REG(®s->BBB_I2C_DATA) =
bus->current_msg_byte[bus->already_transferred];
+  REG(®s->BBB_I2C_IRQSTATUS) = AM335X_I2C_IRQSTATUS_XRDY;
+  am335x_i2c_masterint_disable(regs, AM335X_I2C_IRQSTATUS_XRDY );
+  REG(®s->BBB_I2C_CON) |= AM335X_I2C_CON_STOP;
+   } else {
+
writeb(bus->current_msg_byte[bus->already_transferred],®s->BBB_I2C_DATA);
+  REG(®s->BBB_I2C_IRQSTATUS) = AM335X_I2C_IRQSTATUS_XRDY;
+ bus->already_transferred++;
+   }
+}

> 
> becausethe function is more than 80 character.

I didn't check for lines longer than 80 characters. But if there are
still some, that would be a point too ;-)

Kind regards

Christian
> 
> 
> *From:* devel  on behalf of Christian Mauderer
> 
> *Sent:* Wednesday, May 24, 2017 1:36 AM
> *To:* Sichen Zhao
> *Cc:* punit vara; devel@rtems.org
> *Subject:* Re: [PATCH] Add the i2c driver for Beaglebone Black:
>  
> Hello Sichen Zhao,
> 
> the patch works fine. I tested it with a (just slightly) different app.
> 
> I added some lines of comments into the code. Please take a look at them.
> 
> Please excuse me for being a little picky but there are still some style
> points. If you write code, you should keep in mind that most source code
> is read multiple times by different people but only written once. So it
> is really a good idea to put some more time into the writing to make it
> easy to read. A steady and readable style is one very important point in
> that context.
> 
> By the way: If you send multiple versions of a patch, it's a good idea
> to add a version to the the subject like "[PATCH v2] ...". That
> simplifies it for all mailing list readers to find the newest version of
> the patch. If you use `git send-email` to send your patches, you can do
> that by adding a `-v2`.
> 
> If you have some explanation to your patches (like you did in another
> mail), you can also use the `--compose` option or (like I just found out
> at [1]) the `--cover-letter` option of git send-email.
> 
> [1]
> https://www.freedesktop.org/wiki/Software/PulseAudio/HowToUseGitSendEmail/
> 
> Kind regards
> 
> Christian
> 
> - Ursprüngliche Mail -
>> Von: "Sichen Zhao" <1473996...@qq.com>
>> An: devel@rtems.org
>> CC: "punit vara" , "Christian Mauderer" 
>> 
>> Gesendet: Dienstag, 23. Mai 2017 16:56:06
>> Betreff: [PATCH] Add the i2c driver for Beaglebone Black:
> 
>> Update ticket #2891 and my GSOC project
>> 
>> add c/src/lib/libbsp/arm/beagle/i2c/bbb-i2c.c
>> modify c/src/lib/libbsp/arm/beagle/include/i2c.h
>> modify c/src/lib/libbsp/arm/beagle/include/bbb-gpio.h
>> modify c/src/lib/libcpu/arm/shared/include/am335x.h
>> modify c/src/lib/libbsp/arm/beagle/Makefile.am
>> 
>> Now can read the EEPROM by i2c, the test application link is:
>> https://github.com/hahchenchen/GSOC-test-application
>> ---
>> c/src/lib/libbsp/arm/beagle/Makefile.am|   1 +
>> c/src/lib/libbsp/arm/beagle/i2c/bbb-i2c.c  | 578 
>> +
>> c/src/lib/libbsp/arm/beagle/include/bbb-gpio.h |   4 +-
>> c/src/lib/libbsp/arm/beagle/include/i2c.h  | 162 ++-
>> c/src/lib/libcpu/arm/shared/include/am335x.h   | 196 +
>> 5 files changed, 920 insertions(+), 21 deletions(-)
>> create mode 100644 c/src/lib/libbsp/arm/beagle/i2c/bbb-i2c.c
>> 
>> diff --git a/c/src/lib/libbsp/arm/beagle/Makefile.am
>> b/c/src/lib/libbsp/arm/beagle/Makefile.am
>> index 8bb8478..274dc0e 100644
>> --- a/c/src/lib/libbsp/arm/beagle/Makefile.am
>> +++ b/c/src/lib/libbsp/arm/beagle/Makefile.am
>> @@ -115,6 +115,7 @@ libbsp_a_SOURCES += ../../shared/console.c \
>> 
>> # I2C
>> libbsp_a_SOURCES += misc/i2c.c
>> +libbsp_a_SOURCES += i2c/bbb-i2c.c
>> 
>> # GPIO
>> libbsp_a_SOURCES += gpio/bbb-gpio.c
>> diff --git a/c/src/lib/libbsp/arm/beagle/i2c/bbb-i2c.c
>> b/c/src/lib/libbsp/arm/beagle/i2c/bbb-i2c.c
>> new file mode 100644
>> index 000..dbab776
>> --- /dev/null
>> +++ b/c/src/lib/libbsp/arm/beagle/i2c/bbb-i2c.c
>> @@ -0,0 +1,578 @@
>> +/**
>> + * @file
>> + *
>> + * @ingroup arm_beagle
>> + *
>> + * @brief BeagleBoard I2C bus initialization and API Support.
>> + */
>> +
>> +/*
>> + * Copyright (c) 2017 Sichen Zhao 
>> + *
>> + * 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.
> 
>> + */
>> +
>> +/*
>> + * Modified on Punit Vara works, currently
>> + * the i2c file 

[PATCH] build-system: Parallel build all subdirs.

2017-05-24 Thread Chris Johns
---
 c/Makefile.am  |   4 +-
 c/src/Makefile.am  |   2 +-
 c/src/automake/subdirs.am  | 117 +++--
 c/src/lib/Makefile.am  |   7 +-
 c/src/lib/libbsp/Makefile.am   |   4 +-
 c/src/lib/libbsp/arm/Makefile.am   |   2 +-
 c/src/lib/libbsp/bfin/Makefile.am  |   2 +-
 c/src/lib/libbsp/epiphany/Makefile.am  |   2 +-
 c/src/lib/libbsp/i386/Makefile.am  |   2 +-
 c/src/lib/libbsp/i386/pc386/Makefile.am|   3 +-
 c/src/lib/libbsp/lm32/Makefile.am  |   2 +-
 c/src/lib/libbsp/m32c/Makefile.am  |   2 +-
 c/src/lib/libbsp/m68k/Makefile.am  |   2 +-
 c/src/lib/libbsp/m68k/mcf5206elite/Makefile.am |   2 +-
 c/src/lib/libbsp/mips/Makefile.am  |   2 +-
 c/src/lib/libbsp/moxie/Makefile.am |   2 +-
 c/src/lib/libbsp/nios2/Makefile.am |   2 +-
 c/src/lib/libbsp/no_cpu/Makefile.am|   2 +-
 c/src/lib/libbsp/or1k/Makefile.am  |   2 +-
 c/src/lib/libbsp/powerpc/Makefile.am   |   2 +-
 .../libbsp/powerpc/motorola_powerpc/Makefile.am|   7 +-
 c/src/lib/libbsp/sh/Makefile.am|   2 +-
 c/src/lib/libbsp/sparc/Makefile.am |   2 +-
 c/src/lib/libbsp/sparc64/Makefile.am   |   2 +-
 c/src/lib/libbsp/v850/Makefile.am  |   2 +-
 c/src/lib/libcpu/Makefile.am   |   2 +-
 cpukit/Makefile.am |  44 
 cpukit/automake/subdirs.am | 104 --
 cpukit/libfs/Makefile.am   |   2 +-
 cpukit/score/Makefile.am   |   2 +-
 cpukit/score/cpu/Makefile.am   |   2 +-
 31 files changed, 222 insertions(+), 114 deletions(-)

diff --git a/c/Makefile.am b/c/Makefile.am
index b44db89c21..81d8b7801f 100644
--- a/c/Makefile.am
+++ b/c/Makefile.am
@@ -11,8 +11,8 @@ SUBDIRS = . $(RTEMS_BSP)
 DIST_SUBDIRS = $(RTEMS_BSP)
 
 ## Let all RTEMS' make targets depend on ${RTEMS_BSP}
-all-local: ${RTEMS_BSP}
-preinstall-am: ${RTEMS_BSP}
+all-local: $(RTEMS_BSP)
+preinstall-am: $(RTEMS_BSP)
 
 ## Pull in extra files intro the distribution
 EXTRA_DIST = ACKNOWLEDGEMENTS
diff --git a/c/src/Makefile.am b/c/src/Makefile.am
index aeec2ea1d1..8fcdd645eb 100644
--- a/c/src/Makefile.am
+++ b/c/src/Makefile.am
@@ -1,6 +1,6 @@
 ACLOCAL_AMFLAGS = -I aclocal
 
-SUBDIRS = . @BSP_SUBDIRS@
+_SUBDIRS = . @BSP_SUBDIRS@
 DIST_SUBDIRS = @BSP_SUBDIRS@
 
 clean-local:
diff --git a/c/src/automake/subdirs.am b/c/src/automake/subdirs.am
index 1e0a9a757a..3e57f0c06f 100644
--- a/c/src/automake/subdirs.am
+++ b/c/src/automake/subdirs.am
@@ -1,30 +1,87 @@
-## Borrowed from automake-1.4 and adapted to RTEMS
-
-## NOTE: This is a temporary work-around to keep
-## RTEMS's non automake standard make targets working.
-## Once automake is fully integrated these make targets
-## and this file will probably be removed
-
-preinstall-recursive:
-   @set fnord $(MAKEFLAGS); amf=$$2; \
-   dot_seen=no; \
-   target=`echo $@ | sed s/-recursive//`; \
-   list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
-   dot_seen=yes; \
-   local_target="$$target-am"; \
- else \
-   local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-## This trick allows "-k" to keep its natural meaning when running a
-## recursive rule.
-  || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
-   done; \
-   if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
-   fi; test -z "$$fail"
-
-preinstall: preinstall-recursive
-.PHONY: preinstall-recursive
+## Copyright 2017 Chris Johns 
+
+##
+## The following builds in parallel. The subdirectories are
+## expanded into separate rules and all the targets are listed
+## and make runs as many as it can.
+##
+## A macro is defined and evaluated once for each directory. This
+## creates the instance of the rule. Use $(info ...) to print them.
+##
+
+SUBDIRS_dot= $(filter .,$(_SUBDIRS))
+SUBDIRS_no_dot = $(filter-out .,$(_SUBDIRS))
+SUBDIRS_no_dot_no_wrapup   = $(filter-out wrapup,$(SUBDIRS_no_dot))
+SUBDIRS_no_dot_no_testsuites   = $(filter-out 
testsuites,$(SUBDIRS_no_dot))
+SUBDIRS_no_dot_no_wrapup_no_testsuites = $(filter-out 
testsuites,$(SUBDIRS_no_dot_no_wrapup))
+SUBDIRS_wrapup = $(filter wrapup,$(SUBDIRS_no_dot))
+SUBDIRS_testsuites = $(filter 
testsuites,$(SUBDIRS_no_dot))
+
+SUBDIR_TARGET = $(subst /,-,$1)
+PREI

[PATCH] Add RTEMS port of Linux FB user-space API

2017-05-24 Thread Kevin Kirspel
---
 cpukit/dev/include/linux/fb.h | 1188 +
 1 file changed, 1188 insertions(+)
 create mode 100644 cpukit/dev/include/linux/fb.h

diff --git a/cpukit/dev/include/linux/fb.h b/cpukit/dev/include/linux/fb.h
new file mode 100644
index 000..eebe1d4
--- /dev/null
+++ b/cpukit/dev/include/linux/fb.h
@@ -0,0 +1,1188 @@
+/**
+ * @file
+ *
+ * @brief RTEMS Port of Linux FB API
+ *
+ * @ingroup FBLinux
+ */
+
+/*
+ * Copyright (c) 2017 Kevin Kirspel.
+ *
+ * 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 _UAPI_LINUX_FB_H
+#define _UAPI_LINUX_FB_H
+
+#include 
+
+/**
+ * @defgroup FBLinux Linux FB User-Space API
+ *
+ * @ingroup FB
+ *
+ * @brief RTEMS port of Linux FB user-space API.
+ *
+ * Additional documentation is available through the Linux sources, see
+ *
+ * - /usr/src/linux/include/uapi/linux/fb.h,
+ * - /usr/src/linux/Documentation/fb.
+ *
+ * @{
+ */
+
+/**
+ * @name FB Definitions
+ *
+ * @{
+ */
+
+/**
+ * @brief The maximum number of framebuffer devices.
+ */
+#define FB_MAX 32
+
+/** @} */
+
+/**
+ * @name FB Ioctls
+ *
+ * @{
+ */
+
+/**
+ * @brief Gets the variable screen information.
+ *
+ * @see fb_var_screeninfo.
+ */
+#define FBIOGET_VSCREENINFO 0x4600
+
+/**
+ * @brief Sets the variable screen information.
+ *
+ * Will return -1 if kernel is unable to activate the settings
+ *
+ * @see fb_var_screeninfo.
+ */
+#define FBIOPUT_VSCREENINFO 0x4601
+
+/**
+ * @brief Gets the fix screen information.
+ *
+ * @see fb_fix_screeninfo.
+ */
+#define FBIOGET_FSCREENINFO 0x4602
+
+/**
+ * @brief Gets the color map.
+ *
+ * @see fb_cmap.
+ */
+#define FBIOGETCMAP 0x4604
+
+/**
+ * @brief Sets the color map.
+ *
+ * @see fb_cmap.
+ */
+#define FBIOPUTCMAP 0x4605
+
+/**
+ * @brief Move physical display within the virtual.
+ */
+#define FBIOPAN_DISPLAY 0x4606
+
+/**
+ * @brief Controls cursor attributes.
+ *
+ * @see fb_cursor.
+ */
+#define FBIO_CURSOR_IOWR('F', 0x08, struct fb_cursor)
+
+/**
+ * @brief Gets content of console.
+ */
+#define FBIOGET_CON2FBMAP   0x460F
+
+/**
+ * @brief Sets content of console.
+ */
+#define FBIOPUT_CON2FBMAP   0x4610
+
+/**
+ * @brief Delete contents of console.
+ */
+#define FBIOBLANK   0x4611
+
+/**
+ * @brief Gets the current raster beam position.
+ */
+#define FBIOGET_VBLANK  _IOR('F', 0x12, struct fb_vblank)
+
+/**
+ * @brief Allocates graphics memory for own purposes.
+ */
+#define FBIO_ALLOC  0x4613
+
+/**
+ * @brief Frees allocated graphics memory.
+ */
+#define FBIO_FREE   0x4614
+
+/**
+ * @brief Gets font glyph.
+ */
+#define FBIOGET_GLYPH   0x4615
+
+/**
+ * @brief Gets hardware cursor information.
+ */
+#define FBIOGET_HWCINFO 0x4616
+
+/**
+ * @brief Sets the video mode information.
+ */
+#define FBIOPUT_MODEINFO0x4617
+
+/**
+ * @brief Gets display information.
+ */
+#define FBIOGET_DISPINFO0x4618
+
+/**
+ * @brief Waits for vertical sync to occur.
+ */
+#define FBIO_WAITFORVSYNC   _IOW('F', 0x20, uint32_t)
+
+/** @} */
+
+/**
+ * @name FB type settings
+ *
+ * @{
+ */
+
+/**
+ * @brief FB type packed pixels.
+ */
+#define FB_TYPE_PACKED_PIXELS   0
+
+/**
+ * @brief FB type non interleaved planes.
+ */
+#define FB_TYPE_PLANES  1
+
+/**
+ * @brief FB type interleaved planes.
+ */
+#define FB_TYPE_INTERLEAVED_PLANES  2
+
+/**
+ * @brief FB type text.
+ */
+#define FB_TYPE_TEXT3
+
+/**
+ * @brief FB type vga planes.
+ */
+#define FB_TYPE_VGA_PLANES  4
+
+/**
+ * @brief FB type identified by a V4L2 FOURCC.
+ */
+#define FB_TYPE_FOURCC  5
+
+/** @} */
+
+/**
+ * @name FB AUX text settings
+ *
+ * @{
+ */
+
+/**
+ * @brief FB AUX text Monochrome text.
+ */
+#define FB_AUX_TEXT_MDA 0
+
+/**
+ * @brief FB AUX text CGA/EGA/VGA Color text.
+ */
+#define FB_AUX_TEXT_CGA 1
+
+/**
+ * @brief FB AUX text S3 MMIO fasttext.
+ */
+#define FB_AUX_TEXT_S3_MMIO 2
+
+/**
+ * @brief FB AUX text MGA Millenium I: text, attr, 14 reserved bytes.
+ */
+#define FB_AUX_TEXT_MGA_STEP16  3
+
+/**
+ * @brief FB AUX text other MGAs: text, attr,  6 reserved bytes.
+ */
+#define FB_AUX_TEXT_MGA_STEP8   4
+
+/**
+ * @brief FB AUX text 8-15: SVGA tileblit compatible modes.
+ */
+#define FB_AUX_TEXT_SVGA_GROUP  8
+
+/**
+ * @brief FB AUX text lower three bits says step.
+ */
+#define FB_AUX_TEXT_SVGA_MASK   7
+
+/**
+ * @brief FB AUX text SVGA text mode:  text, attr.
+ */
+#define FB_AUX_TEXT_SVGA_STEP2  8
+
+/**
+ * @brief FB AUX text SVGA text mode: text, attr,  2 reserved bytes.
+ */
+#define FB_AUX_TEXT_SVGA_STEP4  9
+
+/**
+ * @brief FB AUX text SVGA text mode: text, attr,  6 reserved bytes.
+ */
+#define FB_AUX_TEXT_SVGA_STEP8  10
+
+/**
+ * @brief FB AUX text SVGA text mode: text, attr, 14

[PATCH v2] Add the i2c driver for Beaglebone Black:

2017-05-24 Thread Sichen Zhao
Update ticket #2891 and my GSOC project

add c/src/lib/libbsp/arm/beagle/i2c/bbb-i2c.c
modify c/src/lib/libbsp/arm/beagle/include/i2c.h
modify c/src/lib/libbsp/arm/beagle/include/bbb-gpio.h
modify c/src/lib/libcpu/arm/shared/include/am335x.h
modify c/src/lib/libbsp/arm/beagle/Makefile.am

Now can read the EEPROM by i2c, the test application link is: 
https://github.com/hahchenchen/GSOC-test-application
---
 c/src/lib/libbsp/arm/beagle/Makefile.am|   1 +
 c/src/lib/libbsp/arm/beagle/i2c/bbb-i2c.c  | 427 +
 c/src/lib/libbsp/arm/beagle/include/bbb-gpio.h |   4 +-
 c/src/lib/libbsp/arm/beagle/include/i2c.h  | 162 --
 c/src/lib/libcpu/arm/shared/include/am335x.h   | 136 
 5 files changed, 709 insertions(+), 21 deletions(-)
 create mode 100644 c/src/lib/libbsp/arm/beagle/i2c/bbb-i2c.c

diff --git a/c/src/lib/libbsp/arm/beagle/Makefile.am 
b/c/src/lib/libbsp/arm/beagle/Makefile.am
index 8bb8478..274dc0e 100644
--- a/c/src/lib/libbsp/arm/beagle/Makefile.am
+++ b/c/src/lib/libbsp/arm/beagle/Makefile.am
@@ -115,6 +115,7 @@ libbsp_a_SOURCES += ../../shared/console.c \
 
 # I2C
 libbsp_a_SOURCES += misc/i2c.c
+libbsp_a_SOURCES += i2c/bbb-i2c.c
 
 # GPIO
 libbsp_a_SOURCES += gpio/bbb-gpio.c
diff --git a/c/src/lib/libbsp/arm/beagle/i2c/bbb-i2c.c 
b/c/src/lib/libbsp/arm/beagle/i2c/bbb-i2c.c
new file mode 100644
index 000..aa4b53f
--- /dev/null
+++ b/c/src/lib/libbsp/arm/beagle/i2c/bbb-i2c.c
@@ -0,0 +1,427 @@
+/**
+ * @file
+ *
+ * @ingroup arm_beagle
+ *
+ * @brief BeagleBoard I2C bus initialization and API Support.
+ */
+
+/*
+ * Copyright (c) 2017 Sichen Zhao 
+ *
+ * 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.
+ */
+
+/*
+ * Modified on Punit Vara works, currently
+ * the i2c file is working on the Beaglebone Black board(AM335x)
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+static void am335x_i2c0_pinmux(bbb_i2c_bus *bus)
+{
+  REG(bus->regs + AM335X_CONF_I2C0_SDA) =
+  (BBB_RXACTIVE | BBB_SLEWCTRL | BBB_PU_EN);
+
+  REG(bus->regs + AM335X_CONF_I2C0_SCL) =
+  (BBB_RXACTIVE | BBB_SLEWCTRL | BBB_PU_EN);
+}
+
+static void I2C0ModuleClkConfig(void)
+{
+  /* Writing to MODULEMODE field of AM335X_CM_WKUP_I2C0_CLKCTRL register. */
+  REG(AM335X_SOC_CM_WKUP_REGS + AM335X_CM_WKUP_I2C0_CLKCTRL) |=
+  AM335X_CM_WKUP_I2C0_CLKCTRL_MODULEMODE_ENABLE;
+
+  /* Waiting for MODULEMODE field to reflect the written value. */
+  while(AM335X_CM_WKUP_I2C0_CLKCTRL_MODULEMODE_ENABLE !=
+  (REG(AM335X_SOC_CM_WKUP_REGS + AM335X_CM_WKUP_I2C0_CLKCTRL) &
+   AM335X_CM_WKUP_I2C0_CLKCTRL_MODULEMODE));
+
+  /*
+  ** Waiting for IDLEST field in AM335X_CM_WKUP_CONTROL_CLKCTRL
+  ** register to attain
+  ** desired value.
+  */
+  while((AM335X_CM_WKUP_CONTROL_CLKCTRL_IDLEST_FUNC <<
+   AM335X_CM_WKUP_CONTROL_CLKCTRL_IDLEST_SHIFT) !=
+  (REG(AM335X_SOC_CM_WKUP_REGS + AM335X_CM_WKUP_CONTROL_CLKCTRL) &
+   AM335X_CM_WKUP_CONTROL_CLKCTRL_IDLEST));
+
+  /*
+  ** Waiting for CLKACTIVITY_I2C0_GFCLK field in AM335X_CM_WKUP_CLKSTCTRL
+  ** register to attain desired value.
+  */
+  while(AM335X_CM_WKUP_CLKSTCTRL_CLKACTIVITY_I2C0_GFCLK !=
+  (REG(AM335X_SOC_CM_WKUP_REGS + AM335X_CM_WKUP_CLKSTCTRL) &
+   AM335X_CM_WKUP_CLKSTCTRL_CLKACTIVITY_I2C0_GFCLK));
+
+  /*
+  ** Waiting for IDLEST field in AM335X_CM_WKUP_I2C0_CLKCTRL register to attain
+  ** desired value.
+  */
+  while((AM335X_CM_WKUP_I2C0_CLKCTRL_IDLEST_FUNC <<
+   AM335X_CM_WKUP_I2C0_CLKCTRL_IDLEST_SHIFT) !=
+  (REG(AM335X_SOC_CM_WKUP_REGS + AM335X_CM_WKUP_I2C0_CLKCTRL) &
+   AM335X_CM_WKUP_I2C0_CLKCTRL_IDLEST));
+}
+
+
+static void am335x_i2c_reset(bbb_i2c_bus *bus)
+{
+  volatile bbb_i2c_regs *regs = bus->regs;
+  int timeout = I2C_TIMEOUT;
+  if (REG(®s->BBB_I2C_CON) & I2C_CON_EN) {
+REG(®s->BBB_I2C_CON) = I2C_CON_CLR;
+udelay(5);
+  }
+  REG(®s->BBB_I2C_SYSC) = I2C_SYSC_SRST; /* for ES2 after soft reset */
+  udelay(1000);
+  REG(®s->BBB_I2C_CON) = I2C_CON_EN;
+
+  while (!(REG(®s->BBB_I2C_SYSS) & I2C_SYSS_RDONE) && timeout--) {
+if (timeout <= 0) {
+  puts("ERROR: Timeout in soft-reset\n");
+  return;
+}
+udelay(1000);
+  }
+}
+/*
+Possible values for msg->flag
+   * - @ref I2C_M_TEN,
+   * - @ref I2C_M_RD,
+   * - @ref I2C_M_STOP,
+   * - @ref I2C_M_NOSTART,
+   * - @ref I2C_M_REV_DIR_ADDR,
+   * - @ref I2C_M_IGNORE_NAK,
+   * - @ref I2C_M_NO_RD_ACK, and
+   * - @ref I2C_M_RECV_LEN.
+*/
+
+static void am335x_i2c_set_address_size(const i2c_msg *msgs,
+  volatile bbb_i2c_regs *regs)
+{
+  /*can be configured multiple modes here.
+  **Need to think about own address modes*/
+  if ((msgs->flags & I2C_M_TEN) == 0)  {
+  /* 7-bit mode slave address mode*/
+  REG(®s->BBB_I2C_CON) = AM335X_I2C_CFG_7BIT_SLAVE_ADDR;
+  } else {
+  /* 10-bit slave address mode*/
+  REG(®s->BBB_I2

Re: [rtems commit] arm: Optimize context switch

2017-05-24 Thread Gedare Bloom
On Tue, May 23, 2017 at 3:09 AM, Sebastian Huber
 wrote:
> On 22/05/17 16:49, Gedare Bloom wrote:
>
>> Everything. 'hello' doesn't even work. I can't debug until later.
>> Probably gem5 deals with some processor context a bit differently and
>> may be incorrectly.
>
>
> It works on Qemu, a real Cortex-R4 and a real Cortex-A9. It would be nice if
> you could debug this a bit. Do you reach _Thread_Handler()? Interesting
> functions are _CPU_ISR_Set_level(), _CPU_Context_restore() and
> _CPU_Context_switch().
>
Thanks for the help Sebastian. The problem was that the simulator did
not handle an LDM instruction that loads to the PC properly. I have
submitted a fix to gem5 that ought to be merged soon I guess.

Anyone needing to cherrypick it meanwhile can pick it up at
https://gem5-review.googlesource.com/c/3520/

Gedare

>>
>> On Mon, May 22, 2017 at 1:07 AM, Sebastian Huber
>>   wrote:
>>>
>>> Which tests fail?
>>>
>>> On 19/05/17 20:52, Gedare Bloom wrote:

 This commit causes an error when running realview_pbx_a9_qemu in the
 gem5 simulator. I have only been able to identify that this is the
 problematic commit. I have not been able to debug further.
>
>
> --
> 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: arm/rtl22xx_t build failures

2017-05-24 Thread Chris Johns

On 24/05/2017 15:30, Sebastian Huber wrote:


../../../../../.././lpc1768_mbed/lib/include/bsp/lpc-i2s.h:26:25: 
fatal error: bsp/utility.h: No such file or directory

  #include 
  ^
compilation terminated.


Maybe its time to get rid of the make preinstall.



I have not seen this again using the parallel build patch I just pushed. 
This change lets make correctly handle the dependencies between all the 
various phases and parts. This means preinstall is finished before any 
directories are entered to be built.


I am repeatably building all BSPs with and out tests. With the latest 
rtems-bsp-builder and `--jobs=7/8` I am seeing an average BSP build time 
around 47 seconds on a 16 core machine.


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