📄 rzkgetqueueparameters.c
字号:
/*
* File : RZKGetQueueParameters.c
*
* Description : This file contains RZKGetQueueParameters function which
* copies the queue parameters into the user specified structure.
*
* Copyright 2004 ZiLOG Inc. ALL RIGHTS RESERVED.
*
* This file contains unpublished confidential and proprietary information
* of ZiLOG, Inc.
* NO PART OF THIS WORK MAY BE DUPLICATED, STORED, PUBLISHED OR DISCLOSED
* IN ANY FORM WITHOUT THE PRIOR WRITTEN CONSENT OF ZiLOG, INC.
* This is not a license and no use of any kind of this work is authorized
* in the absence of a written license granted by ZiLOG, Inc. in ZiLOG's
* sole discretion
*/
#include "ZSysgen.h"
#include "ZTypes.h"
#include "ZThread.h"
#include "ZQueue.h"
#include "ZMessageQ.h"
#define pMessageQueue ((RZK_MESSAGEQUEUE_t *) hMessageQueue)
/** extern functions */
extern UINT GetMaxCount(RZK_TCB_t *);
/*
* Function : RZKGetQueueParameters
*
* Description : Copies the queue parameters into the user specified structure.
*
* Inputs : hMessageQueue - handle to the message queue whose parameters are to be copied.
* pQueueParams - pointer to the MESSAGEQ_PARAMS_t structure which receives the queue parameters.
*
* Outputs : RZKERR_SUCCESS - If the parameters are successfully copied.
* RZKERR_OBJECTBUSY- If the message control block is being used by other thread exclusively.
* RZKERR_INVALID_HANDLE - If the hMessageQueue parameter is invalid.
* RZKERR_INVALID_ARGUMENTS - If pMessageQueue parameter is invalid
*
* Dependencies : None
*/
RZK_STATUS_t RZKGetQueueParameters
(
RZK_MESSAGEQHANDLE_t hMessageQueue,
RZK_MESSAGEQPARAMS_t *pQueueParams
)
{
/* Check for the validity of the arguments */
#ifdef RZK_DEBUG
if ( (pMessageQueue==NULL) || ( pMessageQueue -> uState == 0 ) ||
( pMessageQueue -> magic_num != MAGIC_NUM_MESSAGEQ))
return RZKERR_INVALID_HANDLE;
if ( pQueueParams == NULL )
return RZKERR_INVALID_ARGUMENTS;
#endif
#ifndef RZK_PERFORMANCE
if ( ! ( pMessageQueue -> uState & OBJECT_CREATED))
return RZKERR_CB_BUSY;
#endif
/* Fill up the Queue information in the structure pointed by pQueueParams*/
pQueueParams->uState = pMessageQueue->uState;
pQueueParams->uQueueLength = pMessageQueue->uQueueLength;
pQueueParams->uMaxMessageSize = pMessageQueue->uTotalMessageSize;
pQueueParams->nNumThreads =
GetMaxCount(pMessageQueue->pResNext);
pQueueParams->uMessageSpaceLeft = pMessageQueue->uMessageSpaceLeft;
pQueueParams->pStart = pMessageQueue->pStart;
return RZKERR_SUCCESS;
} /* end of RZKGetQueueParams */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -