diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/consumers/generic/generic_consumer_main.c src/consumers/generic/generic_consumer_main.c
--- ../tsp-0.8.3-Source-ref/src/consumers/generic/generic_consumer_main.c	2007-03-29 22:42:53.000000000 +0200
+++ src/consumers/generic/generic_consumer_main.c	2008-03-03 10:36:22.000000000 +0100
@@ -1,6 +1,6 @@
 /*
 
-$Id: generic_consumer_main.c,v 1.11 2007/03/29 20:42:53 deweerdt Exp $
+$Id: generic_consumer_main.c,v 1.13 2007/12/08 13:56:41 erk Exp $
 
 -----------------------------------------------------------------------
 
@@ -37,7 +37,7 @@
 #include <stdio.h>
 #include <malloc.h>
 #include <stdlib.h>
-#ifdef WIN32
+#ifdef _WIN32
     #define assert(exp)     ((void)0)
     #include  "getopt.h"
 #else
@@ -98,7 +98,7 @@
 int 
 main(int argc, char *argv[]){
 
-#if !defined (WIN32)
+#if !defined (_WIN32)
   struct sigaction   my_action;
   struct sigaction   old_action;
 #endif
@@ -112,7 +112,7 @@
 
   opt_ok            = 1;   
 
-#if defined (WIN32)
+#if defined (_WIN32)
   /* Intercept the CTRL-C signal */  
   (void) signal(SIGINT, my_sighandler);
 #else
@@ -131,7 +131,7 @@
   generic_consumer_request_create(&req);
 
   /* Analyse command line parameters */
-  while (opt_ok && (EOF != (c_opt = getopt(argc,argv,"u:hnsv")))) {    
+  while (opt_ok && (EOF != (c_opt = getopt(argc,argv,"+u:hnsv")))) {    
     switch (c_opt) {
     case 'u':
       opt_ok+=2;      
@@ -161,7 +161,7 @@
       break;
     } /* end of switch */
   } /* end of while */
-     
+  
   /* indicates number of global options to skip */
   req.nb_global_opt = opt_ok-1;
   req.argv          = argv;








diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/ctrl/tsp_default_glu.h src/core/ctrl/tsp_default_glu.h
--- ../tsp-0.8.3-Source-ref/src/core/ctrl/tsp_default_glu.h	2006-10-18 11:58:48.000000000 +0200
+++ src/core/ctrl/tsp_default_glu.h	2008-03-03 10:36:22.000000000 +0100
@@ -109,7 +109,7 @@
  */ 
 GLU_handle_t* 
 GLU_get_instance_default(GLU_handle_t* cthis,
-			 int custom_argc,
+			 int32_t custom_argc,
 			 char* custom_argv[],
 			 char** error_info);
 
@@ -135,19 +135,29 @@
 				  int filter_kind, char* filter_string, 
 				  TSP_answer_sample_t* answer_sample);
 
-int32_t
+/*int32_t
 GLU_get_ssi_list_fromPGI_default(struct GLU_handle_t* cthis, 
 				 int* pgis, int pgis_len, 
-				 TSP_sample_symbol_info_list_t* SSI_list);
-
+				 TSP_sample_symbol_info_list_t* SSI_list);*/
 int32_t
+GLU_get_ssi_list_fromPGI_default(struct GLU_handle_t* this, 
+				 int32_t* pgis, int32_t pgis_len, 
+				 TSP_sample_symbol_info_list_t* SSI_list);
+/*int32_t
 GLU_get_ssei_list_fromPGI_default(struct GLU_handle_t* cthis, 
 				  int* pgis, int pgis_len, 
-  				  TSP_sample_symbol_extended_info_list_t* SSEI_list);
-
+  				  TSP_sample_symbol_extended_info_list_t* SSEI_list);*/
 int32_t
+GLU_get_ssei_list_fromPGI_default(struct GLU_handle_t* this, 
+				  int32_t* pgis, int32_t pgis_len, 
+				  TSP_sample_symbol_extended_info_list_t* SSEI_list);
+/*int32_t
 GLU_async_sample_read_default(struct GLU_handle_t* cthis, 
 			      int pgi, 
+			      void* value_ptr, uint32_t* value_size);*/
+int32_t
+GLU_async_sample_read_default(struct GLU_handle_t* this, 
+			      int32_t pgi, 
 			      void* value_ptr, uint32_t* value_size);
 
 int32_t

diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/ctrl/tsp_group_algo.c src/core/ctrl/tsp_group_algo.c
--- ../tsp-0.8.3-Source-ref/src/core/ctrl/tsp_group_algo.c	2007-02-11 22:45:56.000000000 +0100
+++ src/core/ctrl/tsp_group_algo.c	2008-03-03 10:36:22.000000000 +0100
@@ -38,6 +38,8 @@
  */
 
 #include <string.h>
+#include <sys/types.h>		 /* for types compatibility with RTEMS*/
+
 #ifdef WIN32
     #define assert(exp)     ((void)0)
 #else
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/ctrl/tsp_group_algo.h src/core/ctrl/tsp_group_algo.h
--- ../tsp-0.8.3-Source-ref/src/core/ctrl/tsp_group_algo.h	2007-02-11 22:45:56.000000000 +0100
+++ src/core/ctrl/tsp_group_algo.h	2008-03-03 10:36:22.000000000 +0100
@@ -54,10 +54,15 @@
  * to the value in the group table
  * @return TRUE=OK
  */
-int TSP_group_algo_create_symbols_table(const TSP_sample_symbol_info_list_t* symbols,
+/*int TSP_group_algo_create_symbols_table(const TSP_sample_symbol_info_list_t* symbols,
 					TSP_sample_symbol_info_list_t* out_symbols,
 					TSP_groups_t* out_groups,
-					TSP_datapool_t* datapool);
+					TSP_datapool_t* datapool);*/
+int32_t 
+TSP_group_algo_create_symbols_table(const TSP_sample_symbol_info_list_t* in_symbols,
+				    TSP_sample_symbol_info_list_t* out_symbols,
+				    TSP_groups_t* out_groups,
+				    TSP_datapool_t* datapool);
 /**
  * Destroy the group table
  * @param groups List allocated by TSP_group_algo_create_symbols_table
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/ctrl/tsp_provider.h src/core/ctrl/tsp_provider.h
--- ../tsp-0.8.3-Source-ref/src/core/ctrl/tsp_provider.h	2006-10-18 23:23:51.000000000 +0200
+++ src/core/ctrl/tsp_provider.h	2008-03-03 10:36:22.000000000 +0100
@@ -60,9 +60,9 @@
  * @param[in,out] argc   the number of argument of the main
  * @param[in,out] argv   array of argument of size argc.
  */
-int TSP_provider_private_init(GLU_handle_t* theGLU, int* argc, char** argv[]);
+int32_t TSP_provider_private_init(GLU_handle_t* theGLU, int* argc, char** argv[]);// int changed to int32_t
 
-int TSP_provider_private_run();
+int32_t TSP_provider_private_run();	// int changed to int32_t
 
 const char* TSP_provider_get_name();
 
@@ -93,9 +93,9 @@
 int TSP_provider_get_server_number();
 int TSP_provider_get_server_base_number( );
 
-int TSP_provider_request_async_sample_write(TSP_async_sample_t* async_sample_write);
+int32_t TSP_provider_request_async_sample_write(TSP_async_sample_t* async_sample_write); // int changed to int32_t
 
-int TSP_provider_request_async_sample_read(TSP_async_sample_t* async_sample_read);
+int32_t TSP_provider_request_async_sample_read(TSP_async_sample_t* async_sample_read); // int changed to int32_t
 
 void  TSP_provider_request_extended_information(TSP_request_extended_information_t* req_extinfo, 
 						TSP_answer_extended_information_t* ans_extinfo);

diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/ctrl/tsp_session.h src/core/ctrl/tsp_session.h
--- ../tsp-0.8.3-Source-ref/src/core/ctrl/tsp_session.h	2006-10-18 11:58:48.000000000 +0200
+++ src/core/ctrl/tsp_session.h	2008-03-03 10:36:22.000000000 +0100
@@ -50,7 +50,7 @@
  * @param glu_h The GLU handled that will be linked to the session
  * @return TRUE or FALSE. TRUE = OK.
  */
-int TSP_add_session(channel_id_t* new_channel_id, GLU_handle_t* glu_h);
+int32_t TSP_add_session(channel_id_t* new_channel_id, GLU_handle_t* glu_h); // int changed to int32_t
 
 /**
  * Session initialisation.
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/ctrl/tsp_stream_sender.c src/core/ctrl/tsp_stream_sender.c
--- ../tsp-0.8.3-Source-ref/src/core/ctrl/tsp_stream_sender.c	2006-10-21 10:48:00.000000000 +0200
+++ src/core/ctrl/tsp_stream_sender.c	2008-03-03 10:36:22.000000000 +0100

@@ -51,7 +55,7 @@
     #include <assert.h>
 #endif
 
-#if !defined (VXWORKS) && !defined(WIN32)
+#if !defined (VXWORKS) && !defined(WIN32) && !defined(TSP_RTEMS)
 #include <strings.h> /* for bzero */
 #endif
 #include <string.h>  /* for bzero too :=} */
@@ -319,7 +323,7 @@
     }
   myhost = gethostbyname(host);
   if (myhost == NULL) {
-    STRACE_ERROR(("Cannot gethostbyname '(hostname --> @IP)' for host <%s> check your /etc/hosts file.\n",host));
+    STRACE_WARNING(("Cannot gethostbyname '(hostname --> @IP)' for host <%s> check your /etc/hosts file.\n",host));
     /* be tolerant we keep going with hostname but... consumer may not handle this properly */    
   } else {
      /* 
@@ -330,8 +334,8 @@
     myu.addr = (uint32_t)ntohl(*((uint32_t*)myhost->h_addr_list[0]));
     sprintf(host,"%d.%d.%d.%d",myu.parts[3], myu.parts[2], myu.parts[1], myu.parts[0]);
   }
-     
-  sock = (TSP_socket_t*)calloc(1, sizeof(TSP_socket_t));
+  
+	sock = (TSP_socket_t*)calloc(1, sizeof(TSP_socket_t));
   TSP_CHECK_ALLOC(sock, 0);
 
   sock->hClient = 0;
@@ -544,7 +548,7 @@
 #ifdef WIN32
      STRACE_DEBUG(("send failed with errno = %d : <%s>",WSAGetLastError(),strerror(errno)));   
 #else
-	  STRACE_ERROR(("send failed with errno = %d : <%s>",errno,strerror(errno)));
+	  STRACE_WARNING(("send failed with errno = %d : <%s>",errno,strerror(errno)));
 #endif
 	  sock->connection_ok = FALSE;
 	  return FALSE;
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/ctrl_init/tsp_provider_init.c src/core/ctrl_init/tsp_provider_init.c
--- ../tsp-0.8.3-Source-ref/src/core/ctrl_init/tsp_provider_init.c	2007-04-26 19:51:30.000000000 +0200
+++ src/core/ctrl_init/tsp_provider_init.c	2008-03-03 10:36:22.000000000 +0100

diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/include/tsp_abs_types.h src/core/include/tsp_abs_types.h
--- ../tsp-0.8.3-Source-ref/src/core/include/tsp_abs_types.h	2007-01-26 18:09:52.000000000 +0100
+++ src/core/include/tsp_abs_types.h	2008-03-03 10:36:22.000000000 +0100
@@ -235,6 +235,27 @@
 
 #endif /* OpenBSD / i386 */
 
+/* RTEMS */
+#if defined (TSP_RTEMS)
+# include <sys/types.h>		 /* for types compatibility */
+# include <rtems/stdint.h>
+
+#if defined (pc386)
+# define TSP_BYTE_ORDER TSP_LITTLE_ENDIAN
+#else
+# define TSP_BYTE_ORDER TSP_BIG_ENDIAN
+#endif	/* Endianness */
+
+# define TSP_SYSTEM_HAVE_NANOSLEEP
+//# define TSP_SYSTEM_HAVE_THREADSAFE_USLEEP
+# define TSP_HAVE_INT64 1
+# define TSP_INT64_CONSTANT(val)  (val##LL)
+# define TSP_GUINT64_FORMAT "llu"
+
+#endif /* _TSP_RTEMS_ */
+
+
+
 /*-----------------------------------------------------*/
 
 #ifndef	NULL
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/include/tsp_const_def.h src/core/include/tsp_const_def.h
--- ../tsp-0.8.3-Source-ref/src/core/include/tsp_const_def.h	2007-02-26 20:30:11.000000000 +0100
+++ src/core/include/tsp_const_def.h	2008-03-03 10:36:22.000000000 +0100
@@ -152,9 +152,9 @@
 
 /*-------- MISC --------*/
 
-typedef uint32_t channel_id_t;
-typedef uint32_t version_id_t;
-typedef uint32_t xdr_and_sync_type_t;
+typedef u_int32_t channel_id_t;
+typedef u_int32_t version_id_t;
+typedef u_int32_t xdr_and_sync_type_t;
 
 typedef int time_stamp_t;
 
@@ -294,7 +294,7 @@
 	{ \
 		if ( 0 != status ) \
 		{ \
-			STRACE_ERROR(("TSP_CHECK_THREAD : ERROR : Thread API Error"))  \
+			STRACE_ERROR(("TSP_CHECK_THREAD : ERROR : Thread API Error status = %d",status))  \
 			return ret; \
 		} \
 	}	
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/include/tsp_glu.h src/core/include/tsp_glu.h
--- ../tsp-0.8.3-Source-ref/src/core/include/tsp_glu.h	2006-10-18 11:58:48.000000000 +0200
+++ src/core/include/tsp_glu.h	2008-03-03 10:36:22.000000000 +0100


diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/include/tsp_simple_trace.h src/core/include/tsp_simple_trace.h
--- ../tsp-0.8.3-Source-ref/src/core/include/tsp_simple_trace.h	2006-10-21 10:48:00.000000000 +0200
+++ src/core/include/tsp_simple_trace.h	2008-03-03 10:36:22.000000000 +0100
@@ -41,6 +41,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+
+
 #define SIMPLE_TRACE_FUNC(level,src,func,text) \
 { \
     static int _strace_debug_level = -1; \
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/include/tsp_sys_headers.h src/core/include/tsp_sys_headers.h
--- ../tsp-0.8.3-Source-ref/src/core/include/tsp_sys_headers.h	2007-01-29 17:52:39.000000000 +0100
+++ src/core/include/tsp_sys_headers.h	2008-03-03 10:36:22.000000000 +0100
@@ -67,7 +67,7 @@
 
 #include <string.h>
 
-#ifndef WIN32
+#if  !defined(WIN32) && !defined(TSP_RTEMS)
 #include <strings.h>
 #endif
 
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/misc_utils/tsp_time.c src/core/misc_utils/tsp_time.c
--- ../tsp-0.8.3-Source-ref/src/core/misc_utils/tsp_time.c	2006-10-18 11:58:48.000000000 +0200
+++ src/core/misc_utils/tsp_time.c	2008-03-03 10:36:22.000000000 +0100
@@ -70,7 +70,7 @@
 #ifdef TSP_SYSTEM_HAVE_THREADSAFE_USLEEP
   return usleep(useconds);
 #else
-  
+ 
 #ifdef TSP_SYSTEM_USE_WIN32_SLEEP
   Sleep(useconds / 1000);
   return 0;
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/rpc/tsp_client.c src/core/rpc/tsp_client.c
--- ../tsp-0.8.3-Source-ref/src/core/rpc/tsp_client.c	2007-03-01 23:26:39.000000000 +0100
+++ src/core/rpc/tsp_client.c	2008-03-03 10:36:22.000000000 +0100
@@ -67,16 +67,33 @@
 
 CLIENT* tsp_remote_open_progid(const char *target_name, int progid)
 {
-
+  int sock = -1;      // modif pour RTEMS
+  struct hostent *hp;
+	struct sockaddr_in farAddr;
   CLIENT* cl = (CLIENT *)0;
   /* struct timeval timeout = { 1, 0 }; */
 
-  /*cl = clnt_create_timed(target_name, progid, TSP_RPC_VERSION_INITIAL, "tcp",&timeout );*/
+  /* modifie */
+	hp = gethostbyname (target_name);
+	if (hp == NULL) {
+		fprintf (stderr, "No server %s\n", target_name);
+		return 2;
+	}
+	/*
+	 * Set up server address
+	 * TCP_PORT = 15376 fixe pour RTEMS
+	 */
+	farAddr.sin_family = hp->h_addrtype;
+	farAddr.sin_port = htons (TCP_PORT);
+	memcpy((char*)&farAddr.sin_addr, hp->h_addr, hp->h_length);
 
-  cl = clnt_create(target_name, progid, TSP_RPC_VERSION_INITIAL, "tcp");
+  /*cl = clnt_create_timed(target_name, progid, TSP_RPC_VERSION_INITIAL, "tcp",&timeout );*/
 
+  //cl = clnt_create(target_name, progid, TSP_RPC_VERSION_INITIAL, "tcp");  	
+	cl = clnttcp_create (&farAddr, TSP_RPC, TSP_RPC_VERSION_INITIAL, &sock, 0, 0);
+	
   if (cl == (CLIENT *)0) {
-    STRACE_ERROR(("ERROR : GLOBAL clnt_create failed for host <%s> / progid <%d/0x%08X>", target_name, progid,progid));
+    STRACE_ERROR(("ERROR : GLOBAL clnt_create failed for host <%s> / progid <%d/0x%08X>", target_name, progid, progid));
   }
   else {
     STRACE_INFO(("CONNECTED to server %s", target_name));

diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/rpc/tsp_rpc_clnt.c.linux src/core/rpc/tsp_rpc_clnt.c.linux
--- ../tsp-0.8.3-Source-ref/src/core/rpc/tsp_rpc_clnt.c.linux	2007-04-22 23:15:35.000000000 +0200
+++ src/core/rpc/tsp_rpc_clnt.c.linux	2008-03-03 17:41:48.000000000 +0100
@@ -4,7 +4,11 @@
  */
 
 #include <memory.h> /* for memset */
-#include "rpc/tsp_rpc.h"
+#ifdef TSP_RTEMS
+# include "tsp_rpc.h"
+#else
+# include "rpc/tsp_rpc.h"
+#endif /* TSP_RTEMS */
 
 int tsp_wrap_rpc_clnt_set_timeout(CLIENT *client, int timeout)
 {
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/rpc/tsp_rpc_svc.c.linux src/core/rpc/tsp_rpc_svc.c.linux
--- ../tsp-0.8.3-Source-ref/src/core/rpc/tsp_rpc_svc.c.linux	2007-04-22 23:15:35.000000000 +0200
+++ src/core/rpc/tsp_rpc_svc.c.linux	2008-03-03 17:50:16.000000000 +0100
@@ -6,7 +6,12 @@
  * It was generated using rpcgen.
  */
 
-#include "rpc/tsp_rpc.h"
+#ifdef TSP_RTEMS
+# include "tsp_rpc.h"
+#else
+# include "rpc/tsp_rpc.h"
+#endif /* TSP_RTEMS */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <rpc/pmap_clnt.h>
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/rpc/tsp_rpc_xdr.c.linux src/core/rpc/tsp_rpc_xdr.c.linux
--- ../tsp-0.8.3-Source-ref/src/core/rpc/tsp_rpc_xdr.c.linux	2007-04-22 23:15:35.000000000 +0200
+++ src/core/rpc/tsp_rpc_xdr.c.linux	2008-03-03 18:15:44.000000000 +0100
@@ -3,7 +3,11 @@
  * It was generated using rpcgen.
  */
 
-#include "rpc/tsp_rpc.h"
+#ifdef TSP_RTEMS
+# include "tsp_rpc.h"
+#else
+# include "rpc/tsp_rpc.h"
+#endif /* TSP_RTEMS */
 
 bool_t
 xdr_TSP_status_t (XDR *xdrs, TSP_status_t *objp)
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/rpc/tsp_server.c src/core/rpc/tsp_server.c
--- ../tsp-0.8.3-Source-ref/src/core/rpc/tsp_server.c	2006-10-21 10:48:00.000000000 +0200
+++ src/core/rpc/tsp_server.c	2008-03-03 10:36:22.000000000 +0100
@@ -260,24 +260,52 @@
 
 static void TSP_rpc_run(TSP_rpc_request_config_t *config)
 {
-  int32_t rpc_progid = TSP_get_progid(config->server_number);
-
-  /* svc_create does not exist for linux, we must use the deprecated function */
-  /* pmap_unset (rpc_progid, TSP_RPC_VERSION_INITIAL); */
-
-  config->xprt = svctcp_create(RPC_ANYSOCK, 0, 0);
-  if (config->xprt == NULL) 
-    {
-      STRACE_ERROR(("Cannot create TCP service"));
-      return;
-    }
-
-  if (!svc_register(config->xprt, rpc_progid, TSP_RPC_VERSION_INITIAL, tsp_rpc_1, IPPROTO_TCP))
-    {
-      STRACE_ERROR(("RPC server unable to register ProgId=%X",  rpc_progid));
-      return;
-    }
+	int32_t rpc_progid = TSP_get_progid(config->server_number);
+	int sock;
+	struct sockaddr_in myAddr;
+	SVCXPRT *transp;
+	bool_t status;
+	
+	/* svc_create does not exist for linux, we must use the deprecated function */
+	/* pmap_unset (rpc_progid, TSP_RPC_VERSION_INITIAL); */
+	
+	/*             MODIFIE SELON RPC DEMO                */
+	/*
+	 * Create socket
+	 */
+	sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
+	if (sock < 0) {
+		perror ("socket creation problem");
+		return 1;
+	}
 
+	/*
+	 * Bind to local address
+	 */
+	myAddr.sin_family = htons (AF_INET);
+	myAddr.sin_port = htons (TCP_PORT);
+	myAddr.sin_addr.s_addr = htonl (INADDR_ANY);
+	if (bind (sock, (struct sockaddr *)&myAddr, sizeof myAddr) < 0) {
+		perror ("bind problem");
+		return 2;
+	}
+	
+	/*
+	 * Create TCP server
+	 */
+	//config->xprt = svctcp_create(RPC_ANYSOCK, 0, 0); 
+	config->xprt = svctcp_create(sock, 0, 0); 	 	
+	if (config->xprt == NULL) 
+	{
+    STRACE_ERROR(("Cannot create TCP service"));
+    return;
+	}
+//  if (!svc_register(config->xprt, rpc_progid, TSP_RPC_VERSION_INITIAL, tsp_rpc_1, IPPROTO_TCP))
+	if (!svc_register(config->xprt, rpc_progid, TSP_RPC_VERSION_INITIAL, tsp_rpc_1, 0))
+	{
+    STRACE_ERROR(("RPC server unable to register ProgId=%X",  rpc_progid));
+    return;
+	}
   STRACE_DEBUG(("RPC server is being be started with ProgId=%X", rpc_progid));
   
   STRACE_DEBUG(("launching svc_run..."));
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/rpc/tsp_server.h src/core/rpc/tsp_server.h
--- ../tsp-0.8.3-Source-ref/src/core/rpc/tsp_server.h	2006-10-18 11:58:48.000000000 +0200
+++ src/core/rpc/tsp_server.h	2008-03-03 10:36:22.000000000 +0100
@@ -40,6 +40,10 @@
 
 #include "tsp_prjcfg.h"
 
+#ifdef TSP_RTEMS
+# define TCP_PORT 15376
+#endif /* _TSP_RTEMS_ */
+
 /**
  * @defgroup TSP_RPCRequestHandlerLib RPC Request Handler
  * The module is the set of functions which encapsulate
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/xmlrpc/README src/core/xmlrpc/README
--- ../tsp-0.8.3-Source-ref/src/core/xmlrpc/README	2007-03-25 17:50:21.000000000 +0200
+++ src/core/xmlrpc/README	1970-01-01 01:00:00.000000000 +0100
@@ -1,23 +0,0 @@
-The XML-RPC TSP command channel handler.
-
-If you want to activate XML-RPC command channel
-
-1) Install libwww and libwww-dev
-2) Get xmlrpc-c from http://xmlrpc-c.sourceforge.net/
-   Get stable xmlrpc-c-1.06.xxx
-3) Configure and install it
-
-./configure --prefix=/opt/xmlrpc
-
-or
-
-./configure --prefix=/opt/xmlrpc --enable-libxml2-backend
-
-export PATH=/opt/xmlrpc/bin:$PATH
-export LD_LIBRARY_PATH=/opt/xmlrpc/lib:$LD_LIBRARY_PATH
-export CMAKE_LIBRARY_PATH=/opt/xmlrpc/lib
-export CMAKE_PROGRAM_PATH=/opt/xmlrpc/bin
-export CMAKE_INCLUDE_PATH=/opt/xmlrpc/include
-
-4) Then configure TSP with XMLRPC enable
-cmake -DBUILD_XMLRPC=ON  /path/to/tsp/source
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/core/xmlrpc/readme src/core/xmlrpc/readme
--- ../tsp-0.8.3-Source-ref/src/core/xmlrpc/readme	1970-01-01 01:00:00.000000000 +0100
+++ src/core/xmlrpc/readme	2007-03-25 17:50:20.000000000 +0200
@@ -0,0 +1,23 @@
+The XML-RPC TSP command channel handler.
+
+If you want to activate XML-RPC command channel
+
+1) Install libwww and libwww-dev
+2) Get xmlrpc-c from http://xmlrpc-c.sourceforge.net/
+   Get stable xmlrpc-c-1.06.xxx
+3) Configure and install it
+
+./configure --prefix=/opt/xmlrpc
+
+or
+
+./configure --prefix=/opt/xmlrpc --enable-libxml2-backend
+
+export PATH=/opt/xmlrpc/bin:$PATH
+export LD_LIBRARY_PATH=/opt/xmlrpc/lib:$LD_LIBRARY_PATH
+export CMAKE_LIBRARY_PATH=/opt/xmlrpc/lib
+export CMAKE_PROGRAM_PATH=/opt/xmlrpc/bin
+export CMAKE_INCLUDE_PATH=/opt/xmlrpc/include
+
+4) Then configure TSP with XMLRPC enable
+cmake -DBUILD_XMLRPC=ON  /path/to/tsp/source
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/jcore/README src/jcore/README
--- ../tsp-0.8.3-Source-ref/src/jcore/README	2005-06-05 22:46:17.000000000 +0200
+++ src/jcore/README	1970-01-01 01:00:00.000000000 +0100
@@ -1,7 +0,0 @@
--*- text -*-
-
-The jcore modules and other 'Java' TSP
-part has been moved to the 'high' level module
-'jtsp'
-
-http://savannah.nongnu.org/cgi-bin/viewcvs/tsp/jtsp
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/jcore/readme src/jcore/readme
--- ../tsp-0.8.3-Source-ref/src/jcore/readme	1970-01-01 01:00:00.000000000 +0100
+++ src/jcore/readme	2005-06-05 22:46:16.000000000 +0200
@@ -0,0 +1,7 @@
+-*- text -*-
+
+The jcore modules and other 'Java' TSP
+part has been moved to the 'high' level module
+'jtsp'
+
+http://savannah.nongnu.org/cgi-bin/viewcvs/tsp/jtsp
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/providers/bb_provider/TODO src/providers/bb_provider/TODO
--- ../tsp-0.8.3-Source-ref/src/providers/bb_provider/TODO	2004-10-27 01:48:25.000000000 +0200
+++ src/providers/bb_provider/TODO	1970-01-01 01:00:00.000000000 +0100
@@ -1,7 +0,0 @@
-- handle lost synchro (generates a BB provider overrun)
-- make the bb provider generates its own timestamp
-  as provided symbol
-- add a standalone (not synchronized) mode where the shadow
-  blackboard update is made by the provider itself without
-  waiting for BB synchro 
-- add full-synchronized mode with TSP consumer writer 
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/providers/bb_provider/bb_tsp_provider_main.c src/providers/bb_provider/bb_tsp_provider_main.c
--- ../tsp-0.8.3-Source-ref/src/providers/bb_provider/bb_tsp_provider_main.c	2006-10-18 11:58:48.000000000 +0200
+++ src/providers/bb_provider/bb_tsp_provider_main.c	2008-03-03 10:36:22.000000000 +0100
@@ -56,7 +56,7 @@
  */
 
 
-#ifndef VXWORKS
+#if !defined RTEMS
 
 int 
 main (int argc, char ** argv) {
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/providers/bb_provider/todo src/providers/bb_provider/todo
--- ../tsp-0.8.3-Source-ref/src/providers/bb_provider/todo	1970-01-01 01:00:00.000000000 +0100
+++ src/providers/bb_provider/todo	2004-10-27 01:48:24.000000000 +0200
@@ -0,0 +1,7 @@
+- handle lost synchro (generates a BB provider overrun)
+- make the bb provider generates its own timestamp
+  as provided symbol
+- add a standalone (not synchronized) mode where the shadow
+  blackboard update is made by the provider itself without
+  waiting for BB synchro 
+- add full-synchronized mode with TSP consumer writer 

diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/scripts/README.rpm src/scripts/README.rpm
--- ../tsp-0.8.3-Source-ref/src/scripts/README.rpm	2005-07-19 21:27:38.000000000 +0200
+++ src/scripts/README.rpm	1970-01-01 01:00:00.000000000 +0100
@@ -1,21 +0,0 @@
-You will find here a TSP spec file: tsp.spec.
-
-The spec file is maintained and tested on a Mandriva distro.
-You may find binary and source RPM on http://enoulard.free.fr/tsp.
-
-If you want to build an RPM for your favorite distro:
-
-1) Copy tsp.spec at your favorite location
-2) take the corresponding TSP tarball at
-   https://savannah.nongnu.org/download/tsp/
-
-3) Put the tarball in your RPM source dir (e.g. /usr/src/RPM/SOURCES)
-
-4) Customize the spec file if needed.
-
-5) rpmbuild -bb tsp.spec
-   should build the binary RPM
-
-6) rpmbuild -bs tsp.spec
-   should build the source RPM
-
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/scripts/readme.rpm src/scripts/readme.rpm
--- ../tsp-0.8.3-Source-ref/src/scripts/readme.rpm	1970-01-01 01:00:00.000000000 +0100
+++ src/scripts/readme.rpm	2005-07-19 21:27:38.000000000 +0200
@@ -0,0 +1,21 @@
+You will find here a TSP spec file: tsp.spec.
+
+The spec file is maintained and tested on a Mandriva distro.
+You may find binary and source RPM on http://enoulard.free.fr/tsp.
+
+If you want to build an RPM for your favorite distro:
+
+1) Copy tsp.spec at your favorite location
+2) take the corresponding TSP tarball at
+   https://savannah.nongnu.org/download/tsp/
+
+3) Put the tarball in your RPM source dir (e.g. /usr/src/RPM/SOURCES)
+
+4) Customize the spec file if needed.
+
+5) rpmbuild -bb tsp.spec
+   should build the binary RPM
+
+6) rpmbuild -bs tsp.spec
+   should build the source RPM
+
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/README src/util/libbb/README
--- ../tsp-0.8.3-Source-ref/src/util/libbb/README	2006-11-27 20:14:04.000000000 +0100
+++ src/util/libbb/README	1970-01-01 01:00:00.000000000 +0100
@@ -1,60 +0,0 @@
- Overview
- ========
-
-Current directory implement a 
-BlackBoard idiom implemenation.
-
-The idea of the blackboard is a publish/subscribe paradigm.
-The blackboard idiom makes it very easy to implement
-a TSP enabled simulator using the tsp_bb_provider.
-
-If you want to try you may run
-
-bb_simu -s (the faked simulator using a BlackBoard)
-
-then run
-
-bb_tsp_provider
-
-then launch any tsp consumer
-
-
- In-kernel black board 
- =====================
-
-The build produces a bb.ko module, insmod it:
-	# insmod bb.ko
-The dmesg, will show the following messages:
-	# dmesg
-	New bb device created, major: 254, minor: 0
-	New bb device created, major: 254, minor: 1
-	Kernel black board loaded.
-	See http://savannah.nongnu.org/projects/tsp for details.
-
-This means that two sample black boards were just created (pass run_test=0
-to insmod if you want to avoid it). To access them, you need to create
-the associated character devices (with the corresponding major and
-minor numbers):
-	# mknod /dev/bbk0 c 254 0
-
-
-The black board can now be reached by:
-	# bb_tools bb_dump /dev/bbk0
-	============= <[begin] BlackBoard [bb_test1] [begin] > ===============
-	  @start blackboard    = 0xb7f6f000
-	  stored data          = 1 / 2 [max desc]
-	  free data size       = 196 / 200
-	  @data_desc           = 0xb7f6f134
-	  @data                = 0xb7f6f28c
-	================ < [begin] Data [begin] > ==================
-	---------- < bb_test1_variable > ----------
-	  alias-target = -1
-	  type         = 5  (int32_t)
-	  dimension    = 1
-	  type_size    = 4
-	  data_offset  = 0
-	  value        = 21
-	---------- ---------- ----------
-	================== < [end] Data [end] > ====================
-	============== < [end] BlackBoard [bb_test1] [end] > ================
-	
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/TODO src/util/libbb/TODO
--- ../tsp-0.8.3-Source-ref/src/util/libbb/TODO	2005-02-23 02:34:48.000000000 +0100
+++ src/util/libbb/TODO	1970-01-01 01:00:00.000000000 +0100
@@ -1,16 +0,0 @@
-- update doxygen documentation
-- write a tutorial
-- make bbtools use a common bbtools
-  may be like busybox style [ongoing]
-
-- use hcreate to improve symbol search and lookup
-
-- add bb_memset command and API to reset [API is ok]
-  BB data area without destroying BB
-
-- add bb_publish and bb_synchro_xx to bbtools in order
-  to be able script BB for demo and even practical
-  application control
-
-- add some direct scripting language binding
-  (TCL, python, ...) as bbtools for 'shell'
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/bb_alias.c src/util/libbb/bb_alias.c
--- ../tsp-0.8.3-Source-ref/src/util/libbb/bb_alias.c	2007-04-01 15:17:21.000000000 +0200
+++ src/util/libbb/bb_alias.c	2008-03-03 10:36:22.000000000 +0100
@@ -40,7 +40,11 @@
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
-#include <sys/mman.h>
+
+#if !defined TSP_RTEMS
+# include <sys/mman.h>
+#endif /* _TSP_RTEMS_ */
+
 #include <unistd.h>
 #include <assert.h>
 
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/bb_core.c src/util/libbb/bb_core.c
--- ../tsp-0.8.3-Source-ref/src/util/libbb/bb_core.c	2007-04-01 15:17:21.000000000 +0200
+++ src/util/libbb/bb_core.c	2008-03-03 22:31:47.000000000 +0100
@@ -39,14 +39,23 @@
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
-#include <sys/mman.h>
+
+#if !defined (TSP_RTEMS)
+# include <sys/mman.h>
+# include <dlfcn.h>
+#endif /* _TSP_RTEMS_ */
+
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <errno.h>
 #include <unistd.h>
 #include <assert.h>
 #include <ctype.h>
-#include <dlfcn.h>
+
+#if defined (TSP_RTEMS)
+# include <semaphore.h>
+#endif /* _TSP_RTEMS_ */
+
 #ifndef RTLD_DEFAULT
 #define RTLD_DEFAULT (void *)0
 #endif
@@ -115,33 +124,49 @@
 extern struct bb_operations k_bb_ops;
 #endif
 #endif
+#if defined(TSP_RTEMS)
+extern struct bb_operations posix_bb_ops;
+#endif
 
 /* Note: This is thigtly related to enum bb_type in bb_core.h,
    if you ever modify this, you'll probably need to modify
    enum bb_type */
 static struct bb_operations *ops[] = {
+#if defined(sysv)
 	&sysv_bb_ops
+#else
+	NULL
+#endif /* sysv */
 #if defined(linux) || defined(__linux)
-	,&k_bb_ops
-#endif
+	&k_bb_ops
+#else
+	,NULL
+#endif /* linux */
+#if defined(TSP_RTEMS)
+	,&posix_bb_ops
+#else
+	,NULL
+#endif /* TSP_RTEMS */
 };
 
 static enum bb_type bb_type(const char *name)
 {
 #ifdef __KERNEL__
 	return BB_KERNEL;
+#endif /* __KERNEL__ */
+
+#ifdef TSP_RTEMS
+	return BB_POSIX;
 #else
 	if (!strncmp(name, "/dev/", 5))
 		return BB_KERNEL;
-
 	return BB_SYSV;
-#endif /* __KERNEL__ */
+#endif /* __TSP_RTEMS__ */
 }
 
-size_t 
-sizeof_bb_type(E_BB_TYPE_T bb_type) {
+size_t sizeof_bb_type(E_BB_TYPE_T bb_type) {
   size_t retval = 0;
-  if ((bb_type>=1) && (bb_type<E_BB_USER)) {
+  if ((bb_type >= 1) && (bb_type < E_BB_USER)) {
     retval = E_BB_TYPE_SIZE[bb_type];
   }
   return retval;
@@ -225,7 +250,7 @@
 bb_set_varname_fn bb_set_varname = bb_set_varname_default;
 bb_varname_max_len_fn bb_varname_max_len = bb_varname_max_len_default;
 
-#ifndef __KERNEL__
+#if !defined (__KERNEL__)  && !defined (TSP_RTEMS)
 static int32_t
 bb_varname_init(S_BB_T *bb)
 {
@@ -678,7 +703,7 @@
        (E_BB_CHAR  != data_desc.type)
        )
       ) {
-    fprintf(pf,"%s  value[%d]     = ",tabs,idx);
+    fprintf(pf,"%s  value[%d]     = ",tabs,(int)idx);
   } else {
     fprintf(pf,"%s  value        = ",tabs);
   }
@@ -913,36 +938,36 @@
 } /* end of bb_data_print */
 #endif /* !__KERNEL__ */
 
-int32_t 
+int32_t
 bb_create(S_BB_T** bb, 
 	       const char* pc_bb_name,
 	       int32_t n_data,
 	       int32_t data_size) {
+	enum bb_type type;
+	int32_t retcode;
+	assert(bb);
 
-  enum bb_type type;
-  int32_t retcode;
-  assert(bb);
-
-  type = bb_type(pc_bb_name);
-  retcode = ops[type]->bb_shmem_get(bb, pc_bb_name, n_data, data_size, 1);
-  if (retcode != BB_OK)
-  	goto err;
+	type = bb_type(pc_bb_name);
 
-  retcode = ops[(*bb)->type]->bb_sem_get(*bb, 1);
-  if (retcode != BB_OK)
-  	goto err;
+	retcode = ops[type]->bb_shmem_get(bb, pc_bb_name, n_data, data_size, 1);
+	if (retcode != BB_OK)
+		goto err;
 
-  retcode = ops[(*bb)->type]->bb_msgq_get(*bb, 1);
-  
-err:
-  return retcode;
+	retcode = ops[(*bb)->type]->bb_sem_get(*bb, 1);
+	if (retcode != BB_OK)
+		goto err;
+	
+	retcode = ops[(*bb)->type]->bb_msgq_get(*bb, 1);
+	
+	err:
+	return retcode;
 } /* end of bb_create */
+	
 #ifdef __KERNEL__
 EXPORT_SYMBOL_GPL(bb_create);
 #endif
 
-int32_t 
-bb_destroy(S_BB_T** bb) {
+int32_t bb_destroy(S_BB_T** bb) {
   
   int32_t retcode;
   
@@ -950,7 +975,7 @@
   assert(*bb);  
   /* 
    * On signale la destruction en cours pour les processes qui
-   * resteraient attachés
+   * resteraient attaches
    */
   (*bb)->status = BB_STATUS_DESTROYED;
   retcode = ops[(*bb)->type]->bb_sem_destroy(*bb);
@@ -978,12 +1003,11 @@
 
 int32_t 
 bb_lock(volatile S_BB_T* bb) {
-  return ops[bb->type]->bb_unlock(bb);
+  return ops[bb->type]->bb_lock(bb);	// return ops[bb->type]->bb_unlock(bb); -> bug
 } /* end of bb_lock */
 
 int32_t 
-bb_unlock(volatile S_BB_T* bb) {
-  
+bb_unlock(volatile S_BB_T* bb) {  
   return ops[bb->type]->bb_unlock(bb);
 } /* end of bb_unlock */
 
@@ -1012,10 +1036,11 @@
 
 int32_t
 bb_detach(S_BB_T** bb) {
-  assert(bb);
-  assert(*bb);
-
-  return ops[(*bb)->type]->bb_shmem_detach(bb);
+  	assert(bb);
+//  assert(*bb);
+	puts("bb_detach\n");
+	return ops[BB_POSIX]->bb_shmem_detach(bb);
+//  return ops[(*bb)->type]->bb_shmem_detach(bb);
 } /* end of bb_detach */
 
 void*
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/bb_core.h src/util/libbb/bb_core.h
--- ../tsp-0.8.3-Source-ref/src/util/libbb/bb_core.h	2007-04-01 15:17:21.000000000 +0200
+++ src/util/libbb/bb_core.h	2008-03-03 10:36:22.000000000 +0100
@@ -71,6 +71,8 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <tsp_abs_types.h>
+#include <mqueue.h>		
+#include <semaphore.h>
 
 #endif /* __KERNEL__ */
 
@@ -325,7 +327,19 @@
 	int msg_id;
 };
 
-
+/**
+ * POSIX specific data, part of the S_BB_T structure
+ */
+struct posix_private {
+	/* shm file descriptor */
+	int fd;
+	/** the size of the allocated black board */
+	int shm_size;
+	/* posix semaphore handle */
+	sem_t *sem_id ;
+	/* posix message queue handle */
+	mqd_t msg_id;
+};
 /**
  * BlackBoard message definition.
  * This type must conform to the constraint of
@@ -355,6 +369,7 @@
 enum bb_type {
 	BB_SYSV,
 	BB_KERNEL,
+	BB_POSIX
 };
 /**
  * BlackBoard description structure.
@@ -426,6 +441,7 @@
   union {
 	struct sysv_private sysv;
 	struct kernel_private k;
+	struct posix_private posix;
   } priv;
 
 } S_BB_T;
@@ -733,7 +749,7 @@
 
 /**
  * Lock blackboard.
- * A BlackBoard should be locked befaore any structural change
+ * A BlackBoard should be locked before any structural change
  * or to protect different process against each other from
  * concurrent modifications.
  * This is a blocking call (using sys V semaphore).
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/bb_simple.c src/util/libbb/bb_simple.c
--- ../tsp-0.8.3-Source-ref/src/util/libbb/bb_simple.c	2007-04-01 15:17:21.000000000 +0200
+++ src/util/libbb/bb_simple.c	2008-03-03 10:36:22.000000000 +0100
@@ -36,7 +36,13 @@
  */
 #ifndef __KERNEL__
 #include <sys/types.h>
-#include <sys/msg.h>
+
+#if !defined TSP_RTEMS
+# include <sys/msg.h>
+#else
+# include <mqueue.h>
+#endif /* TSP_RTEMS */
+
 #include <string.h>
 #endif /* __KERNEL__ */
 
@@ -79,33 +85,35 @@
     int type_size,
     int dimension) {
 
-  void* retval = NULL;
-  S_BB_DATADESC_T s_data_desc;
-  char *new_name;
-  int ret;
+	void* retval = NULL;
+	S_BB_DATADESC_T s_data_desc;
+	char *new_name;
+	int ret;
 
-  new_name = malloc(sizeof(char)*bb_varname_max_len());
-  if (!new_name)
-    goto out;
-  gen_var_name(new_name, module_instance, module_name, var_name);
-  ret = bb_set_varname(&s_data_desc, new_name);
-  if (ret == BB_NOK)
-    goto err_free;
-  s_data_desc.type        = type;
-  s_data_desc.type_size   = type_size;
-  s_data_desc.dimension   = dimension;
-  retval = bb_publish(bb_simple,&s_data_desc);
+	new_name = malloc(sizeof(char)*bb_varname_max_len());
 
-  if (retval == NULL) {
-    bb_logMsg(BB_LOG_SEVERE,"BlackBoard::bb_simple_publish",
-        "Cannot publish data <%s> instance <%d> module <%s>",
-        var_name,module_instance,module_name);
-  }
+	if (!new_name)
+		goto out;
+	gen_var_name(new_name, module_instance, module_name, var_name);
+	ret = bb_set_varname(&s_data_desc, new_name);
+	if (ret == BB_NOK)
+		goto err_free;
+		
+	s_data_desc.type        = type;
+	s_data_desc.type_size   = type_size;
+	s_data_desc.dimension   = dimension;
+	retval = bb_publish(bb_simple,&s_data_desc);
 
-err_free:
-  free(new_name);
-out:
-  return retval;
+  	if (retval == NULL) {
+		bb_logMsg(BB_LOG_SEVERE,"BlackBoard::bb_simple_publish",
+					"Cannot publish data <%s> instance <%d> module <%s>",
+					var_name,module_instance,module_name);
+	}
+
+	err_free:
+	  free(new_name);
+	out:
+	  return retval;
 } /* end of bb_simple_publish */
 
 
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/bb_utils.c src/util/libbb/bb_utils.c
--- ../tsp-0.8.3-Source-ref/src/util/libbb/bb_utils.c	2007-03-20 11:11:33.000000000 +0100
+++ src/util/libbb/bb_utils.c	2008-03-03 10:36:22.000000000 +0100
@@ -41,7 +41,10 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <assert.h>
-#include <sys/ipc.h>
+
+#if !defined TSP_RTEMS
+# include <sys/ipc.h>
+#endif /*_TSP_RTEMS_ */
 
 #include <tsp_sys_headers.h>
 #include <bb_utils.h>
@@ -70,21 +73,20 @@
 char*
 bb_utils_build_sem_name(const char* sem_name) {
   
-  char* retval;
+  char* retval = NULL;
   int i_size_name;
   const char * prefix = "/";
   const char * postfix = "_sem";
 
   i_size_name = strlen(sem_name)+strlen(prefix)+strlen(postfix)+1;
-  retval = NULL;
   retval = (char *) malloc(i_size_name*sizeof(char));
+
   if (retval!=NULL) {
     strncpy(retval,prefix,strlen(prefix));
     strncpy(retval+strlen(prefix),sem_name,strlen(sem_name));
     strncpy(retval+strlen(prefix)+strlen(sem_name),postfix,strlen(postfix));
     retval[i_size_name-1] = '\0';
   }
-
   return retval;
 } /* end of bb_utils_build_sem_name */
 
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/bb_utils.h src/util/libbb/bb_utils.h
--- ../tsp-0.8.3-Source-ref/src/util/libbb/bb_utils.h	2006-11-27 21:05:22.000000000 +0100
+++ src/util/libbb/bb_utils.h	2008-03-03 10:36:22.000000000 +0100
@@ -40,7 +40,10 @@
 #ifdef __KERNEL__
 #include <linux/types.h>
 #else
-#include <sys/ipc.h>
+#ifndef TSP_RTEMS
+# include <sys/ipc.h>
+#endif /* _TSP_RTEMS_ */
+
 #include <sys/types.h>
 
 #include <tsp_abs_types.h>
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/bbtools/README src/util/libbb/bbtools/README
--- ../tsp-0.8.3-Source-ref/src/util/libbb/bbtools/README	2005-02-23 14:33:26.000000000 +0100
+++ src/util/libbb/bbtools/README	1970-01-01 01:00:00.000000000 +0100
@@ -1,10 +0,0 @@
-
-BBTools are sample tools for using BB.
-You may try this:
-
-1) in a first window "bb_simu -s"
-2) in a second window "bb_tsp_provider bb_simu"
-3) in a third window "tsp_gdisp bb_simu.xml localhost"
-4) in a fourth window "tsp_ascii_writer --f=bb_simu.dat --o=bb_simu.out --output_limit 50"
-5) in a fifth (yes you can do it)
-   gnuplot bb_simu.gp
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/bbtools/readme src/util/libbb/bbtools/readme
--- ../tsp-0.8.3-Source-ref/src/util/libbb/bbtools/readme	1970-01-01 01:00:00.000000000 +0100
+++ src/util/libbb/bbtools/readme	2005-02-23 14:33:26.000000000 +0100
@@ -0,0 +1,10 @@
+
+BBTools are sample tools for using BB.
+You may try this:
+
+1) in a first window "bb_simu -s"
+2) in a second window "bb_tsp_provider bb_simu"
+3) in a third window "tsp_gdisp bb_simu.xml localhost"
+4) in a fourth window "tsp_ascii_writer --f=bb_simu.dat --o=bb_simu.out --output_limit 50"
+5) in a fifth (yes you can do it)
+   gnuplot bb_simu.gp
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/doc/README src/util/libbb/doc/README
--- ../tsp-0.8.3-Source-ref/src/util/libbb/doc/README	2005-02-20 17:53:04.000000000 +0100
+++ src/util/libbb/doc/README	1970-01-01 01:00:00.000000000 +0100
@@ -1,7 +0,0 @@
-BlackBoard documentation
-
-High level doc moved to tsp_bbguide/ top-level CVS module:
- cvs co tsp_bbguide.
-
-API doc is doxygen generated:
- look at $DEVBASE/doc/html/index.html
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/doc/readme src/util/libbb/doc/readme
--- ../tsp-0.8.3-Source-ref/src/util/libbb/doc/readme	1970-01-01 01:00:00.000000000 +0100
+++ src/util/libbb/doc/readme	2005-02-20 17:53:04.000000000 +0100
@@ -0,0 +1,7 @@
+BlackBoard documentation
+
+High level doc moved to tsp_bbguide/ top-level CVS module:
+ cvs co tsp_bbguide.
+
+API doc is doxygen generated:
+ look at $DEVBASE/doc/html/index.html
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/readme src/util/libbb/readme
--- ../tsp-0.8.3-Source-ref/src/util/libbb/readme	1970-01-01 01:00:00.000000000 +0100
+++ src/util/libbb/readme	2006-11-27 20:14:04.000000000 +0100
@@ -0,0 +1,60 @@
+ Overview
+ ========
+
+Current directory implement a 
+BlackBoard idiom implemenation.
+
+The idea of the blackboard is a publish/subscribe paradigm.
+The blackboard idiom makes it very easy to implement
+a TSP enabled simulator using the tsp_bb_provider.
+
+If you want to try you may run
+
+bb_simu -s (the faked simulator using a BlackBoard)
+
+then run
+
+bb_tsp_provider
+
+then launch any tsp consumer
+
+
+ In-kernel black board 
+ =====================
+
+The build produces a bb.ko module, insmod it:
+	# insmod bb.ko
+The dmesg, will show the following messages:
+	# dmesg
+	New bb device created, major: 254, minor: 0
+	New bb device created, major: 254, minor: 1
+	Kernel black board loaded.
+	See http://savannah.nongnu.org/projects/tsp for details.
+
+This means that two sample black boards were just created (pass run_test=0
+to insmod if you want to avoid it). To access them, you need to create
+the associated character devices (with the corresponding major and
+minor numbers):
+	# mknod /dev/bbk0 c 254 0
+
+
+The black board can now be reached by:
+	# bb_tools bb_dump /dev/bbk0
+	============= <[begin] BlackBoard [bb_test1] [begin] > ===============
+	  @start blackboard    = 0xb7f6f000
+	  stored data          = 1 / 2 [max desc]
+	  free data size       = 196 / 200
+	  @data_desc           = 0xb7f6f134
+	  @data                = 0xb7f6f28c
+	================ < [begin] Data [begin] > ==================
+	---------- < bb_test1_variable > ----------
+	  alias-target = -1
+	  type         = 5  (int32_t)
+	  dimension    = 1
+	  type_size    = 4
+	  data_offset  = 0
+	  value        = 21
+	---------- ---------- ----------
+	================== < [end] Data [end] > ====================
+	============== < [end] BlackBoard [bb_test1] [end] > ================
+	
diff -U 3 -H -d -r -N -- ../tsp-0.8.3-Source-ref/src/util/libbb/todo src/util/libbb/todo
--- ../tsp-0.8.3-Source-ref/src/util/libbb/todo	1970-01-01 01:00:00.000000000 +0100
+++ src/util/libbb/todo	2005-02-23 02:34:48.000000000 +0100
@@ -0,0 +1,16 @@
+- update doxygen documentation
+- write a tutorial
+- make bbtools use a common bbtools
+  may be like busybox style [ongoing]
+
+- use hcreate to improve symbol search and lookup
+
+- add bb_memset command and API to reset [API is ok]
+  BB data area without destroying BB
+
+- add bb_publish and bb_synchro_xx to bbtools in order
+  to be able script BB for demo and even practical
+  application control
+
+- add some direct scripting language binding
+  (TCL, python, ...) as bbtools for 'shell'
