diff --git a/examples/aadlv2/producer-consumer/Makefile.am b/examples/aadlv2/producer-consumer/Makefile.am index 9ba63c50b4138a3b5c79786529914244006e8892..762f943bdb3c436b4a0a89270287c3da5b69dc9a 100644 --- a/examples/aadlv2/producer-consumer/Makefile.am +++ b/examples/aadlv2/producer-consumer/Makefile.am @@ -9,4 +9,4 @@ include $(srcdir)/../../Makefile.common EXTRA_DIST = $(AADL_FILES) $(SCENARIO_FILES) $(C_FILES) -CLEANDIRS = pc_simple_impl +CLEANDIRS = pc_simple_impl pc_simple_local pc_simple_rtems diff --git a/include/po_hi_gqueue.h b/include/po_hi_gqueue.h index d7b7001c7f6169fdff58a33a54cf6b2b7745d9e2..f40092d27a5bce2873f837f79b6c8a466c9b3613 100644 --- a/include/po_hi_gqueue.h +++ b/include/po_hi_gqueue.h @@ -5,7 +5,7 @@ * * For more informations, please visit http://taste.tuxfamily.org/wiki * - * Copyright (C) 2007-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. + * Copyright (C) 2007-2009 Telecom ParisTech, 2010-2017 ESA & ISAE. */ #ifndef __PO_HI_GQUEUE_H__ @@ -24,19 +24,19 @@ #include void __po_hi_gqueue_init (__po_hi_task_id id, - __po_hi_uint8_t nb_ports, + __po_hi_port_id_t nb_ports, __po_hi_port_t queue[], - __po_hi_int8_t sizes[], - __po_hi_uint8_t first[], - __po_hi_uint8_t offsets[], - __po_hi_uint8_t woffsets[], - __po_hi_uint8_t n_dest[], + __po_hi_port_id_t sizes[], + __po_hi_port_id_t first[], + __po_hi_port_id_t offsets[], + __po_hi_port_id_t woffsets[], + __po_hi_port_id_t n_dest[], __po_hi_port_t* destinations[], - __po_hi_uint8_t used_size[], + __po_hi_port_id_t used_size[], __po_hi_local_port_t history[], __po_hi_request_t recent[], - __po_hi_uint8_t empties[], - __po_hi_uint16_t total_fifo_size); + __po_hi_port_id_t empties[], + __po_hi_uint32_t total_fifo_size); /* * Initialize a global queue. In a distributed system, each task has * its own global queue. This function is invoked by each thead to @@ -116,7 +116,7 @@ void __po_hi_gqueue_wait_for_incoming_event(__po_hi_task_id id, * the event. */ -__po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id, +__po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id, __po_hi_local_port_t port, __po_hi_request_t* request); /* @@ -144,7 +144,7 @@ uint8_t __po_hi_gqueue_get_destinations_number (const __po_hi_task_id task_id, * identifier for the local thread. */ -__po_hi_int8_t __po_hi_gqueue_get_port_size(const __po_hi_task_id id, +__po_hi_port_id_t __po_hi_gqueue_get_port_size(const __po_hi_task_id id, const __po_hi_local_port_t port); /* @@ -153,9 +153,9 @@ __po_hi_int8_t __po_hi_gqueue_get_port_size(const __po_hi_task_id id, * identifier for the local thread. */ -__po_hi_int8_t __po_hi_gqueue_used_size( __po_hi_task_id id, __po_hi_local_port_t port); +__po_hi_port_id_t __po_hi_gqueue_used_size( __po_hi_task_id id, __po_hi_local_port_t port); -__po_hi_int8_t po_hi_gqueues_queue_is_empty(__po_hi_task_id id); +__po_hi_port_id_t po_hi_gqueues_queue_is_empty(__po_hi_task_id id); __po_hi_request_t* __po_hi_gqueues_get_request(__po_hi_task_id id, __po_hi_local_port_t port); diff --git a/include/po_hi_types.h b/include/po_hi_types.h index 52473980e1d85a89cc2ca8cc3afec693351ea30d..25bf3388a4b2bcd975e9e84bcb5340f8a71468b0 100644 --- a/include/po_hi_types.h +++ b/include/po_hi_types.h @@ -5,7 +5,7 @@ * * For more informations, please visit http://taste.tuxfamily.org/wiki * - * Copyright (C) 2007-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. + * Copyright (C) 2007-2009 Telecom ParisTech, 2010-2017 ESA & ISAE. */ #ifndef __PO_HI_TYPES_H_ @@ -85,6 +85,8 @@ typedef double __po_hi_float64_t; typedef unsigned char __po_hi_byte_t; +typedef __po_hi_int32_t __po_hi_port_id_t; + typedef enum { __PO_HI_IN_DATA_INTER_PROCESS = 0, diff --git a/src/po_hi_gqueue.c b/src/po_hi_gqueue.c index c5c1f3732460e4683cc7910afabe4cb8d6bb4973..3ebf8fc5bc2a9992b5e876e4830cbe5f8dd41034 100644 --- a/src/po_hi_gqueue.c +++ b/src/po_hi_gqueue.c @@ -47,59 +47,59 @@ /* give a default value to the out port */ __po_hi_port_t* __po_hi_gqueues[__PO_HI_NB_TASKS]; -__po_hi_int8_t __po_hi_gqueues_nb_ports[__PO_HI_NB_TASKS]; -__po_hi_int8_t* __po_hi_gqueues_sizes[__PO_HI_NB_TASKS]; -__po_hi_uint8_t* __po_hi_gqueues_used_size[__PO_HI_NB_TASKS]; -__po_hi_uint8_t* __po_hi_gqueues_offsets[__PO_HI_NB_TASKS]; -__po_hi_uint8_t* __po_hi_gqueues_woffsets[__PO_HI_NB_TASKS]; -__po_hi_uint8_t* __po_hi_gqueues_n_destinations[__PO_HI_NB_TASKS]; +__po_hi_port_id_t __po_hi_gqueues_nb_ports[__PO_HI_NB_TASKS]; +__po_hi_port_id_t* __po_hi_gqueues_sizes[__PO_HI_NB_TASKS]; +__po_hi_port_id_t* __po_hi_gqueues_used_size[__PO_HI_NB_TASKS]; +__po_hi_port_id_t* __po_hi_gqueues_offsets[__PO_HI_NB_TASKS]; +__po_hi_port_id_t* __po_hi_gqueues_woffsets[__PO_HI_NB_TASKS]; +__po_hi_port_id_t* __po_hi_gqueues_n_destinations[__PO_HI_NB_TASKS]; __po_hi_port_t** __po_hi_gqueues_destinations[__PO_HI_NB_TASKS]; -__po_hi_uint16_t __po_hi_gqueues_total_fifo_size[__PO_HI_NB_TASKS]; +__po_hi_uint32_t __po_hi_gqueues_total_fifo_size[__PO_HI_NB_TASKS]; __po_hi_request_t* __po_hi_gqueues_most_recent_values[__PO_HI_NB_TASKS]; -__po_hi_uint8_t* __po_hi_gqueues_first[__PO_HI_NB_TASKS]; +__po_hi_port_id_t* __po_hi_gqueues_first[__PO_HI_NB_TASKS]; -__po_hi_uint8_t __po_hi_gqueues_global_size[__PO_HI_NB_TASKS]; -__po_hi_local_port_t* __po_hi_gqueues_global_history[__PO_HI_NB_TASKS]; -__po_hi_uint16_t __po_hi_gqueues_global_history_offset[__PO_HI_NB_TASKS]; -__po_hi_uint16_t __po_hi_gqueues_global_history_woffset[__PO_HI_NB_TASKS]; +__po_hi_port_id_t __po_hi_gqueues_global_size[__PO_HI_NB_TASKS]; +__po_hi_local_port_t* __po_hi_gqueues_global_history[__PO_HI_NB_TASKS]; +__po_hi_uint32_t __po_hi_gqueues_global_history_offset[__PO_HI_NB_TASKS]; +__po_hi_uint32_t __po_hi_gqueues_global_history_woffset[__PO_HI_NB_TASKS]; -__po_hi_uint8_t* __po_hi_gqueues_port_is_empty[__PO_HI_NB_TASKS]; -__po_hi_uint8_t __po_hi_gqueues_queue_is_empty[__PO_HI_NB_TASKS]; -__po_hi_uint8_t __po_hi_gqueues_n_empty[__PO_HI_NB_TASKS]; +__po_hi_port_id_t* __po_hi_gqueues_port_is_empty[__PO_HI_NB_TASKS]; +__po_hi_port_id_t __po_hi_gqueues_queue_is_empty[__PO_HI_NB_TASKS]; +__po_hi_port_id_t __po_hi_gqueues_n_empty[__PO_HI_NB_TASKS]; #if defined (RTEMS_POSIX) || defined (POSIX) || defined (XENO_POSIX) -pthread_mutex_t __po_hi_gqueues_mutexes[__PO_HI_NB_TASKS]; -pthread_cond_t __po_hi_gqueues_conds[__PO_HI_NB_TASKS]; -pthread_mutexattr_t __po_hi_gqueues_mutexes_attr[__PO_HI_NB_TASKS]; -pthread_condattr_t __po_hi_gqueues_conds_attr[__PO_HI_NB_TASKS]; +pthread_mutex_t __po_hi_gqueues_mutexes[__PO_HI_NB_TASKS]; +pthread_cond_t __po_hi_gqueues_conds[__PO_HI_NB_TASKS]; +pthread_mutexattr_t __po_hi_gqueues_mutexes_attr[__PO_HI_NB_TASKS]; +pthread_condattr_t __po_hi_gqueues_conds_attr[__PO_HI_NB_TASKS]; #elif defined (RTEMS_PURE) -rtems_id __po_hi_gqueues_semaphores[__PO_HI_NB_TASKS]; -rtems_id __po_hi_gqueues_barriers[__PO_HI_NB_TASKS]; +rtems_id __po_hi_gqueues_semaphores[__PO_HI_NB_TASKS]; +rtems_id __po_hi_gqueues_barriers[__PO_HI_NB_TASKS]; #elif defined (XENO_NATIVE) -RT_MUTEX __po_hi_gqueues_mutexes[__PO_HI_NB_TASKS]; -RT_COND __po_hi_gqueues_conds[__PO_HI_NB_TASKS]; +RT_MUTEX __po_hi_gqueues_mutexes[__PO_HI_NB_TASKS]; +RT_COND __po_hi_gqueues_conds[__PO_HI_NB_TASKS]; #elif defined (_WIN32) -HANDLE __po_hi_gqueues_events[__PO_HI_NB_TASKS]; -CRITICAL_SECTION __po_hi_gqueues_cs[__PO_HI_NB_TASKS]; +HANDLE __po_hi_gqueues_events[__PO_HI_NB_TASKS]; +CRITICAL_SECTION __po_hi_gqueues_cs[__PO_HI_NB_TASKS]; #endif void __po_hi_gqueue_init (__po_hi_task_id id, - __po_hi_uint8_t nb_ports, + __po_hi_port_id_t nb_ports, __po_hi_port_t queue[], - __po_hi_int8_t sizes[], - __po_hi_uint8_t first[], - __po_hi_uint8_t offsets[], - __po_hi_uint8_t woffsets[], - __po_hi_uint8_t n_dest[], + __po_hi_port_id_t sizes[], + __po_hi_port_id_t first[], + __po_hi_port_id_t offsets[], + __po_hi_port_id_t woffsets[], + __po_hi_port_id_t n_dest[], __po_hi_port_t* destinations[], - __po_hi_uint8_t used_size[], + __po_hi_port_id_t used_size[], __po_hi_local_port_t history[], __po_hi_request_t recent[], - __po_hi_uint8_t empties[], - __po_hi_uint16_t total_fifo_size) + __po_hi_port_id_t empties[], + __po_hi_uint32_t total_fifo_size) { - __po_hi_uint8_t tmp; - __po_hi_uint16_t off; + __po_hi_port_id_t tmp; + __po_hi_uint32_t off; /* XXX May overflow for large value .. */ int err; #if defined (RTEMS_PURE) @@ -153,7 +153,7 @@ void __po_hi_gqueue_init (__po_hi_task_id id, err = pthread_cond_init (&__po_hi_gqueues_conds[id], &__po_hi_gqueues_conds_attr[id]); __DEBUGMSG("COND_INIT %d %d\n", id, err); assert(err == 0); - + #endif #ifdef RTEMS_PURE @@ -201,7 +201,7 @@ void __po_hi_gqueue_init (__po_hi_task_id id, #endif off = 0; - + for (tmp=0;tmpport = __PO_HI_GQUEUE_INVALID_PORT; @@ -246,13 +246,13 @@ void __po_hi_gqueue_store_out (__po_hi_task_id id, __PO_HI_DEBUG_DEBUG ("__po_hi_gqueue_store_out() from task %d on port %d\n", id, port); } -__po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id, +__po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id, __po_hi_local_port_t port, __po_hi_request_t* request) { __po_hi_request_t* ptr; __po_hi_request_t* tmp; - + #ifdef RTEMS_PURE rtems_status_code ret; #endif @@ -310,7 +310,7 @@ __po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id, __DEBUGMSG ("[GQUEUE] Semaphore released (id=%d)\n", id); return __PO_HI_ERROR_QUEUE_FULL; } - + __po_hi_uint32_t size; tmp = (__po_hi_request_t*) &__po_hi_gqueues[id][port]; size = __po_hi_gqueues_woffsets[id][port] + __po_hi_gqueues_first[id][port]; @@ -338,7 +338,7 @@ __po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id, #if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX) pthread_mutex_unlock (&__po_hi_gqueues_mutexes[id]); int err = pthread_cond_signal (&__po_hi_gqueues_conds[id]); - assert(err == 0); + assert(err == 0); __DEBUGMSG("*** Releasing (%d) %d\n", id, err); #elif defined (XENO_NATIVE) rt_mutex_release (&__po_hi_gqueues_mutexes[id]); @@ -645,24 +645,24 @@ __po_hi_port_t __po_hi_gqueue_get_destination (const __po_hi_task_id task_id, co return (__po_hi_gqueues_destinations[task_id][local_port][destination_number]); } -__po_hi_int8_t __po_hi_gqueue_get_port_size( __po_hi_task_id id, __po_hi_local_port_t port) +__po_hi_port_id_t __po_hi_gqueue_get_port_size( __po_hi_task_id id, __po_hi_local_port_t port) { return __po_hi_gqueues_sizes[id][port]; } -__po_hi_int8_t __po_hi_gqueue_used_size( __po_hi_task_id id, __po_hi_local_port_t port) +__po_hi_port_id_t __po_hi_gqueue_used_size( __po_hi_task_id id, __po_hi_local_port_t port) { return __po_hi_gqueues_used_size[id][port]; } -__po_hi_int8_t po_hi_gqueues_queue_is_empty( __po_hi_task_id id) +__po_hi_port_id_t po_hi_gqueues_queue_is_empty( __po_hi_task_id id) { return __po_hi_gqueues_queue_is_empty[id]; } -__po_hi_request_t* +__po_hi_request_t* __po_hi_gqueues_get_request(__po_hi_task_id id, __po_hi_local_port_t port) { diff --git a/src/po_hi_storage.c b/src/po_hi_storage.c index 5a7855be8f715d69fbf871da0d119bbae25349a1..b402d97aae13f607db75bbc7b54d9cc094c1fcee 100644 --- a/src/po_hi_storage.c +++ b/src/po_hi_storage.c @@ -311,7 +311,7 @@ int __po_hi_storage_file_append (const __po_hi_storage_file_t* file, char* buf, ret = write (file->fd, buf, bufsize); if (ret != bufsize) - { + { __DEBUGMSG ("[STORAGE] __po_hi_storage_file_append: cannot write %d bytes\n", bufsize); return __PO_HI_ERROR_UNKNOWN; } @@ -332,7 +332,7 @@ int __po_hi_storage_file_replace (const __po_hi_storage_file_t* oldfile, const _ #pragma GCC diagnostic ignored "-Wunused-parameter" int __po_hi_storage_file_lock (const __po_hi_storage_file_t* file) { - + return __PO_HI_NOTIMPLEMENTED; } #pragma GCC diagnostic pop @@ -525,7 +525,7 @@ int __po_hi_storage_directory_list (__po_hi_storage_dir_t* dir) __DEBUGMSG ("[STORAGE] __po_hi_storage_directory_list: fail to call closedir on %s\n", dir->dirname); return __PO_HI_ERROR_UNKNOWN; } - + return __PO_HI_SUCCESS; #endif