TI DVRRDK4.0 设置背景地图的方法1
TI DVRRDK4.0 设置背景地图的方法1
1、在swmsLink中修改,由于swmsLink是属于vpss M3核,而我想要的是通过A8的程序去控制swmsLink显示不同的背景。一开始以为给swmsLink做interface 给A8利用,后面想想是没用。应为vpss M3 和A8是两个独立的核不能直接在A8上利用Vpss M3的代码。那如何解决呢??
方法:
通过建立自己的信息,A8发送消息给Vpss M3,通知link来做相应的修改。所以这里就有两部一部分是:A8做用户输入,并发送消息给swmslink。
Vpss M3的swmslink需要解释此消息,然后做出相应的动作。
消息机制,消息CMD: SYSTEM_SW_MS_LINK_CMD_CHANGE_COLOR , 此消息是我自己自定义。下面的函数式给swmsLink发送消息:
System_linkControl(swMsLinkId, SYSTEM_SW_MS_LINK_CMD_CHANGE_COLOR,layoutInfo ,sizeof(*layoutInfo), TRUE);
swmsLink解码消息:
有运行中swmslink会有自己的线程,所以我们只需要找到相应的线程,swmslink_tsk.c里面就是对应该link的线程。
SwMsLink_tskRun函数就是swmslink运行的线程,找到switch case,添加自己的case,解码消息。我的做法如下:
static UInt8 unm =0;
case SYSTEM_SW_MS_LINK_CMD_CHANGE_COLOR :
{
Vps_printf("\n num is---> %d");
Utils_tskAckOrFreeMsg(pRunMsg, status);
switch(num)
{
case 0:
num++;
break;
case 1:
num++;
break;
case 2:
num++;
break;
case 3:
num=0;
break;
default:
break;
}
}
break;
case SW_MS_LINK_CMD_DO_SCALING:
Utils_tskAckOrFreeMsg(pRunMsg, status);
flushCmds[0] = SYSTEM_CMD_NEW_DATA;
flushCmds[1] = SW_MS_LINK_CMD_DO_SCALING;
Utils_tskFlushMsg(pTsk, flushCmds, 2);
SwMsLink_drvProcessData(pObj);
SwMsLink_drvDoScaling(pObj,num);//此处为修改的函数,原函数:SwMsLink_drvDoScaling(pObj);
调用关系: SwMsLink_drvDoScaling(pObj,num) -> SwMsLink_drvMakeFrameLists(pObj, pOutFrame); ——> SwMsLink_drvCheckBlankOutputBuffer(pObj,pOutFrame);
SwMsLink_drvDoScaling(pObj,colorIndexm){gColorIndex = colorIndex;}
最终有作用的函数:
static
Int32 SwMsLink_drvCheckBlankOutputBuffer(SwMsLink_Obj * pObj, FVID2_Frame *pFrame)
{
Int32 status = 0;
System_FrameInfo *frameInfo = pFrame->appData;
//if ((NULL != frameInfo)
// &&
// (frameInfo->swMsBlankOutBuf))
// if(gPrevColorIndex != gColorIndex)
{
//gPrevColorIndex = gColorIndex;
Utils_DmaFill2D blankFrameInfo[SWMS_LINK_DMA_MAX_TRANSFERS];
UInt16 numTx;
UInt32 pitch;
pitch = pObj->outFrameFormat.pitch[0];
numTx=0;
blankFrameInfo[numTx].destAddr[0] = pFrame->addr[0][0];
blankFrameInfo[numTx].destPitch[0] = pitch;
blankFrameInfo[numTx].dataFormat = pObj->createArgs.outDataFormat;
if (pObj->createArgs.outDataFormat == SYSTEM_DF_YUV420SP_UV)
{
blankFrameInfo[numTx].destAddr[1] = pFrame->addr[0][1];
blankFrameInfo[numTx].destPitch[1] = pObj->outFrameFormat.pitch[1];
}
blankFrameInfo[numTx].width = pObj->outFrameFormat.width;
blankFrameInfo[numTx].height = pObj->outFrameFormat.height;
FastFillColor(blankFrameInfo,numTx);
#if 0
switch(gColorIndex)
{
case 0:
blankFrameInfo[numTx].fillColorYUYV =UTILS_DMA_GENERATE_FILL_PATTERN(0x30, 0x80, 0x80);
blankFrameInfo[numTx].fastFillColorIndex = UTILS_DMA_FAST_FILL_COLOR_BLACK;
break;
case 1:
blankFrameInfo[numTx].fillColorYUYV =UTILS_DMA_GENERATE_FILL_PATTERN(0x80, 0x80, 0x80);
blankFrameInfo[numTx].fastFillColorIndex = UTILS_DMA_FAST_FILL_COLOR_GREY;
break;
case 2:
blankFrameInfo[numTx].fillColorYUYV =UTILS_DMA_GENERATE_FILL_PATTERN(0x68, 0xD5, 0x5A);
blankFrameInfo[numTx].fastFillColorIndex = UTILS_DMA_FAST_FILL_COLOR_BLUE;
break;
case 3:
blankFrameInfo[numTx].fillColorYUYV =UTILS_DMA_GENERATE_FILL_PATTERN(0xFF, 0x80, 0x80);
blankFrameInfo[numTx].fastFillColorIndex = UTILS_DMA_FAST_FILL_COLOR_WHITE;
break;
default:
break;
}
#endif
// blankFrameInfo[numTx].fillColorYUYV =
// UTILS_DMA_GENERATE_FILL_PATTERN(SW_MS_BLANK_FRAME_PIXEL_LUMA ,
// SW_MS_BLANK_FRAME_PIXEL_CHROMA,
// SW_MS_BLANK_FRAME_PIXEL_CHROMA);
// blankFrameInfo[numTx].fastFillColorIndex = SW_MS_BLANK_FRAME_FAST_FILL_PIXEL_COLOR;
blankFrameInfo[numTx].startX = 0;
blankFrameInfo[numTx].startY = 0;
#if SWMSLINK_DEBUG_BLANK_OUTPUT_BUFFER
Vps_printf("%d:SWMS: Start Blanking of output buffer: "
"BufAddr:[%p] Width:[%d] Height:[%d] Pitch:[%d] Pixel:[0x%X / %d]",
Utils_getCurTimeInMsec(),
blankFrameInfo[numTx].destAddr[0],
blankFrameInfo[numTx].width,
blankFrameInfo[numTx].height,
blankFrameInfo[numTx].destPitch[0],
blankFrameInfo[numTx].fillColorYUYV,
blankFrameInfo[numTx].fastFillColorIndex
);
#endif
numTx++;
UTILS_assert(numTx<=SWMS_LINK_DMA_MAX_TRANSFERS);
status = Utils_dmaFastFill2D(&pObj->dmaObj, blankFrameInfo, numTx);
if (UTILS_ISERROR(status))
{
Vps_printf("SWMS: Utils_dmaFill2D for output buffer failed!!");
}
else
{
#if SWMSLINK_DEBUG_BLANK_OUTPUT_BUFFER
Vps_printf("%d:SWMS: End Blanking of output buffer: "
"BufAddr:[%p] ",
Utils_getCurTimeInMsec(),
blankFrameInfo[0].destAddr[0]);
#endif
}
frameInfo->swMsBlankOutBuf = FALSE;
}
return status;
}
static UInt8 gColorIndex = 0;
//static UInt8 gPrevColorIndex =0;
void FastFillColor(Utils_DmaFill2D* pblankFrameInfo,UInt32 numTx){
switch(gColorIndex)
{
case 0:
pblankFrameInfo[numTx].fillColorYUYV =UTILS_DMA_GENERATE_FILL_PATTERN(0x30, 0x80, 0x80);
pblankFrameInfo[numTx].fastFillColorIndex = UTILS_DMA_FAST_FILL_COLOR_BLACK;
break;
case 1:
pblankFrameInfo[numTx].fillColorYUYV =UTILS_DMA_GENERATE_FILL_PATTERN(0x80, 0x80, 0x80);
pblankFrameInfo[numTx].fastFillColorIndex = UTILS_DMA_FAST_FILL_COLOR_GREY;
break;
case 2:
pblankFrameInfo[numTx].fillColorYUYV =UTILS_DMA_GENERATE_FILL_PATTERN(0x68, 0xD5, 0x5A);
pblankFrameInfo[numTx].fastFillColorIndex = UTILS_DMA_FAST_FILL_COLOR_BLUE;
break;
case 3:
pblankFrameInfo[numTx].fillColorYUYV =UTILS_DMA_GENERATE_FILL_PATTERN(0xFF, 0x80, 0x80);
pblankFrameInfo[numTx].fastFillColorIndex = UTILS_DMA_FAST_FILL_COLOR_WHITE;
break;
default:
break;
}
}