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,22 +14,23 @@
|
|||||||
#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:
|
||||||
return E_OK;
|
return E_OK;
|
||||||
case CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
|
case CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
|
||||||
return E_TMOUT;
|
return E_TMOUT;
|
||||||
case CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
|
case CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
|
||||||
return E_PAR;
|
return E_PAR;
|
||||||
case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
|
case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
|
||||||
return E_TMOUT;
|
return E_TMOUT;
|
||||||
case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
|
case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
|
||||||
return E_TMOUT;
|
return E_TMOUT;
|
||||||
default:
|
default:
|
||||||
return E_ID;
|
return E_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -43,31 +46,30 @@ ER _ITRON_Message_buffer_Translate_core_message_buffer_return_code(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void _ITRON_Message_buffer_Manager_initialization(
|
void _ITRON_Message_buffer_Manager_initialization(
|
||||||
unsigned32 maximum_message_buffers
|
unsigned32 maximum_message_buffers
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_ITRON_Message_buffer_Information, /* object information table */
|
&_ITRON_Message_buffer_Information, /* object information table */
|
||||||
OBJECTS_ITRON_MESSAGE_BUFFERS, /* object class */
|
OBJECTS_ITRON_MESSAGE_BUFFERS, /* object class */
|
||||||
FALSE, /* TRUE if this is a
|
FALSE, /* TRUE if this is a
|
||||||
global object class */
|
global object class */
|
||||||
maximum_message_buffers, /* maximum objects of this class */
|
maximum_message_buffers, /* maximum objects of this class */
|
||||||
sizeof( ITRON_Message_buffer_Control ), /* size of this
|
sizeof( ITRON_Message_buffer_Control ), /* size of this
|
||||||
object's control
|
object's control
|
||||||
block */
|
block */
|
||||||
FALSE, /* TRUE if names for this
|
FALSE, /* TRUE if names for this
|
||||||
object are strings */
|
object are strings */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each
|
RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each
|
||||||
object's name */
|
object's name */
|
||||||
FALSE /* TRUE if this class is threads */
|
FALSE /* TRUE if this class is threads */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
|
||||||
* Register the MP Process Packet routine.
|
|
||||||
*
|
|
||||||
* NOTE: No MP Support YET in RTEMS ITRON implementation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Register the MP Process Packet routine.
|
||||||
|
*
|
||||||
|
* NOTE: No MP Support YET in RTEMS ITRON implementation.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -75,71 +77,71 @@ void _ITRON_Message_buffer_Manager_initialization(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER cre_mbf(
|
ER cre_mbf(
|
||||||
ID mbfid,
|
ID mbfid,
|
||||||
T_CMBF *pk_cmbf
|
T_CMBF *pk_cmbf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CORE_message_queue_Attributes the_message_queue_attributes;
|
CORE_message_queue_Attributes the_message_queue_attributes;
|
||||||
ITRON_Message_buffer_Control *the_message_buffer;
|
ITRON_Message_buffer_Control *the_message_buffer;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bad pointer to the attributes structure
|
* Bad pointer to the attributes structure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !pk_cmbf )
|
if ( !pk_cmbf )
|
||||||
return E_PAR;
|
return E_PAR;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bits were set that were note defined.
|
* Bits were set that were note defined.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (pk_cmbf->mbfatr & ~(TA_TPRI))
|
if (pk_cmbf->mbfatr & ~(TA_TPRI))
|
||||||
return E_RSATR;
|
return E_RSATR;
|
||||||
|
|
||||||
if (pk_cmbf->bufsz < 0 || pk_cmbf->maxmsz < 0)
|
if (pk_cmbf->bufsz < 0 || pk_cmbf->maxmsz < 0)
|
||||||
return E_PAR;
|
return E_PAR;
|
||||||
|
|
||||||
if (pk_cmbf->bufsz < pk_cmbf->maxmsz)
|
if (pk_cmbf->bufsz < pk_cmbf->maxmsz)
|
||||||
return E_PAR;
|
return E_PAR;
|
||||||
|
|
||||||
_Thread_Disable_dispatch(); /* prevents deletion */
|
_Thread_Disable_dispatch(); /* prevents deletion */
|
||||||
|
|
||||||
the_message_buffer = _ITRON_Message_buffer_Allocate(mbfid);
|
the_message_buffer = _ITRON_Message_buffer_Allocate(mbfid);
|
||||||
if ( !the_message_buffer ) {
|
if ( !the_message_buffer ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
return _ITRON_Message_buffer_Clarify_allocation_id_error(mbfid);
|
return _ITRON_Message_buffer_Clarify_allocation_id_error(mbfid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pk_cmbf->mbfatr & TA_TPRI )
|
if ( pk_cmbf->mbfatr & TA_TPRI )
|
||||||
the_message_queue_attributes.discipline =
|
the_message_queue_attributes.discipline =
|
||||||
CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY;
|
CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY;
|
||||||
else
|
else
|
||||||
the_message_queue_attributes.discipline =
|
the_message_queue_attributes.discipline =
|
||||||
CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
|
CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
|
||||||
|
|
||||||
_CORE_message_queue_Initialize(
|
_CORE_message_queue_Initialize(
|
||||||
&the_message_buffer->message_queue,
|
&the_message_buffer->message_queue,
|
||||||
OBJECTS_ITRON_MESSAGE_BUFFERS,
|
OBJECTS_ITRON_MESSAGE_BUFFERS,
|
||||||
&the_message_queue_attributes,
|
&the_message_queue_attributes,
|
||||||
pk_cmbf->bufsz / pk_cmbf->maxmsz,
|
pk_cmbf->bufsz / pk_cmbf->maxmsz,
|
||||||
pk_cmbf->maxmsz,
|
pk_cmbf->maxmsz,
|
||||||
NULL /* Multiprocessing not supported */
|
NULL /* Multiprocessing not supported */
|
||||||
);
|
);
|
||||||
|
|
||||||
_ITRON_Objects_Open( &_ITRON_Message_buffer_Information,
|
_ITRON_Objects_Open( &_ITRON_Message_buffer_Information,
|
||||||
&the_message_buffer->Object );
|
&the_message_buffer->Object );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
|
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -147,37 +149,36 @@ ER cre_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER del_mbf(
|
ER del_mbf(
|
||||||
ID mbfid
|
ID mbfid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ITRON_Message_buffer_Control *the_message_buffer;
|
ITRON_Message_buffer_Control *the_message_buffer;
|
||||||
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 */
|
||||||
return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
|
return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
|
||||||
|
|
||||||
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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
#endif
|
#endif
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -185,10 +186,10 @@ ER del_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER snd_mbf(
|
ER snd_mbf(
|
||||||
ID mbfid,
|
ID mbfid,
|
||||||
VP msg,
|
VP msg,
|
||||||
INT msgsz
|
INT msgsz
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
@@ -198,36 +199,36 @@ ER snd_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER psnd_mbf(
|
ER psnd_mbf(
|
||||||
ID mbfid,
|
ID mbfid,
|
||||||
VP msg,
|
VP msg,
|
||||||
INT msgsz
|
INT msgsz
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ITRON_Message_buffer_Control *the_message_buffer;
|
ITRON_Message_buffer_Control *the_message_buffer;
|
||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
CORE_message_queue_Status status;
|
CORE_message_queue_Status status;
|
||||||
|
|
||||||
if (msgsz <= 0 || !msg)
|
if (msgsz <= 0 || !msg)
|
||||||
return E_PAR;
|
return E_PAR;
|
||||||
|
|
||||||
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 */
|
||||||
return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
|
return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
status = _CORE_message_queue_Submit(
|
status = _CORE_message_queue_Submit(
|
||||||
&the_message_buffer->message_queue,
|
&the_message_buffer->message_queue,
|
||||||
msg,
|
msg,
|
||||||
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();
|
);
|
||||||
return
|
_Thread_Enable_dispatch();
|
||||||
_ITRON_Message_buffer_Translate_core_message_buffer_return_code(
|
return
|
||||||
status);
|
_ITRON_Message_buffer_Translate_core_message_buffer_return_code(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -246,13 +247,13 @@ ER psnd_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER tsnd_mbf(
|
ER tsnd_mbf(
|
||||||
ID mbfid,
|
ID mbfid,
|
||||||
VP msg,
|
VP msg,
|
||||||
INT msgsz,
|
INT msgsz,
|
||||||
TMO tmout
|
TMO tmout
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -260,12 +261,12 @@ ER tsnd_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER rcv_mbf(
|
ER rcv_mbf(
|
||||||
VP msg,
|
VP msg,
|
||||||
INT *p_msgsz,
|
INT *p_msgsz,
|
||||||
ID mbfid
|
ID mbfid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return trcv_mbf(msg, p_msgsz, mbfid, TMO_FEVR);
|
return trcv_mbf(msg, p_msgsz, mbfid, TMO_FEVR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -273,12 +274,12 @@ ER rcv_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER prcv_mbf(
|
ER prcv_mbf(
|
||||||
VP msg,
|
VP msg,
|
||||||
INT *p_msgsz,
|
INT *p_msgsz,
|
||||||
ID mbfid
|
ID mbfid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return trcv_mbf(msg, p_msgsz, mbfid, TMO_POL);
|
return trcv_mbf(msg, p_msgsz, mbfid, TMO_POL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -286,54 +287,52 @@ ER prcv_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER trcv_mbf(
|
ER trcv_mbf(
|
||||||
VP msg,
|
VP msg,
|
||||||
INT *p_msgsz,
|
INT *p_msgsz,
|
||||||
ID mbfid,
|
ID mbfid,
|
||||||
TMO tmout
|
TMO tmout
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ITRON_Message_buffer_Control *the_message_buffer;
|
ITRON_Message_buffer_Control *the_message_buffer;
|
||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
CORE_message_queue_Status status;
|
CORE_message_queue_Status status;
|
||||||
boolean wait;
|
boolean wait;
|
||||||
Watchdog_Interval interval;
|
Watchdog_Interval interval;
|
||||||
|
|
||||||
interval = 0;
|
interval = 0;
|
||||||
if (tmout == TMO_POL) {
|
if (tmout == TMO_POL) {
|
||||||
wait = FALSE;
|
wait = FALSE;
|
||||||
} else {
|
} else {
|
||||||
wait = TRUE;
|
wait = TRUE;
|
||||||
if (tmout != TMO_FEVR)
|
if (tmout != TMO_FEVR)
|
||||||
interval = TOD_MILLISECONDS_TO_TICKS(tmout);
|
interval = TOD_MILLISECONDS_TO_TICKS(tmout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wait && _ITRON_Is_in_non_task_state() )
|
if (wait && _ITRON_Is_in_non_task_state() )
|
||||||
return E_CTX;
|
return E_CTX;
|
||||||
|
|
||||||
if (!p_msgsz || !msg || tmout <= -2)
|
if (!p_msgsz || !msg || tmout <= -2)
|
||||||
return E_PAR;
|
return E_PAR;
|
||||||
|
|
||||||
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 */
|
||||||
return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
|
return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
_CORE_message_queue_Seize(
|
_CORE_message_queue_Seize(
|
||||||
&the_message_buffer->message_queue,
|
&the_message_buffer->message_queue,
|
||||||
the_message_buffer->Object.id,
|
the_message_buffer->Object.id,
|
||||||
msg,
|
msg,
|
||||||
p_msgsz,
|
p_msgsz,
|
||||||
wait,
|
wait,
|
||||||
interval);
|
interval
|
||||||
_Thread_Enable_dispatch();
|
);
|
||||||
status =
|
_Thread_Enable_dispatch();
|
||||||
(CORE_message_queue_Status)_Thread_Executing->Wait.return_code;
|
status = (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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -351,62 +350,59 @@ ER trcv_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER ref_mbf(
|
ER ref_mbf(
|
||||||
T_RMBF *pk_rmbf,
|
T_RMBF *pk_rmbf,
|
||||||
ID mbfid
|
ID mbfid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
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 */
|
||||||
|
|
||||||
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: /* Multiprocessing not supported */
|
case OBJECTS_REMOTE: /* Multiprocessing not supported */
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
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
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(the_message_buffer->message_queue.
|
/*
|
||||||
number_of_pending_messages == 0) {
|
* Fill in the size of message to be sent
|
||||||
pk_rmbf->msgsz = 0;
|
*/
|
||||||
}
|
|
||||||
else {
|
|
||||||
CORE_message_queue_Buffer_control *the_message;
|
|
||||||
the_message = (CORE_message_queue_Buffer_control*)
|
|
||||||
the_message_buffer->message_queue.
|
|
||||||
Pending_messages.first;
|
|
||||||
pk_rmbf->msgsz = the_message->Contents.size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
if (the_core_msgq->number_of_pending_messages == 0) {
|
||||||
* Fill in the size of free buffer
|
pk_rmbf->msgsz = 0;
|
||||||
*/
|
} else {
|
||||||
|
pk_rmbf->msgsz = ((CORE_message_queue_Buffer_control *)
|
||||||
pk_rmbf->frbufsz =
|
the_core_msgq->Pending_messages.first)->Contents.size;
|
||||||
(the_message_buffer->message_queue.maximum_pending_messages-
|
|
||||||
the_message_buffer->message_queue.number_of_pending_messages)*
|
|
||||||
the_message_buffer->message_queue.maximum_message_size;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fill in whether or not there is a waiting task
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( !_Thread_queue_First(
|
|
||||||
&the_message_buffer->message_queue.Wait_queue ) )
|
|
||||||
pk_rmbf->wtsk = FALSE;
|
|
||||||
else
|
|
||||||
pk_rmbf->wtsk = TRUE;
|
|
||||||
|
|
||||||
pk_rmbf->stsk = FALSE;
|
|
||||||
_Thread_Enable_dispatch();
|
|
||||||
return E_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fill in the size of free buffer
|
||||||
|
*/
|
||||||
|
|
||||||
|
pk_rmbf->frbufsz =
|
||||||
|
(the_core_msgq->maximum_pending_messages -
|
||||||
|
the_core_msgq->number_of_pending_messages) *
|
||||||
|
the_core_msgq->maximum_message_size;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fill in whether or not there is a waiting task
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( !_Thread_queue_First(&the_core_msgq->Wait_queue ) )
|
||||||
|
pk_rmbf->wtsk = FALSE;
|
||||||
|
else
|
||||||
|
pk_rmbf->wtsk = TRUE;
|
||||||
|
|
||||||
|
pk_rmbf->stsk = FALSE;
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
return E_OK;
|
return E_OK;
|
||||||
|
}
|
||||||
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,22 +14,23 @@
|
|||||||
#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:
|
||||||
return E_OK;
|
return E_OK;
|
||||||
case CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
|
case CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
|
||||||
return E_TMOUT;
|
return E_TMOUT;
|
||||||
case CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
|
case CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
|
||||||
return E_PAR;
|
return E_PAR;
|
||||||
case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
|
case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
|
||||||
return E_TMOUT;
|
return E_TMOUT;
|
||||||
case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
|
case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
|
||||||
return E_TMOUT;
|
return E_TMOUT;
|
||||||
default:
|
default:
|
||||||
return E_ID;
|
return E_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -43,31 +46,30 @@ ER _ITRON_Message_buffer_Translate_core_message_buffer_return_code(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void _ITRON_Message_buffer_Manager_initialization(
|
void _ITRON_Message_buffer_Manager_initialization(
|
||||||
unsigned32 maximum_message_buffers
|
unsigned32 maximum_message_buffers
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_Objects_Initialize_information(
|
_Objects_Initialize_information(
|
||||||
&_ITRON_Message_buffer_Information, /* object information table */
|
&_ITRON_Message_buffer_Information, /* object information table */
|
||||||
OBJECTS_ITRON_MESSAGE_BUFFERS, /* object class */
|
OBJECTS_ITRON_MESSAGE_BUFFERS, /* object class */
|
||||||
FALSE, /* TRUE if this is a
|
FALSE, /* TRUE if this is a
|
||||||
global object class */
|
global object class */
|
||||||
maximum_message_buffers, /* maximum objects of this class */
|
maximum_message_buffers, /* maximum objects of this class */
|
||||||
sizeof( ITRON_Message_buffer_Control ), /* size of this
|
sizeof( ITRON_Message_buffer_Control ), /* size of this
|
||||||
object's control
|
object's control
|
||||||
block */
|
block */
|
||||||
FALSE, /* TRUE if names for this
|
FALSE, /* TRUE if names for this
|
||||||
object are strings */
|
object are strings */
|
||||||
RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each
|
RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each
|
||||||
object's name */
|
object's name */
|
||||||
FALSE /* TRUE if this class is threads */
|
FALSE /* TRUE if this class is threads */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
|
||||||
* Register the MP Process Packet routine.
|
|
||||||
*
|
|
||||||
* NOTE: No MP Support YET in RTEMS ITRON implementation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Register the MP Process Packet routine.
|
||||||
|
*
|
||||||
|
* NOTE: No MP Support YET in RTEMS ITRON implementation.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -75,71 +77,71 @@ void _ITRON_Message_buffer_Manager_initialization(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER cre_mbf(
|
ER cre_mbf(
|
||||||
ID mbfid,
|
ID mbfid,
|
||||||
T_CMBF *pk_cmbf
|
T_CMBF *pk_cmbf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CORE_message_queue_Attributes the_message_queue_attributes;
|
CORE_message_queue_Attributes the_message_queue_attributes;
|
||||||
ITRON_Message_buffer_Control *the_message_buffer;
|
ITRON_Message_buffer_Control *the_message_buffer;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bad pointer to the attributes structure
|
* Bad pointer to the attributes structure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !pk_cmbf )
|
if ( !pk_cmbf )
|
||||||
return E_PAR;
|
return E_PAR;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bits were set that were note defined.
|
* Bits were set that were note defined.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (pk_cmbf->mbfatr & ~(TA_TPRI))
|
if (pk_cmbf->mbfatr & ~(TA_TPRI))
|
||||||
return E_RSATR;
|
return E_RSATR;
|
||||||
|
|
||||||
if (pk_cmbf->bufsz < 0 || pk_cmbf->maxmsz < 0)
|
if (pk_cmbf->bufsz < 0 || pk_cmbf->maxmsz < 0)
|
||||||
return E_PAR;
|
return E_PAR;
|
||||||
|
|
||||||
if (pk_cmbf->bufsz < pk_cmbf->maxmsz)
|
if (pk_cmbf->bufsz < pk_cmbf->maxmsz)
|
||||||
return E_PAR;
|
return E_PAR;
|
||||||
|
|
||||||
_Thread_Disable_dispatch(); /* prevents deletion */
|
_Thread_Disable_dispatch(); /* prevents deletion */
|
||||||
|
|
||||||
the_message_buffer = _ITRON_Message_buffer_Allocate(mbfid);
|
the_message_buffer = _ITRON_Message_buffer_Allocate(mbfid);
|
||||||
if ( !the_message_buffer ) {
|
if ( !the_message_buffer ) {
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
return _ITRON_Message_buffer_Clarify_allocation_id_error(mbfid);
|
return _ITRON_Message_buffer_Clarify_allocation_id_error(mbfid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pk_cmbf->mbfatr & TA_TPRI )
|
if ( pk_cmbf->mbfatr & TA_TPRI )
|
||||||
the_message_queue_attributes.discipline =
|
the_message_queue_attributes.discipline =
|
||||||
CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY;
|
CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY;
|
||||||
else
|
else
|
||||||
the_message_queue_attributes.discipline =
|
the_message_queue_attributes.discipline =
|
||||||
CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
|
CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
|
||||||
|
|
||||||
_CORE_message_queue_Initialize(
|
_CORE_message_queue_Initialize(
|
||||||
&the_message_buffer->message_queue,
|
&the_message_buffer->message_queue,
|
||||||
OBJECTS_ITRON_MESSAGE_BUFFERS,
|
OBJECTS_ITRON_MESSAGE_BUFFERS,
|
||||||
&the_message_queue_attributes,
|
&the_message_queue_attributes,
|
||||||
pk_cmbf->bufsz / pk_cmbf->maxmsz,
|
pk_cmbf->bufsz / pk_cmbf->maxmsz,
|
||||||
pk_cmbf->maxmsz,
|
pk_cmbf->maxmsz,
|
||||||
NULL /* Multiprocessing not supported */
|
NULL /* Multiprocessing not supported */
|
||||||
);
|
);
|
||||||
|
|
||||||
_ITRON_Objects_Open( &_ITRON_Message_buffer_Information,
|
_ITRON_Objects_Open( &_ITRON_Message_buffer_Information,
|
||||||
&the_message_buffer->Object );
|
&the_message_buffer->Object );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
|
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -147,37 +149,36 @@ ER cre_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER del_mbf(
|
ER del_mbf(
|
||||||
ID mbfid
|
ID mbfid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ITRON_Message_buffer_Control *the_message_buffer;
|
ITRON_Message_buffer_Control *the_message_buffer;
|
||||||
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 */
|
||||||
return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
|
return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
|
||||||
|
|
||||||
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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
#endif
|
#endif
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -185,10 +186,10 @@ ER del_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER snd_mbf(
|
ER snd_mbf(
|
||||||
ID mbfid,
|
ID mbfid,
|
||||||
VP msg,
|
VP msg,
|
||||||
INT msgsz
|
INT msgsz
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
@@ -198,36 +199,36 @@ ER snd_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER psnd_mbf(
|
ER psnd_mbf(
|
||||||
ID mbfid,
|
ID mbfid,
|
||||||
VP msg,
|
VP msg,
|
||||||
INT msgsz
|
INT msgsz
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ITRON_Message_buffer_Control *the_message_buffer;
|
ITRON_Message_buffer_Control *the_message_buffer;
|
||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
CORE_message_queue_Status status;
|
CORE_message_queue_Status status;
|
||||||
|
|
||||||
if (msgsz <= 0 || !msg)
|
if (msgsz <= 0 || !msg)
|
||||||
return E_PAR;
|
return E_PAR;
|
||||||
|
|
||||||
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 */
|
||||||
return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
|
return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
status = _CORE_message_queue_Submit(
|
status = _CORE_message_queue_Submit(
|
||||||
&the_message_buffer->message_queue,
|
&the_message_buffer->message_queue,
|
||||||
msg,
|
msg,
|
||||||
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();
|
);
|
||||||
return
|
_Thread_Enable_dispatch();
|
||||||
_ITRON_Message_buffer_Translate_core_message_buffer_return_code(
|
return
|
||||||
status);
|
_ITRON_Message_buffer_Translate_core_message_buffer_return_code(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -246,13 +247,13 @@ ER psnd_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER tsnd_mbf(
|
ER tsnd_mbf(
|
||||||
ID mbfid,
|
ID mbfid,
|
||||||
VP msg,
|
VP msg,
|
||||||
INT msgsz,
|
INT msgsz,
|
||||||
TMO tmout
|
TMO tmout
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -260,12 +261,12 @@ ER tsnd_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER rcv_mbf(
|
ER rcv_mbf(
|
||||||
VP msg,
|
VP msg,
|
||||||
INT *p_msgsz,
|
INT *p_msgsz,
|
||||||
ID mbfid
|
ID mbfid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return trcv_mbf(msg, p_msgsz, mbfid, TMO_FEVR);
|
return trcv_mbf(msg, p_msgsz, mbfid, TMO_FEVR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -273,12 +274,12 @@ ER rcv_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER prcv_mbf(
|
ER prcv_mbf(
|
||||||
VP msg,
|
VP msg,
|
||||||
INT *p_msgsz,
|
INT *p_msgsz,
|
||||||
ID mbfid
|
ID mbfid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return trcv_mbf(msg, p_msgsz, mbfid, TMO_POL);
|
return trcv_mbf(msg, p_msgsz, mbfid, TMO_POL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -286,54 +287,52 @@ ER prcv_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER trcv_mbf(
|
ER trcv_mbf(
|
||||||
VP msg,
|
VP msg,
|
||||||
INT *p_msgsz,
|
INT *p_msgsz,
|
||||||
ID mbfid,
|
ID mbfid,
|
||||||
TMO tmout
|
TMO tmout
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ITRON_Message_buffer_Control *the_message_buffer;
|
ITRON_Message_buffer_Control *the_message_buffer;
|
||||||
Objects_Locations location;
|
Objects_Locations location;
|
||||||
CORE_message_queue_Status status;
|
CORE_message_queue_Status status;
|
||||||
boolean wait;
|
boolean wait;
|
||||||
Watchdog_Interval interval;
|
Watchdog_Interval interval;
|
||||||
|
|
||||||
interval = 0;
|
interval = 0;
|
||||||
if (tmout == TMO_POL) {
|
if (tmout == TMO_POL) {
|
||||||
wait = FALSE;
|
wait = FALSE;
|
||||||
} else {
|
} else {
|
||||||
wait = TRUE;
|
wait = TRUE;
|
||||||
if (tmout != TMO_FEVR)
|
if (tmout != TMO_FEVR)
|
||||||
interval = TOD_MILLISECONDS_TO_TICKS(tmout);
|
interval = TOD_MILLISECONDS_TO_TICKS(tmout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wait && _ITRON_Is_in_non_task_state() )
|
if (wait && _ITRON_Is_in_non_task_state() )
|
||||||
return E_CTX;
|
return E_CTX;
|
||||||
|
|
||||||
if (!p_msgsz || !msg || tmout <= -2)
|
if (!p_msgsz || !msg || tmout <= -2)
|
||||||
return E_PAR;
|
return E_PAR;
|
||||||
|
|
||||||
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 */
|
||||||
return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
|
return _ITRON_Message_buffer_Clarify_get_id_error(mbfid);
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
_CORE_message_queue_Seize(
|
_CORE_message_queue_Seize(
|
||||||
&the_message_buffer->message_queue,
|
&the_message_buffer->message_queue,
|
||||||
the_message_buffer->Object.id,
|
the_message_buffer->Object.id,
|
||||||
msg,
|
msg,
|
||||||
p_msgsz,
|
p_msgsz,
|
||||||
wait,
|
wait,
|
||||||
interval);
|
interval
|
||||||
_Thread_Enable_dispatch();
|
);
|
||||||
status =
|
_Thread_Enable_dispatch();
|
||||||
(CORE_message_queue_Status)_Thread_Executing->Wait.return_code;
|
status = (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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -351,62 +350,59 @@ ER trcv_mbf(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ER ref_mbf(
|
ER ref_mbf(
|
||||||
T_RMBF *pk_rmbf,
|
T_RMBF *pk_rmbf,
|
||||||
ID mbfid
|
ID mbfid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
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 */
|
||||||
|
|
||||||
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: /* Multiprocessing not supported */
|
case OBJECTS_REMOTE: /* Multiprocessing not supported */
|
||||||
case OBJECTS_ERROR:
|
case OBJECTS_ERROR:
|
||||||
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
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(the_message_buffer->message_queue.
|
/*
|
||||||
number_of_pending_messages == 0) {
|
* Fill in the size of message to be sent
|
||||||
pk_rmbf->msgsz = 0;
|
*/
|
||||||
}
|
|
||||||
else {
|
|
||||||
CORE_message_queue_Buffer_control *the_message;
|
|
||||||
the_message = (CORE_message_queue_Buffer_control*)
|
|
||||||
the_message_buffer->message_queue.
|
|
||||||
Pending_messages.first;
|
|
||||||
pk_rmbf->msgsz = the_message->Contents.size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
if (the_core_msgq->number_of_pending_messages == 0) {
|
||||||
* Fill in the size of free buffer
|
pk_rmbf->msgsz = 0;
|
||||||
*/
|
} else {
|
||||||
|
pk_rmbf->msgsz = ((CORE_message_queue_Buffer_control *)
|
||||||
pk_rmbf->frbufsz =
|
the_core_msgq->Pending_messages.first)->Contents.size;
|
||||||
(the_message_buffer->message_queue.maximum_pending_messages-
|
|
||||||
the_message_buffer->message_queue.number_of_pending_messages)*
|
|
||||||
the_message_buffer->message_queue.maximum_message_size;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fill in whether or not there is a waiting task
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( !_Thread_queue_First(
|
|
||||||
&the_message_buffer->message_queue.Wait_queue ) )
|
|
||||||
pk_rmbf->wtsk = FALSE;
|
|
||||||
else
|
|
||||||
pk_rmbf->wtsk = TRUE;
|
|
||||||
|
|
||||||
pk_rmbf->stsk = FALSE;
|
|
||||||
_Thread_Enable_dispatch();
|
|
||||||
return E_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fill in the size of free buffer
|
||||||
|
*/
|
||||||
|
|
||||||
|
pk_rmbf->frbufsz =
|
||||||
|
(the_core_msgq->maximum_pending_messages -
|
||||||
|
the_core_msgq->number_of_pending_messages) *
|
||||||
|
the_core_msgq->maximum_message_size;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fill in whether or not there is a waiting task
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( !_Thread_queue_First(&the_core_msgq->Wait_queue ) )
|
||||||
|
pk_rmbf->wtsk = FALSE;
|
||||||
|
else
|
||||||
|
pk_rmbf->wtsk = TRUE;
|
||||||
|
|
||||||
|
pk_rmbf->stsk = FALSE;
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
return E_OK;
|
return E_OK;
|
||||||
|
}
|
||||||
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user