[RSB Graphics Library] add patch for library source

2015-06-30 Thread QIAO YANG

Hi,

I'm now working on moving the graphic libraries from rtems-graphic-tool-kits 
into rsb, based on the existing work for libjpeg and the 
rtems-graphic-tool-kits's buid script.

The port of libpng, libtiff, freetype2 can be review on my github:
https://github.com/yangqiao/rtems-source-builder/commits/graphics

While I've got some problems when trying to add patch for source code.
As what I've read from other cfg files, we should first "patch add" the needed patches, 
then "patch setup" to apply them. When I try to add the patch under 
source-builder/patches/,  it warned me that the path doesn't have a proper protocl such as https, 
git  And I've found that some patches of gdb ..etc are in rtems-tools and the sb-build retrieve 
them from the git server. How can I add a patch from source-builder/patches/ instead of uploading 
to rtems-tools ? Or maybe I missed something?

Thanks in advance

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

Re: [PATCH] Temporary fix for ethernet rx intr hang issue and Disable cache

2015-06-30 Thread ragu nath
Hi Sebatian,

I will try both your suggestions and let you know on the progress.

Thanks,
Ragunath

On Mon, Jun 29, 2015 at 12:49 PM, Sebastian Huber
 wrote:
>
>
> On 25/06/15 18:20, ragunath wrote:
>>
>> This patch has two changes that are needed for networking to work in BBB.
>> We disable cache as it is causing random values to be learned in the cpsw
>> Address
>> Lookup Engine(ALE) causing tx to fail. Vector enable is done after handler
>> is called by the server task.
>>
>> ---
>>   c/src/lib/libbsp/arm/beagle/irq.c | 2 ++
>>   c/src/lib/libbsp/arm/beagle/startup/bspstartmmu.c | 8 +---
>>   2 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/c/src/lib/libbsp/arm/beagle/irq.c
>> b/c/src/lib/libbsp/arm/beagle/irq.c
>> index c6485cd..64e7756 100644
>> --- a/c/src/lib/libbsp/arm/beagle/irq.c
>> +++ b/c/src/lib/libbsp/arm/beagle/irq.c
>> @@ -73,6 +73,7 @@ void bsp_interrupt_dispatch(void)
>> _ARMV4_Status_restore(psr);
>>   +if(!(irq == 40 || irq == 41 || irq == 42 || irq == 43))
>>   bsp_interrupt_vector_enable(irq);
>> }
>>   }
>
>
> Why not remove the bsp_interrupt_vector_disable/enable() calls in
> bsp_interrupt_dispatch() unconditionally?
>
>
>> @@ -94,6 +95,7 @@ rtems_status_code
>> bsp_interrupt_vector_enable(rtems_vector_number vector)
>> uint32_t mask, cur;
>> uint32_t mir_reg = get_mir_reg(vector, &mask);
>>   +  irqs_enabled[vector] = 1;
>> cur = mmio_read(omap_intr.base + mir_reg);
>> mmio_write(omap_intr.base + mir_reg, cur & ~mask);
>> flush_data_cache();
>> diff --git a/c/src/lib/libbsp/arm/beagle/startup/bspstartmmu.c
>> b/c/src/lib/libbsp/arm/beagle/startup/bspstartmmu.c
>> index 157edfa..6cd0f38 100644
>> --- a/c/src/lib/libbsp/arm/beagle/startup/bspstartmmu.c
>> +++ b/c/src/lib/libbsp/arm/beagle/startup/bspstartmmu.c
>> @@ -44,15 +44,17 @@ BSP_START_TEXT_SECTION void
>> beagle_setup_mmu_and_cache(void)
>>   {
>> /* turn mmu off first in case it's on */
>> uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
>> -ARM_CP15_CTRL_M | ARM_CP15_CTRL_A, /* clear - mmu off */
>> +ARM_CP15_CTRL_M | ARM_CP15_CTRL_A | ARM_CP15_CTRL_I |
>> ARM_CP15_CTRL_C, /* clear - mmu off */
>>   ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z
>> );
>>   -  arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
>> -ctrl,
>> +  arm_cp15_start_setup_translation_table(
>>   (uint32_t *) bsp_translation_table_base,
>>   ARM_MMU_DEFAULT_CLIENT_DOMAIN,
>>   &beagle_mmu_config_table[0],
>>   RTEMS_ARRAY_SIZE(beagle_mmu_config_table)
>> );
>> +
>> +  ctrl |= ARM_CP15_CTRL_M;
>> +  arm_cp15_set_control(ctrl);
>>   }
>
>
> I would rather fix the driver. Add cache flush/invalidate calls to the right
> spots or use a non-cacheable memory area, see
> rtems_cache_coherent_allocate() for example.
>
> --
> 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.
>



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

[PATCH 1/2] GPIO Driver

2015-06-30 Thread Ketul Shah
diff --git a/cpukit/include/rtems/gpio.h b/cpukit/include/rtems/gpio.h
new file mode 100644
index 000..3d68c39
--- /dev/null
+++ b/cpukit/include/rtems/gpio.h
@@ -0,0 +1,64 @@
+/**
+ * @file rtems/gpio.h
+ *
+ * @brief Global GPIO definitions.
+ *
+ * This include the generalized definitions for GPIO 
+ */
+
+/**
+ * Copyright (c) 2015 Ketul Shah 
+ *
+ * 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 _RTEMS_GPIO_H
+#define _RTEMS_GPIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Returned Error Codes by function */
+#define GPIO_SUCCESSFUL0 /* operation is OK */
+#define GPIO_UNKNOWN_PIN   1 /* pin not known by bsp */
+#define GPIO_UNCONFIGURED_PIN  2 /* pin unable to configure */
+#define GPIO_MISCONFIGURED_PIN 3 /* pin configuration can't match operation */
+
+/* Possible GPIO Pin States */
+#define GPIO_PIN_STATE_UNCONFIGURED 0
+#define GPIO_PIN_STATE_DIGITAL_OUT  1
+#define GPIO_PIN_STATE_DIGITAL_IN   2
+
+/**
+ * @brief Structure contains all the required members for GPIO access.
+ */
+typedef struct
+{
+  int   pin_number;/* The pin number. */
+  void* platform;  /* Opaque hardware specific set up details. */
+} gpio_pin_handle;
+
+/**
+ * @brief Initializes the GPIO API.
+ */
+extern void rtems_gpio_initialize(void);
+/**
+ * @brief Selects a GPIO pin for a digital output.
+ */
+extern int rtems_gpio_configure_pin_digital_out(
+   gpio_pin_handle *, unsigned int );
+/**
+ * @brief Turns on the given pin.
+ */
+extern int rtems_gpio_digital_set(gpio_pin_handle *);
+/**
+ * @brief Turns off the given pin.
+ */
+extern int rtems_gpio_digital_clear(gpio_pin_handle *);
+/**
+ * @brief currently configured pin is released and made UNCONFIGURED.
+ */
+extern int rtems_gpio_release_pin(gpio_pin_handle *);
\ No newline at end of file

diff --git a/c/src/lib/libbsp/arm/beagle/gpio/gpio.c 
b/c/src/lib/libbsp/arm/beagle/gpio/gpio.c
new file mode 100644
index 000..541d456
--- /dev/null
+++ b/c/src/lib/libbsp/arm/beagle/gpio/gpio.c
@@ -0,0 +1,210 @@
+/**
+ * @file
+ *
+ * @ingroup arm_beagle
+ *
+ * @brief Global BSP definitions.
+ */
+ 
+/**
+ * Copyright (c) 2015 Ketul Shah 
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+ 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * @brief GPIO API mutex atributes.
+ */
+#define MUTEX_ATRIBUTES \
+  ( RTEMS_LOCAL \
+| RTEMS_PRIORITY\
+| RTEMS_BINARY_SEMAPHORE\
+| RTEMS_INHERIT_PRIORITY\
+| RTEMS_NO_PRIORITY_CEILING \
+)
+
+#define OBTAIN_LOCK(s)  if(rtems_semaphore_obtain(s, \
+  RTEMS_WAIT,\
+  RTEMS_NO_TIMEOUT   \ 
+  ) != RTEMS_SUCCESSFUL) \
+  printf("Semaphore not obtained\n");
+
+#define RELEASE_LOCK(s) if(rtems_semaphore_release(s) != RTEMS_SUCCESSFUL) \
+  printf("Semaphore not released\n");
+
+/* GPIO bank pin number as per TRM of AM335X */
+static unsigned int gpio_bank_pin[GPIO_PIN_COUNT]; 
+/* GPIO bank determines register of AM335X */
+static unsigned int gpio_bank[GPIO_PIN_COUNT];
+/* Pin states for all GPIO pins*/
+static unsigned int gpio_pin_state[GPIO_PIN_COUNT];
+/* Variable for gpio initialization */
+static bool is_initialized = false;
+/* Total number of gpio banks */
+static int gpio_bank_count = GPIO_PIN_COUNT / GPIO_PINS_PER_BANK;
+/* Semaphore for avoiding race condition */
+static rtems_id bank_lock;
+
+static const uint32_t gpio_bank_addrs[] = 
+  { AM335X_GPIO0, AM335X_GPIO1, AM335X_GPIO2, AM335X_GPIO3 };
+
+static uint32_t inline get_pin_mask(unsigned int pin_number)
+{
+  return (1UL << gpio_bank_pin[pin_number]);
+}
+
+static void inline reg_update_set(unsigned int pin_number,uint32_t reg)
+{
+  uint32_t gpioreg=gpio_bank[pin_number]+reg;
+  uint32_t gpioreg_val=mmio_read(gpioreg);
+  gpioreg_val |= get_pin_mask(pin_number);
+  mmio_write(gpioreg, gpioreg_val);
+}
+
+static void inline reg_update_unset(unsigned int pin_number,uint32_t reg)
+{
+  uint32_t gpioreg=gpio_bank[pin_number]+reg;
+  uint32_t gpioreg_val=mmio_read(gpioreg);
+  gpioreg_val &= ~get_pin_mask(pin_number);
+  mmio_write(gpioreg, gpioreg_val);
+}
+
+/**
+ * @brief Initializes the GPIO API. 
+ *Allocates space to gpio_pin_state and sets pin state as UNCONFIGURED.
+ *Creates Semaphore for avoiding any race condition.
+ *If the API has already been initialized silently exits.
+ */
+void rtems_gpio_initialize(void)
+{ 
+  i

[PATCH 2/2] GPIO Driver

2015-06-30 Thread Ketul Shah
diff --git a/c/src/lib/libbsp/arm/beagle/include/beagleboneblack.h 
b/c/src/lib/libbsp/arm/beagle/include/beagleboneblack.h
new file mode 100644
index 000..1265828
--- /dev/null
+++ b/c/src/lib/libbsp/arm/beagle/include/beagleboneblack.h
@@ -0,0 +1,63 @@
+/**
+ * @file
+ *
+ * @ingroup arm_beagle
+ *
+ * @brief BeagleBone Black BSP definitions.
+ */
+
+/**
+ * Copyright (c) 2015 Ketul Shah 
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef LIBBSP_ARM_BEAGLE_BEAGLEBONEBLACK_H
+#define LIBBSP_ARM_BEAGLE_BEAGLEBONEBLACK_H
+
+/* BSP related specifications */
+#define GPIO_PIN_COUNT 128
+#define GPIO_PINS_PER_BANK 32 
+
+/* USER LEDs of BeagleBone Black */
+#define BBB_LED_USR0  53 /* USR LED0 */
+#define BBB_LED_USR1  54 /* USR LED1 */
+#define BBB_LED_USR2  55 /* USR LED2 */
+#define BBB_LED_USR3  56 /* USR LED3 */
+
+/* Header P8 of BeagleBone Black */
+#define BBB_P8_7  66 /* GPIO2_2 */
+#define BBB_P8_8  67 /* GPIO2_3 */
+#define BBB_P8_9  69 /* GPIO2_5 */
+#define BBB_P8_10 68 /* GPIO2_4 */
+#define BBB_P8_11 45 /* GPIO1_13 */
+#define BBB_P8_12 44 /* GPIO1_12 */
+#define BBB_P8_13 23 /* GPIO0_23 */
+#define BBB_P8_14 26 /* GPIO0_26 */
+#define BBB_P8_15 47 /* GPIO1_15 */
+#define BBB_P8_16 46 /* GPIO1_14 */
+#define BBB_P8_17 27 /* GPIO0_27 */
+#define BBB_P8_18 65 /* GPIO2_1 */
+#define BBB_P8_19 22 /* GPIO0_22 */
+#define BBB_P8_26 61 /* GPIO1_29 */
+   
+/* Header P9 of BeagleBone Black */
+#define BBB_P9_11 30 /* GPIO0_30 */
+#define BBB_P9_12 60 /* GPIO1_28 */
+#define BBB_P9_13 31 /* GPIO0_31 */
+#define BBB_P9_14 50 /* GPIO1_18 */
+#define BBB_P9_15 48 /* GPIO1_16 */
+#define BBB_P9_16 51 /* GPIO1_19 */
+#define BBB_P9_17  5 /* GPIO0_5 */
+#define BBB_P9_18  4 /* GPIO0_4 */
+#define BBB_P9_23 49 /* GPIO1_17 */
+#define BBB_P9_24 15 /* GPIO0_15 */
+#define BBB_P9_26 14 /* GPIO1_14 */
+#define BBB_P9_27 115/* GPIO3_19 */
+#define BBB_P9_30 112/* GPIO3_16 */
+#define BBB_P9_41 20 /* GPIO0_20 */
+#define BBB_P9_42  7 /* GPIO0_7 */
+
+#endif /* LIBBSP_ARM_BEAGLE_GPIO_H */
\ No newline at end of file
diff --git a/c/src/lib/libcpu/arm/shared/include/am335x.h 
b/c/src/lib/libcpu/arm/shared/include/am335x.h
index 37c5eeb..ebaa703 100644
--- a/c/src/lib/libcpu/arm/shared/include/am335x.h
+++ b/c/src/lib/libcpu/arm/shared/include/am335x.h
@@ -300,3 +300,23 @@
 
 #define AM335X_RTC_KICK0_KEY0x83E70B13
 #define AM335X_RTC_KICK1_KEY0x95A4F1E0
+
+/*Gpio memory registers am335x*/
+#define AM335X_GPIO0  0x44E07000
+/* GPIO Bank 0 base Register */
+#define AM335X_GPIO1  0x4804C000
+/* GPIO Bank 1 base Register */
+#define AM335X_GPIO2  0x481AC000
+/* GPIO Bank 2 base Register */
+#define AM335X_GPIO3  0x481AE000
+/* GPIO Bank 3 base Register */
+#define AM335X_GPIO_OE0x134
+/* GPIO Output Enable Register */
+#define AM335X_GPIO_DATAOUT   0x13C
+/* GPIO Output pin set Register */
+#define AM335X_GPIO_DATAIN0x138
+/* GPIO Read Data Register */
+#define AM335X_GPIO_CLEARDATAOUT  0x190
+/* GPIO Output Clear Register */
+#define AM335X_GPIO_SETDATAOUT0x194
+/* GPIO Output Set Register */
\ No newline at end of file
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] GPIO Driver Sample Application

2015-06-30 Thread Ketul Shah
diff --git a/testsuites/samples/gpio/init.c b/testsuites/samples/gpio/init.c
new file mode 100644
index 000..391d80c
--- /dev/null
+++ b/testsuites/samples/gpio/init.c
@@ -0,0 +1,94 @@
+/*
+ *  Copyright (c) 2015 Ketul Shah 
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include  /* Calls the BBB specific library */
+#include  /* Calls the BSP gpio library */
+#include 
+#include 
+
+static void inline delay_sec(int sec)
+{
+  rtems_task_wake_after(sec*rtems_clock_get_ticks_per_second());
+}
+/* forward declarations to avoid warnings */
+rtems_task Init(rtems_task_argument argument);
+
+const char rtems_test_name[] = "Gpio Test";
+
+rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  rtems_test_begin();
+  printf("Starting Gpio Testing\n");
+ 
+ /* Intializing GPIO API */
+  rtems_gpio_initialize();
+  static gpio_pin_handle led_usr0_handle, led_usr1_handle, led_usr2_handle;
+  static gpio_pin_handle led_usr3_handle;
+  static unsigned int status;
+ 
+  status = rtems_gpio_configure_pin_digital_out(&led_usr0_handle, 
BBB_LED_USR0);
+  if (status == GPIO_SUCCESSFUL) {
+rtems_gpio_digital_set(&led_usr0_handle);
+delay_sec(1);
+rtems_gpio_digital_clear(&led_usr0_handle);
+delay_sec(1);
+rtems_gpio_release_pin(&led_usr0_handle);
+  }
+  status = rtems_gpio_configure_pin_digital_out(&led_usr1_handle, 
BBB_LED_USR1);
+  if (status == GPIO_SUCCESSFUL) {
+rtems_gpio_digital_set(&led_usr1_handle);
+delay_sec(1);
+rtems_gpio_digital_clear(&led_usr1_handle);
+delay_sec(1);
+rtems_gpio_release_pin(&led_usr1_handle);
+  }
+  status = rtems_gpio_configure_pin_digital_out(&led_usr2_handle, 
BBB_LED_USR2);
+  if (status == GPIO_SUCCESSFUL) {
+rtems_gpio_digital_set(&led_usr2_handle);
+delay_sec(1);
+rtems_gpio_digital_clear(&led_usr2_handle);
+delay_sec(1);
+rtems_gpio_release_pin(&led_usr2_handle);
+  }
+  status = rtems_gpio_configure_pin_digital_out(&led_usr3_handle, 
BBB_LED_USR3);
+  if (status == GPIO_SUCCESSFUL) {
+rtems_gpio_digital_set(&led_usr3_handle);
+delay_sec(1);
+rtems_gpio_digital_clear(&led_usr3_handle);
+delay_sec(1);
+rtems_gpio_release_pin(&led_usr3_handle);
+  }
+  printf("Gpio Test Completed\n");
+  rtems_test_end();
+  exit( 0 );
+}
+
+/* NOTICE: the clock driver is enabled */
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+ 
+#define CONFIGURE_MAXIMUM_TASKS1
+#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
+
+#define CONFIGURE_MAXIMUM_SEMAPHORES1
+ 
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE 
+
+#define CONFIGURE_EXTRA_TASK_STACKS (2 * RTEMS_MINIMUM_STACK_SIZE)
+ 
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+ 
+#define CONFIGURE_INIT
+#include 
\ No newline at end of file

diff --git a/testsuites/samples/gpio/gpio.doc b/testsuites/samples/gpio/gpio.doc
new file mode 100644
index 000..9812864
--- /dev/null
+++ b/testsuites/samples/gpio/gpio.doc
@@ -0,0 +1,9 @@
+#  COPYRIGHT (c) 1989-1999.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  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.
+#
+
+
diff --git a/testsuites/samples/gpio/gpio.scn b/testsuites/samples/gpio/gpio.scn
new file mode 100644
index 000..057ab6e
--- /dev/null
+++ b/testsuites/samples/gpio/gpio.scn
@@ -0,0 +1,3 @@
+*** GPIO TEST ***
+Gpio Testing
+*** END OF GPIO TEST ***
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/2] score: Accept NULL pointer in _Freechain_Put()

2015-06-30 Thread Sebastian Huber
With this a _Freechain_Put( _Freechain_Get() ) works always.
---
 cpukit/score/include/rtems/score/freechain.h | 3 ++-
 cpukit/score/src/freechain.c | 4 +++-
 testsuites/sptests/spfreechain01/init.c  | 2 ++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/cpukit/score/include/rtems/score/freechain.h 
b/cpukit/score/include/rtems/score/freechain.h
index 7fa580a..1540c0e 100644
--- a/cpukit/score/include/rtems/score/freechain.h
+++ b/cpukit/score/include/rtems/score/freechain.h
@@ -93,7 +93,8 @@ void *_Freechain_Get(
  * @brief Puts a node back onto the freechain.
  *
  * @param[in] freechain The freechain control.
- * @param[in] node The node to put back.
+ * @param[in] node The node to put back.  The node may be @c NULL, in this case
+ *   the function does nothing.
  */
 void _Freechain_Put(
   Freechain_Control *freechain,
diff --git a/cpukit/score/src/freechain.c b/cpukit/score/src/freechain.c
index 84b4c63..301e9b2 100644
--- a/cpukit/score/src/freechain.c
+++ b/cpukit/score/src/freechain.c
@@ -74,5 +74,7 @@ void *_Freechain_Get(
 
 void _Freechain_Put( Freechain_Control *freechain, void *node )
 {
-  _Chain_Prepend_unprotected( &freechain->Free, node );
+  if ( node != NULL ) {
+_Chain_Prepend_unprotected( &freechain->Free, node );
+  }
 }
diff --git a/testsuites/sptests/spfreechain01/init.c 
b/testsuites/sptests/spfreechain01/init.c
index 8963752..6efcd93 100644
--- a/testsuites/sptests/spfreechain01/init.c
+++ b/testsuites/sptests/spfreechain01/init.c
@@ -40,6 +40,8 @@ static rtems_task Init(rtems_task_argument ignored)
 
 /* check whether freechain put and get works correctly*/
 
+_Freechain_Put(&fc, NULL);
+
 puts( "INIT - Get node from freechain - OK" );
 node = _Freechain_Get(&fc, malloc, 1, sizeof(test_node));
 node->x = 1;
-- 
1.8.4.5

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


[PATCH 1/2] score: Freechain handler API changes

2015-06-30 Thread Sebastian Huber
Replace the extend function with an allocator since this fits better
to the current use case.
---
 cpukit/posix/include/rtems/posix/keyimpl.h |   6 +-
 cpukit/posix/src/key.c |  53 ++-
 cpukit/score/include/rtems/score/freechain.h   |  54 +++
 cpukit/score/src/freechain.c   |  53 +--
 testsuites/sptests/spfreechain01/init.c| 161 ++---
 testsuites/sptests/spfreechain01/spfreechain01.scn |  10 +-
 6 files changed, 104 insertions(+), 233 deletions(-)

diff --git a/cpukit/posix/include/rtems/posix/keyimpl.h 
b/cpukit/posix/include/rtems/posix/keyimpl.h
index a5c80d6..6fd4d13 100644
--- a/cpukit/posix/include/rtems/posix/keyimpl.h
+++ b/cpukit/posix/include/rtems/posix/keyimpl.h
@@ -156,11 +156,7 @@ RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get (
 _Objects_Get( &_POSIX_Keys_Information, (Objects_Id) id, location );
 }
 
-RTEMS_INLINE_ROUTINE POSIX_Keys_Key_value_pair *
-_POSIX_Keys_Key_value_pair_allocate( void )
-{
-  return (POSIX_Keys_Key_value_pair *) _Freechain_Get( &_POSIX_Keys_Keypool );
-}
+POSIX_Keys_Key_value_pair * _POSIX_Keys_Key_value_pair_allocate( void );
 
 RTEMS_INLINE_ROUTINE void _POSIX_Keys_Key_value_pair_free(
   POSIX_Keys_Key_value_pair *key_value_pair
diff --git a/cpukit/posix/src/key.c b/cpukit/posix/src/key.c
index 6753d57..55c65900 100644
--- a/cpukit/posix/src/key.c
+++ b/cpukit/posix/src/key.c
@@ -92,49 +92,24 @@ static uint32_t _POSIX_Keys_Get_initial_keypool_size( void )
   return _Objects_Maximum_per_allocation( max );
 }
 
-static bool _POSIX_Keys_Keypool_extend( Freechain_Control *keypool )
+static void _POSIX_Keys_Initialize_keypool( void )
 {
-  size_t bump_count = _POSIX_Keys_Get_keypool_bump_count();
-  bool ok = bump_count > 0;
-
-  if ( ok ) {
-size_t size = bump_count * sizeof( POSIX_Keys_Key_value_pair );
-POSIX_Keys_Key_value_pair *nodes = _Workspace_Allocate( size );
-
-ok = nodes != NULL;
-
-if ( ok ) {
-  _Chain_Initialize(
-&keypool->Freechain,
-nodes,
-bump_count,
-sizeof( *nodes )
-  );
-}
-  }
-
-  return ok;
+  _Freechain_Initialize(
+&_POSIX_Keys_Keypool,
+_Workspace_Allocate_or_fatal_error,
+_POSIX_Keys_Get_initial_keypool_size(),
+sizeof( POSIX_Keys_Key_value_pair )
+  );
 }
 
-static void _POSIX_Keys_Initialize_keypool( void )
+POSIX_Keys_Key_value_pair * _POSIX_Keys_Key_value_pair_allocate( void )
 {
-  Freechain_Control *keypool = &_POSIX_Keys_Keypool;
-  size_t initial_count = _POSIX_Keys_Get_initial_keypool_size();
-
-  _Freechain_Initialize( keypool, _POSIX_Keys_Keypool_extend );
-
-  if ( initial_count > 0 ) {
-size_t size = initial_count * sizeof( POSIX_Keys_Key_value_pair );
-POSIX_Keys_Key_value_pair *nodes =
-  _Workspace_Allocate_or_fatal_error( size );
-
-_Chain_Initialize(
-  &keypool->Freechain,
-  nodes,
-  initial_count,
-  sizeof( *nodes )
-);
-  }
+  return (POSIX_Keys_Key_value_pair *) _Freechain_Get(
+&_POSIX_Keys_Keypool,
+_Workspace_Allocate,
+_POSIX_Keys_Get_keypool_bump_count(),
+sizeof( POSIX_Keys_Key_value_pair )
+  );
 }
 
 /**
diff --git a/cpukit/score/include/rtems/score/freechain.h 
b/cpukit/score/include/rtems/score/freechain.h
index d68a1f7..7fa580a 100644
--- a/cpukit/score/include/rtems/score/freechain.h
+++ b/cpukit/score/include/rtems/score/freechain.h
@@ -16,8 +16,7 @@
 #ifndef _RTEMS_SCORE_FREECHAIN_H
 #define _RTEMS_SCORE_FREECHAIN_H
 
-#include 
-
+#include 
 #include 
 
 #ifdef __cplusplus
@@ -36,27 +35,20 @@ extern "C" {
  * @{
  */
 
-typedef struct Freechain_Control Freechain_Control;
-
 /**
- * @brief Extends the freechain.
- *
- * @param[in] freechain The freechain control.
- *
- * @retval true The freechain contains now at least one node.
- * @retval false Otherwise.
+ * @brief Allocator function.
  */
-typedef bool ( *Freechain_Extend )( Freechain_Control *freechain );
+typedef void *( *Freechain_Allocator )( size_t size );
 
 /**
- * @typedef Freechain_Control
- *
- * This is used to manage freechain's nodes.
+ * @brief The freechain control.
  */
-struct Freechain_Control {
-  Chain_Control Freechain;
-  Freechain_Extend  extend;
-};
+typedef struct {
+  /**
+   * @brief Chain of free nodes.
+   */
+  Chain_Control Free;
+} Freechain_Control;
 
 /**
  * @brief Initializes a freechain.
@@ -65,32 +57,42 @@ struct Freechain_Control {
  * of nodes.  In case the freechain is empty the extend handler is called to
  * get more nodes.
  *
- * @param[in,out] freechain The freechain control to initialize.
- * @param[in] extend The extend handler.  It is called by _Freechain_Get() in
- * case the freechain is empty.
+ * @param[in] freechain The freechain control to initialize.
+ * @param[in] allocator The allocator function.
+ * @param[in] number_nodes The initial number of nodes.
+ * @param[in] node_size The node size.
  */
 void _Freechain_Initialize(
-  Freechain_Control *f

Re: Cache issue with BBB networking

2015-06-30 Thread Marcos Díaz
I have a question about this, the frebsd driver, was prepared to be used
with cache enabled?
I mean, in freeBSD OS the cache is enabled?

On Tue, Jun 30, 2015 at 12:46 AM, Daniel Gutson <
daniel.gut...@tallertechnologies.com> wrote:

> Ragu,
>
>Please ensure that you are getting cache coherence right. That is,
> there are no packets crossing the cache lines.
> FWIW, in a life ago, i got a problem with an eth driver where the
> descriptors ring was not properly sized (ie no modulus cache line).
> El 29/6/2015 17:23, "ragu nath"  escribió:
>
>> Thanks Marcos. I will let you know if there is any progress.
>>
>> Regards,
>> Ragunath
>>
>> On Tue, Jun 30, 2015 at 12:50 AM, Marcos Díaz <
>> marcos.d...@tallertechnologies.com> wrote:
>>
>>> Hi,
>>> I'm sorry but in the development of the porting of LWIP i couldn't give
>>> any more time to the task, so when I reached that stage I just disabled the
>>> cache.
>>> I will try to give some time to that to see if i can help you, and of
>>> course, let me know if you find something.
>>> Sorry again
>>>
>>> On Mon, Jun 29, 2015 at 3:16 PM, ragu nath 
>>> wrote:
>>>
 Hi Marcos,

 I am working on porting ethernet driver for Beaglebone black from
 FreeBSD to rtems-libbsd as part of GSOC 2015. I ported the driver and
 got it working.

 But there was one issue I faced, similar to the one you mentioned in
 our earlier correspondence (regarding lwIP). You mentioned that the
 system crashes if cache is enabled.

 In my case, the Address Lookup Engine (ALE) is getting corrupted if
 cache is enabled. Because of this packet transmission failed sending
 out random junk packets. With cache disabled, networking is working.

 I am looking for options other than disabling cache as a whole. Is
 there any other option available?  Can you share the details of any of
 the things you tried and found not working?


 Thanks,
 Ragunath

>>>
>>>
>>>
>>> --
>>>
>>> __
>>>
>>> 
>>>
>>>
>>> Marcos Díaz
>>>
>>> Software Engineer
>>>
>>>
>>> San Lorenzo 47, 3rd Floor, Office 5
>>>
>>> Córdoba, Argentina
>>>
>>>
>>> Phone: +54 351 4217888 / +54 351 4218211/ +54 351 7617452
>>>
>>> Skype: markdiaz22
>>>
>>>
>>
>>
>> --
>> ragu
>>
>


-- 

__




Marcos Díaz

Software Engineer


San Lorenzo 47, 3rd Floor, Office 5

Córdoba, Argentina


Phone: +54 351 4217888 / +54 351 4218211/ +54 351 7617452

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

Re: Using tar to access files

2015-06-30 Thread Gedare Bloom
On Tue, Jun 30, 2015 at 1:10 AM, Nick Withers  wrote:
> On Tue, 2015-06-30 at 10:09 +0530, Sujay Raj wrote:
>> I need to access configurations files the for web server I am porting to
>> rtems.
>>
>> I create a tar archive , that contains the required folders and files ,
>> convert it into c source using rtems-bin2c , ( a header file and a c source
>> ) and link them with my project.
>>
>> In the init, I call
>>
>> sc = Untar_FromMemory((void *)TARFILE_START, (size_t)TARFILE_SIZE);
>
> I'm not familiar with that function but I use rtems_tarfs_load()
> successfully.
>
> Not sure whether it needs CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS or
> other resources off the top of my head.
>
> P.S. It'd probably be best to send help requests like this to the users
> list
>
I've used this Untar some. You might want to look into the file image
created, and even untar it with your host to see what it produces.

Here are the commands I use from an old repo (with CVS and SVN vc),
after placing the files in a directory called "files"

cd files
tar -cvf ../FileSystemImage --exclude CVS --exclude .cvsignore --exclude .svn .
cd ..
rtems-bin2c FileSystemImage FileSystemImage

This creates the .c and .h files I need so that I can use in my init():
Untar_FromMemory(FileSystemImage, FileSystemImage_size)

I also used
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40
#define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK 512

All of this was awhile ago, but maybe these pointers will help you.

-Gedare

>> where TARFILE_START is the macro with the name of the array , TARFILE_SIZE
>> is the size of the array.
>>
>> But when I run the program, I get errors of the form
>>
>> "Untar: failed to create file /"
>>
>> for all the files in the tar archive (there are about 10 files, 10 errors).
>>
>> There are no build errors, and since my application recognizes files
>> present in the tar archive, I think possibly I am missing to initialize
>> something.
>>
>> Help would be really appreciated.
>>
>> Thanks and Regards,
>> Sujay Raj
>> ___
>> 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
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 2/2] score: Accept NULL pointer in _Freechain_Put()

2015-06-30 Thread Gedare Bloom
OK

On Tue, Jun 30, 2015 at 9:29 AM, Sebastian Huber
 wrote:
> With this a _Freechain_Put( _Freechain_Get() ) works always.
> ---
>  cpukit/score/include/rtems/score/freechain.h | 3 ++-
>  cpukit/score/src/freechain.c | 4 +++-
>  testsuites/sptests/spfreechain01/init.c  | 2 ++
>  3 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/cpukit/score/include/rtems/score/freechain.h 
> b/cpukit/score/include/rtems/score/freechain.h
> index 7fa580a..1540c0e 100644
> --- a/cpukit/score/include/rtems/score/freechain.h
> +++ b/cpukit/score/include/rtems/score/freechain.h
> @@ -93,7 +93,8 @@ void *_Freechain_Get(
>   * @brief Puts a node back onto the freechain.
>   *
>   * @param[in] freechain The freechain control.
> - * @param[in] node The node to put back.
> + * @param[in] node The node to put back.  The node may be @c NULL, in this 
> case
> + *   the function does nothing.
>   */
>  void _Freechain_Put(
>Freechain_Control *freechain,
> diff --git a/cpukit/score/src/freechain.c b/cpukit/score/src/freechain.c
> index 84b4c63..301e9b2 100644
> --- a/cpukit/score/src/freechain.c
> +++ b/cpukit/score/src/freechain.c
> @@ -74,5 +74,7 @@ void *_Freechain_Get(
>
>  void _Freechain_Put( Freechain_Control *freechain, void *node )
>  {
> -  _Chain_Prepend_unprotected( &freechain->Free, node );
> +  if ( node != NULL ) {
> +_Chain_Prepend_unprotected( &freechain->Free, node );
> +  }
>  }
> diff --git a/testsuites/sptests/spfreechain01/init.c 
> b/testsuites/sptests/spfreechain01/init.c
> index 8963752..6efcd93 100644
> --- a/testsuites/sptests/spfreechain01/init.c
> +++ b/testsuites/sptests/spfreechain01/init.c
> @@ -40,6 +40,8 @@ static rtems_task Init(rtems_task_argument ignored)
>
>  /* check whether freechain put and get works correctly*/
>
> +_Freechain_Put(&fc, NULL);
> +
>  puts( "INIT - Get node from freechain - OK" );
>  node = _Freechain_Get(&fc, malloc, 1, sizeof(test_node));
>  node->x = 1;
> --
> 1.8.4.5
>
> ___
> 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] GPIO Driver Sample Application

2015-06-30 Thread Gedare Bloom
Try to figure out how to make the sample not be BSP (BBB)-specific. If
you can't then instead this should probably go into examples-v2 and
use a similar model as the LED example there. Speaking of which,
perhaps the LED example should be extended to be supported on the BBB?

Gedare

On Tue, Jun 30, 2015 at 6:01 AM, Ketul Shah  wrote:
> diff --git a/testsuites/samples/gpio/init.c b/testsuites/samples/gpio/init.c
> new file mode 100644
> index 000..391d80c
> --- /dev/null
> +++ b/testsuites/samples/gpio/init.c
> @@ -0,0 +1,94 @@
> +/*
> + *  Copyright (c) 2015 Ketul Shah 
> + *
> + *  The license and distribution terms for this file may be
> + *  found in the file LICENSE in this distribution or at
> + *  http://www.rtems.org/license/LICENSE.
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
> +#include 
> +#include  /* Calls the BBB specific library */
> +#include  /* Calls the BSP gpio library */
> +#include 
> +#include 
> +
> +static void inline delay_sec(int sec)
> +{
> +  rtems_task_wake_after(sec*rtems_clock_get_ticks_per_second());
> +}
> +/* forward declarations to avoid warnings */
> +rtems_task Init(rtems_task_argument argument);
> +
> +const char rtems_test_name[] = "Gpio Test";
> +
> +rtems_task Init(
> +  rtems_task_argument ignored
> +)
> +{
> +  rtems_test_begin();
> +  printf("Starting Gpio Testing\n");
> +
> + /* Intializing GPIO API */
> +  rtems_gpio_initialize();
> +  static gpio_pin_handle led_usr0_handle, led_usr1_handle, led_usr2_handle;
> +  static gpio_pin_handle led_usr3_handle;
> +  static unsigned int status;
> +
> +  status = rtems_gpio_configure_pin_digital_out(&led_usr0_handle, 
> BBB_LED_USR0);
> +  if (status == GPIO_SUCCESSFUL) {
> +rtems_gpio_digital_set(&led_usr0_handle);
> +delay_sec(1);
> +rtems_gpio_digital_clear(&led_usr0_handle);
> +delay_sec(1);
> +rtems_gpio_release_pin(&led_usr0_handle);
> +  }
> +  status = rtems_gpio_configure_pin_digital_out(&led_usr1_handle, 
> BBB_LED_USR1);
> +  if (status == GPIO_SUCCESSFUL) {
> +rtems_gpio_digital_set(&led_usr1_handle);
> +delay_sec(1);
> +rtems_gpio_digital_clear(&led_usr1_handle);
> +delay_sec(1);
> +rtems_gpio_release_pin(&led_usr1_handle);
> +  }
> +  status = rtems_gpio_configure_pin_digital_out(&led_usr2_handle, 
> BBB_LED_USR2);
> +  if (status == GPIO_SUCCESSFUL) {
> +rtems_gpio_digital_set(&led_usr2_handle);
> +delay_sec(1);
> +rtems_gpio_digital_clear(&led_usr2_handle);
> +delay_sec(1);
> +rtems_gpio_release_pin(&led_usr2_handle);
> +  }
> +  status = rtems_gpio_configure_pin_digital_out(&led_usr3_handle, 
> BBB_LED_USR3);
> +  if (status == GPIO_SUCCESSFUL) {
> +rtems_gpio_digital_set(&led_usr3_handle);
> +delay_sec(1);
> +rtems_gpio_digital_clear(&led_usr3_handle);
> +delay_sec(1);
> +rtems_gpio_release_pin(&led_usr3_handle);
> +  }
> +  printf("Gpio Test Completed\n");
> +  rtems_test_end();
> +  exit( 0 );
> +}
> +
> +/* NOTICE: the clock driver is enabled */
> +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
> +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
> +
> +#define CONFIGURE_MAXIMUM_TASKS1
> +#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
> +
> +#define CONFIGURE_MAXIMUM_SEMAPHORES1
> +
> +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> +
> +#define CONFIGURE_EXTRA_TASK_STACKS (2 * RTEMS_MINIMUM_STACK_SIZE)
> +
> +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
> +
> +#define CONFIGURE_INIT
> +#include 
> \ No newline at end of file
>
> diff --git a/testsuites/samples/gpio/gpio.doc 
> b/testsuites/samples/gpio/gpio.doc
> new file mode 100644
> index 000..9812864
> --- /dev/null
> +++ b/testsuites/samples/gpio/gpio.doc
> @@ -0,0 +1,9 @@
> +#  COPYRIGHT (c) 1989-1999.
> +#  On-Line Applications Research Corporation (OAR).
> +#
> +#  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.
> +#
> +
> +
> diff --git a/testsuites/samples/gpio/gpio.scn 
> b/testsuites/samples/gpio/gpio.scn
> new file mode 100644
> index 000..057ab6e
> --- /dev/null
> +++ b/testsuites/samples/gpio/gpio.scn
> @@ -0,0 +1,3 @@
> +*** GPIO TEST ***
> +Gpio Testing
> +*** END OF GPIO TEST ***
> ___
> 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/2] GPIO Driver

2015-06-30 Thread Gedare Bloom
I don't think we want the shared code in cpukit but rather in
libbsp/shared.. Also, I think Andre shall commit the shared code, so
perhaps you should focus on just getting a localized solution working
in the beagleboard BSP

On Tue, Jun 30, 2015 at 5:46 AM, Ketul Shah  wrote:
> diff --git a/cpukit/include/rtems/gpio.h b/cpukit/include/rtems/gpio.h
> new file mode 100644
> index 000..3d68c39
> --- /dev/null
> +++ b/cpukit/include/rtems/gpio.h
> @@ -0,0 +1,64 @@
> +/**
> + * @file rtems/gpio.h
> + *
> + * @brief Global GPIO definitions.
> + *
> + * This include the generalized definitions for GPIO
> + */
> +
> +/**
> + * Copyright (c) 2015 Ketul Shah 
> + *
> + * 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 _RTEMS_GPIO_H
> +#define _RTEMS_GPIO_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif /* __cplusplus */
> +
> +/* Returned Error Codes by function */
> +#define GPIO_SUCCESSFUL0 /* operation is OK */
> +#define GPIO_UNKNOWN_PIN   1 /* pin not known by bsp */
> +#define GPIO_UNCONFIGURED_PIN  2 /* pin unable to configure */
> +#define GPIO_MISCONFIGURED_PIN 3 /* pin configuration can't match operation 
> */
> +
> +/* Possible GPIO Pin States */
> +#define GPIO_PIN_STATE_UNCONFIGURED 0
> +#define GPIO_PIN_STATE_DIGITAL_OUT  1
> +#define GPIO_PIN_STATE_DIGITAL_IN   2
> +
> +/**
> + * @brief Structure contains all the required members for GPIO access.
> + */
> +typedef struct
> +{
> +  int   pin_number;/* The pin number. */
> +  void* platform;  /* Opaque hardware specific set up details. */
> +} gpio_pin_handle;
> +
> +/**
> + * @brief Initializes the GPIO API.
> + */
> +extern void rtems_gpio_initialize(void);
> +/**
> + * @brief Selects a GPIO pin for a digital output.
> + */
> +extern int rtems_gpio_configure_pin_digital_out(
> +   gpio_pin_handle *, unsigned int );
> +/**
> + * @brief Turns on the given pin.
> + */
> +extern int rtems_gpio_digital_set(gpio_pin_handle *);
> +/**
> + * @brief Turns off the given pin.
> + */
> +extern int rtems_gpio_digital_clear(gpio_pin_handle *);
> +/**
> + * @brief currently configured pin is released and made UNCONFIGURED.
> + */
> +extern int rtems_gpio_release_pin(gpio_pin_handle *);
> \ No newline at end of file
>
> diff --git a/c/src/lib/libbsp/arm/beagle/gpio/gpio.c 
> b/c/src/lib/libbsp/arm/beagle/gpio/gpio.c
> new file mode 100644
> index 000..541d456
> --- /dev/null
> +++ b/c/src/lib/libbsp/arm/beagle/gpio/gpio.c
> @@ -0,0 +1,210 @@
> +/**
> + * @file
> + *
> + * @ingroup arm_beagle
> + *
> + * @brief Global BSP definitions.
> + */
> +
> +/**
> + * Copyright (c) 2015 Ketul Shah 
> + *
> + * The license and distribution terms for this file may be
> + * found in the file LICENSE in this distribution or at
> + * http://www.rtems.org/license/LICENSE.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/**
> + * @brief GPIO API mutex atributes.
> + */
> +#define MUTEX_ATRIBUTES \
> +  ( RTEMS_LOCAL \
> +| RTEMS_PRIORITY\
> +| RTEMS_BINARY_SEMAPHORE\
> +| RTEMS_INHERIT_PRIORITY\
> +| RTEMS_NO_PRIORITY_CEILING \
> +)
> +
> +#define OBTAIN_LOCK(s)  if(rtems_semaphore_obtain(s, \
> +  RTEMS_WAIT,\
> +  RTEMS_NO_TIMEOUT   \
> +  ) != RTEMS_SUCCESSFUL) \
> +  printf("Semaphore not obtained\n");
> +
> +#define RELEASE_LOCK(s) if(rtems_semaphore_release(s) != RTEMS_SUCCESSFUL) \
> +  printf("Semaphore not released\n");
> +
> +/* GPIO bank pin number as per TRM of AM335X */
> +static unsigned int gpio_bank_pin[GPIO_PIN_COUNT];
> +/* GPIO bank determines register of AM335X */
> +static unsigned int gpio_bank[GPIO_PIN_COUNT];
> +/* Pin states for all GPIO pins*/
> +static unsigned int gpio_pin_state[GPIO_PIN_COUNT];
> +/* Variable for gpio initialization */
> +static bool is_initialized = false;
> +/* Total number of gpio banks */
> +static int gpio_bank_count = GPIO_PIN_COUNT / GPIO_PINS_PER_BANK;
> +/* Semaphore for avoiding race condition */
> +static rtems_id bank_lock;
> +
> +static const uint32_t gpio_bank_addrs[] =
> +  { AM335X_GPIO0, AM335X_GPIO1, AM335X_GPIO2, AM335X_GPIO3 };
> +
> +static uint32_t inline get_pin_mask(unsigned int pin_number)
> +{
> +  return (1UL << gpio_bank_pin[pin_number]);
> +}
> +
> +static void inline reg_update_set(unsigned int pin_number,uint32_t reg)
> +{
> +  uint32_t gpioreg=gpio_bank[pin_number]+reg;
> +  uint32_t gpioreg_val=mmio_read(gpioreg);
> +  gpioreg_val |= get_pin_mask(pin_number);
> +  mmio_write(gpioreg

Re: [RSB Graphics Library] add patch for library source

2015-06-30 Thread Gedare Bloom
Chris,

Have we documented how to get custom patches working in RSB?

I CC'ed Hesham too, since he has done this recently, he might have some advice.

Gedare

On Tue, Jun 30, 2015 at 3:24 AM, QIAO YANG  wrote:
> Hi,
>
> I'm now working on moving the graphic libraries from rtems-graphic-tool-kits
> into rsb, based on the existing work for libjpeg and the
> rtems-graphic-tool-kits's buid script.
>
> The port of libpng, libtiff, freetype2 can be review on my github:
> https://github.com/yangqiao/rtems-source-builder/commits/graphics
>
> While I've got some problems when trying to add patch for source code.
> As what I've read from other cfg files, we should first "patch add" the
> needed patches, then "patch setup" to apply them. When I try to add the
> patch under source-builder/patches/,  it warned me that the path doesn't
> have a proper protocl such as https, git  And I've found that some
> patches of gdb ..etc are in rtems-tools and the sb-build retrieve them from
> the git server. How can I add a patch from source-builder/patches/ instead
> of uploading to rtems-tools ? Or maybe I missed something?
>
> Thanks in advance
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [RSB Graphics Library] add patch for library source

2015-06-30 Thread Joel Sherrill



On 6/30/2015 11:54 AM, Gedare Bloom wrote:

Chris,

Have we documented how to get custom patches working in RSB?

I CC'ed Hesham too, since he has done this recently, he might have some advice.


I don't know if it is documented. But if the upstage doesn't have
a patch retrieval system, then it goes in rtems-tools on our side
as far as I understand.

For testing, you can manually place the patch in the RSB patches
directory.

FWIW I have a series of patches for 5 packages to add to the RSB.


Gedare

On Tue, Jun 30, 2015 at 3:24 AM, QIAO YANG  wrote:

Hi,

I'm now working on moving the graphic libraries from rtems-graphic-tool-kits
into rsb, based on the existing work for libjpeg and the
rtems-graphic-tool-kits's buid script.

The port of libpng, libtiff, freetype2 can be review on my github:
https://github.com/yangqiao/rtems-source-builder/commits/graphics

While I've got some problems when trying to add patch for source code.
As what I've read from other cfg files, we should first "patch add" the
needed patches, then "patch setup" to apply them. When I try to add the
patch under source-builder/patches/,  it warned me that the path doesn't
have a proper protocl such as https, git  And I've found that some
patches of gdb ..etc are in rtems-tools and the sb-build retrieve them from
the git server. How can I add a patch from source-builder/patches/ instead
of uploading to rtems-tools ? Or maybe I missed something?

Thanks in advance


___
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: [RSB Graphics Library] add patch for library source

2015-06-30 Thread Chris Johns
On 1/07/2015 4:35 am, Joel Sherrill wrote:
> 
> On 6/30/2015 11:54 AM, Gedare Bloom wrote:
>> Chris,
>>
>> Have we documented how to get custom patches working in RSB?
>>
>> I CC'ed Hesham too, since he has done this recently, he might have
>> some advice.
> 
> I don't know if it is documented. But if the upstage doesn't have
> a patch retrieval system, then it goes in rtems-tools on our side
> as far as I understand.

We have been putting patches into rtems-tools when there is no other
home. Having no patches in rtems-tool is the ideal situation.

This is the first use case, the RTEMS project needs a specific patch.

> For testing, you can manually place the patch in the RSB patches
> directory.

This is the second use case, when testing patches.

Placing the files in the patches directory and then adding any path to
the config file works. The RSB uses the basename of the URL for the file
name and it checks the patches directory for that file.

Another solution is to define a real path such as the rtems-tools repo
and to create a user macro file. An example I am currently using for
qemu is:

#
# QEMU patches
#
[patch-qemu]
patch0100: none, override,
'file://opt/work/chris/rtems/rsb/patches/0001-FIXME-Hack-to-support-libbsd-tests.patch'
patch0101:  none, override,
'file://opt/work/chris/rtems/rsb/patches/0001-net-cadence_gem-Set-initial-MAC-address.patch'

Notice, absolute paths. I am not sure if relative paths work. I have not
tried. Use high patch numbers that keep clear of any patches included in
the base config files. The RSB applies the patches in the numbered order.

Use the --macros argument to supply the macros with the patches.

The RSB places the places in a macro map with the name of the patch set
prefixed by 'patch-'. The source files live in a different map to the
where the map name prefix is 'source-'. This lets the RSB collect all
the sources and patches without packages overlapping each other in a
build set. If you add '--dry-run --trace' the log file will output the
macros.

> 
> FWIW I have a series of patches for 5 packages to add to the RSB.
> 

Please post. Thanks

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


Re: [RSB Graphics Library] add patch for library source

2015-06-30 Thread Hesham ALMatary
On Tue, Jun 30, 2015 at 5:54 PM Gedare Bloom  wrote:

> Chris,
>
> Have we documented how to get custom patches working in RSB?
>
> I CC'ed Hesham too, since he has done this recently, he might have some
> advice.
>
> There were two ways I used to get RSB fetch the patches: 1) An absolute
URL to a patch (on Github for example), and I think some gaisler and/or
sparc tools do the same, and 2) Place the patch at rtems-tools as Dr. Joel
mentioned and refer to it from RSB.

I think RTEMS would prefer the second approach to avoid fetching from
external sources that might be changed or even the URL might get
invalidiated, seizing the whole toolchain build (and IIRC that happened
with sparc)

> Gedare
>
> On Tue, Jun 30, 2015 at 3:24 AM, QIAO YANG  wrote:
> > Hi,
> >
> > I'm now working on moving the graphic libraries from
> rtems-graphic-tool-kits
> > into rsb, based on the existing work for libjpeg and the
> > rtems-graphic-tool-kits's buid script.
> >
> > The port of libpng, libtiff, freetype2 can be review on my github:
> > https://github.com/yangqiao/rtems-source-builder/commits/graphics
> >
> > While I've got some problems when trying to add patch for source code.
> > As what I've read from other cfg files, we should first "patch add" the
> > needed patches, then "patch setup" to apply them. When I try to add the
> > patch under source-builder/patches/,  it warned me that the path doesn't
> > have a proper protocl such as https, git  And I've found that some
> > patches of gdb ..etc are in rtems-tools and the sb-build retrieve them
> from
> > the git server. How can I add a patch from source-builder/patches/
> instead
> > of uploading to rtems-tools ? Or maybe I missed something?
> >
> > Thanks in advance
> >
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Testing of the Raspberry Pi graphic support

2015-06-30 Thread Pavel Pisa
Hello Qiao Yang,

I have prepared testing on RPi B+ hardware last days
I have got to test your RTEMS branch

  https://github.com/yangqiao/rtems

I have tried

  e89884b add memory table entry for frame buffer (try to cover all 
possibility, may be larger afterward if it's not enough)

and then

  b560cb2 refactor outch scratch

which has been left in my local copy from the previous fetch.

I have been able to build RTEMS as well as graphic libraries.
I have tried to build my standard shell test code and some graphic
test.

My setup

  host system Debian Linux amd64

  -

  tools - local build

  arm-rtems4.11-gcc (GCC) 4.9.2 with newlib newlib-2.2.0.20150423, binutils 2.24
  Configured 
with: ../../../src/gcc-4.9/configure --target=arm-rtems4.11 --prefix=/usr 
--build=x86_64-pc-linux-gnu --enable-languages=c,c++ --disable-libstdcxx-pch 
--with-gnu-ld --with-gnu-as --enable-threads --enable-target-optspace 
--with-system-zlib --verbose --disable-nls --without-included-gettext 
--disable-win32-registry --with-newlib --enable-plugin 
--enable-newlib-io-c99-formats --enable-version-specific-runtime-libs 
--enable-newlib-iconv --disable-lto

  used successfully for LPC4078 and LPC1778 RTEMS

  -

  RTEMS configured

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

  -

  Raspberry Pi direct boot by config.txt options

  kernel=appfoo.bin

  generated by

  arm-rtems4.11-objcopy -R -S -O binary "$EXE_NAME" "$EXE_NAME.bin"

  -

  Raspberry Pi boot over U-boot and extlinux/extlinux.conf

  TIMEOUT 100
  DEFAULT default
  MENU TITLE Boot menu

  LABEL RTEMS appfoo
MENU LABEL RTEMS appfoo
LINUX appfoo.img
FDTDIR .

  Image generated by

  arm-rtems4.11-objcopy -R -S -O binary "$EXE_NAME" "$EXE_NAME.bin" || exit 1
  cat "$EXE_NAME.bin" | gzip -9 >"$EXE_NAME.gz"
  mkimage \
-A arm -O rtems -T kernel -a 0x8000 -e 0x8000 -n "RTEMS" \
-d "$EXE_NAME.gz" "$EXE_NAME.img"

  -

The monitor resolution has been correctly obtained and printed for all 
combinations
but then there has been no progress/output on serial port even on HDMI output

Startup log for U-boot case

-
U-Boot 2015.04-rc2-gc5ec3a2 (Mar 05 2015 - 21:46:11)

DRAM:  448 MiB
WARNING: Caches not enabled
RPI Model B+
MMC:   bcm2835_sdhci: 0
reading uboot.env
In:serial
Out:   lcd
Err:   lcd
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
reading /extlinux/extlinux.conf
2176 bytes read in 20 ms (105.5 KiB/s)
Boot menu
1:  Linux 3.18.8-rt2+ with Overlay
2:  Linux 3.18.8-rt2+ with Aufs
3:  Linux 3.18.8-rt2+ RW root
4:  Linux 3.18.8-rt2+ NFS BusyBox
5:  Linux 3.18.8-rt2+ NFS Overlay
6:  Linux 3.18.8-rt2+ NFS RW
7:  RTEMS appfoo
8:  RTEMS demo_suitk
9:  Boot by localcmd
Enter choice: 8
8:  RTEMS demo_suitk
Retrieving file: /extlinux/demo_suitk.img
reading /extlinux/demo_suitk.img
375420 bytes read in 89 ms (4 MiB/s)
Retrieving file: /extlinux/./bcm2835-rpi-b-plus.dtb
reading /extlinux/./bcm2835-rpi-b-plus.dtb
4702 bytes read in 28 ms (163.1 KiB/s)
## Booting kernel from Legacy Image at 0100 ...
   Image Name:   RTEMS
   Image Type:   ARM RTEMS Kernel Image (gzip compressed)
   Data Size:375356 Bytes = 366.6 KiB
   Load Address: 8000
   Entry Point:  8000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
## Transferring control to RTEMS (at address 8000) ...
[+] framebuffer initialize
width:1680 height:1050
[+] framebuffer use display resolution 1680*1050
[+] write to mailbox
[+] read mailbox
[#] Done read mailbox, return val: 0
[#]FrameBufferInfo: width : 1680
[#]FrameBufferInfo: height : 1050
[#]FrameBufferInfo: vWidth : 1680
[#]FrameBufferInfo: vHeight : 1050
[#]FrameBufferInfo: pitch : 6720
[#]FrameBufferInfo: bitDepth : 32
[#]FrameBufferInfo: x_offset : 0
[#]FrameBufferInfo: y_offset : 0
[#]FrameBufferInfo: pointer : 0
[#]FrameBufferInfo: size : 0
[#]_RPI_initVideo: maxCol : 210
[#]_RPI_initVideo: maxRow : 65
-

Please, report more about actual state of your work
and what (which examples, test code) should work or if I have
done some configu

Re: [PATCH 1/2] GPIO Driver

2015-06-30 Thread Steve B
After this is sorted into the right place it would be great to see GPIO
IRQs included. I got an IRQ working by just writing to the correct memory
locations from application code (posted the source to users list last
week), but I think Andre's API does have some hooks for that (seemed that
way when I last looked). So it should not be too challenging to add that
feature. If you don't have time to get to it then I will volunteer to do it
once there is a patch that Gedare is happy with.

Steve


On Tue, Jun 30, 2015 at 9:53 AM, Gedare Bloom  wrote:

> I don't think we want the shared code in cpukit but rather in
> libbsp/shared.. Also, I think Andre shall commit the shared code, so
> perhaps you should focus on just getting a localized solution working
> in the beagleboard BSP
>
> On Tue, Jun 30, 2015 at 5:46 AM, Ketul Shah 
> wrote:
> > diff --git a/cpukit/include/rtems/gpio.h b/cpukit/include/rtems/gpio.h
> > new file mode 100644
> > index 000..3d68c39
> > --- /dev/null
> > +++ b/cpukit/include/rtems/gpio.h
> > @@ -0,0 +1,64 @@
> > +/**
> > + * @file rtems/gpio.h
> > + *
> > + * @brief Global GPIO definitions.
> > + *
> > + * This include the generalized definitions for GPIO
> > + */
> > +
> > +/**
> > + * Copyright (c) 2015 Ketul Shah 
> > + *
> > + * 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 _RTEMS_GPIO_H
> > +#define _RTEMS_GPIO_H
> > +
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif /* __cplusplus */
> > +
> > +/* Returned Error Codes by function */
> > +#define GPIO_SUCCESSFUL0 /* operation is OK */
> > +#define GPIO_UNKNOWN_PIN   1 /* pin not known by bsp */
> > +#define GPIO_UNCONFIGURED_PIN  2 /* pin unable to configure */
> > +#define GPIO_MISCONFIGURED_PIN 3 /* pin configuration can't match
> operation */
> > +
> > +/* Possible GPIO Pin States */
> > +#define GPIO_PIN_STATE_UNCONFIGURED 0
> > +#define GPIO_PIN_STATE_DIGITAL_OUT  1
> > +#define GPIO_PIN_STATE_DIGITAL_IN   2
> > +
> > +/**
> > + * @brief Structure contains all the required members for GPIO access.
> > + */
> > +typedef struct
> > +{
> > +  int   pin_number;/* The pin number. */
> > +  void* platform;  /* Opaque hardware specific set up details. */
> > +} gpio_pin_handle;
> > +
> > +/**
> > + * @brief Initializes the GPIO API.
> > + */
> > +extern void rtems_gpio_initialize(void);
> > +/**
> > + * @brief Selects a GPIO pin for a digital output.
> > + */
> > +extern int rtems_gpio_configure_pin_digital_out(
> > +   gpio_pin_handle *, unsigned int );
> > +/**
> > + * @brief Turns on the given pin.
> > + */
> > +extern int rtems_gpio_digital_set(gpio_pin_handle *);
> > +/**
> > + * @brief Turns off the given pin.
> > + */
> > +extern int rtems_gpio_digital_clear(gpio_pin_handle *);
> > +/**
> > + * @brief currently configured pin is released and made UNCONFIGURED.
> > + */
> > +extern int rtems_gpio_release_pin(gpio_pin_handle *);
> > \ No newline at end of file
> >
> > diff --git a/c/src/lib/libbsp/arm/beagle/gpio/gpio.c
> b/c/src/lib/libbsp/arm/beagle/gpio/gpio.c
> > new file mode 100644
> > index 000..541d456
> > --- /dev/null
> > +++ b/c/src/lib/libbsp/arm/beagle/gpio/gpio.c
> > @@ -0,0 +1,210 @@
> > +/**
> > + * @file
> > + *
> > + * @ingroup arm_beagle
> > + *
> > + * @brief Global BSP definitions.
> > + */
> > +
> > +/**
> > + * Copyright (c) 2015 Ketul Shah 
> > + *
> > + * The license and distribution terms for this file may be
> > + * found in the file LICENSE in this distribution or at
> > + * http://www.rtems.org/license/LICENSE.
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/**
> > + * @brief GPIO API mutex atributes.
> > + */
> > +#define MUTEX_ATRIBUTES \
> > +  ( RTEMS_LOCAL \
> > +| RTEMS_PRIORITY\
> > +| RTEMS_BINARY_SEMAPHORE\
> > +| RTEMS_INHERIT_PRIORITY\
> > +| RTEMS_NO_PRIORITY_CEILING \
> > +)
> > +
> > +#define OBTAIN_LOCK(s)  if(rtems_semaphore_obtain(s,
>  \
> > +  RTEMS_WAIT,
>   \
> > +  RTEMS_NO_TIMEOUT
>  \
> > +  ) !=
> RTEMS_SUCCESSFUL) \
> > +  printf("Semaphore not obtained\n");
> > +
> > +#define RELEASE_LOCK(s) if(rtems_semaphore_release(s) !=
> RTEMS_SUCCESSFUL) \
> > +  printf("Semaphore not released\n");
> > +
> > +/* GPIO bank pin number as per TRM of AM335X */
> > +static unsigned int gpio_bank_pin[GPIO_PIN_COUNT];
> > +/* GPIO bank determines register of AM335X */
> > +static unsigned int gpio_bank[GPIO_PIN_COUNT];
> > +/* Pin states for all GPIO pins*/
> > +sta