Unverified Commit e4c361e9 authored by Jerome Hugues's avatar Jerome Hugues Committed by GitHub

Merge pull request #28 from antcis/doxygen

Doxygen
parents d58d58db 13245b54
C_FILES = $(srcdir)/hello.cc C_FILES = $(srcdir)/hello.cc
AADL_FILES = $(srcdir)/cpp_test.aadl AADL_FILES = $(srcdir)/cpp_test.aadl
SCENARIO_FILES = $(srcdir)/scenario.aadl $(srcdir)/scenario_rtems.aadl SCENARIO_FILES = $(srcdir)/scenario.aadl
#$(srcdir)/scenario_rtems.aadl
include $(srcdir)/../../Makefile.common include $(srcdir)/../../Makefile.common
......
C_FILES = $(srcdir)/producer-consumer.c $(srcdir)/devicesconf.c C_FILES = $(srcdir)/producer-consumer.c $(srcdir)/devicesconf.c \
$(srcdir)/devicesconf_spw.c
AADL_FILES = $(srcdir)/producer_consumer.aadl $(srcdir)/software.aadl AADL_FILES = $(srcdir)/producer_consumer.aadl $(srcdir)/software.aadl
......
...@@ -109,10 +109,10 @@ public ...@@ -109,10 +109,10 @@ public
subcomponents subcomponents
pr_A : process A.Impl; pr_A : process A.Impl;
Device_A : device ocarina_drivers::rasta_spacewire.pohic Device_A : device ocarina_drivers::rasta_spacewire.grspw_pohic
{Source_Text => ("devicesconf_spw.c");}; {Source_Text => ("devicesconf_spw.c");};
pr_B : process B.Impl; pr_B : process B.Impl;
Device_B : device ocarina_drivers::rasta_spacewire.pohic Device_B : device ocarina_drivers::rasta_spacewire.grspw_pohic
{Source_Text => ("devicesconf_spw.c");}; {Source_Text => ("devicesconf_spw.c");};
CPU_A : processor the_processor.i; CPU_A : processor the_processor.i;
CPU_B : processor the_processor.i; CPU_B : processor the_processor.i;
......
...@@ -95,6 +95,9 @@ int __po_hi_gqueue_send_output (__po_hi_task_id id, ...@@ -95,6 +95,9 @@ int __po_hi_gqueue_send_output (__po_hi_task_id id,
* If the port is an output, this function will return nothing, * If the port is an output, this function will return nothing,
* but will not produce an error. * but will not produce an error.
* *
* If the port is an *IN* event port, this function will return
* the last value received in the request parameter, or block until an event arrives.
*
* \param id task-id which owns the global queue. * \param id task-id which owns the global queue.
* \param port number of port that received the data. * \param port number of port that received the data.
* \param request pointer to store the received data. * \param request pointer to store the received data.
...@@ -152,17 +155,47 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id, ...@@ -152,17 +155,47 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id,
__po_hi_local_port_t port, __po_hi_local_port_t port,
__po_hi_request_t* request); __po_hi_request_t* request);
/**
* \brief Access the most recent value queued.
*
* The program fetches the most recent value on this port in the __po_hi_gqueue_get_most_recent_value array.
* It gives the result in the form of a request.
* WARNING the function doesn't take into account whether the port is an output or input, if the port is empty or not.
* For this details, see the function get_value.
*
* \param task_id task identifier in the local process.
* \param local_port port identifier for the local thread.
* \return the request.
*/
__po_hi_request_t* __po_hi_gqueue_get_most_recent_value __po_hi_request_t* __po_hi_gqueue_get_most_recent_value
(const __po_hi_task_id task_id, (const __po_hi_task_id task_id,
const __po_hi_local_port_t local_port); const __po_hi_local_port_t local_port);
/**
* \brief Access the destination port thanks to the destination number.
*
* The program fetches the destination port.
* \param task_id task identifier in the local process.
* \param local_port port identifier for the local thread.
* \param destination_number the number of the destination (__po_hi_gqueue_get_destinations_number function).
* \return the port.
*/
__po_hi_port_t __po_hi_gqueue_get_destination (const __po_hi_task_id task_id, __po_hi_port_t __po_hi_gqueue_get_destination (const __po_hi_task_id task_id,
const __po_hi_local_port_t local_port, const __po_hi_local_port_t local_port,
const uint8_t destination_number); const uint8_t destination_number);
uint8_t __po_hi_gqueue_get_destinations_number (const __po_hi_task_id task_id, /**
* \brief Access the destination number (for a specified port).
*
* The program fetches the destination number in the __po_hi_gqueues_n_destinations array.
* It gives the destination number in the form of a __po_hi_port_id_t.
* It can be used then to get the destination port with the get_destination function.
*
* \param task_id task identifier in the local process.
* \param local_port port identifier for the local thread.
* \return the number.
*/
__po_hi_port_id_t __po_hi_gqueue_get_destinations_number (const __po_hi_task_id task_id,
const __po_hi_local_port_t local_port); const __po_hi_local_port_t local_port);
...@@ -185,8 +218,14 @@ __po_hi_port_id_t __po_hi_gqueue_get_port_size(const __po_hi_task_id id, ...@@ -185,8 +218,14 @@ __po_hi_port_id_t __po_hi_gqueue_get_port_size(const __po_hi_task_id id,
*/ */
__po_hi_port_id_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);
/**
* \brief Check whether the queue belonging to the id task is empty.
*
* The program checks the array __po_hi_gqueues_queue_is_empty.
* \param id task identifier in the local process.
* \return the value in the array.
* \return 0 and 1 if the queue is not empty because of array construction.
*/
__po_hi_port_id_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);
#endif /* __PO_HI_GQUEUE_H__ */ #endif /* __PO_HI_GQUEUE_H__ */
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <po_hi_returns.h> #include <po_hi_returns.h>
#include <po_hi_gqueue.h> #include <po_hi_gqueue.h>
#include <po_hi_main.h> #include <po_hi_main.h>
#include <po_hi_protected.h>
#include <drivers/po_hi_driver_rasta_common.h> #include <drivers/po_hi_driver_rasta_common.h>
#include <drivers/po_hi_rtems_utils.h> #include <drivers/po_hi_rtems_utils.h>
#include <drivers/po_hi_driver_leon_eth.h> #include <drivers/po_hi_driver_leon_eth.h>
......
...@@ -197,7 +197,7 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id, ...@@ -197,7 +197,7 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id,
assert(result == __PO_HI_SUCCESS); assert(result == __PO_HI_SUCCESS);
if (__po_hi_gqueues_sizes[id][port] == __PO_HI_GQUEUE_FIFO_INDATA) if (__po_hi_gqueue_get_port_size(id,port) == __PO_HI_GQUEUE_FIFO_INDATA)
{ {
memcpy(ptr,request,sizeof(*request)); memcpy(ptr,request,sizeof(*request));
} }
...@@ -205,7 +205,7 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id, ...@@ -205,7 +205,7 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id,
{ {
__DEBUGMSG ("[GQUEUE] Received message for task %d, port %d\n", id, port); __DEBUGMSG ("[GQUEUE] Received message for task %d, port %d\n", id, port);
if (__po_hi_gqueues_used_size[id][port] == __po_hi_gqueues_sizes[id][port]) if (__po_hi_gqueue_used_size(id,port) == __po_hi_gqueue_get_port_size(id,port))
{ {
/* Releasing only a mutex */ /* Releasing only a mutex */
int res = __po_hi_sem_mutex_release_gqueue(__po_hi_gqueues_semaphores,id); int res = __po_hi_sem_mutex_release_gqueue(__po_hi_gqueues_semaphores,id);
...@@ -230,7 +230,7 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id, ...@@ -230,7 +230,7 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id,
__po_hi_gqueues_woffsets[id][port] = (__po_hi_gqueues_woffsets[id][port] + 1 ) % __po_hi_gqueues_sizes[id][port]; __po_hi_gqueues_woffsets[id][port] = (__po_hi_gqueues_woffsets[id][port] + 1 ) % __po_hi_gqueues_sizes[id][port];
__po_hi_gqueues_used_size[id][port]++; __po_hi_gqueues_used_size[id][port]++;
__PO_HI_INSTRUMENTATION_VCD_WRITE("r%d p%d.%d\n", __po_hi_gqueues_used_size[id][port], id, port); __PO_HI_INSTRUMENTATION_VCD_WRITE("r%d p%d.%d\n", __po_hi_gqueue_used_size(id,port), id, port);
__po_hi_gqueues_global_history[id][__po_hi_gqueues_global_history_woffset[id]] = port; __po_hi_gqueues_global_history[id][__po_hi_gqueues_global_history_woffset[id]] = port;
__po_hi_gqueues_global_history_woffset[id] = (__po_hi_gqueues_global_history_woffset[id] + 1 ) % __po_hi_gqueues_total_fifo_size[id]; __po_hi_gqueues_global_history_woffset[id] = (__po_hi_gqueues_global_history_woffset[id] + 1 ) % __po_hi_gqueues_total_fifo_size[id];
...@@ -260,7 +260,7 @@ void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id, ...@@ -260,7 +260,7 @@ void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id,
__DEBUGMSG("GQUEUE_SEM_MUTEX_WAIT %d %d\n", id, result); __DEBUGMSG("GQUEUE_SEM_MUTEX_WAIT %d %d\n", id, result);
assert(result == __PO_HI_SUCCESS); assert(result == __PO_HI_SUCCESS);
while(__po_hi_gqueues_queue_is_empty[id] == 1) while(po_hi_gqueues_queue_is_empty(id) == 1)
{ {
__PO_HI_INSTRUMENTATION_VCD_WRITE("0t%d\n", id); __PO_HI_INSTRUMENTATION_VCD_WRITE("0t%d\n", id);
...@@ -288,17 +288,16 @@ void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id, ...@@ -288,17 +288,16 @@ void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id,
int __po_hi_gqueue_get_count( __po_hi_task_id id, __po_hi_local_port_t port) int __po_hi_gqueue_get_count( __po_hi_task_id id, __po_hi_local_port_t port)
{ {
if (__po_hi_gqueues_sizes[id][port] == __PO_HI_GQUEUE_FIFO_INDATA) if (__po_hi_gqueue_get_port_size(id,port) == __PO_HI_GQUEUE_FIFO_INDATA)
{ {
return 1; /* data port are always of size 1 */ return 1; /* data port are always of size 1 */
} }
else else
{ {
return (__po_hi_gqueues_used_size[id][port]); return (__po_hi_gqueue_used_size(id,port));
} }
} }
int __po_hi_gqueue_get_value (__po_hi_task_id id, int __po_hi_gqueue_get_value (__po_hi_task_id id,
__po_hi_local_port_t port, __po_hi_local_port_t port,
__po_hi_request_t* request) __po_hi_request_t* request)
...@@ -320,11 +319,20 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id, ...@@ -320,11 +319,20 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
__DEBUGMSG("GQUEUE_SEM_MUTEX_WAIT %d %d\n", id, result); __DEBUGMSG("GQUEUE_SEM_MUTEX_WAIT %d %d\n", id, result);
assert(result == __PO_HI_SUCCESS); assert(result == __PO_HI_SUCCESS);
/*
* If the port is an OUTPUT, with no value queued, the function returns
* nothing.
*/
if (__po_hi_gqueue_get_port_size(id,port) == 0)
{
__DEBUGMSG("THE PORT IS AN OUTPUT, REQUEST NOT SET UP");
return 0;
}
/* /*
* If the port is an event port, with no value queued, then we block * If the port is an event port, with no value queued, then we block
* the thread. * the thread.
*/ */
if (__po_hi_gqueues_sizes[id][port] != __PO_HI_GQUEUE_FIFO_INDATA) if (__po_hi_gqueue_get_port_size(id,port) != __PO_HI_GQUEUE_FIFO_INDATA)
{ {
while (__po_hi_gqueues_port_is_empty[id][port] == 1) while (__po_hi_gqueues_port_is_empty[id][port] == 1)
{ {
...@@ -334,12 +342,10 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id, ...@@ -334,12 +342,10 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
assert(res_sem == __PO_HI_SUCCESS); assert(res_sem == __PO_HI_SUCCESS);
} }
} }
/*
#if defined (MONITORING) * The request is set up
record_event(ANY, GET_VALUE, id, invalid_port_t, invalid_port_t, port, invalid_local_port_t , request); */
#endif if (__po_hi_gqueue_used_size(id,port) == 0)
if (__po_hi_gqueues_used_size[id][port] == 0)
{ {
memcpy (request, ptr, sizeof (__po_hi_request_t)); memcpy (request, ptr, sizeof (__po_hi_request_t));
//update_runtime (id, port, ptr); //update_runtime (id, port, ptr);
...@@ -350,6 +356,10 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id, ...@@ -350,6 +356,10 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
memcpy (request, ptr, sizeof (__po_hi_request_t)); memcpy (request, ptr, sizeof (__po_hi_request_t));
} }
#if defined (MONITORING)
record_event(ANY, GET_VALUE, id, invalid_port_t, invalid_port_t, port, invalid_local_port_t , request);
#endif
__PO_HI_DEBUG_INFO ("[GQUEUE] Task %d get a value on port %d\n", id, port); __PO_HI_DEBUG_INFO ("[GQUEUE] Task %d get a value on port %d\n", id, port);
/* Releasing only the mutex of the semaphore*/ /* Releasing only the mutex of the semaphore*/
...@@ -370,7 +380,7 @@ int __po_hi_gqueue_next_value (__po_hi_task_id id, __po_hi_local_port_t port) ...@@ -370,7 +380,7 @@ int __po_hi_gqueue_next_value (__po_hi_task_id id, __po_hi_local_port_t port)
there is a next value or not */ there is a next value or not */
/* XXX change and use assert ? */ /* XXX change and use assert ? */
if (__po_hi_gqueues_sizes[id][port] == __PO_HI_GQUEUE_FIFO_INDATA) if (__po_hi_gqueue_get_port_size(id,port) == __PO_HI_GQUEUE_FIFO_INDATA)
{ {
return 1; return 1;
} }
...@@ -386,9 +396,9 @@ int __po_hi_gqueue_next_value (__po_hi_task_id id, __po_hi_local_port_t port) ...@@ -386,9 +396,9 @@ int __po_hi_gqueue_next_value (__po_hi_task_id id, __po_hi_local_port_t port)
__po_hi_gqueues_used_size[id][port]--; __po_hi_gqueues_used_size[id][port]--;
__PO_HI_INSTRUMENTATION_VCD_WRITE("r%d p%d.%d\n", __po_hi_gqueues_used_size[id][port], id, port); __PO_HI_INSTRUMENTATION_VCD_WRITE("r%d p%d.%d\n", __po_hi_gqueue_used_size(id,port), id, port);
if (__po_hi_gqueues_used_size[id][port] == 0) if (__po_hi_gqueue_used_size(id,port) == 0)
{ {
__po_hi_gqueues_n_empty[id]++; __po_hi_gqueues_n_empty[id]++;
__po_hi_gqueues_port_is_empty[id][port] = 1; __po_hi_gqueues_port_is_empty[id][port] = 1;
...@@ -417,7 +427,7 @@ __po_hi_request_t* __po_hi_gqueue_get_most_recent_value (const __po_hi_task_id ...@@ -417,7 +427,7 @@ __po_hi_request_t* __po_hi_gqueue_get_most_recent_value (const __po_hi_task_id
return (&__po_hi_gqueues_most_recent_values[task_id][local_port]); return (&__po_hi_gqueues_most_recent_values[task_id][local_port]);
} }
uint8_t __po_hi_gqueue_get_destinations_number (const __po_hi_task_id task_id, const __po_hi_local_port_t local_port) __po_hi_port_id_t __po_hi_gqueue_get_destinations_number (const __po_hi_task_id task_id, const __po_hi_local_port_t local_port)
{ {
return (__po_hi_gqueues_n_destinations[task_id][local_port]); return (__po_hi_gqueues_n_destinations[task_id][local_port]);
} }
...@@ -441,23 +451,3 @@ __po_hi_port_id_t po_hi_gqueues_queue_is_empty( __po_hi_task_id id) ...@@ -441,23 +451,3 @@ __po_hi_port_id_t po_hi_gqueues_queue_is_empty( __po_hi_task_id id)
{ {
return __po_hi_gqueues_queue_is_empty[id]; return __po_hi_gqueues_queue_is_empty[id];
} }
__po_hi_request_t*
__po_hi_gqueues_get_request(__po_hi_task_id id, __po_hi_local_port_t port)
{
__po_hi_request_t* request ;
__po_hi_request_t* ptr ;
request = calloc(1,sizeof(__po_hi_request_t));
ptr = &__po_hi_gqueues_most_recent_values[id][port];
if (__po_hi_gqueues_used_size[id][port] == 0)
{
memcpy (request, ptr, sizeof (__po_hi_request_t));
//update_runtime (id, port, ptr);
}
else
{
ptr = ((__po_hi_request_t *) &__po_hi_gqueues[id][port]) + __po_hi_gqueues_first[id][port] + __po_hi_gqueues_offsets[id][port];
memcpy (request, ptr, sizeof (__po_hi_request_t));
} return request;
}
...@@ -290,9 +290,7 @@ int __po_hi_initialize () ...@@ -290,9 +290,7 @@ int __po_hi_initialize ()
/*! /*!
* Initialize the monitoring trace if needed * Initialize the monitoring trace if needed
*/ */
printf("soon monitoring\n ");
#if defined (MONITORING) #if defined (MONITORING)
printf("trace_init");
trace_initialize (); trace_initialize ();
#endif #endif
......
...@@ -127,7 +127,7 @@ int __po_hi_sem_wait(__po_hi_sem_t* sem) ...@@ -127,7 +127,7 @@ int __po_hi_sem_wait(__po_hi_sem_t* sem)
} }
#elif defined (__PO_HI_RTEMS_CLASSIC_API) #elif defined (__PO_HI_RTEMS_CLASSIC_API)
if (rtems_semaphore_release (sem->rtems_sem, RTEMS_WAIT, RTEMS_NO_TIMEOUT) != RTEMS_SUCCESSFUL) if (rtems_semaphore_release (sem->rtems_sem) != RTEMS_SUCCESSFUL)
{ {
__PO_HI_DEBUG_CRITICAL ("[SEMAPHORE] Error when trying to release to next obtain the rtems_sem\n"); __PO_HI_DEBUG_CRITICAL ("[SEMAPHORE] Error when trying to release to next obtain the rtems_sem\n");
return __PO_HI_ERROR_SEM_WAIT; return __PO_HI_ERROR_SEM_WAIT;
...@@ -253,7 +253,7 @@ int __po_hi_sem_mutex_release(__po_hi_sem_t* sem){ ...@@ -253,7 +253,7 @@ int __po_hi_sem_mutex_release(__po_hi_sem_t* sem){
return __PO_HI_ERROR_SEM_RELEASE; return __PO_HI_ERROR_SEM_RELEASE;
} }
#elif defined (__PO_HI_RTEMS_CLASSIC_API) #elif defined (__PO_HI_RTEMS_CLASSIC_API)
if (rtems_semaphore_release (sem->rtems_sem, RTEMS_WAIT, RTEMS_NO_TIMEOUT) != RTEMS_SUCCESSFUL) if (rtems_semaphore_release (sem->rtems_sem) != RTEMS_SUCCESSFUL)
{ {
__PO_HI_DEBUG_CRITICAL ("[SEMAPHORE MUTEX] Error when trying to release the rtems_sem\n"); __PO_HI_DEBUG_CRITICAL ("[SEMAPHORE MUTEX] Error when trying to release the rtems_sem\n");
return __PO_HI_ERROR_SEM_RELEASE; return __PO_HI_ERROR_SEM_RELEASE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment