<html><body><div>On Apr 23, 2015, at 10:27 AM, Joel Sherrill <joel.sherrill@oarcorp.com> wrote:<br><br><div><blockquote type="cite"><div class="msg-quote"><br> <br><div class="moz-cite-prefix">On 4/19/2015 2:17 PM, QIAO YANG wrote:<br></div><blockquote type="cite"><div>Here is a modified patch for mailbox.  If there's still anything against the convention, please point it out and I'll correct it immediately. The mailbox implementation might also be needed by other rpi bsp developpers.<br> <br></div></blockquote>My understanding is that the mailbox is used to determine the board<br> version and memory size. </div></blockquote><span></span><blockquote type="cite"><div class="msg-quote"><br> <br> What did you use the mailbox for to test it?</div></blockquote><span> </span><br>The mailbox is the main way to communicate with videocore processor, not only to get board informations and cpu state. I use this to get the framebuffer pointer and its related properties.<br><br><blockquote type="cite"><div class="msg-quote"><br><blockquote type="cite"><div>----------------------<br> <br> diff --git a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am<br> index c6133df..70bc01d 100644<br> --- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am<br> +++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am<br> @@ -43,6 +43,7 @@ include_bsp_HEADERS += ../shared/include/arm-release-id.h<br>  include_bsp_HEADERS += include/irq.h<br>  include_bsp_HEADERS += include/mmu.h<br>  include_bsp_HEADERS += include/usart.h<br> +include_bsp_HEADERS += include/mailbox.h<br>  include_bsp_HEADERS += include/raspberrypi.h<br>  <br>  include_libcpu_HEADERS = ../../../libcpu/arm/shared/include/cache_.h \<br> @@ -123,6 +124,9 @@ libbsp_a_SOURCES += misc/timer.c<br>  <br>  # I2C<br>  <br> +# Mailbox<br> +libbsp_a_SOURCES += misc/mailbox.c<br> +<br>  # Cache<br>  libbsp_a_SOURCES += ../../../libcpu/shared/src/cache_manager.c<br>  libbsp_a_SOURCES += ../../../libcpu/arm/shared/include/cache_.h<br> diff --git a/c/src/lib/libbsp/arm/raspberrypi/include/mailbox.h b/c/src/lib/libbsp/arm/raspberrypi/include/mailbox.h<br> new file mode 100644<br> index 0000000..fa6a0c2<br> --- /dev/null<br> +++ b/c/src/lib/libbsp/arm/raspberrypi/include/mailbox.h<br> @@ -0,0 +1,33 @@<br> +/**<br> + * @file<br> + *<br> + * @ingroup raspberrypi<br> + *<br> + * @brief mailbox support.<br> + */<br> +<br> +/*<br> + * Copyright (c) 2015 Yang Qiao<br> + *<br> + *  The license and distribution terms for this file may be<br> + *  found in the file LICENSE in this distribution or at<br> + *<br> + *  <a class="moz-txt-link-freetext" href="http://www.rtems.org/license/LICENSE" data-mce-href="http://www.rtems.org/license/LICENSE">http://www.rtems.org/license/LICENSE</a><br> + *<br> + */<br> +<br> +#ifndef LIBBSP_ARM_RASPBERRYPI_MAILBOX_H<br> +#define LIBBSP_ARM_RASPBERRYPI_MAILBOX_H<br> +<br> +#ifdef __cplusplus<br> +extern "C" {<br> +#endif /* __cplusplus */<br> +<br> +extern unsigned int  raspberrypi_mailbox_read(unsigned int channel);<br> +extern void raspberrypi_mailbox_write(unsigned int channel, unsigned int data);<br> +<br> +#ifdef __cplusplus<br> +}<br> +#endif /* __cplusplus */<br> +<br> +#endif  /* LIBBSP_ARM_RASPBERRYPI_MAILBOX_H */<br> diff --git a/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h b/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h<br> index c33e22a..3240404 100644<br> --- a/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h<br> +++ b/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h<br> @@ -208,6 +208,55 @@<br>  <br>  /** @} */<br>  <br> + /**<br> + * @name Mailbox Registers<br> + *<br> + * @{<br> + */<br> +<br> +#define BCM2835_MBOX_BASE (RPI_PERIPHERAL_BASE+0xB880)<br> +<br> +#define BCM2835_MBOX_PEEK (BCM2835_MBOX_BASE+0x10)<br> +#define BCM2835_MBOX_READ (BCM2835_MBOX_BASE+0x00)<br> +#define BCM2835_MBOX_WRITE (BCM2835_MBOX_BASE+0x20)<br> +#define BCM2835_MBOX_STATUS (BCM2835_MBOX_BASE+0x18)<br> +#define BCM2835_MBOX_SENDER (BCM2835_MBOX_BASE+0x14)<br> +#define BCM2835_MBOX_CONFIG (BCM2835_MBOX_BASE+0x1C)<br> +<br> +#define BCM2835_MBOX_SUCCESS (BCM2835_MBOX_BASE+0x80000000)<br> +#define BCM2835_MBOX_FULL (BCM2835_MBOX_BASE+0x80000000)<br> +#define BCM2835_MBOX_EMPTY (BCM2835_MBOX_BASE+0x40000000)<br> +<br> +/**<br> +* @name Mailbox Channels<br> +*<br> +* @{<br> +*/<br> +<br> +/* Power Manager channel */<br> +#define BCM2835_MBOX_CHANNEL_PM         0<br> +/* Framebuffer channel */<br> +#define BCM2835_MBOX_CHANNEL_FB         1<br> + /* Virtual UART channel */<br> +#define BCM2835_MBOX_CHANNEL_VUART      2<br> + /* VCHIQ channel */<br> +#define BCM2835_MBOX_CHANNEL_VCHIQ      3<br> + /* LEDs channel */<br> +#define BCM2835_MBOX_CHANNEL_LED        4<br> + /* Button channel */<br> +#define BCM2835_MBOX_CHANNEL_BUTTON     5<br> + /* Touch screen channel */<br> +#define BCM2835_MBOX_CHANNEL_TOUCHS     6<br> +/* Property tags (ARM <-> VC) channel */<br> +#define BCM2835_MBOX_CHANNEL_PROP_AVC   8<br> + /* Property tags (VC <-> ARM) channel */<br> +#define BCM2835_MBOX_CHANNEL_PROP_VCA   9<br> +<br> +/** @} */<br> +<br> +<br> +/** @} */<br> +<br>  <br>  /** @} */<br>  <br> diff --git a/c/src/lib/libbsp/arm/raspberrypi/misc/mailbox.c b/c/src/lib/libbsp/arm/raspberrypi/misc/mailbox.c<br> new file mode 100644<br> index 0000000..2a63a41<br> --- /dev/null<br> +++ b/c/src/lib/libbsp/arm/raspberrypi/misc/mailbox.c<br> @@ -0,0 +1,44 @@<br> +/**<br> + * @file<br> + *<br> + * @ingroup raspberrypi<br> + *<br> + * @brief mailbox support.<br> + */<br> +<br> +/*<br> + * Copyright (c) 2015 Yang Qiao<br> + *<br> + *  The license and distribution terms for this file may be<br> + *  found in the file LICENSE in this distribution or at<br> + *<br> + *  <a class="moz-txt-link-freetext" href="http://www.rtems.org/license/LICENSE" data-mce-href="http://www.rtems.org/license/LICENSE">http://www.rtems.org/license/LICENSE</a><br> + *<br> + */<br> +<br> +#include <stdint.h><br> +#include <bsp/raspberrypi.h><br> +#include <bsp/mailbox.h><br> +<br> +unsigned int raspberrypi_mailbox_read (unsigned int channel)<br> +{<br> +  unsigned int data;<br> +  unsigned int read_channel;<br> +<br> +  while ( 1 )<br> +  {<br> +    while (BCM2835_REG (BCM2835_MBOX_STATUS ) & BCM2835_MBOX_EMPTY);<br> +    data = BCM2835_REG (BCM2835_MBOX_READ );<br> +    read_channel = (unsigned int) (data & 0xF );<br> +    if (read_channel == channel)<br> +      return (data & 0xFFFFFFF0);<br> +  }<br> +}<br> +<br> +void raspberrypi_mailbox_write(unsigned int channel, unsigned int data)<br> +{<br> +  while (BCM2835_REG(BCM2835_MBOX_STATUS) & BCM2835_MBOX_FULL);<br> +  BCM2835_REG(BCM2835_MBOX_WRITE) = <br> +    (data & 0xFFFFFFF0) | <br> +    (unsigned int) (channel & 0xF);<br> +}<br> diff --git a/c/src/lib/libbsp/arm/raspberrypi/preinstall.am b/c/src/lib/libbsp/arm/raspberrypi/preinstall.am<br> index 70259e2..4cb7ed6 100644<br> --- a/c/src/lib/libbsp/arm/raspberrypi/preinstall.am<br> +++ b/c/src/lib/libbsp/arm/raspberrypi/preinstall.am<br> @@ -126,6 +126,10 @@ $(PROJECT_INCLUDE)/bsp/usart.h: include/usart.h $(PROJECT_INCLUDE)/bsp/$(dirstam<br>      $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/usart.h<br>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/usart.h<br>  <br> +$(PROJECT_INCLUDE)/bsp/mailbox.h: include/mailbox.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)<br> +    $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/mailbox.h<br> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/mailbox.h<br> +<br>  $(PROJECT_INCLUDE)/bsp/raspberrypi.h: include/raspberrypi.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)<br>      $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/raspberrypi.h<br>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/raspberrypi.h<br></div><div><br></div><div><br> On Apr 16, 2015, at 11:20 PM, Gedare Bloom <a class="moz-txt-link-rfc2396E" href="mailto:gedare@rtems.org" data-mce-href="mailto:gedare@rtems.org"><gedare@rtems.org></a> wrote:<br> <br><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><span class="body-text-content">Are you working to make the corrections I mentioned?<br> <br> On Tue, Apr 7, 2015 at 10:05 AM, Gedare Bloom <<a href="mailto:gedare@rtems.org" data-mce-href="mailto:gedare@rtems.org">gedare@rtems.org</a>> wrote:<br> </span></span><blockquote class="quoted-plain-text" type="cite">On Mon, Apr 6, 2015 at 5:12 PM, QIAO YANG <<a href="mailto:yangqiao0505@me.com" data-mce-href="mailto:yangqiao0505@me.com">yangqiao0505@me.com</a>> wrote:</blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">-----</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">diff --git a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">index c6133df..70bc01d 100644</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">--- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">@@ -43,6 +43,7 @@ include_bsp_HEADERS += ../shared/include/arm-release-id.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">include_bsp_HEADERS += include/irq.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">include_bsp_HEADERS += include/mmu.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">include_bsp_HEADERS += include/usart.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+include_bsp_HEADERS += include/mailbox.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">include_bsp_HEADERS += include/raspberrypi.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">include_libcpu_HEADERS = ../../../libcpu/arm/shared/include/cache_.h \</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">@@ -123,6 +124,9 @@ libbsp_a_SOURCES += misc/timer.c</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"># I2C</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+# Mailbox</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+libbsp_a_SOURCES += misc/mailbox.c</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"># Cache</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">libbsp_a_SOURCES += ../../../libcpu/shared/src/cache_manager.c</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">libbsp_a_SOURCES += ../../../libcpu/arm/shared/include/cache_.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">diff --git a/c/src/lib/libbsp/arm/raspberrypi/include/mailbox.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">b/c/src/lib/libbsp/arm/raspberrypi/include/mailbox.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">new file mode 100644</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">index 0000000..abdb258</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">--- /dev/null</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+++ b/c/src/lib/libbsp/arm/raspberrypi/include/mailbox.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">@@ -0,0 +1,7 @@</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite">Need file header documentation. Please see</blockquote><blockquote class="quoted-plain-text" type="cite"><a href="https://devel.rtems.org/wiki/Developer/Coding/Conventions" data-mce-href="https://devel.rtems.org/wiki/Developer/Coding/Conventions">https://devel.rtems.org/wiki/Developer/Coding/Conventions</a><div style="width:0px; height:0px;" data-mce-style="width: 0px; height: 0px;"> </div></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#ifndef MAILBOX_H</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define MAILBOX_H</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+extern unsigned int readmailbox(unsigned int channel);</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+extern void writemailbox(unsigned int channel, unsigned int data);</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite">Please use function names with a "namespace". the usual convention in</blockquote><blockquote class="quoted-plain-text" type="cite">RTEMS is to use Package_Class_Method like raspberrypi_mailbox_read()</blockquote><blockquote class="quoted-plain-text" type="cite">and raspberrypi_mailbox_write().</blockquote><blockquote class="quoted-plain-text" type="cite"><br></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#endif /* MAILBOX_H */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">\ No newline at end of file</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">diff --git a/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">b/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">index c33e22a..e4ce18f 100644</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">--- a/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+++ b/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">@@ -208,6 +208,52 @@</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">/** @} */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ /**</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ * @name Mailbox Registers</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ *</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ * @{</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+/**</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ * NOTE:</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_BASE (RPI_PERIPHERAL_BASE+0xB880)</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_PEEK (BCM2835_MBOX_BASE+0x10)</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_READ (BCM2835_MBOX_BASE+0x00)</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_WRITE (BCM2835_MBOX_BASE+0x20)</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_STATUS (BCM2835_MBOX_BASE+0x18)</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_SENDER (BCM2835_MBOX_BASE+0x14)</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_CONFIG (BCM2835_MBOX_BASE+0x1C)</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+/* Power Manager channel */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_CHANNEL_PM 0</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+/* Framebuffer channel */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_CHANNEL_FB 1</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ /* Virtual UART channel */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_CHANNEL_VUART 2</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ /* VCHIQ channel */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_CHANNEL_VCHIQ 3</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ /* LEDs channel */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_CHANNEL_LED 4</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ /* Button channel */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_CHANNEL_BUTTON 5</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ /* Touch screen channel */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_CHANNEL_TOUCHS 6</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+/* Property tags (ARM <-> Video Core) channel */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_CHANNEL_PROP_AVC 8</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ /* Property tags (Video Core <-> ARM) channel */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_CHANNEL_PROP_VCA 9</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_SUCCESS (BCM2835_MBOX_BASE+0x80000000)</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_FULL (BCM2835_MBOX_BASE+0x80000000)</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#define BCM2835_MBOX_EMPTY (BCM2835_MBOX_BASE+0x40000000)</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+/** @} */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">/** @} */</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">diff --git a/c/src/lib/libbsp/arm/raspberrypi/misc/mailbox.c</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">b/c/src/lib/libbsp/arm/raspberrypi/misc/mailbox.c</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">new file mode 100644</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">index 0000000..7bfb7e3</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">--- /dev/null</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+++ b/c/src/lib/libbsp/arm/raspberrypi/misc/mailbox.c</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">@@ -0,0 +1,22 @@</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite">Need file header documentation</blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#include <stdint.h></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#include <bsp/raspberrypi.h></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+#include <bsp/mailbox.h></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+unsigned int readmailbox ( unsigned int channel )</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+{</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ unsigned int data;</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ unsigned int read_channel;</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ while ( 1 )</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ {</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ while ( BCM2835_REG ( BCM2835_MBOX_STATUS ) &</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">BCM2835_MBOX_EMPTY );</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ data = BCM2835_REG ( BCM2835_MBOX_READ );</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ read_channel = ( unsigned int ) ( data & 0xF );</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ if ( read_channel == channel )</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ return ( data & 0xFFFFFFF0 );</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ }</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite">The white spaces look wrong here. Are they tabs? Or 8 blank spaces?</blockquote><blockquote class="quoted-plain-text" type="cite">Please check the style rules in the Coding Conventions page.</blockquote><blockquote class="quoted-plain-text" type="cite"><br></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+}</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+void writemailbox( unsigned int channel, unsigned int data )</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+{</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ while ( BCM2835_REG ( BCM2835_MBOX_STATUS ) & BCM2835_MBOX_FULL );</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ BCM2835_REG (BCM2835_MBOX_WRITE) = ( data & 0xFFFFFFF0 ) | (unsigned</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">int) ( channel & 0xF );</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+}</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">\ No newline at end of file</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">diff --git a/c/src/lib/libbsp/arm/raspberrypi/preinstall.am</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">b/c/src/lib/libbsp/arm/raspberrypi/preinstall.am</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">index 70259e2..4cb7ed6 100644</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">--- a/c/src/lib/libbsp/arm/raspberrypi/preinstall.am</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+++ b/c/src/lib/libbsp/arm/raspberrypi/preinstall.am</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">@@ -126,6 +126,10 @@ $(PROJECT_INCLUDE)/bsp/usart.h: include/usart.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">$(PROJECT_INCLUDE)/bsp/$(dirstam</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/usart.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/usart.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+$(PROJECT_INCLUDE)/bsp/mailbox.h: include/mailbox.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">$(PROJECT_INCLUDE)/bsp/$(dirstamp)</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/mailbox.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/mailbox.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">+</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">$(PROJECT_INCLUDE)/bsp/raspberrypi.h: include/raspberrypi.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">$(PROJECT_INCLUDE)/bsp/$(dirstamp)</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/raspberrypi.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/raspberrypi.h</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">-----</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">Here is a patch for rpi bsp which include the operation and chanel</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">defininitions for mailbox and its implementations.</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">I've only tested the framebuffer with it and it works well : set the screen</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">size and get the informations.</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">Andre used it for sd card reading. I've checked it out and added full</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">channel definitions.</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">Please point it out if further tests should be done.</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">YANG QIAO</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">_______________________________________________</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">devel mailing list</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><a href="mailto:devel@rtems.org" data-mce-href="mailto:devel@rtems.org">devel@rtems.org</a><div style="width:0px; height:0px;" data-mce-style="width: 0px; height: 0px;"> </div></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><a href="http://lists.rtems.org/mailman/listinfo/devel" data-mce-href="http://lists.rtems.org/mailman/listinfo/devel">http://lists.rtems.org/mailman/listinfo/devel</a><div style="width:0px; height:0px;" data-mce-style="width: 0px; height: 0px;"> </div></blockquote></blockquote></div></div></blockquote></div></div></blockquote><br><pre class="moz-signature">-- 
Joel Sherrill, Ph.D.             Director of Research & Development
<a class="moz-txt-link-abbreviated" href="mailto:joel.sherrill@OARcorp.com" data-mce-href="mailto:joel.sherrill@OARcorp.com">joel.sherrill@OARcorp.com</a>        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985</pre></div></blockquote></div></div><div><style class="_message-styles">div.msg-quote { background-color:#FFFFFF;}
</style></div></body></html>