i wrote a program transfer bits from a8 to m3-video, and then back to a8, when i call System_linkDelete to delete link_bit_in_hlos, it hang, does anyone know the reason ?
/*************************************
----A8----- ------VIDEO---------- ----A8---
BitsOutHLOS--BitInRTOS--BitOutRTOS--BitInHLOS
*************************************/
#include <osa.h>
#include <mcfw/interfaces/link_api/system.h>
#include <mcfw/interfaces/ti_media_common_def.h>
#include <link_api/ipcLink.h>
#include <link_api/encLink.h>
#include <ti/xdais/xdas.h>
#include <ti/xdais/dm/xdm.h>
#include <ti/xdais/dm/ivideo.h>
#include <ih264enc.h>
#include <ih264vdec.h>
#include <ti/syslink/utils/IHeap.h>
#include <ti/syslink/utils/Memory.h>
#include <ti/ipc/SharedRegion.h>
#define SHARE_REGION_ID (0)
#define PRINT OSA_printf
#define PRINT_LINE PRINT("File:%s, Line:%d\n", __FILE__, __LINE__);
#define ZERO_VAR(var) memset(&(var), 0, sizeof(var));
#define RUN(func)\
{\
int ret;\
PRINT(">>>> enter %s @ %s, %d \n", #func, __FILE__, __LINE__);\
ret = func;\
if (ret != (0))\
{\
PRINT(">>>> fail %s %d @ %s, %d\n", #func, ret, __FILE__, __LINE__);\
}\
else\
{\
PRINT(">>>> pass %s\n", #func);\
}\
}
#define SYS_LNK_CRT(id, param) RUN(System_linkCreate(id,&(param),sizeof(param)))
#define SYS_LNK_ACT(act, id) RUN(act(id))
#define SYS_LNK_STA(id) SYS_LNK_ACT(System_linkStart,id)
#define SYS_LNK_STP(id) SYS_LNK_ACT(System_linkStop,id)
#define SYS_LNK_DEL(id) SYS_LNK_ACT(System_linkDelete,id)
#define SYS_LNK_CREATE_START_4(lk0, crt0, lk1, crt1, lk2, crt2, lk3, crt3)\
SYS_LNK_CRT(lk0, crt0); SYS_LNK_CRT(lk1, crt1); SYS_LNK_CRT(lk2, crt2); SYS_LNK_CRT(lk3, crt3);\
SYS_LNK_STA(lk3); SYS_LNK_STA(lk2); SYS_LNK_STA(lk1); SYS_LNK_STA(lk0);
#define SYS_LNK_STOP_DEL_4(lk0, lk1, lk2, lk3)\
SYS_LNK_STP(lk0); SYS_LNK_STP(lk1); SYS_LNK_STP(lk2); SYS_LNK_STP(lk3);\
SYS_LNK_DEL(lk0); SYS_LNK_DEL(lk1); SYS_LNK_DEL(lk2); SYS_LNK_DEL(lk3);
static int s32LnkBitOtHost=SYSTEM_HOST_LINK_ID_IPC_BITS_OUT_0;
static int s32LnkBitInVid=SYSTEM_VIDEO_LINK_ID_IPC_BITS_IN_0;
static int s32LnkBitOtVid=SYSTEM_VIDEO_LINK_ID_IPC_BITS_OUT_0;
static int s32LnkBitInHost=SYSTEM_HOST_LINK_ID_IPC_BITS_IN_0;
static void callbackBitInHost(Ptr cbCtx)
{
PRINT("call back bit in on host\n");
}
void bitcopy_host_video_host(int argc, char **argv)
{
int s32Idx;
IpcBitsOutLinkHLOS_CreateParams tBitOtHlCrt;
IpcBitsInLinkRTOS_CreateParams tBitInRtCrt;
IpcBitsOutLinkRTOS_CreateParams tBitOtRtCrt;
IpcBitsInLinkHLOS_CreateParams tBitInHlCrt;
//bit out host
IpcBitsOutLinkHLOS_CreateParams_Init(&tBitOtHlCrt);
tBitOtHlCrt.baseCreateParams.numOutQue = 1;
tBitOtHlCrt.baseCreateParams.outQueParams[0].nextLink = s32LnkBitInVid;
tBitOtHlCrt.baseCreateParams.noNotifyMode = TRUE;
tBitOtHlCrt.baseCreateParams.notifyNextLink = FALSE;
tBitOtHlCrt.baseCreateParams.notifyPrevLink = FALSE;
tBitOtHlCrt.inQueInfo.numCh = 1;
for (s32Idx=0;s32Idx<tBitOtHlCrt.inQueInfo.numCh;s32Idx++)
{
tBitOtHlCrt.inQueInfo.chInfo[0].bufType = SYSTEM_BUF_TYPE_VIDBITSTREAM;
tBitOtHlCrt.inQueInfo.chInfo[0].codingformat = 0;
tBitOtHlCrt.inQueInfo.chInfo[0].dataFormat = 0;
tBitOtHlCrt.inQueInfo.chInfo[0].memType = SYSTEM_MT_NONTILEDMEM;
tBitOtHlCrt.inQueInfo.chInfo[0].startX = 0;
tBitOtHlCrt.inQueInfo.chInfo[0].startY = 0;
tBitOtHlCrt.inQueInfo.chInfo[0].width = 1280;
tBitOtHlCrt.inQueInfo.chInfo[0].height = 720;
tBitOtHlCrt.inQueInfo.chInfo[0].pitch[0] = 0;
tBitOtHlCrt.inQueInfo.chInfo[0].scanFormat = SYSTEM_SF_PROGRESSIVE;
tBitOtHlCrt.numBufPerCh[s32Idx] = 3;
}
//bit in video
IpcBitsInLinkRTOS_CreateParams_Init(&tBitInRtCrt);
tBitInRtCrt.baseCreateParams.inQueParams.prevLinkId = s32LnkBitOtHost;
tBitInRtCrt.baseCreateParams.numOutQue = 1;
tBitInRtCrt.baseCreateParams.outQueParams[0].nextLink = s32LnkBitOtVid;
tBitInRtCrt.baseCreateParams.noNotifyMode = TRUE;
tBitInRtCrt.baseCreateParams.notifyNextLink = TRUE;
tBitInRtCrt.baseCreateParams.notifyPrevLink = FALSE;
//bit out video
IpcBitsOutLinkRTOS_CreateParams_Init(&tBitOtRtCrt);
tBitOtRtCrt.baseCreateParams.inQueParams.prevLinkId = s32LnkBitInVid;
tBitOtRtCrt.baseCreateParams.numOutQue = 1;
tBitOtRtCrt.baseCreateParams.outQueParams[0].nextLink = s32LnkBitInHost;
tBitOtRtCrt.baseCreateParams.noNotifyMode = TRUE;
tBitOtRtCrt.baseCreateParams.notifyNextLink = FALSE;
tBitOtRtCrt.baseCreateParams.notifyPrevLink = TRUE;
//bit in host
IpcBitsInLinkHLOS_CreateParams_Init(&tBitInHlCrt);
tBitInHlCrt.baseCreateParams.inQueParams.prevLinkQueId = 0;
tBitInHlCrt.baseCreateParams.inQueParams.prevLinkId = s32LnkBitOtVid;
tBitInHlCrt.baseCreateParams.numOutQue = 1;
tBitInHlCrt.baseCreateParams.outQueParams[0].nextLink = SYSTEM_LINK_ID_INVALID;
tBitInHlCrt.baseCreateParams.noNotifyMode = TRUE;
tBitInHlCrt.baseCreateParams.notifyNextLink = FALSE;
tBitInHlCrt.baseCreateParams.notifyPrevLink = FALSE;
tBitInHlCrt.cbCtx = NULL;
tBitInHlCrt.cbFxn = callbackBitInHost;
SYS_LNK_CREATE_START_4(s32LnkBitOtHost, tBitOtHlCrt, s32LnkBitInVid, tBitInRtCrt, s32LnkBitOtVid, tBitOtRtCrt, s32LnkBitInHost, tBitInHlCrt);
OSA_waitMsecs(1000*1);
{
Bitstream_BufList tBufList;
IpcBitsOutLinkHLOS_BitstreamBufReqInfo tBufReq;
tBufReq.numBufs = 1;
tBufReq.minBufSize[0] = 100;
tBufList.numBufs = 0;
RUN(IpcBitsOutLink_getEmptyVideoBitStreamBufs(s32LnkBitOtHost,&tBufList,&tBufReq));
PRINT("numBufs:%d, bufSize:%d, addr:%x\n", tBufList.numBufs, tBufList.bufs[0]->bufSize, tBufList.bufs[0]->addr);
RUN(IpcBitsOutLink_putFullVideoBitStreamBufs(s32LnkBitOtHost,&tBufList));
}
OSA_waitMsecs(1000*1);
SYS_LNK_STOP_DEL_4(s32LnkBitOtHost, s32LnkBitInVid, s32LnkBitOtVid, s32LnkBitInHost);
}
root@dvr:/mnt/nfs/8168# ./x.sh
0: SYSTEM: System Common Init in progress !!!
0: SYSTEM: IPC init in progress !!!
8: SYSTEM: Opening MsgQ Heap [IPC_MSGQ_MSG_HEAP] ...
10: SYSTEM: Creating MsgQ [HOST_MSGQ] ...
11: SYSTEM: Creating MsgQ [HOST_ACK_MSGQ] ...
12: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
13: SYSTEM: Opening MsgQ [VIDEO-M3_MSGQ] ...
13: SYSTEM: Opening MsgQ [VPSS-M3_MSGQ] ...
14: SYSTEM: Notify register to [DSP] line 0, event 12 ...
14: SYSTEM: Notify register to [VIDEO-M3] line 0, event 12 ...
15: SYSTEM: Notify register to [VPSS-M3] line 0, event 12 ...
15: SYSTEM: IPC init DONE !!!
16: SYSTEM: Creating ListMP [HOST_IPC_OUT_28] in region 0 ...
18: SYSTEM: Creating ListMP [HOST_IPC_IN_28] in region 0 ...
19: SYSTEM: ListElem Shared Addr = 0x405c1a80
20: SYSTEM: Creating ListMP [HOST_IPC_OUT_29] in region 0 ...
22: SYSTEM: Creating ListMP [HOST_IPC_IN_29] in region 0 ...
23: SYSTEM: ListElem Shared Addr = 0x405da780
25: SYSTEM: Creating ListMP [HOST_IPC_OUT_23] in region 0 ...
26: SYSTEM: Creating ListMP [HOST_IPC_IN_23] in region 0 ...
28: SYSTEM: ListElem Shared Addr = 0x405f3480
29: SYSTEM: Creating ListMP [HOST_IPC_OUT_24] in region 0 ...
31: SYSTEM: Creating ListMP [HOST_IPC_IN_24] in region 0 ...
32: SYSTEM: ListElem Shared Addr = 0x40612e80
33: SYSTEM: Creating ListMP [HOST_IPC_OUT_25] in region 0 ...
35: SYSTEM: Creating ListMP [HOST_IPC_IN_25] in region 0 ...
36: SYSTEM: ListElem Shared Addr = 0x40632880
[m3vpss ]
[m3vpss ] *** UTILS: DM_TIMER[2] KHz = 27000 Khz ***
[m3vpss ]
53: SYSTEM: System Common Init Done !!!
[host] App Compile Time : Aug 1 2012 16:11:32
[host] ======================= start app =======================
[host] >>>> enter System_linkCreate(s32LnkBitOtHost,&(tBitOtHlCrt),sizeof(tBitOtHlCrt)) @ bitcopy_host_video_host.c, 82
[host] 53: IPC_BITS_OUT : Create in progress !!!
###Bit buff of size from the SR # 1 : 2764800
[host] IPC_BITSOUT:BitBuffer Alloc.PoolID:0,Size:0x2A3000
[host] IPCBITSOUTLINK:Translated Addr Virt:0x4147b080 To Phy:0x8f200080
[host] 53: IPC_BITS_OUT : Create Done !!!
[host] >>>> pass System_linkCreate(s32LnkBitOtHost,&(tBitOtHlCrt),sizeof(tBitOtHlCrt))
[host] >>>> enter System_linkCreate(s32LnkBitInVid,&(tBitInRtCrt),sizeof(tBitInRtCrt)) @ bitcopy_host_video_host.c, 82
[host] >>>> pass System_linkCreate(s32LnkBitInVid,&(tBitInRtCrt),sizeof(tBitInRtCrt))
[host] >>>> enter System_linkCreate(s32LnkBitOtVid,&(tBitOtRtCrt),sizeof(tBitOtRtCrt)) @ bitcopy_host_video_host.c, 82
[host] >>>> pass System_linkCreate(s32LnkBitOtVid,&(tBitOtRtCrt),sizeof(tBitOtRtCrt))
[host] >>>> enter System_linkCreate(s32LnkBitInHost,&(tBitInHlCrt),sizeof(tBitInHlCrt)) @ bitcopy_host_video_host.c, 82
[host] IpcBitsInLink_tskMain:Entered
[host] 58: IPC_BITS_IN : Create in progress !!!
[host] 58: IPC_BITS_IN : ListMPOpen start !!!
[host] 58: SYSTEM: Opening ListMP [VIDEO-M3_IPC_OUT_28] ...
[m3video] 13022: IPC_BITS_IN : Create in progress !!!
[m3video] 13023: SYSTEM: Opening ListMP [HOST_IPC_OUT_28] ...
[m3video] 13023: SYSTEM: Opening ListMP [HOST_IPC_IN_28] ...
[m3video] 13024: SYSTEM: Opening MsgQ [HOST_MSGQ] ...
[m3video] 13025: IPC_BITS_IN : Create Done !!!
[m3video] 13025: IPC_BITS_OUT : Create in progress !!!
60: SYSTEM: Opening ListMP [VIDEO-M3_IPC_IN_28] ...
[host] 61: IPC_BITS_IN : ListMPOpen done !!!
[host] 63: IPC_BITS_IN : System_linkGetInfo done !!!
[host] 63: IPC_BITS_IN : Create Done !!!
[host] >>>> pass System_linkCreate(s32LnkBitInHost,&(tBitInHlCrt),sizeof(tBitInHlCrt))
[host] >>>> enter System_linkStart(s32LnkBitInHost) @ bitcopy_host_video_host.c, 82
[host] >>>> pass System_linkStart(s32LnkBitInHost)
[host] >>>> enter System_linkStart(s32LnkBitOtVid) @ bitcopy_host_video_host.c, 82
[host] >>>> pass System_linkStart(s32LnkBitOtVid)
[host] >>>> enter System_linkStart(s32LnkBitInVid) @ bitcopy_host_video_host.c, 82
[host] >>>> pass System_linkStart(s32LnkBitInVid)
[host] >>>> enter System_linkStart(s32LnkBitOtHost) @ bitcopy_host_video_host.c, 82
[host] >>>> pass System_linkStart(s32LnkBitOtHost)
[m3video] 13027: IPC_BITS_OUT : Create Done !!!
[host] >>>> enter IpcBitsOutLink_getEmptyVideoBitStreamBufs(s32LnkBitOtHost,&tBufList,&tBufReq) @ bitcopy_host_video_host.c, 93
[host] >>>> pass IpcBitsOutLink_getEmptyVideoBitStreamBufs(s32LnkBitOtHost,&tBufList,&tBufReq)
[host] numBufs:1, bufSize:921600, addr:4147b080
[host] >>>> enter IpcBitsOutLink_putFullVideoBitStreamBufs(s32LnkBitOtHost,&tBufList) @ bitcopy_host_video_host.c, 96
[host] >>>> pass IpcBitsOutLink_putFullVideoBitStreamBufs(s32LnkBitOtHost,&tBufList)
[host] >>>> enter System_linkStop(s32LnkBitOtHost) @ bitcopy_host_video_host.c, 100
[host] >>>> pass System_linkStop(s32LnkBitOtHost)
[host] >>>> enter System_linkStop(s32LnkBitInVid) @ bitcopy_host_video_host.c, 100
[host] >>>> pass System_linkStop(s32LnkBitInVid)
[host] >>>> enter System_linkStop(s32LnkBitOtVid) @ bitcopy_host_video_host.c, 100
[host] >>>> pass System_linkStop(s32LnkBitOtVid)
[host] >>>> enter System_linkStop(s32LnkBitInHost) @ bitcopy_host_video_host.c, 100
[host] >>>> pass System_linkStop(s32LnkBitInHost)
[host] >>>> enter System_linkDelete(s32LnkBitOtHost) @ bitcopy_host_video_host.c, 100
[host] 2064: IPC_BITS_OUT : Delete in progress !!!
[host]
2064: IPCBITSOUT:Link[3000001c]:
[host] RECV:0 FREE:0,DROPPED:1,AVGLATENCY:0
[host] IPC_BITSOUT:BitBuffer Free.PoolID:0,Size:0x2A3000
[host] 2067: IPC_BITS_OUT : Delete Done !!!
[host] >>>> pass System_linkDelete(s32LnkBitOtHost)
[host] >>>> enter System_linkDelete(s32LnkBitInVid) @ bitcopy_host_video_host.c, 100
[host] >>>> pass System_linkDelete(s32LnkBitInVid)
[host] >>>> enter System_linkDelete(s32LnkBitOtVid) @ bitcopy_host_video_host.c, 100
[host] >>>> pass System_linkDelete(s32LnkBitOtVid)
[host] >>>> enter System_linkDelete(s32LnkBitInHost) @ bitcopy_host_video_host.c, 100
[host] 2069: IPCBITSIN:Link[3000001e]: [m3video] 15037: IPCBITSIN:Link[1000001e]:
[m3video] RECV:0 FREE:0,DROPPED:0,AVGLATENCY:0
[m3video] 15037: IPC_BITS_IN : Delete in progress !!!
[m3video] 15037: IPC_BITS_IN : Delete Done !!!
[m3video] 15037: IPC_BITS_OUT : Delete in progress !!!
[m3video] 15037: IPCBITSOUT:Link[1000001c]:
[m3video] RECV:0 FREE:0,DROPPED:0,AVGLATENCY:0
[m3video] 15038: PRF : IPC_BITS_OUT0 : t: 0 ms, c: 0, f: 0, fps: 0, fpc: 0
[m3video] 15038: IPC_BITS_OUT : Delete Done !!!
[m3vpss ] AVSYNC:WallTime IGNORE Unexpected Discontinuity.PrevTs[159071]/CurTs[0]