Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
PolyORB-HI-C
Commits
13245b54
Commit
13245b54
authored
May 30, 2018
by
Antonia Francis
Browse files
* Documentation and suppression of useless elements
parent
7b6734b4
Changes
5
Hide whitespace changes
Inline
Side-by-side
include/po_hi_gqueue.h
View file @
13245b54
...
...
@@ -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,
* 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 port number of port that received the 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,
__po_hi_local_port_t
port
,
__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
(
const
__po_hi_task_id
task_id
,
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
,
const
__po_hi_local_port_t
local_port
,
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
);
...
...
@@ -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
);
/**
* \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_request_t
*
__po_hi_gqueues_get_request
(
__po_hi_task_id
id
,
__po_hi_local_port_t
port
);
#endif
/* __PO_HI_GQUEUE_H__ */
src/drivers/po_hi_driver_rtems_drvmgr_ethernet.c
View file @
13245b54
...
...
@@ -21,6 +21,8 @@
#include <po_hi_returns.h>
#include <po_hi_gqueue.h>
#include <po_hi_main.h>
#include <po_hi_protected.h>
#include <drivers/po_hi_driver_rasta_common.h>
#include <drivers/po_hi_rtems_utils.h>
#include <drivers/po_hi_driver_leon_eth.h>
...
...
src/po_hi_gqueue.c
View file @
13245b54
...
...
@@ -197,7 +197,7 @@ __po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id,
assert
(
result
==
__PO_HI_SUCCESS
);
if
(
__po_hi_gqueue
s_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
));
}
...
...
@@ -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
);
if
(
__po_hi_gqueue
s
_used_size
[
id
][
port
]
==
__po_hi_gqueue
s_sizes
[
id
][
port
]
)
if
(
__po_hi_gqueue_used_size
(
id
,
port
)
==
__po_hi_gqueue
_get_port_size
(
id
,
port
)
)
{
/* Releasing only a mutex */
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,
__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_INSTRUMENTATION_VCD_WRITE
(
"r%d p%d.%d
\n
"
,
__po_hi_gqueue
s
_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_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,
__DEBUGMSG
(
"GQUEUE_SEM_MUTEX_WAIT %d %d
\n
"
,
id
,
result
);
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
);
...
...
@@ -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
)
{
if
(
__po_hi_gqueue
s_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 */
}
else
{
return
(
__po_hi_gqueue
s
_used_size
[
id
][
port
]
);
return
(
__po_hi_gqueue_used_size
(
id
,
port
)
);
}
}
int
__po_hi_gqueue_get_value
(
__po_hi_task_id
id
,
__po_hi_local_port_t
port
,
__po_hi_request_t
*
request
)
...
...
@@ -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
);
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
* the thread.
*/
if
(
__po_hi_gqueue
s_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
)
{
...
...
@@ -334,12 +342,10 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
assert
(
res_sem
==
__PO_HI_SUCCESS
);
}
}
#if defined (MONITORING)
record_event
(
ANY
,
GET_VALUE
,
id
,
invalid_port_t
,
invalid_port_t
,
port
,
invalid_local_port_t
,
request
);
#endif
if
(
__po_hi_gqueues_used_size
[
id
][
port
]
==
0
)
/*
* The request is set up
*/
if
(
__po_hi_gqueue_used_size
(
id
,
port
)
==
0
)
{
memcpy
(
request
,
ptr
,
sizeof
(
__po_hi_request_t
));
//update_runtime (id, port, ptr);
...
...
@@ -350,6 +356,10 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
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
);
/* 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)
there is a next value or not */
/* XXX change and use assert ? */
if
(
__po_hi_gqueue
s_sizes
[
id
][
port
]
==
__PO_HI_GQUEUE_FIFO_INDATA
)
if
(
__po_hi_gqueue
_get_port_size
(
id
,
port
)
==
__PO_HI_GQUEUE_FIFO_INDATA
)
{
return
1
;
}
...
...
@@ -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_INSTRUMENTATION_VCD_WRITE
(
"r%d p%d.%d
\n
"
,
__po_hi_gqueue
s
_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_gqueue
s
_used_size
[
id
][
port
]
==
0
)
if
(
__po_hi_gqueue_used_size
(
id
,
port
)
==
0
)
{
__po_hi_gqueues_n_empty
[
id
]
++
;
__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
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
]);
}
...
...
@@ -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
];
}
__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
;
}
src/po_hi_main.c
View file @
13245b54
...
...
@@ -290,9 +290,7 @@ int __po_hi_initialize ()
/*!
* Initialize the monitoring trace if needed
*/
printf
(
"soon monitoring
\n
"
);
#if defined (MONITORING)
printf
(
"trace_init"
);
trace_initialize
();
#endif
...
...
src/po_hi_semaphore.c
View file @
13245b54
...
...
@@ -127,7 +127,7 @@ int __po_hi_sem_wait(__po_hi_sem_t* sem)
}
#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
"
);
return
__PO_HI_ERROR_SEM_WAIT
;
...
...
@@ -253,7 +253,7 @@ int __po_hi_sem_mutex_release(__po_hi_sem_t* sem){
return
__PO_HI_ERROR_SEM_RELEASE
;
}
#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
"
);
return
__PO_HI_ERROR_SEM_RELEASE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment