?? zl5011xtdm.c
字號:
tdm.stream the stream that the channel to be removed is from
tdm.channel which channel to remove
osExclusionEnable ZL5011X_TRUE to enable OS exclusion
Structure outputs:
None
Returns:
zlStatusE
Remarks:
None
*******************************************************************************/
zlStatusE zl5011xContextRemoveChannelRx(zl5011xParamsS *zl5011xParams,
zl5011xContextRemoveChannelS *par)
{
zlStatusE status = ZL5011X_OK;
zl5011xBooleanE gotDevice = ZL5011X_FALSE;
/* do some parameter checking */
status = ZL5011X_CHECK_POINTERS(zl5011xParams, par);
if (status == ZL5011X_OK)
{
status = ZL5011X_CHECK_RUNNING(zl5011xParams);
}
if ((status == ZL5011X_OK) && (par->osExclusionEnable == ZL5011X_TRUE))
{
/* get access to the device */
status = zl5011xGetDevice(zl5011xParams, ZL5011X_GET_DEVICE_TIMEOUT_MODE);
if (status == ZL5011X_OK)
{
gotDevice = ZL5011X_TRUE;
}
}
/* check that the Wan Rx context is valid */
if (status == ZL5011X_OK)
{
status = zl5011xContextCheckRx(zl5011xParams, par->context, ZL5011X_CHECK_CONTEXT_MODIFY);
}
/* main function code starts */
if (status == ZL5011X_OK)
{
ZL5011X_TRACE_CONTEXT(ZL5011X_TDM_FN_ID, par->context,
"zl5011xContextRemoveChannelRx: ctxt %3d",
par->context, 0, 0, 0, 0, 0);
status = zl5011xPlaRemoveChan(zl5011xParams, par->context, par->tdm);
}
if (gotDevice == ZL5011X_TRUE)
{
if (status == ZL5011X_OK)
{
status = zl5011xReleaseDevice(zl5011xParams);
}
else
{
/* already have an error code, so don't overwrite it */
(void)zl5011xReleaseDevice(zl5011xParams);
}
}
return status;
}
/*******************************************************************************
Function:
zl5011xContextRemoveChannelTxStructInit
Description:
Initialises structure used by zl5011xContextRemoveChannelTx function.
Inputs:
zl5011xParams Pointer to the structure for this device instance
par Pointer to the structure for configuration items.
See main function
Returns:
zlStatusE
Remarks:
None
*******************************************************************************/
zlStatusE zl5011xContextRemoveChannelTxStructInit(zl5011xParamsS *zl5011xParams,
zl5011xContextRemoveChannelS *par)
{
zlStatusE status = ZL5011X_OK;
/* do some parameter checking */
status = ZL5011X_CHECK_POINTERS(zl5011xParams, par);
if (status == ZL5011X_OK)
{
ZL5011X_TRACE(ZL5011X_TDM_FN_ID,
"zl5011xContextRemoveChannelTxStructInit:",
0, 0, 0, 0, 0, 0);
par->context = (Uint32T)ZL5011X_INVALID_CONTEXT;
par->tdm.stream = (Uint8T)ZL5011X_INVALID_STREAM;
par->tdm.channel = (Uint8T)ZL5011X_INVALID_CHANNEL;
par->osExclusionEnable = ZL5011X_TRUE;
}
return status;
}
/*******************************************************************************
Function:
zl5011xContextRemoveChannelTx
Description:
Removes a channel from a context.
Inputs:
zl5011xParams Pointer to the structure for this device instance
par Pointer to the structure for configuration items. See below:
Structure inputs:
context context to be used
tdm.stream the stream that the channel to be removed is from
tdm.channel which channel to remove
osExclusionEnable ZL5011X_TRUE to enable OS exclusion
Structure outputs:
None
Returns:
zlStatusE
Remarks:
None
*******************************************************************************/
zlStatusE zl5011xContextRemoveChannelTx(zl5011xParamsS *zl5011xParams,
zl5011xContextRemoveChannelS *par)
{
zlStatusE status = ZL5011X_OK;
zl5011xBooleanE gotDevice = ZL5011X_FALSE;
/* do some parameter checking */
status = ZL5011X_CHECK_POINTERS(zl5011xParams, par);
if (status == ZL5011X_OK)
{
status = ZL5011X_CHECK_RUNNING(zl5011xParams);
}
if ((status == ZL5011X_OK) && (par->osExclusionEnable == ZL5011X_TRUE))
{
/* get access to the device */
status = zl5011xGetDevice(zl5011xParams, ZL5011X_GET_DEVICE_TIMEOUT_MODE);
if (status == ZL5011X_OK)
{
gotDevice = ZL5011X_TRUE;
}
}
/* check that the Wan Tx context is valid */
if (status == ZL5011X_OK)
{
status = zl5011xContextCheckTx(zl5011xParams, par->context, ZL5011X_CHECK_CONTEXT_MODIFY);
}
/* main function code starts */
if (status == ZL5011X_OK)
{
ZL5011X_TRACE_CONTEXT(ZL5011X_TDM_FN_ID, par->context,
"zl5011xContextRemoveChannelTx: ctxt %3d", par->context, 0, 0, 0, 0, 0);
status = zl5011xTfmRemoveChan(zl5011xParams, par->context, par->tdm);
}
if (gotDevice == ZL5011X_TRUE)
{
if (status == ZL5011X_OK)
{
status = zl5011xReleaseDevice(zl5011xParams);
}
else
{
/* already have an error code, so don't overwrite it */
(void)zl5011xReleaseDevice(zl5011xParams);
}
}
return status;
}
/*******************************************************************************
Function:
zl5011xWanRxPayloadConfigStructInit
Description:
Initialises structure used by zl5011xWanRxPayloadConfig function.
Inputs:
zl5011xParams Pointer to the structure for this device instance
par Pointer to the structure for configuration items.
See main function
Returns:
zlStatusE
Remarks:
None
*******************************************************************************/
zlStatusE zl5011xWanRxPayloadConfigStructInit(zl5011xParamsS *zl5011xParams,
zl5011xWanRxPayloadConfigS *par)
{
zlStatusE status = ZL5011X_OK;
/* do some parameter checking */
status = ZL5011X_CHECK_POINTERS(zl5011xParams, par);
if (status == ZL5011X_OK)
{
ZL5011X_TRACE(ZL5011X_TDM_FN_ID,
"zl5011xWanRxPayloadConfigStructInit:",
0, 0, 0, 0, 0, 0);
par->context = (Uint32T)ZL5011X_INVALID_CONTEXT;
par->numberOfFrames = 1; /* Either num bytes or frames must be zero */
par->numberOfBytes = 0;
par->unframedForceMultiple64Bits = ZL5011X_FALSE;
par->osExclusionEnable = ZL5011X_TRUE;
}
return status;
}
/*******************************************************************************
Function:
zl5011xWanRxPayloadConfig
Description:
Controls the payload size for a context. The payload is set in number of
frames or a number of bytes
Inputs:
zl5011xParams Pointer to the structure for this device instance
par Pointer to the structure for configuration items. See below:
Structure inputs:
context context to be used
numberOfFrames the number of frames to assemble as payload for the packet
numberOfBytes the number of bytes to assemble as payload for the packet
unframedForceMultiple64Bits ZL5011X_TRUE for the payload to be a multiple
of 8 bytes - only possible if bit stuffing is not enabled
osExclusionEnable ZL5011X_TRUE to enable OS exclusion
Structure outputs:
None
Returns:
zlStatusE
Remarks:
The payload size is initialised to a single frame when the context is
created. The payload size is actually written to the device when the
context is updated.
Exactly one of numberOfFrames or numberOfBytes must be specified and the other
set to zero. For framed mode the numberOfFrames will be used
*******************************************************************************/
zlStatusE zl5011xWanRxPayloadConfig(zl5011xParamsS *zl5011xParams,
zl5011xWanRxPayloadConfigS *par)
{
zlStatusE status = ZL5011X_OK;
zl5011xBooleanE gotDevice = ZL5011X_FALSE;
/* do some parameter checking */
status = ZL5011X_CHECK_POINTERS(zl5011xParams, par);
if (status == ZL5011X_OK)
{
if (zl5011xParams->wanIf.wanConnectionMode == ZL5011X_WAN_CONNECTION_UNFRAMED)
{ /* Unframed mode, either numberOfFrames or numberOfBytes parameter can be used */
if ((par->numberOfFrames == 0) && (par->numberOfBytes == 0))
{
status = ZL5011X_PARAMETER_INVALID;
}
}
else
{ /* Framed mode, numberOfFrames parameter will be used */
if (par->numberOfFrames == 0)
{
status = ZL5011X_PARAMETER_INVALID;
}
}
}
if (status == ZL5011X_OK)
{
status = ZL5011X_CHECK_RUNNING(zl5011xParams);
}
if ((status == ZL5011X_OK) && (par->osExclusionEnable == ZL5011X_TRUE))
{
/* get access to the device */
status = zl5011xGetDevice(zl5011xParams, ZL5011X_GET_DEVICE_TIMEOUT_MODE);
if (status == ZL5011X_OK)
{
gotDevice = ZL5011X_TRUE;
}
}
/* check that the Wan Rx context is valid */
if (status == ZL5011X_OK)
{
status = zl5011xContextCheckRx(zl5011xParams, par->context, ZL5011X_CHECK_CONTEXT_MODIFY);
}
/* main function code starts */
if (status == ZL5011X_OK)
{
ZL5011X_TRACE_CONTEXT(ZL5011X_TDM_FN_ID, par->context,
"zl5011xWanRxPayloadConfig: ctxt %3d",
par->context, 0, 0, 0, 0, 0);
zl5011xParams->wanIf.plaCurrent.context[par->context].payloadFrames = par->numberOfFrames;
zl5011xParams->wanIf.plaCurrent.context[par->context].payloadBytes = par->numberOfBytes;
if (zl5011xParams->wanIf.wanBitStuffingEnabled == ZL5011X_FALSE)
{
zl5011xParams->wanIf.plaCurrent.context[par->context].unframedForceMultiple64Bits = par->unframedForceMultiple64Bits;
}
else
{
zl5011xParams->wanIf.plaCurrent.context[par->context].unframedForceMultiple64Bits = ZL5011X_FALSE;
}
}
if (gotDevice == ZL5011X_TRUE)
{
if (status == ZL5011X_OK)
{
status = zl5011xReleaseDevice(zl5011xParams);
}
else
{
/* already have an error code, so don't overwrite it */
(void)zl5011xReleaseDevice(zl5011xParams);
}
}
return status;
}
/*******************************************************************************
Function:
zl5011xWanRxGetPayloadLengthStructInit
Description:
Initialises structure used by zl5011xWanRxGetPayloadLength function.
Inputs:
zl5011xParams Pointer to the structure for this device instance
par Pointer to the structure for configuration items.
See main function
Returns:
zlStatusE
Remarks:
None
*******************************************************************************/
zlStatusE zl5011xWanRxGetPayloadLengthStructInit(zl5011xParamsS *zl5011xParams,
zl5011xWanRxGetPayloadLengthS *par)
{
zlStatusE status = ZL5011X_OK;
/* do some parameter checking */
status = ZL5011X_CHECK_POINTERS(zl5011xParams, par);
if (status == ZL5011X_OK)
{
"zl5011xWanRxGetPayloadLengthStructInit:",
0, 0, 0, 0, 0, 0);
par->context = (Uint32T)ZL5011X_INVALID_CONTEXT;
par->lengthBits = 0;
par->lengthBytes = 0;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -