Commits (9)
......@@ -13,7 +13,7 @@
#include <deployment.h>
#if (defined (RTEMS_POSIX) || defined (RTEMS_PURE))
#if (defined (RTEMS_POSIX) || defined (__PO_HI_RTEMS_CLASSIC_API))
#if defined (__PO_HI_NEED_DRIVER_ETH_LEON) || \
defined (__PO_HI_NEED_DRIVER_ETH_LEON_SENDER) || \
defined (__PO_HI_NEED_DRIVER_ETH_LEON_RECEIVER)
......@@ -63,7 +63,7 @@
#endif /* RTEMS_POSIX */
#if defined(RTEMS_PURE)
#if defined(__PO_HI_RTEMS_CLASSIC_API)
#include <rtems.h>
#include <inttypes.h>
#define CONFIGURE_INIT
......@@ -105,7 +105,7 @@
#define CONFIGURE_MAXIMUM_BARRIERS 1 + __PO_HI_NB_PORTS + 1
#include <rtems/confdefs.h>
#endif /* RTEMS_PURE */
#endif /* __PO_HI_RTEMS_CLASSIC_API */
#if defined (X86_RTEMS) && defined (__PO_HI_USE_TRANSPORT) && __PO_HI_NB_DEVICES > 1
#include <rtems/rtems_bsdnet.h>
......
......@@ -43,14 +43,23 @@ void __po_hi_gqueue_init (__po_hi_task_id id,
* create its global queue, according to its information (number of
* ports, destination of each port ...).
*
* The first argument is the task-id in the distributed system. The
* second argument is the number of ports for the task. The argument
* sizes contains the size of the FIFO for each port. The offsets
* argument contains the offset position for each queue in the global
* queue. The n_dest argument correspond to the number of
* destinations for an OUT port. The argument destinations tells what
* are the ports connected to an OUT port. Finally, the argument
* total_fifo_size gives the total size of the global queue
*
* id : id of the task associated to this queue
* nb_ports : number of ports for task 'id'
* queue : XXX
* sizes : size of the FIFO for each port, or __PO_HI_GQUEUE_FIFO_OUT
* if this is an out port;
* first
* ofssets: offset position for each queue in the global
* queue
* woffsets :
* n_dest : number of destinations for each port;
* destinations : destination for each port;
* used_size : XXX
* history : XXX
* recent : XXX
* empties : XXX
* total_fifo_sizes: XXX
*/
void __po_hi_gqueue_store_out (__po_hi_task_id id,
......
......@@ -25,7 +25,7 @@
#include <pthread.h>
#endif
#if defined (RTEMS_PURE)
#if defined (__PO_HI_RTEMS_CLASSIC_API)
#include <rtems.h>
#endif
......@@ -37,8 +37,6 @@
#include <windows.h>
#endif
typedef enum
{
__PO_HI_PROTECTED_REGULAR = 1,
......@@ -54,7 +52,6 @@ typedef enum
typedef __po_hi_protected_protocol_t __po_hi_mutex_protocol_t;
typedef struct
{
__po_hi_mutex_protocol_t protocol;
......@@ -63,7 +60,7 @@ typedef struct
pthread_mutex_t posix_mutex;
pthread_mutexattr_t posix_mutexattr;
#endif
#if defined (RTEMS_PURE)
#if defined (__PO_HI_RTEMS_CLASSIC_API)
rtems_id rtems_mutex;
#endif
#if defined (XENO_NATIVE)
......@@ -74,9 +71,6 @@ typedef struct
#endif
}__po_hi_mutex_t;
typedef uint8_t __po_hi_protected_t;
/*
......@@ -92,10 +86,10 @@ int __po_hi_protected_lock (__po_hi_protected_t protected_id);
/**
* \fn __po_hi_protected_lock
*
* Unlock the variable which has he id given
* Unlock the variable which has he id given
* by the argument.
* Return __PO_HI_SUCCESS if it is successfull.
* If there is an error, it can return
* If there is an error, it can return
* __PO_HI_ERROR_PTHREAD_MUTEX value
*/
int __po_hi_protected_unlock (__po_hi_protected_t protected_id);
......@@ -111,11 +105,11 @@ int __po_hi_protected_init (void);
/**
* \fn __po_hi_mutex_init
*
* \brief Initialize a mutex no matter the underlying executive
* \brief Initialize a mutex no matter the underlying executive
*
* This function allocate all the resources to the mutex so that it can be
* used with __po_hi_mutex_lock() and __po_hi_mutex_unlock(). The second
* parameter is the locking protocol of the mutex that is mapped on the
* parameter is the locking protocol of the mutex that is mapped on the
* appropriate underlyign OS directives if supported. The third argument
* is the priority ceiling used, only relevant if the protocol
* needs such an option. Otherwise, any value can be used.
......@@ -131,7 +125,7 @@ int __po_hi_mutex_init (__po_hi_mutex_t* mutex, const __po_hi_mutex_protocol_t p
/**
* \fn __po_hi_mutex_lock
*
* \brief Lock a mutex no matter the underlying executive
* \brief Lock a mutex no matter the underlying executive
*
* This function locks the mutex so that it ensures that only one task
* acquired it. Note that if the mutex was previously acquired, the caller
......@@ -148,7 +142,7 @@ int __po_hi_mutex_lock (__po_hi_mutex_t* mutex);
/**
* \fn __po_hi_mutex_unlock
*
* \brief Unlock a mutex no matter the underlying executive
* \brief Unlock a mutex no matter the underlying executive
*
* This function unlocks the mutex so that other tasks can acquire it
* again.
......
......@@ -48,7 +48,7 @@
#define __PO_HI_MAIN_RETURN 0
#define __ERRORMSG(s, args...) fprintf(stderr, s, ##args)
#elif defined(RTEMS_PURE)
#elif defined(__PO_HI_RTEMS_CLASSIC_API)
#define __PO_HI_MAIN_NAME Init
#define __PO_HI_MAIN_TYPE rtems_task
#define __PO_HI_MAIN_ARGS rtems_task_argument argument
......@@ -92,7 +92,7 @@
#define __PO_HI_MAX_PRIORITY 2
#define __PO_HI_MIN_PRIORITY 0
#elif defined(RTEMS_PURE)
#elif defined(__PO_HI_RTEMS_CLASSIC_API)
#include <rtems.h>
#include <inttypes.h>
#include <po_hi_time.h>
......
......@@ -14,7 +14,7 @@
#include <po_hi_types.h>
#ifndef HAVE_CLOCK_GETTIME
#if defined (__CYGWIN__) || defined (__MINGW32__) || defined (RTEMS_POSIX) || defined (RTEMS_PURE)
#if defined (__CYGWIN__) || defined (__MINGW32__) || defined (RTEMS_POSIX) || defined (__PO_HI_RTEMS_CLASSIC_API)
#else
#include <xlocale.h>
#endif
......
......@@ -15,7 +15,7 @@ TARGET_SOURCES =
#TARGET_TRANSPORT_SOURCES = $(RUNTIME_PATH)/config/leon-rtems/config.c
TARGET_TRANSPORT_SOURCES =
TARGET_CFLAGS = -DRTEMS_PURE -DGUMSTIX_RTEMS -mstructure-size-boundary=8 -mcpu=xscale -mfpu=vfp -mfloat-abi=soft $(GCC_GENERIC_FLAGS)
TARGET_CFLAGS = -D__PO_HI_RTEMS_CLASSIC_API -DGUMSTIX_RTEMS -mstructure-size-boundary=8 -mcpu=xscale -mfpu=vfp -mfloat-abi=soft $(GCC_GENERIC_FLAGS)
TARGET_INCLUDE =
LD = arm-rtems4.10-gcc
......
......@@ -29,7 +29,7 @@ TARGET_SOURCES =
#TARGET_TRANSPORT_SOURCES = $(RUNTIME_PATH)/config/leon-rtems/config.c
TARGET_TRANSPORT_SOURCES =
TARGET_CFLAGS = -DRTEMS_PURE -DLEON_RTEMS $(GCC_GENERIC_FLAGS) $(CPU_FLAGS) $(AM_FLAGS) $(GCCSPECS)
TARGET_CFLAGS = -D__PO_HI_RTEMS_CLASSIC_API -DLEON_RTEMS $(GCC_GENERIC_FLAGS) $(CPU_FLAGS) $(AM_FLAGS) $(GCCSPECS)
TARGET_INCLUDE = -I$(RUNTIME_PATH)/config/leon-rtems/
TARGET_LDFLAGS = -lrtemsbsp -lc -lm
......
......@@ -27,7 +27,7 @@ TARGET_SOURCES =
#TARGET_TRANSPORT_SOURCES = $(RUNTIME_PATH)/config/leon-rtems/config.c
TARGET_TRANSPORT_SOURCES =
TARGET_CFLAGS = -DRTEMS_PURE -DLEON_RTEMS $(GCC_GENERIC_FLAGS) $(CPU_FLAGS) $(AM_FLAGS) $(GCCSPECS)
TARGET_CFLAGS = -D__PO_HI_RTEMS_CLASSIC_API -DLEON_RTEMS $(GCC_GENERIC_FLAGS) $(CPU_FLAGS) $(AM_FLAGS) $(GCCSPECS)
TARGET_INCLUDE = -I $(RUNTIME_PATH)/config/leon-rtems/
TARGET_LDFLAGS = -lrtemsbsp -lc -lm
......
......@@ -21,7 +21,7 @@ GPROF = sparc-rtems-gprof
TARGET_SOURCES =
TARGET_TRANSPORT_SOURCES =
TARGET_CFLAGS = -DRTEMS_PURE -DSPARC_RTEMS -mcpu=v8 -I$(XTRATUM_PATH)/include -B$(RTEMS_PATH)/sparc-rtems/leon3xm3/lib --include xm_inc/config.h --include xm_inc/arch/arch_types.h -DXM_SRC -DXM3_RTEMS_MODE $(GCC_GENERIC_FLAGS)
TARGET_CFLAGS = -D__PO_HI_RTEMS_CLASSIC_API -DSPARC_RTEMS -mcpu=v8 -I$(XTRATUM_PATH)/include -B$(RTEMS_PATH)/sparc-rtems/leon3xm3/lib --include xm_inc/config.h --include xm_inc/arch/arch_types.h -DXM_SRC -DXM3_RTEMS_MODE $(GCC_GENERIC_FLAGS)
LD = sparc-rtems-gcc
TARGET_LDFLAGS = -lrtemsbsp -lc -lm -mcpu=v8 -msoft-float -qrtems -L$(XTRATUM_PATH)/lib -Wl,--defsym=PARTITION_START=$(call xpathstart,$(BINARY),../$(MAINAPP)_xtratum-conf.xml),--defsym=PARTITION_SIZE=$(call xpathsize,$(BINARY),../$(MAINAPP_xtratum-conf.xml)) -Ttext=$(call xpathstart,$(BINARY),../$(MAINAPP)_xtratum-conf.xml)
......
......@@ -22,7 +22,7 @@ TARGET_SOURCES =
#TARGET_TRANSPORT_SOURCES = $(RUNTIME_PATH)/config/leon-rtems/config.c
TARGET_TRANSPORT_SOURCES =
TARGET_CFLAGS = -DRTEMS_PURE -DNDS_RTEMS -mstructure-size-boundary=8 -mcpu=arm9tdmi -mfpu=vfp -mfloat-abi=soft $(GCC_GENERIC_FLAGS) -mthumb-interwork -g
TARGET_CFLAGS = -D__PO_HI_RTEMS_CLASSIC_API -DNDS_RTEMS -mstructure-size-boundary=8 -mcpu=arm9tdmi -mfpu=vfp -mfloat-abi=soft $(GCC_GENERIC_FLAGS) -mthumb-interwork -g
TARGET_INCLUDE = -I $(RUNTIME_PATH)/config/leon-rtems/
LD = $(LD_FOR_TARGET)
......
......@@ -24,7 +24,7 @@ GPROF = i386-rtems4.8-gprof
TARGET_SOURCES =
TARGET_TRANSPORT_SOURCES =
TARGET_CFLAGS = -DRTEMS_PURE -DX86_RTEMS $(GCC_GENERIC_FLAGS)
TARGET_CFLAGS = -D__PO_HI_RTEMS_CLASSIC_API -DX86_RTEMS $(GCC_GENERIC_FLAGS)
TARGET_INCLUDE = -I $(RUNTIME_PATH)/config/
LD = i386-rtems4.8-gcc
......
......@@ -30,6 +30,7 @@
#include <po_hi_main.h>
#include <po_hi_task.h>
#include <po_hi_gqueue.h>
#include <po_hi_protected.h>
#include <drivers/po_hi_driver_sockets.h>
#include <activity.h>
......@@ -49,6 +50,7 @@
#include <sys/time.h>
#endif
/******************************************************************************/
/*
* This file (po_hi_sockets.c) provides function to handle
* communication between nodes in PolyORB-HI-C. We don't use a
......@@ -67,24 +69,33 @@
#define __PO_HI_NB_NODES 1
#endif
/*
* We have two arrays of sockets. The first array (nodes) is used to
* send data to other nodes. A special socket if nodes[__po_hi_mynode] : this
* socket is used to listen others processes. The second array
* (rnodes), is used to store all socket that are created by the
* listen socket. This array is used only by the receiver_task
*/
/* The following elements are configured during initilization phase,
and then reuse by the poller thread
*/
__po_hi_device_id __po_hi_c_sockets_device_id;
/* id of the device we are bound to */
int __po_hi_c_sockets_listen_socket;
/* Listen socket */
int __po_hi_c_sockets_read_sockets[__PO_HI_NB_DEVICES];
int __po_hi_c_sockets_write_sockets[__PO_HI_NB_DEVICES];
/* Socket we read from, used by the __po_hi_sockets_poller task */
__po_hi_request_t __po_hi_c_sockets_poller_received_request;
/* Request, heap allocated, used by the __po_hi_sockets_poller task */
__po_hi_msg_t __po_hi_c_sockets_poller_msg;
/* Message, heap allocated, used by the __po_hi_sockets_poller task */
int __po_hi_c_sockets_write_sockets[__PO_HI_NB_DEVICES];
/* Sockets we write to, used by the __po_hi_drivers_socket_send() function */
__po_hi_msg_t __po_hi_c_sockets_send_msg;
__po_hi_device_id __po_hi_c_sockets_device_id;
/* Message, heap allocated, used by the __po_hi_sockets_send() funtion */
int __po_hi_c_sockets_array_init_done = 0;
__po_hi_mutex_t __po_hi_c_sockets_send_mutex;
/******************************************************************************/
int __po_hi_driver_sockets_send (__po_hi_task_id task_id,
__po_hi_port_t port)
{
......@@ -113,7 +124,8 @@ int __po_hi_driver_sockets_send (__po_hi_task_id task_id,
protocol_id = __po_hi_transport_get_protocol (port, destination_port);
protocol_conf = __po_hi_transport_get_protocol_configuration (protocol_id);
__DEBUGMSG ("[DRIVER SOCKETS] Try to write from task=%d, port=%d, local_device=%d, remote device=%d, socket=%d\n", task_id, port, local_device, remote_device, __po_hi_c_sockets_write_sockets[remote_device]);
__DEBUGMSG ("[DRIVER SOCKETS] Try to write from task=%d, port=%d, local_device=%d, remote device=%d, socket=%d\n",
task_id, port, local_device, remote_device, __po_hi_c_sockets_write_sockets[remote_device]);
if (request->port == -1)
{
__DEBUGMSG (" [DRIVER SOCKETS] No data to write on port %d\n", port);
......@@ -208,8 +220,9 @@ int __po_hi_driver_sockets_send (__po_hi_task_id task_id,
case invalid_protocol:
default:
{
request->port = destination_port;
__po_hi_mutex_lock (&__po_hi_c_sockets_send_mutex);
__po_hi_msg_reallocate (&__po_hi_c_sockets_send_msg);
__po_hi_marshall_request (request, &__po_hi_c_sockets_send_msg);
......@@ -227,6 +240,7 @@ int __po_hi_driver_sockets_send (__po_hi_task_id task_id,
if (len != size_to_write)
{
__po_hi_mutex_unlock (&__po_hi_c_sockets_send_mutex);
#if __PO_HI_MONITOR_ENABLED
__po_hi_monitor_report_failure_device (remote_device, po_hi_monitor_failure_value);
......@@ -238,6 +252,7 @@ int __po_hi_driver_sockets_send (__po_hi_task_id task_id,
return __PO_HI_ERROR_TRANSPORT_SEND;
}
}
__po_hi_mutex_unlock (&__po_hi_c_sockets_send_mutex);
request->port = __PO_HI_GQUEUE_INVALID_PORT;
break;
......@@ -247,6 +262,7 @@ int __po_hi_driver_sockets_send (__po_hi_task_id task_id,
return __PO_HI_SUCCESS;
}
/******************************************************************************/
/*pragma is for unused parameter "dev_id_addr"*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
......@@ -291,7 +307,6 @@ void* __po_hi_sockets_poller (__po_hi_device_id* dev_id_addr)
assert (n_connected >= 0);
__DEBUGMSG ("Number of devices that share the bus=%d\n", n_connected);
/*
* Create a socket for each node that will communicate with us.
*/
......@@ -401,7 +416,6 @@ void* __po_hi_sockets_poller (__po_hi_device_id* dev_id_addr)
#else
memset (__po_hi_c_sockets_poller_msg.content, '\0', __PO_HI_MESSAGES_MAX_SIZE);
#ifdef _WIN32
len = recv (__po_hi_c_sockets_read_sockets[dev], __po_hi_c_sockets_poller_msg.content, __PO_HI_MESSAGES_MAX_SIZE, 0);
#else
......@@ -433,9 +447,10 @@ void* __po_hi_sockets_poller (__po_hi_device_id* dev_id_addr)
}
#pragma GCC diagnostic pop
/******************************************************************************/
void __po_hi_driver_sockets_init (__po_hi_device_id dev_id)
{
static int __po_hi_c_sockets_array_init_done = 0;
int ret;
#ifdef _WIN32
char FAR reuse;
......@@ -462,7 +477,7 @@ void __po_hi_driver_sockets_init (__po_hi_device_id dev_id)
__po_hi_c_sockets_device_id = dev_id;
if (__po_hi_c_sockets_array_init_done == 0)
if (__po_hi_c_sockets_array_init_done == 0) /* XXX */
{
for (dev = 0 ; dev < __PO_HI_NB_DEVICES ; dev++)
{
......@@ -473,6 +488,8 @@ void __po_hi_driver_sockets_init (__po_hi_device_id dev_id)
__po_hi_c_sockets_array_init_done = 1;
}
__po_hi_mutex_init (&__po_hi_c_sockets_send_mutex,__PO_HI_MUTEX_REGULAR, 0);
__po_hi_transport_set_sending_func (dev_id, __po_hi_driver_sockets_send);
ipconf = (__po_hi_c_ip_conf_t*)__po_hi_get_device_configuration (dev_id);
......@@ -489,7 +506,6 @@ void __po_hi_driver_sockets_init (__po_hi_device_id dev_id)
{
__po_hi_c_sockets_listen_socket = socket (AF_INET, SOCK_STREAM, 0);
if (__po_hi_c_sockets_listen_socket == -1 )
{
#ifdef __PO_HI_DEBUG
......@@ -533,7 +549,6 @@ void __po_hi_driver_sockets_init (__po_hi_device_id dev_id)
/* For now, we force affinity to 0 */
}
/*
* For each node in the sytem that may communicate with the current
* node we create a socket. This socket will be used to send data.
......@@ -606,7 +621,6 @@ void __po_hi_driver_sockets_init (__po_hi_device_id dev_id)
tmp[i] = hostinfo->h_addr[i];
}
/*
* We try to connect on the remote host. We try every
* second to connect on.
......
......@@ -29,7 +29,7 @@
#if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX)
#include <pthread.h>
#elif defined(RTEMS_PURE)
#elif defined(__PO_HI_RTEMS_CLASSIC_API)
#include <rtems.h>
#include <inttypes.h>
#include <po_hi_time.h>
......@@ -72,7 +72,7 @@ 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)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
rtems_id __po_hi_gqueues_semaphores[__PO_HI_NB_TASKS];
rtems_id __po_hi_gqueues_barriers[__PO_HI_NB_TASKS];
#elif defined (XENO_NATIVE)
......@@ -102,7 +102,7 @@ void __po_hi_gqueue_init (__po_hi_task_id id,
__po_hi_uint32_t off; /* XXX May overflow for large value .. */
int err;
#if defined (RTEMS_PURE)
#if defined (__PO_HI_RTEMS_CLASSIC_API)
rtems_status_code ret;
#elif defined (XENO_NATIVE)
int ret;
......@@ -156,7 +156,7 @@ void __po_hi_gqueue_init (__po_hi_task_id id,
#endif
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
__PO_HI_DEBUG_INFO ("[GQUEUE] Create semaphore for queue of task %d\n", id);
ret = rtems_semaphore_create (rtems_build_name ('G', 'S', 'E' , 'A' + (char) id), 1, RTEMS_BINARY_SEMAPHORE, __PO_HI_DEFAULT_PRIORITY, &(__po_hi_gqueues_semaphores[id]));
if (ret != RTEMS_SUCCESSFUL)
......@@ -253,7 +253,7 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id,
__po_hi_request_t* ptr;
__po_hi_request_t* tmp;
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_status_code ret;
#endif
ptr = &__po_hi_gqueues_most_recent_values[id][port];
......@@ -268,7 +268,7 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id,
pthread_mutex_lock (&__po_hi_gqueues_mutexes[id]);
#elif defined (XENO_NATIVE)
rt_mutex_acquire (&__po_hi_gqueues_mutexes[id], TM_INFINITE);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
__DEBUGMSG ("[GQUEUE] Try to obtain semaphore for queue of task %d\n", id);
ret = rtems_semaphore_obtain (__po_hi_gqueues_semaphores[id], RTEMS_WAIT, RTEMS_NO_TIMEOUT);
if (ret != RTEMS_SUCCESSFUL)
......@@ -296,7 +296,7 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id,
pthread_mutex_unlock (&__po_hi_gqueues_mutexes[id]);
#elif defined (XENO_NATIVE)
rt_mutex_release (&__po_hi_gqueues_mutexes[id]);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
ret = rtems_semaphore_release (__po_hi_gqueues_semaphores[id]);
if (ret != RTEMS_SUCCESSFUL)
{
......@@ -349,7 +349,7 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id,
{
__DEBUGMSG("SetEvent failed (%d)\n", GetLastError());
}
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
ret = rtems_semaphore_release (__po_hi_gqueues_semaphores[id]);
if (ret != RTEMS_SUCCESSFUL)
{
......@@ -366,7 +366,7 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id,
void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id,
__po_hi_local_port_t* port)
{
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_status_code ret;
#endif
......@@ -380,7 +380,7 @@ void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id,
__DEBUGMSG("*** Locking (%d) %d\n", id, error);
#elif defined (XENO_NATIVE)
rt_mutex_acquire (&__po_hi_gqueues_mutexes[id], TM_INFINITE);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
ret = rtems_semaphore_obtain (__po_hi_gqueues_semaphores[id], RTEMS_WAIT, RTEMS_NO_TIMEOUT);
if (ret != RTEMS_SUCCESSFUL)
{
......@@ -402,7 +402,7 @@ void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id,
__DEBUGMSG("*** Done Waiting (%d) %d\n", id, error);
#elif defined (XENO_NATIVE)
rt_cond_wait (&__po_hi_gqueues_conds[id], &__po_hi_gqueues_mutexes[id], TM_INFINITE);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
ret = rtems_semaphore_release (__po_hi_gqueues_semaphores[id]);
if (ret != RTEMS_SUCCESSFUL)
{
......@@ -442,7 +442,7 @@ void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id,
rt_mutex_release (&__po_hi_gqueues_mutexes[id]);
#elif defined (_WIN32)
LeaveCriticalSection(&__po_hi_gqueues_cs[id]);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
ret = rtems_semaphore_release (__po_hi_gqueues_semaphores[id]);
if (ret != RTEMS_SUCCESSFUL)
{
......@@ -473,7 +473,7 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
__po_hi_request_t* request)
{
__po_hi_request_t* ptr;
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_status_code ret;
#endif
......@@ -487,7 +487,7 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
pthread_mutex_lock (&__po_hi_gqueues_mutexes[id]);
#elif defined (XENO_NATIVE)
rt_mutex_acquire (&__po_hi_gqueues_mutexes[id], TM_INFINITE);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
ret = rtems_semaphore_obtain (__po_hi_gqueues_semaphores[id], RTEMS_WAIT, RTEMS_NO_TIMEOUT);
if (ret != RTEMS_SUCCESSFUL)
{
......@@ -511,7 +511,7 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
#elif defined (XENO_NATIVE)
rt_cond_wait (&__po_hi_gqueues_conds[id], &__po_hi_gqueues_mutexes[id], TM_INFINITE);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
#elif defined (_WIN32)
LeaveCriticalSection(&__po_hi_gqueues_cs[id]);
......@@ -547,7 +547,7 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
pthread_mutex_unlock (&__po_hi_gqueues_mutexes[id]);
#elif defined (XENO_NATIVE)
rt_mutex_release (&__po_hi_gqueues_mutexes[id]);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
ret = rtems_semaphore_release (__po_hi_gqueues_semaphores[id]);
if (ret != RTEMS_SUCCESSFUL)
{
......@@ -562,7 +562,7 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
int __po_hi_gqueue_next_value (__po_hi_task_id id, __po_hi_local_port_t port)
{
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_status_code ret;
#endif
......@@ -581,7 +581,7 @@ int __po_hi_gqueue_next_value (__po_hi_task_id id, __po_hi_local_port_t port)
rt_mutex_acquire (&__po_hi_gqueues_mutexes[id], TM_INFINITE);
#elif defined (_WIN32)
EnterCriticalSection(&__po_hi_gqueues_cs[id]);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
ret = rtems_semaphore_obtain (__po_hi_gqueues_semaphores[id], RTEMS_WAIT, RTEMS_NO_TIMEOUT);
if (ret != RTEMS_SUCCESSFUL)
{
......@@ -617,7 +617,7 @@ int __po_hi_gqueue_next_value (__po_hi_task_id id, __po_hi_local_port_t port)
pthread_mutex_unlock (&__po_hi_gqueues_mutexes[id]);
#elif defined (XENO_NATIVE)
rt_mutex_release (&__po_hi_gqueues_mutexes[id]);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
ret = rtems_semaphore_release (__po_hi_gqueues_semaphores[id]);
if (ret != RTEMS_SUCCESSFUL)
{
......
......@@ -35,12 +35,12 @@ pthread_cond_t cond_init;
pthread_mutex_t mutex_init;
#endif
#if defined (RTEMS_POSIX) || defined (RTEMS_PURE)
#if defined (RTEMS_POSIX) || defined (__PO_HI_RTEMS_CLASSIC_API)
#include <rtems.h>
#include <rtems/rtems/clock.h>
#endif
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_id __po_hi_main_initialization_barrier;
#endif
......@@ -167,7 +167,7 @@ int __po_hi_initialize_early ()
#endif
#if defined (RTEMS_POSIX) || defined (RTEMS_PURE)
#if defined (RTEMS_POSIX) || defined (__PO_HI_RTEMS_CLASSIC_API)
rtems_status_code ret;
rtems_time_of_day time;
......@@ -187,7 +187,7 @@ int __po_hi_initialize_early ()
}
#endif
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
__DEBUGMSG ("[MAIN] Create a barrier that wait for %d tasks\n", __po_hi_nb_tasks_to_init);
ret = rtems_barrier_create (rtems_build_name ('B', 'A', 'R', 'M'), RTEMS_BARRIER_AUTOMATIC_RELEASE, __po_hi_nb_tasks_to_init, &__po_hi_main_initialization_barrier);
......@@ -356,7 +356,7 @@ int __po_hi_wait_initialization (void)
LeaveCriticalSection (&__po_hi_main_initialization_critical_section);
return (__PO_HI_SUCCESS);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
rtems_status_code ret;
__DEBUGMSG ("[MAIN] Task wait for the barrier\n");
......@@ -409,7 +409,7 @@ int __po_hi_wait_initialization (void)
#ifdef __PO_HI_USE_GPROF
void __po_hi_wait_end_of_instrumentation ()
{
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_task_wake_after (10000000 / _TOD_Microseconds_per_tick);
#else
#include <po_hi_time.h>
......@@ -428,7 +428,7 @@ void __po_hi_wait_end_of_instrumentation ()
exit (1);
__DEBUGMSG ("exit() called\n");
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_task_delete (rtems_self ());
#endif
}
......
......@@ -14,7 +14,7 @@
/* Headers from PolyORB-HI-C */
#if defined (__CYGWIN__) || defined (__MINGW32__) || defined (RTEMS_POSIX) || defined (RTEMS_PURE) || defined (FREERTOS)
#if defined (__CYGWIN__) || defined (__MINGW32__) || defined (RTEMS_POSIX) || defined (__PO_HI_RTEMS_CLASSIC_API) || defined (FREERTOS)
#else
#include <xlocale.h>
#endif
......
......@@ -31,7 +31,7 @@
#include <native/mutex.h>
#endif
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
#include <rtems.h>
#endif
......@@ -93,7 +93,7 @@ int __po_hi_protected_unlock (__po_hi_protected_t protected_id)
int __po_hi_mutex_init (__po_hi_mutex_t* mutex, const __po_hi_mutex_protocol_t protocol, const int priority)
{
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
static int nb_mutex = 0;
#endif
......@@ -166,7 +166,7 @@ int __po_hi_mutex_init (__po_hi_mutex_t* mutex, const __po_hi_mutex_protocol_t p
return __PO_HI_ERROR_UNKNOWN;
}
#endif
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
if (rtems_semaphore_create (rtems_build_name ('P', 'S', 'E' , 'A' + (char) nb_mutex++), 1, RTEMS_BINARY_SEMAPHORE, __PO_HI_DEFAULT_PRIORITY, &mutex->rtems_mutex) != RTEMS_SUCCESSFUL)
{
__PO_HI_DEBUG_CRITICAL ("[PROTECTED] Cannot create RTEMS binary semaphore\n");
......@@ -194,7 +194,7 @@ int __po_hi_mutex_lock (__po_hi_mutex_t* mutex)
return __PO_HI_ERROR_MUTEX_LOCK;
}
#endif
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
if (rtems_semaphore_obtain (mutex->rtems_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT) != RTEMS_SUCCESSFUL)
{
__PO_HI_DEBUG_CRITICAL ("[PROTECTED] Error when trying to lock mutex\n");
......@@ -236,7 +236,7 @@ int __po_hi_mutex_unlock (__po_hi_mutex_t* mutex)
return __PO_HI_ERROR_MUTEX_UNLOCK;
}
#endif
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
if (rtems_semaphore_release (mutex->rtems_mutex) != RTEMS_SUCCESSFUL)
{
__PO_HI_DEBUG_CRITICAL ("[PROTECTED] Error when trying to unlock mutex\n");
......
......@@ -8,7 +8,7 @@
* Copyright (C) 2011-2017 ESA & ISAE.
*/
#if defined (__CYGWIN__) || defined (__MINGW32__) || defined (RTEMS_POSIX) || defined (RTEMS_PURE) || defined (FREERTOS)
#if defined (__CYGWIN__) || defined (__MINGW32__) || defined (RTEMS_POSIX) || defined (__PO_HI_RTEMS_CLASSIC_API) || defined (FREERTOS)
#else
#include <xlocale.h>
#endif
......
......@@ -26,14 +26,14 @@
#undef POSIX
#endif
#if defined (RTEMS_POSIX) || defined (RTEMS_PURE)
#if defined (RTEMS_POSIX) || defined (__PO_HI_RTEMS_CLASSIC_API)
#ifdef RTEMS412
#include <sys/cpuset.h>
#endif
#endif
#if defined (RTEMS_POSIX) || defined (POSIX) || defined (XENO_POSIX)
#if defined (__CYGWIN__) || defined (__MINGW32__) || defined (RTEMS_POSIX) || defined (RTEMS_PURE)
#if defined (__CYGWIN__) || defined (__MINGW32__) || defined (RTEMS_POSIX) || defined (__PO_HI_RTEMS_CLASSIC_API)
#else
#include <xlocale.h>
#include <unistd.h>
......@@ -94,7 +94,7 @@ typedef struct
#elif defined (_WIN32)
__po_hi_time_t timer;
DWORD tid;
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
rtems_id ratemon_period;
rtems_id rtems_id;
#elif defined(XENO_NATIVE)
......@@ -141,7 +141,7 @@ void __po_hi_wait_for_tasks ()
pthread_join( tasks[i].tid , NULL );
}
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
rtems_task_suspend(RTEMS_SELF);
#elif defined (_WIN32)
......@@ -212,7 +212,7 @@ int __po_hi_compute_next_period (__po_hi_task_id task)
return (__PO_HI_SUCCESS);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
rtems_status_code ret;
rtems_name name;
......@@ -276,7 +276,7 @@ int __po_hi_wait_for_next_period (__po_hi_task_id task)
return (__PO_HI_SUCCESS);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
rtems_status_code ret;
ret = rtems_rate_monotonic_period (tasks[task].ratemon_period, (rtems_interval)__PO_HI_TIME_TO_US(tasks[task].period) / rtems_configuration_get_microseconds_per_tick());
/*
......@@ -329,7 +329,7 @@ int __po_hi_initialize_tasking( )
{
__po_hi_seconds (&(tasks[i].period), 0);
tasks[i].id = invalid_task_id;
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
tasks[i].ratemon_period = RTEMS_INVALID_ID;
#endif
}
......@@ -514,7 +514,7 @@ DWORD __po_hi_win32_create_thread (__po_hi_task_id id,
}
#endif
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_id __po_hi_rtems_create_thread (__po_hi_priority_t priority,
__po_hi_stack_t stack_size,
__po_hi_int8_t core_id,
......@@ -607,7 +607,7 @@ int __po_hi_create_generic_task (const __po_hi_task_id id,
__DEBUGMSG ("ERROR when starting the task\n");
}
return (__PO_HI_SUCCESS);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
(void) arg;
__po_hi_rtems_create_thread (priority, stack_size, core_id, start_routine, arg);
return (__PO_HI_SUCCESS);
......@@ -627,7 +627,7 @@ int __po_hi_create_generic_task (const __po_hi_task_id id,
(priority, stack_size, core_id, start_routine, arg);
my_task->timer = ORIGIN_OF_TIME;
__po_hi_posix_initialize_task (my_task);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
my_task->rtems_id = __po_hi_rtems_create_thread
(priority, stack_size, core_id, start_routine, arg);
#elif defined (_WIN32)
......@@ -826,7 +826,7 @@ void __po_hi_tasks_killall ()
for (i = 0; i < __PO_HI_NB_TASKS; i++)
{
__DEBUGMSG ("Kill task %d\n", i);
#ifdef RTEMS_PURE
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_task_delete (tasks[i].rtems_id);
#elif defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX)
pthread_cancel (tasks[i].tid);
......
......@@ -18,7 +18,7 @@
#if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX)
#include <pthread.h>
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
#include <bsp.h>
#endif
......@@ -120,7 +120,7 @@ int __po_hi_get_time (__po_hi_time_t* mytime)
mytime->nsec *= 100;
return (__PO_HI_SUCCESS);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
rtems_time_of_day current_time;
if (rtems_clock_get (RTEMS_CLOCK_GET_TOD, &current_time) != RTEMS_SUCCESSFUL)
......@@ -225,7 +225,7 @@ int __po_hi_delay_until (const __po_hi_time_t* time)
}
return (ret);
#elif defined (RTEMS_PURE)
#elif defined (__PO_HI_RTEMS_CLASSIC_API)
return (__PO_HI_UNAVAILABLE);
#elif defined (XENO_NATIVE)
......
......@@ -20,10 +20,6 @@
#include <stdlib.h>
#if defined(__PO_HI_USE_VCD) && defined(__unix__)
enum tagVCD VCD_state = VCD_UNCHECKED;
#endif
int __po_hi_compute_miss (__po_hi_uint8_t rate)
{
int v;
......@@ -52,7 +48,8 @@ unsigned long __po_hi_swap_byte (unsigned long value)
return (vn.ni);
}
#ifdef __PO_HI_USE_VCD
#if defined(__PO_HI_USE_VCD) && defined(__unix__)
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
......@@ -67,6 +64,8 @@ unsigned long __po_hi_swap_byte (unsigned long value)
#include <deployment.h>
enum tagVCD VCD_state = VCD_UNCHECKED;
int __po_hi_vcd_file;
int __po_hi_vcd_init = 0;
__po_hi_time_t __po_hi_vcd_start_time;
......@@ -90,17 +89,13 @@ void __po_hi_instrumentation_vcd_init ()
int size_to_write = 0;
time_t current_time;
#if defined(__PO_HI_USE_VCD) && defined(__unix__)
if (VCD_state == VCD_UNCHECKED)
{
VCD_state = NULL == getenv("VCD_ENABLED")?VCD_DISABLED:VCD_ENABLED;
if (VCD_state == VCD_UNCHECKED) {
VCD_state = NULL == getenv("VCD_ENABLED")?VCD_DISABLED:VCD_ENABLED;
}
if (VCD_state != VCD_ENABLED)
{
return;
if (VCD_state != VCD_ENABLED) {
return;
}
#endif
if (__po_hi_vcd_init == 0)
{
......