📄 dp_api_command_functions.c
字号:
* Returns : DP_UINT_16 - Returns one of the defined display pipeline error
* codes, according to the success of the function and
* whether the compiler directive DP_ERROR_CHECKING
* is enabled. See API specification for more details
* on error types.
*
* Description : This function is used to specify the address from which source data for the
* indicated plane should be fetched.
*
***********************************************************************************************/
DP_UINT_16 DP_SetSourceAddress ( DP_UINT_16 ui16PlaneHandle,
DP_YUVStreamTypes eYUVStream,
DP_PVOID pvSourceAddress,
DP_UINT_16 ui16Stride,
DP_BOOL bUVStrideHalved,
DP_SourceDataTypes eSourceDataType )
{
#if defined DP_ERROR_CHECKING
DP_UINT_16 ui16ReturnValue = DP_STANDARD_CODE_NO_ERROR;
#else
DP_UINT_16 ui16ReturnValue = DP_ERR_NO_ERROR_CHECKING;
#endif
DP_UINT_16 ui16CommandResult;
DP_BOOL bExternalInterlacedFields;
DP_BOOL bIsScaling;
DP_pScalerModifier psLastScalerModifier = DP_NULL;
#if defined DP_SIMULATION_MODE
sprintf ( &ai8DumpComment[0], "DP_SetSourceAddress Plane : %01i Stream type : %01i Address : %x Stride : %x Stride halved (y/n) : %01i Source data type h/w val : %01i\n",
ui16PlaneHandle,
eYUVStream,
pvSourceAddress,
ui16Stride,
bUVStrideHalved,
eSourceDataType );
printf ( ai8DumpComment );
PDumpComment( ai8DumpComment );
#endif
#if defined DP_ERROR_CHECKING
if ( !DP_bIsPipelineInitialised )
ui16ReturnValue = DP_ERR_NOT_INITIALISED;
else if ( ui16PlaneHandle > DP_NO_OF_STREAMS )
ui16ReturnValue = DP_ERR_UNKNOWN_PLANE;
else if ( ( ui16Stride < DP_HARDWARE_STRIDE_COMPENSATE ) && ( eYUVStream == DP_YUV_Y_OR_SOLE_RGB ) )
ui16ReturnValue = DP_ERR_OUT_OF_RANGE;
else if ( ( eSourceDataType == DP_SOURCE_DATA_TYPE_UNKNOWN ) )
ui16ReturnValue = DP_ERR_UNKNOWN_MODE;
/* else if.... (other tests here) */
if ( ui16ReturnValue == DP_STANDARD_CODE_NO_ERROR )
{
#endif
DP_CommandSequence ( DP_COMMAND_SEQUENCE_OPERATIONS_NEW_SEQUENCE,
DP_NULL,
DP_NULL );
psLastScalerModifier = DP_pCurrentScalerModifier [ ui16PlaneHandle ];
/* Which sub stream base address is being written ? */
switch ( eYUVStream )
{
case DP_YUV_Y_OR_SOLE_RGB:
ui16CommandResult = DP_CommandSequence ( DP_COMMAND_SEQUENCE_OPERATIONS_ADD_COMMAND,
(DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][DP_STREAM_SPECIFIC_FIELD_SOURCE_BUFFER_BASE_ADDRESS],
(DP_UINT_32) pvSourceAddress );
#if defined DP_ERROR_CHECKING
if ( ui16CommandResult == DP_STANDARD_CODE_NO_ERROR )
{
#else
if (( ui16CommandResult > DP_CRITICAL_ERROR_END_MARKER ) || ( ui16CommandResult == DP_STANDARD_CODE_NO_ERROR ))
{
#endif
if ( !DP_asStreamCapabilities [ ui16PlaneHandle ].bIsCursor )
{
/* The stride is not specified independently for cursors */
ui16CommandResult = DP_CommandSequence ( DP_COMMAND_SEQUENCE_OPERATIONS_ADD_COMMAND,
(DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][DP_STREAM_SPECIFIC_FIELD_SOURCE_BUFFER_STRIDE],
(DP_UINT_32) (ui16Stride - DP_HARDWARE_STRIDE_COMPENSATE) );
}
}
#if defined DP_ERROR_CHECKING
if ( ui16CommandResult == DP_STANDARD_CODE_NO_ERROR )
{
#else
if (( ui16CommandResult > DP_CRITICAL_ERROR_END_MARKER ) || ( ui16CommandResult == DP_STANDARD_CODE_NO_ERROR ))
{
#endif
/* Store the supplied source data type */
DP_StreamSourceDataTypes [ ui16PlaneHandle ] = eSourceDataType;
bExternalInterlacedFields = DP_ExternalInterlacedFields [ ui16PlaneHandle ] ;
bIsScaling = DP_IsPlaneBeingScaled [ ui16PlaneHandle ];
DP_pCurrentScalerModifier [ ui16PlaneHandle ] = (DP_pScalerModifier) &( DP_ScalerModifiersTable [ bExternalInterlacedFields ? 1:0]
[ eSourceDataType ]
[ DP_bIsDisplayInterlaced ]
[ bIsScaling ? 1:0 ] );
#ifdef INTERLACEDENABLED
/* Independently interlaced fields are not supported for the right hand side of the split background */
if ( DP_asStreamCapabilities [ ui16PlaneHandle ].eSlaveModeSupported != DP_SLAVE_MODE_IS_SLAVE_PLANE )
{
ui16CommandResult = DP_CommandSequence ( DP_COMMAND_SEQUENCE_OPERATIONS_ADD_COMMAND,
(DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][DP_STREAM_SPECIFIC_FIELD_INTERLACED],
(DP_UINT_32) (DP_pCurrentScalerModifier [ ui16PlaneHandle ]->bInterlacedFieldBit & 0x01) );
}
#endif
}
break;
case DP_YUV_U:
ui16CommandResult = DP_CommandSequence ( DP_COMMAND_SEQUENCE_OPERATIONS_ADD_COMMAND,
(DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][DP_STREAM_SPECIFIC_FIELD_SOURCE_BUFFER_U_ADDRESS],
(DP_UINT_32) pvSourceAddress );
#if defined DP_ERROR_CHECKING
if ( ui16CommandResult == DP_STANDARD_CODE_NO_ERROR )
{
#else
if (( ui16CommandResult > DP_CRITICAL_ERROR_END_MARKER ) || ( ui16CommandResult == DP_STANDARD_CODE_NO_ERROR ))
{
#endif
ui16CommandResult = DP_CommandSequence ( DP_COMMAND_SEQUENCE_OPERATIONS_ADD_COMMAND,
(DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][DP_STREAM_SPECIFIC_FIELD_UV_STRIDE_HALVED],
(DP_UINT_32) (bUVStrideHalved & 0x01) );
}
break;
case DP_YUV_V:
ui16CommandResult = DP_CommandSequence ( DP_COMMAND_SEQUENCE_OPERATIONS_ADD_COMMAND,
(DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][DP_STREAM_SPECIFIC_FIELD_SOURCE_BUFFER_V_ADDRESS],
(DP_UINT_32) pvSourceAddress );
#if defined DP_ERROR_CHECKING
if ( ui16CommandResult == DP_STANDARD_CODE_NO_ERROR )
{
#else
if (( ui16CommandResult > DP_CRITICAL_ERROR_END_MARKER ) || ( ui16CommandResult == DP_STANDARD_CODE_NO_ERROR ))
{
#endif
ui16CommandResult = DP_CommandSequence ( DP_COMMAND_SEQUENCE_OPERATIONS_ADD_COMMAND,
(DP_FieldTarget *) &DP_asStreamFieldTargets [ui16PlaneHandle][DP_STREAM_SPECIFIC_FIELD_UV_STRIDE_HALVED],
(DP_UINT_32) (bUVStrideHalved & 0x01) );
}
break;
}
#if defined DP_ERROR_CHECKING
if ( ui16CommandResult == DP_STANDARD_CODE_NO_ERROR )
{
#else
if (( ui16CommandResult > DP_CRITICAL_ERROR_END_MARKER ) || ( ui16CommandResult == DP_STANDARD_CODE_NO_ERROR ))
{
#endif
DP_CommandSequence ( DP_COMMAND_SEQUENCE_OPERATIONS_SEND_SEQUENCE,
DP_NULL,
DP_NULL );
if ( psLastScalerModifier != DP_NULL )
{
/* We've moved position in the scaler modifier table, so adjust all affected fields accordingly */
NewScalerModifierSelected ( ui16PlaneHandle,
psLastScalerModifier,
DP_TRUE, /* Rework scaling */
DP_TRUE /* Rework source window panning */
);
}
}
else
{
/* Move back to the last scaler modifier setting */
DP_pCurrentScalerModifier [ ui16PlaneHandle ] = psLastScalerModifier;
}
#if defined DP_ERROR_CHECKING
}
#endif
#if defined DP_ERROR_CHECKING
if ( ui16CommandResult != DP_STANDARD_CODE_NO_ERROR )
{
#else
if (( ui16CommandResult < DP_CRITICAL_ERROR_END_MARKER ) && ( ui16CommandResult != DP_STANDARD_CODE_NO_ERROR ))
{
#endif
ui16ReturnValue = ui16CommandResult;
}
#if defined DP_SIMULATION_MODE
sprintf ( &ai8DumpComment[0], "DP_SetSourceAddress returns %i\n", ui16ReturnValue );
printf ( ai8DumpComment );
PDumpComment( ai8DumpComment );
#endif
return ui16ReturnValue;
}
/***********************************************************************************************
*
* Function Name : DP_SetSourceFrameSize
*
* Inputs : ui16PlaneHandle - The handle by which the plane to be used is
* identified.
*
* ui16FrameWidth - The new width of the indicated plane's source frame,
* specified in pixels.
*
* ui16FrameHeight - The new height of the indicated plane's source frame,
* specified in pixels.
*
* Outputs : None.
* Returns : DP_UINT_16 - Returns one of the defined display pipeline error
* codes, according to the success of the function and
* whether the compiler directive DP_ERROR_CHECKING
* is enabled. See API specification for more details
* on error types.
*
* Description : This function is used to specify the size of the indicated plane's source
* frame, in pixels (see figure 6, API specification).
*
***********************************************************************************************/
DP_UINT_16 DP_SetSourceFrameSize ( DP_UINT_16 ui16PlaneHandle,
DP_UINT_16 ui16FrameWidth,
DP_UINT_16 ui16FrameHeight )
{
#if defined DP_ERROR_CHECKING
DP_UINT_16 ui16ReturnValue = DP_STANDARD_CODE_NO_ERROR;
#else
DP_UINT_16 ui16ReturnValue = DP_ERR_NO_ERROR_CHECKING;
#endif
#if defined DP_ERROR_CHECKING
DP_UINT_16 ui16CommandResult = DP_STANDARD_CODE_NO_ERROR;
#else
DP_UINT_16 ui16CommandResult = DP_ERR_NO_ERROR_CHECKING;
#endif
DP_UINT_16 ui16ScalingResult = DP_FALSE;
DP_UINT_16 ui16FetchOK;
DP_PVOID pvSourceAddress;
DP_BOOL bUVStrideHalved;
DP_UINT_16 ui16Stride;
DP_SourceDataTypes eSourceDataType;
DP_UINT_16 ui16InternalFrameHeight,
ui16InternalDestinationFrameHeight,
ui16InternalSourceFrameHeight;
#if defined DP_ERROR_CHECKING
DP_UINT_16 ui16SourceFrameXOffset, ui16SourceFrameYOffset;
DP_UINT_16 ui16SourceFrameWidth, ui16SourceFrameHeight;
DP_UINT_16 ui16SourceImageWidth, ui16SourceImageHeight;
DP_UINT_16 ui16DestinationFrameWidth, ui16DestinationFrameHeight;
DP_INT_32 i32DestinationFrameXOffset, i32DestinationFrameYOffset;
DP_BOOL bWrappingEnabled = DP_FALSE;
DP_FLOAT fVPitch, fHPitch;
DP_PixelColourFormats ePixelColourFormat;
DP_BOOL bOffsetChroma;
#endif
#if defined DP_SIMULATION_MODE
sprintf ( &ai8DumpComment[0], "DP_SetSourceFrameSize Plane : %01i Width : %i Height : %i \n", ui16PlaneHandle,
ui16FrameWidth,
ui16FrameHeight );
printf ( ai8DumpComment );
PDumpComment( ai8DumpComment );
#endif
#if defined DP_ERROR_CHECKING
if ( !DP_bIsPipelineInitialised )
ui16ReturnValue = DP_ERR_NOT_INITIALISED;
if ( ui16ReturnValue == DP_STANDARD_CODE_NO_ERROR )
{
#endif /* error checking */
ui16FetchOK = DP_GetSourceAddress ( ui16PlaneHandle,
DP_YUV_Y_OR_SOLE_RGB,
&pvSourceAddress,
&ui16Stride,
&bUVStrideHalved,
&eSourceDataType );
/* Whether or not to divide the supplied height by 2 or not is decided by the source data */
/* type, as specified in 'SetSourceAddress'. */
if (( DP_pCurrentScalerModifier [ ui16PlaneHandle ]->ui8SourceHeightDivisor ) == 2 )
{
/* Round down the requested height if we're having to divide by 2 (odd numbers don't */
/* divide down neatly, unfortunately). */
ui16FrameHeight &= 0xFFFFFFFE;
}
ui16InternalFrameHeight = ui16FrameHeight / (DP_pCurrentScalerModifier [ ui16PlaneHandle ]->ui8SourceHeightDivisor);
#if defined DP_ERROR_CHECKING
if ( ui16PlaneHandle > DP_NO_OF_STREAMS )
ui16ReturnValue = DP_ERR_UNKNOWN_PLANE;
else if ( ( ui16FrameWidth < DP_HARDWARE_STRIDE_COMPENSATE ) ||
( ui16InternalFrameHeight < DP_HARDWARE_STRIDE_COMPENSATE ) )
ui16ReturnValue = DP_ERR_OUT_OF_RANGE;
else if ( ! DP_asStreamCapabilities [ ui16PlaneHandle ].bPlaneOffScreenPositioningSupported )
{
/* Check that the newly specified size doesn't cause the destination frame to */
/* exceed the bounds of the output frame. */
if ( DP_GetDestinationFrameSize ( ui16PlaneHandle,
&ui16DestinationFrameWidth,
&ui16DestinationFrameHeight ) != DP_STANDARD_CODE_NO_ERROR )
{
/* We were unable to ascertain the size of the destination frame - this is */
/* probably because it's not independently resizable, in which case it's size */
/* is automatically fixed to that of the source frame. */
if ( DP_GetSourceFrameSize ( ui16PlaneHandle,
&ui16SourceFrameWidth,
&ui16SourceFrameHeight ) != DP_STANDARD_CODE_NO_ERROR )
{
/* We couldn't establish the size of the source frame, either ! Try to */
/* carry on regardless, by checking that the source image is not placed
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -