[PATCH 2/2] shell: Add an editor to the shell.

2014-10-03 Thread Chris Johns
This is a small (21K on sparc) editor that provides some powerful
features useful when a file needs editing on an embedded
board. No need for copy off, edit, copy back
---
 cpukit/libmisc/Makefile.am |2 +-
 cpukit/libmisc/shell/main_edit.c   | 2255 
 cpukit/libmisc/shell/shellconfig.h |6 +
 3 files changed, 2262 insertions(+), 1 deletion(-)
 create mode 100644 cpukit/libmisc/shell/main_edit.c

diff --git a/cpukit/libmisc/Makefile.am b/cpukit/libmisc/Makefile.am
index 820a838..2f41ffa 100644
--- a/cpukit/libmisc/Makefile.am
+++ b/cpukit/libmisc/Makefile.am
@@ -109,7 +109,7 @@ libshell_a_SOURCES = shell/cat_file.c shell/cmds.c 
shell/internal.h \
 shell/main_time.c shell/main_mknod.c \
 shell/main_setenv.c shell/main_getenv.c shell/main_unsetenv.c \
 shell/main_mkrfs.c shell/main_debugrfs.c shell/main_df.c \
-shell/main_lsof.c \
+shell/main_lsof.c shell/main_edit.c \
 shell/main_blkstats.c \
 shell/shell-wait-for-input.c
 
diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c
new file mode 100644
index 000..3097eeb
--- /dev/null
+++ b/cpukit/libmisc/shell/main_edit.c
@@ -0,0 +1,2255 @@
+//
+// edit.c
+//
+// Text editor
+//
+// Copyright (C) 2002 Michael Ringgaard. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+//notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//notice, this list of conditions and the following disclaimer in the
+//documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//may be used to endorse or promote products derived from this software
+//without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef SANOS
+#include 
+#endif
+
+#ifdef __rtems__
+#include 
+#include 
+#endif
+
+#if defined(__linux__) || defined(__rtems__)
+#include 
+#include 
+#define O_BINARY 0
+static int linux_console;
+#endif
+
+#define MINEXTEND  32768
+#define LINEBUF_EXTRA  32
+
+#ifndef TABSIZE
+#define TABSIZE8
+#endif
+
+#ifndef INDENT
+#define INDENT "  "
+#endif
+
+#define CLRSCR   "\033[0J\x1b[H\x1b[J"
+#define CLREOL   "\033[K"
+#define GOTOXY   "\033[%d;%dH"
+#define RESET_COLOR  "\033[0m"
+
+#ifdef COLOR
+#define TEXT_COLOR   "\033[44m\033[37m\033[1m"
+#define SELECT_COLOR "\033[47m\033[37m\033[1m"
+#define STATUS_COLOR "\033[0m\033[47m\033[30m"
+#else
+#define TEXT_COLOR   "\033[0m"
+#define SELECT_COLOR "\033[7m\033[1m"
+#define STATUS_COLOR "\033[1m\033[7m"
+#endif
+
+//
+// Key codes
+//
+
+#define KEY_BACKSPACE0x101
+#define KEY_ESC  0x102
+#define KEY_INS  0x103
+#define KEY_DEL  0x104
+#define KEY_LEFT 0x105
+#define KEY_RIGHT0x106
+#define KEY_UP   0x107
+#define KEY_DOWN 0x108
+#define KEY_HOME 0x109
+#define KEY_END  0x10A
+#define KEY_ENTER0x10B
+#define KEY_TAB  0x10C
+#define KEY_PGUP 0x10D
+#define KEY_PGDN 0x10E
+
+#define KEY_CTRL_LEFT0x10F
+#define KEY_CTRL_RIGHT   0x110
+#define KEY_CTRL_UP  0x111
+#define KEY_CTRL_DOWN0x112
+#define KEY_CTRL_HOME0x113
+#define KEY_CTRL_END 0x114
+#define KEY_CTRL_TAB 0x115
+
+#define KEY_SHIFT_LEFT   0x116
+#define KEY_SHIFT_RIGHT  0x117
+#define KEY_SHIFT_UP 0x118
+#define KEY_SHIFT_DOWN   0x119
+#define KEY_SHIFT_PGUP   0x11A
+#define KEY_SHIFT_PGDN   0x11B
+#define KEY_SHIFT_HOME   0x11C
+#define KEY_SHIFT_END0x11D
+#define KEY_SHIFT_TAB0x11E
+
+#define KEY_SHIFT_CTRL_LEFT  0x11F
+#define KEY_SHIFT_CTRL_RIGHT 0x120
+#define KEY_SHIFT_CTRL_U

[PATCH 1/2] libcsupport: Add realpath.

2014-10-03 Thread Chris Johns
---
 cpukit/libcsupport/Makefile.am|   2 +-
 cpukit/libcsupport/src/realpath.c | 253 ++
 2 files changed, 254 insertions(+), 1 deletion(-)
 create mode 100644 cpukit/libcsupport/src/realpath.c

diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
index d39f8f9..40e0800 100644
--- a/cpukit/libcsupport/Makefile.am
+++ b/cpukit/libcsupport/Makefile.am
@@ -119,7 +119,7 @@ TERMINAL_IDENTIFICATION_C_FILES += src/ttyname.c
 LIBC_GLUE_C_FILES = src/__getpid.c src/__gettod.c src/__times.c \
 src/truncate.c src/access.c src/stat.c src/lstat.c src/pathconf.c \
 src/newlibc_reent.c src/newlibc_init.c src/newlibc_exit.c \
-src/kill_noposix.c src/utsname.c
+src/kill_noposix.c src/utsname.c src/realpath.c
 
 BSD_LIBC_C_FILES = src/strlcpy.c src/strlcat.c src/issetugid.c
 
diff --git a/cpukit/libcsupport/src/realpath.c 
b/cpukit/libcsupport/src/realpath.c
new file mode 100644
index 000..dff0838
--- /dev/null
+++ b/cpukit/libcsupport/src/realpath.c
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2003 Constantin S. Svintsoff 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. The names of the authors may not be used to endorse or promote
+ *products derived from this software without specific prior written
+ *permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)realpath.c 8.1 (Berkeley) 2/16/94";
+#endif /* LIBC_SCCS and not lint */
+#include 
+__FBSDID("$FreeBSD: release/9.1.0/lib/libc/stdlib/realpath.c 240647 2012-09-18 
13:03:00Z emaste $");
+
+#if !defined(__rtems__)
+#include "namespace.h"
+#endif
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#if !defined(__rtems__)
+#include "un-namespace.h"
+#endif
+
+/*
+ * Find the real name of path, by removing all ".", ".." and symlink
+ * components.  Returns (resolved) on success, or (NULL) on failure,
+ * in which case the path which caused trouble is left in (resolved).
+ */
+char *
+realpath(const char * __restrict path, char * __restrict resolved)
+{
+   struct stat sb;
+   char *p, *q, *s;
+   size_t left_len, resolved_len;
+   unsigned symlinks;
+   int m, slen;
+   char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
+
+   if (path == NULL) {
+   errno = EINVAL;
+   return (NULL);
+   }
+   if (path[0] == '\0') {
+   errno = ENOENT;
+   return (NULL);
+   }
+   if (resolved == NULL) {
+   resolved = malloc(PATH_MAX);
+   if (resolved == NULL)
+   return (NULL);
+   m = 1;
+   } else
+   m = 0;
+   symlinks = 0;
+   if (path[0] == '/') {
+   resolved[0] = '/';
+   resolved[1] = '\0';
+   if (path[1] == '\0')
+   return (resolved);
+   resolved_len = 1;
+   left_len = strlcpy(left, path + 1, sizeof(left));
+   } else {
+   if (getcwd(resolved, PATH_MAX) == NULL) {
+   if (m)
+   free(resolved);
+   else {
+   resolved[0] = '.';
+   resolved[1] = '\0';
+   }
+   return (NULL);
+   }
+   resolved_len = strlen(resolved);
+   left_len = strlcpy(left, path, sizeof(left));
+   }
+   if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) {
+   if (m)
+   free(resolved);
+   errno = ENAMETOOLONG;
+   return (NULL);
+   }
+
+   /*
+* Iterate over path 

Re: [rtems commit] libmisc/shell: Remove the need for -lm when linking from the ping command.

2014-10-03 Thread Chris Johns

On 4/10/2014 10:05 am, Gedare Bloom wrote:

On Fri, Oct 3, 2014 at 8:04 PM, Gedare Bloom  wrote:

On Fri, Oct 3, 2014 at 6:48 PM, Chris Johns  wrote:

Module:rtems
Branch:master
Commit:56ed56a641b69be42f5a38046307b33096014c84
Changeset: 
http://git.rtems.org/rtems/commit/?id=56ed56a641b69be42f5a38046307b33096014c84

Author:Chris Johns 
Date:  Sat Oct  4 08:55:12 2014 +1000

libmisc/shell: Remove the need for -lm when linking from the ping command.

Remove the use of sqrt and so the need to link to -lm.
Clean up some warnings.

  static void
  g_check_status(globals)
@@ -1638,10 +1639,16 @@ g_finish(globals)
 if (nreceived && timing) {
 double n = nreceived + nrepeats;
 double avg = tsum / n;
+#if defined(__rtems__)
+   (void) printf(
+   "round-trip min/avg/max/stddev = %.3f/%.3f/%.3f ms\n",

Remove "/stddev"?

Actually, I'd suggest to just print the variance as it can be computed
relatively cheaply (compared to sqrt).



Ah yes I can change this. There is another step to remove the use of 
floating point which Pavel raised and I think is a great idea. This is 
just a simple clean up while that can be done.


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


Re: [rtems commit] libmisc/shell: Remove the need for -lm when linking from the ping command.

2014-10-03 Thread Gedare Bloom
On Fri, Oct 3, 2014 at 8:04 PM, Gedare Bloom  wrote:
> On Fri, Oct 3, 2014 at 6:48 PM, Chris Johns  wrote:
>> Module:rtems
>> Branch:master
>> Commit:56ed56a641b69be42f5a38046307b33096014c84
>> Changeset: 
>> http://git.rtems.org/rtems/commit/?id=56ed56a641b69be42f5a38046307b33096014c84
>>
>> Author:Chris Johns 
>> Date:  Sat Oct  4 08:55:12 2014 +1000
>>
>> libmisc/shell: Remove the need for -lm when linking from the ping command.
>>
>> Remove the use of sqrt and so the need to link to -lm.
>> Clean up some warnings.
>>
>> ---
>>
>>  cpukit/libmisc/shell/main_ping.c |   17 -
>>  1 files changed, 12 insertions(+), 5 deletions(-)
>>
>> diff --git a/cpukit/libmisc/shell/main_ping.c 
>> b/cpukit/libmisc/shell/main_ping.c
>> index a13d726..f13f241 100644
>> --- a/cpukit/libmisc/shell/main_ping.c
>> +++ b/cpukit/libmisc/shell/main_ping.c
>> @@ -86,7 +86,9 @@ __FBSDID("$FreeBSD$");
>>  #include 
>>  //#include 
>>  #include 
>> +#if !defined(__rtems__)
>>  #include 
>> +#endif
>>  #include 
>>  #include 
>>  #include 
>> @@ -333,7 +335,6 @@ static char *pr_ntime(n_time);
>>  static void pr_icmph(struct icmp *);
>>  static void pr_iph(struct ip *);
>>  static void pr_retip(struct ip *);
>> -static void status(int);
>>  static void stopit(int);
>>  static void tvsub(struct timeval *, struct timeval *);
>>
>> @@ -358,7 +359,7 @@ static void g_pr_pack(char *, int, struct sockaddr_in *, 
>> struct timeval *, rtems
>>  #define usage() g_usage(globals)
>>  static void g_usage(rtems_shell_globals_t* globals) __dead2;
>>
>> -void
>> +static void
>>  rtems_shell_ping_exit (rtems_shell_globals_t* globals, int code)
>>  {
>>globals->exit_code = code;
>> @@ -1581,14 +1582,14 @@ tvsub(out, in)
>>   * Print out statistics when SIGINFO is received.
>>   */
>>
>> +#if !defined(__rtems__)
>>  static void
>>  status(sig)
>> int sig __unused;
>>  {
>> -#if !__rtems__
>> siginfo_p = 1;
>> -#endif
>>  }
>> +#endif
>>
>>  static void
>>  g_check_status(globals)
>> @@ -1638,10 +1639,16 @@ g_finish(globals)
>> if (nreceived && timing) {
>> double n = nreceived + nrepeats;
>> double avg = tsum / n;
>> +#if defined(__rtems__)
>> +   (void) printf(
>> +   "round-trip min/avg/max/stddev = %.3f/%.3f/%.3f ms\n",
> Remove "/stddev"?
Actually, I'd suggest to just print the variance as it can be computed
relatively cheaply (compared to sqrt).

>
>> +   tmin, avg, tmax);
>> +#else
>> double vari = tsumsq / n - avg * avg;
>> (void)printf(
>> "round-trip min/avg/max/stddev = %.3f/%.3f/%.3f/%.3f 
>> ms\n",
>> tmin, avg, tmax, sqrt(vari));
>> +#endif
>> }
>> if (nreceived)
>> exit(0);
>> @@ -1917,7 +1924,7 @@ g_fill(bp, patp, globals)
>> u_int ii, jj, kk;
>>
>> for (cp = patp; *cp; cp++) {
>> -   if (!isxdigit(*cp))
>> +   if (!isxdigit((int)*cp))
>> errx(&globals->exit_jmp, EX_USAGE,
>> "patterns must be specified as hex digits");
>>
>>
>> ___
>> vc mailing list
>> v...@rtems.org
>> http://lists.rtems.org/mailman/listinfo/vc
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [rtems commit] libmisc/shell: Remove the need for -lm when linking from the ping command.

2014-10-03 Thread Gedare Bloom
On Fri, Oct 3, 2014 at 6:48 PM, Chris Johns  wrote:
> Module:rtems
> Branch:master
> Commit:56ed56a641b69be42f5a38046307b33096014c84
> Changeset: 
> http://git.rtems.org/rtems/commit/?id=56ed56a641b69be42f5a38046307b33096014c84
>
> Author:Chris Johns 
> Date:  Sat Oct  4 08:55:12 2014 +1000
>
> libmisc/shell: Remove the need for -lm when linking from the ping command.
>
> Remove the use of sqrt and so the need to link to -lm.
> Clean up some warnings.
>
> ---
>
>  cpukit/libmisc/shell/main_ping.c |   17 -
>  1 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/cpukit/libmisc/shell/main_ping.c 
> b/cpukit/libmisc/shell/main_ping.c
> index a13d726..f13f241 100644
> --- a/cpukit/libmisc/shell/main_ping.c
> +++ b/cpukit/libmisc/shell/main_ping.c
> @@ -86,7 +86,9 @@ __FBSDID("$FreeBSD$");
>  #include 
>  //#include 
>  #include 
> +#if !defined(__rtems__)
>  #include 
> +#endif
>  #include 
>  #include 
>  #include 
> @@ -333,7 +335,6 @@ static char *pr_ntime(n_time);
>  static void pr_icmph(struct icmp *);
>  static void pr_iph(struct ip *);
>  static void pr_retip(struct ip *);
> -static void status(int);
>  static void stopit(int);
>  static void tvsub(struct timeval *, struct timeval *);
>
> @@ -358,7 +359,7 @@ static void g_pr_pack(char *, int, struct sockaddr_in *, 
> struct timeval *, rtems
>  #define usage() g_usage(globals)
>  static void g_usage(rtems_shell_globals_t* globals) __dead2;
>
> -void
> +static void
>  rtems_shell_ping_exit (rtems_shell_globals_t* globals, int code)
>  {
>globals->exit_code = code;
> @@ -1581,14 +1582,14 @@ tvsub(out, in)
>   * Print out statistics when SIGINFO is received.
>   */
>
> +#if !defined(__rtems__)
>  static void
>  status(sig)
> int sig __unused;
>  {
> -#if !__rtems__
> siginfo_p = 1;
> -#endif
>  }
> +#endif
>
>  static void
>  g_check_status(globals)
> @@ -1638,10 +1639,16 @@ g_finish(globals)
> if (nreceived && timing) {
> double n = nreceived + nrepeats;
> double avg = tsum / n;
> +#if defined(__rtems__)
> +   (void) printf(
> +   "round-trip min/avg/max/stddev = %.3f/%.3f/%.3f ms\n",
Remove "/stddev"?

> +   tmin, avg, tmax);
> +#else
> double vari = tsumsq / n - avg * avg;
> (void)printf(
> "round-trip min/avg/max/stddev = %.3f/%.3f/%.3f/%.3f 
> ms\n",
> tmin, avg, tmax, sqrt(vari));
> +#endif
> }
> if (nreceived)
> exit(0);
> @@ -1917,7 +1924,7 @@ g_fill(bp, patp, globals)
> u_int ii, jj, kk;
>
> for (cp = patp; *cp; cp++) {
> -   if (!isxdigit(*cp))
> +   if (!isxdigit((int)*cp))
> errx(&globals->exit_jmp, EX_USAGE,
> "patterns must be specified as hex digits");
>
>
> ___
> vc mailing list
> v...@rtems.org
> http://lists.rtems.org/mailman/listinfo/vc
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


RTEMS with QEMU read from serial inside VM

2014-10-03 Thread Мороз Олег
Hello everyone. I've got a problem with reading data from /dev/ttys1 
configured  as UDP socket.

I'm starting qemu like this:
qemu-system-i386 -serial udp:127.0.0.1:4555@127.0.0.1:4556 -serial 
udp:127.0.0.1:4557@127.0.0.1:4558 -kernel zvezda_shell.exe


then i've opend a file and trying to read from it

  tty_in_descriptor = open("/dev/ttyS1",O_RDONLY);
  printf("tty_in_descriptor is %d\n",tty_in_descriptor);
  if (tty_in_descriptor)
  {
  while(1)
  printf("read() %d\n",read(tty_in_descriptor,buffer,1));
  }

at the same time i'm using a python program to send data to 4555 UDP port

The executions stops at the first data read.

How can i resolve it?
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: Libatomic support

2014-10-03 Thread Daniel Cederman



On 2014-10-02 15:09, Daniel Gutson wrote:

On Thu, Oct 2, 2014 at 6:16 AM, Daniel Cederman  wrote:

I would not put too much time into this.  Who needs this stuff?


Thanks for the comment. I thought it would be a quick fix to add support,
but looking at the code that gcc generates for _Atomic struct's I do not
really trust it to be correct. And on embedded platforms it is probably
better to get an undefined reference error and make a custom solution than
to add locks indirectly. So I will put this on hold.


is libatomic the implementation of C++11's std::atomic?
If so, it is more and more used in the "lock-free programming" trend.


libatomic provides support for doing atomic operations on data types 
larger than the ones supported by hardware. It does this by using locks, 
so for lock-free programming it is of no real use.


A simple example:

#include 

_Atomic struct Big {
  int a;
  int b;
  int c;
  int d;
  int e;
} global;

int main()
{
  struct Big local;

  local = global;

  return 0;
}

The assignment to local should be done atomically. The compiler 
transforms the assignment to a call to __atomic_load, which is 
implemented in libatomic. There the memory range that global is 
occupying will be locked and then memcpy:ed to local.


The strange thing is that gcc allows members of the _Atomic struct to be 
read without taking locks, which seems wrong. clang does not allow this.


/Daniel C




We *might* be interested in this C++11 feature to be available in RTEMS.
Could you please let me know whether this is currently working
suboptimally (i.e. using POSIX) or needs some work to be available?
I'm not familiar with _Atomic but I could if this needs work.

Thanks!

Daniel.




On 2014-10-02 07:50, Sebastian Huber wrote:


On 01/10/14 16:20, Daniel Cederman wrote:


I'm looking at GCC's libatomic, which provides software emulation of
atomic
operations that are not supported by hardware. It does this by using a
compare-and-swap loop, or, failing that, using locks. At the moment it
is not
selected for compilation for RTEMS since it requires operating system (or
architecture) support for the locks. It needs support for two types of
lock/unlock operations. Here is a cut-and-paste from the libatomic_i.h
file in
libatomic:

  >/* Locking for a "small" operation.  In the bare-metal single processor
  >   cases this could be implemented by disabling interrupts.  Thus
the extra
  >   word passed between the two functions, saving the interrupt level.
  >   It is assumed that the object being locked does not cross the
locking
  >   granularity.
  >
  >   Not actually declared here so that they can be defined static inline
  >   in a target-specfic .
  >
  >UWORD protect_start (void *ptr);
  >void protect_end (void *ptr, UWORD);
  >*/
  >
  >/* Locking for a "large' operation.  This should always be some sort of
  >   test-and-set operation, as we assume that the interrupt latency
would
  >   be unreasonably large.  */
  >void libat_lock_n (void *ptr, size_t n);
  >void libat_unlock_n (void *ptr, size_t n);



Yes, libatomic is for targets lacking proper hardware atomic
operations.  So protect_start/end() should use
rtems_interrupt_disable/enable().  For libat_lock_n/unlock_n() you can
simply use the allocator lock for example.

I would not put too much time into this.  Who needs this stuff?



--
Daniel Cederman
Software Engineer
Aeroflex Gaisler AB
Aeroflex Microelectronic Solutions – HiRel
Kungsgatan 12
SE-411 19 Gothenburg, Sweden
Phone: +46 31 7758665
ceder...@gaisler.com
www.Aeroflex.com/Gaisler

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






--
Daniel Cederman
Software Engineer
Aeroflex Gaisler AB
Aeroflex Microelectronic Solutions – HiRel
Kungsgatan 12
SE-411 19 Gothenburg, Sweden
Phone: +46 31 7758665
ceder...@gaisler.com
www.Aeroflex.com/Gaisler
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel