forked from Imagelibrary/rtems
Cleaned up style.
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
* ITRON Message Buffer Manager
|
||||||
|
*
|
||||||
* The license and distribution terms for this file may be
|
* The license and distribution terms for this file may be
|
||||||
* found in the file LICENSE in this distribution or at
|
* found in the file LICENSE in this distribution or at
|
||||||
* http://www.OARcorp.com/rtems/license.html.
|
* http://www.OARcorp.com/rtems/license.html.
|
||||||
@@ -12,7 +14,8 @@
|
|||||||
#include <rtems/itron/task.h>
|
#include <rtems/itron/task.h>
|
||||||
|
|
||||||
ER _ITRON_Message_buffer_Translate_core_message_buffer_return_code(
|
ER _ITRON_Message_buffer_Translate_core_message_buffer_return_code(
|
||||||
CORE_message_queue_Status status)
|
CORE_message_queue_Status status
|
||||||
|
)
|
||||||
{
|
{
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
|
case CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
|
||||||
@@ -67,7 +70,6 @@ void _ITRON_Message_buffer_Manager_initialization(
|
|||||||
*
|
*
|
||||||
* NOTE: No MP Support YET in RTEMS ITRON implementation.
|
* NOTE: No MP Support YET in RTEMS ITRON implementation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -154,7 +156,6 @@ ER del_mbf(
|
|||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
|
|
||||||
the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location);
|
the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location);
|
||||||
|
|
||||||
switch (location) {
|
switch (location) {
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
case OBJECTS_ERROR: /* Multiprocessing not supported */
|
case OBJECTS_ERROR: /* Multiprocessing not supported */
|
||||||
@@ -162,10 +163,10 @@ ER del_mbf(
|
|||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
_CORE_message_queue_Flush(&the_message_buffer->message_queue);
|
_CORE_message_queue_Flush(&the_message_buffer->message_queue);
|
||||||
_ITRON_Objects_Close(
|
_ITRON_Objects_Close( &_ITRON_Message_buffer_Information,
|
||||||
&_ITRON_Message_buffer_Information,
|
|
||||||
&the_message_buffer->Object);
|
&the_message_buffer->Object);
|
||||||
_ITRON_Message_buffer_Free(the_message_buffer);
|
_ITRON_Message_buffer_Free(the_message_buffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If multiprocessing were supported, this is where we would announce
|
* If multiprocessing were supported, this is where we would announce
|
||||||
* the existence of the semaphore to the rest of the system.
|
* the existence of the semaphore to the rest of the system.
|
||||||
@@ -223,11 +224,11 @@ ER psnd_mbf(
|
|||||||
msgsz,
|
msgsz,
|
||||||
the_message_buffer->Object.id,
|
the_message_buffer->Object.id,
|
||||||
NULL,
|
NULL,
|
||||||
CORE_MESSAGE_QUEUE_SEND_REQUEST);
|
CORE_MESSAGE_QUEUE_SEND_REQUEST
|
||||||
|
);
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
return
|
return
|
||||||
_ITRON_Message_buffer_Translate_core_message_buffer_return_code(
|
_ITRON_Message_buffer_Translate_core_message_buffer_return_code(status);
|
||||||
status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -326,14 +327,12 @@ ER trcv_mbf(
|
|||||||
msg,
|
msg,
|
||||||
p_msgsz,
|
p_msgsz,
|
||||||
wait,
|
wait,
|
||||||
interval);
|
interval
|
||||||
|
);
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
status =
|
status = (CORE_message_queue_Status)_Thread_Executing->Wait.return_code;
|
||||||
(CORE_message_queue_Status)_Thread_Executing->Wait.return_code;
|
|
||||||
return
|
return
|
||||||
_ITRON_Message_buffer_Translate_core_message_buffer_return_code
|
_ITRON_Message_buffer_Translate_core_message_buffer_return_code(status);
|
||||||
(status);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -357,6 +356,7 @@ ER ref_mbf(
|
|||||||
{
|
{
|
||||||
ITRON_Message_buffer_Control *the_message_buffer;
|
ITRON_Message_buffer_Control *the_message_buffer;
|
||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
|
CORE_message_queue_Control *the_core_msgq;
|
||||||
|
|
||||||
if ( !pk_rmbf )
|
if ( !pk_rmbf )
|
||||||
return E_PAR; /* XXX check this error code */
|
return E_PAR; /* XXX check this error code */
|
||||||
@@ -368,20 +368,17 @@ ER ref_mbf(
|
|||||||
return _ITRON_Message_buffer_Clarify_get_id_error( mbfid );
|
return _ITRON_Message_buffer_Clarify_get_id_error( mbfid );
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
|
the_core_msgq = &the_message_buffer->message_queue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in the size of message to be sent
|
* Fill in the size of message to be sent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(the_message_buffer->message_queue.
|
if (the_core_msgq->number_of_pending_messages == 0) {
|
||||||
number_of_pending_messages == 0) {
|
|
||||||
pk_rmbf->msgsz = 0;
|
pk_rmbf->msgsz = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
pk_rmbf->msgsz = ((CORE_message_queue_Buffer_control *)
|
||||||
CORE_message_queue_Buffer_control *the_message;
|
the_core_msgq->Pending_messages.first)->Contents.size;
|
||||||
the_message = (CORE_message_queue_Buffer_control*)
|
|
||||||
the_message_buffer->message_queue.
|
|
||||||
Pending_messages.first;
|
|
||||||
pk_rmbf->msgsz = the_message->Contents.size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -389,17 +386,16 @@ ER ref_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
pk_rmbf->frbufsz =
|
pk_rmbf->frbufsz =
|
||||||
(the_message_buffer->message_queue.maximum_pending_messages-
|
(the_core_msgq->maximum_pending_messages -
|
||||||
the_message_buffer->message_queue.number_of_pending_messages)*
|
the_core_msgq->number_of_pending_messages) *
|
||||||
the_message_buffer->message_queue.maximum_message_size;
|
the_core_msgq->maximum_message_size;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in whether or not there is a waiting task
|
* Fill in whether or not there is a waiting task
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !_Thread_queue_First(
|
if ( !_Thread_queue_First(&the_core_msgq->Wait_queue ) )
|
||||||
&the_message_buffer->message_queue.Wait_queue ) )
|
|
||||||
pk_rmbf->wtsk = FALSE;
|
pk_rmbf->wtsk = FALSE;
|
||||||
else
|
else
|
||||||
pk_rmbf->wtsk = TRUE;
|
pk_rmbf->wtsk = TRUE;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
* ITRON Message Buffer Manager
|
||||||
|
*
|
||||||
* The license and distribution terms for this file may be
|
* The license and distribution terms for this file may be
|
||||||
* found in the file LICENSE in this distribution or at
|
* found in the file LICENSE in this distribution or at
|
||||||
* http://www.OARcorp.com/rtems/license.html.
|
* http://www.OARcorp.com/rtems/license.html.
|
||||||
@@ -12,7 +14,8 @@
|
|||||||
#include <rtems/itron/task.h>
|
#include <rtems/itron/task.h>
|
||||||
|
|
||||||
ER _ITRON_Message_buffer_Translate_core_message_buffer_return_code(
|
ER _ITRON_Message_buffer_Translate_core_message_buffer_return_code(
|
||||||
CORE_message_queue_Status status)
|
CORE_message_queue_Status status
|
||||||
|
)
|
||||||
{
|
{
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
|
case CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
|
||||||
@@ -67,7 +70,6 @@ void _ITRON_Message_buffer_Manager_initialization(
|
|||||||
*
|
*
|
||||||
* NOTE: No MP Support YET in RTEMS ITRON implementation.
|
* NOTE: No MP Support YET in RTEMS ITRON implementation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -154,7 +156,6 @@ ER del_mbf(
|
|||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
|
|
||||||
the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location);
|
the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location);
|
||||||
|
|
||||||
switch (location) {
|
switch (location) {
|
||||||
case OBJECTS_REMOTE:
|
case OBJECTS_REMOTE:
|
||||||
case OBJECTS_ERROR: /* Multiprocessing not supported */
|
case OBJECTS_ERROR: /* Multiprocessing not supported */
|
||||||
@@ -162,10 +163,10 @@ ER del_mbf(
|
|||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
_CORE_message_queue_Flush(&the_message_buffer->message_queue);
|
_CORE_message_queue_Flush(&the_message_buffer->message_queue);
|
||||||
_ITRON_Objects_Close(
|
_ITRON_Objects_Close( &_ITRON_Message_buffer_Information,
|
||||||
&_ITRON_Message_buffer_Information,
|
|
||||||
&the_message_buffer->Object);
|
&the_message_buffer->Object);
|
||||||
_ITRON_Message_buffer_Free(the_message_buffer);
|
_ITRON_Message_buffer_Free(the_message_buffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If multiprocessing were supported, this is where we would announce
|
* If multiprocessing were supported, this is where we would announce
|
||||||
* the existence of the semaphore to the rest of the system.
|
* the existence of the semaphore to the rest of the system.
|
||||||
@@ -223,11 +224,11 @@ ER psnd_mbf(
|
|||||||
msgsz,
|
msgsz,
|
||||||
the_message_buffer->Object.id,
|
the_message_buffer->Object.id,
|
||||||
NULL,
|
NULL,
|
||||||
CORE_MESSAGE_QUEUE_SEND_REQUEST);
|
CORE_MESSAGE_QUEUE_SEND_REQUEST
|
||||||
|
);
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
return
|
return
|
||||||
_ITRON_Message_buffer_Translate_core_message_buffer_return_code(
|
_ITRON_Message_buffer_Translate_core_message_buffer_return_code(status);
|
||||||
status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -326,14 +327,12 @@ ER trcv_mbf(
|
|||||||
msg,
|
msg,
|
||||||
p_msgsz,
|
p_msgsz,
|
||||||
wait,
|
wait,
|
||||||
interval);
|
interval
|
||||||
|
);
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
status =
|
status = (CORE_message_queue_Status)_Thread_Executing->Wait.return_code;
|
||||||
(CORE_message_queue_Status)_Thread_Executing->Wait.return_code;
|
|
||||||
return
|
return
|
||||||
_ITRON_Message_buffer_Translate_core_message_buffer_return_code
|
_ITRON_Message_buffer_Translate_core_message_buffer_return_code(status);
|
||||||
(status);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -357,6 +356,7 @@ ER ref_mbf(
|
|||||||
{
|
{
|
||||||
ITRON_Message_buffer_Control *the_message_buffer;
|
ITRON_Message_buffer_Control *the_message_buffer;
|
||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
|
CORE_message_queue_Control *the_core_msgq;
|
||||||
|
|
||||||
if ( !pk_rmbf )
|
if ( !pk_rmbf )
|
||||||
return E_PAR; /* XXX check this error code */
|
return E_PAR; /* XXX check this error code */
|
||||||
@@ -368,20 +368,17 @@ ER ref_mbf(
|
|||||||
return _ITRON_Message_buffer_Clarify_get_id_error( mbfid );
|
return _ITRON_Message_buffer_Clarify_get_id_error( mbfid );
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
|
the_core_msgq = &the_message_buffer->message_queue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in the size of message to be sent
|
* Fill in the size of message to be sent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(the_message_buffer->message_queue.
|
if (the_core_msgq->number_of_pending_messages == 0) {
|
||||||
number_of_pending_messages == 0) {
|
|
||||||
pk_rmbf->msgsz = 0;
|
pk_rmbf->msgsz = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
pk_rmbf->msgsz = ((CORE_message_queue_Buffer_control *)
|
||||||
CORE_message_queue_Buffer_control *the_message;
|
the_core_msgq->Pending_messages.first)->Contents.size;
|
||||||
the_message = (CORE_message_queue_Buffer_control*)
|
|
||||||
the_message_buffer->message_queue.
|
|
||||||
Pending_messages.first;
|
|
||||||
pk_rmbf->msgsz = the_message->Contents.size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -389,17 +386,16 @@ ER ref_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
pk_rmbf->frbufsz =
|
pk_rmbf->frbufsz =
|
||||||
(the_message_buffer->message_queue.maximum_pending_messages-
|
(the_core_msgq->maximum_pending_messages -
|
||||||
the_message_buffer->message_queue.number_of_pending_messages)*
|
the_core_msgq->number_of_pending_messages) *
|
||||||
the_message_buffer->message_queue.maximum_message_size;
|
the_core_msgq->maximum_message_size;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in whether or not there is a waiting task
|
* Fill in whether or not there is a waiting task
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !_Thread_queue_First(
|
if ( !_Thread_queue_First(&the_core_msgq->Wait_queue ) )
|
||||||
&the_message_buffer->message_queue.Wait_queue ) )
|
|
||||||
pk_rmbf->wtsk = FALSE;
|
pk_rmbf->wtsk = FALSE;
|
||||||
else
|
else
|
||||||
pk_rmbf->wtsk = TRUE;
|
pk_rmbf->wtsk = TRUE;
|
||||||
|
|||||||
Reference in New Issue
Block a user