📄 isoch.c
字号:
SetDlgItemText(hDlg, IDC_ISOCH_TALK_SECOND_COUNT, tmpBuff);
return(TRUE); // WM_INITDIALOG
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
GetDlgItemText(hDlg, IDC_ISOCH_TALK_RESOURCE_HANDLE, tmpBuff, STRING_SIZE);
if (!sscanf (tmpBuff, "%p", &(pIsochTalk->hResource)))
{
// failed to get the handle, just return here
EndDialog(hDlg, TRUE);
return FALSE;
}
GetDlgItemText(hDlg, IDC_ISOCH_TALK_CYCLE_OFFSET, tmpBuff, STRING_SIZE);
pIsochTalk->StartTime.CL_CycleOffset = strtoul(tmpBuff, NULL, 16);
GetDlgItemText(hDlg, IDC_ISOCH_TALK_CYCLE_COUNT, tmpBuff, STRING_SIZE);
pIsochTalk->StartTime.CL_CycleCount = strtoul(tmpBuff, NULL, 16);
GetDlgItemText(hDlg, IDC_ISOCH_TALK_SECOND_COUNT, tmpBuff, STRING_SIZE);
pIsochTalk->StartTime.CL_SecondCount = strtoul(tmpBuff, NULL, 16);
EndDialog(hDlg, TRUE);
return(TRUE); // IDOK
case IDCANCEL:
EndDialog(hDlg, FALSE);
return(TRUE); // IDCANCEL
default:
return(TRUE); // default
} // switch
break; // WM_COMMAND
default:
break; // default
} // switch
return(FALSE);
} // IsochTalkDlgProc
void
w1394_IsochTalk(
HWND hWnd,
PSTR szDeviceName
)
{
ISOCH_TALK isochTalk;
DWORD dwRet;
TRACE(TL_TRACE, (hWnd, "Enter w1394_IsochTalk\r\n"));
isochTalk.hResource = NULL;
isochTalk.fulFlags = 0;
isochTalk.StartTime.CL_CycleOffset = 0;
isochTalk.StartTime.CL_CycleCount = 0;
isochTalk.StartTime.CL_SecondCount = 0;
if (DialogBoxParam( (HINSTANCE) GetWindowLongPtr(hWnd, GWLP_HINSTANCE),
"IsochTalk",
hWnd,
IsochTalkDlgProc,
(LPARAM)&isochTalk
)) {
dwRet = IsochTalk( hWnd,
szDeviceName,
&isochTalk
);
}
TRACE(TL_TRACE, (hWnd, "Exit w1394_IsochTalk\r\n"));
return;
} // w1394_IsochTalk
INT_PTR CALLBACK
IsochLoopbackDlgProc(
HWND hDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
static PISOCH_LOOPBACK_PARAMS pIsochLoopbackParams;
static PISOCH_ATTACH_BUFFERS pIsochAttachBuffers;
CHAR tmpBuff[STRING_SIZE];
switch(uMsg) {
case WM_INITDIALOG:
pIsochLoopbackParams = (PISOCH_LOOPBACK_PARAMS)lParam;
pIsochAttachBuffers = &pIsochLoopbackParams->isochAttachBuffers;
CheckRadioButton( hDlg,
IDC_ISOCH_LOOP_LISTEN,
IDC_ISOCH_LOOP_TALK,
pIsochLoopbackParams->ulLoopFlag + (IDC_ISOCH_LOOP_LISTEN-1)
);
if (pIsochLoopbackParams->ulLoopFlag & RESOURCE_USED_IN_LISTENING)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_LISTEN, BST_CHECKED);
if (pIsochLoopbackParams->ulLoopFlag & RESOURCE_USED_IN_TALKING)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_TALK, BST_CHECKED);
if (pIsochLoopbackParams->ulLoopFlag & RESOURCE_BUFFERS_CIRCULAR)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_CIRCULAR, BST_CHECKED);
if (pIsochLoopbackParams->ulLoopFlag & RESOURCE_STRIP_ADDITIONAL_QUADLETS)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_STRIP_QUADS, BST_CHECKED);
if (pIsochLoopbackParams->ulLoopFlag & RESOURCE_SYNCH_ON_TIME)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_SYNC_TIME, BST_CHECKED);
if (pIsochLoopbackParams->ulLoopFlag & RESOURCE_USE_PACKET_BASED)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_PACKET_BASED, BST_CHECKED);
sprintf (tmpBuff, "%p", pIsochAttachBuffers->hResource);
SetDlgItemText(hDlg, IDC_ISOCH_LOOP_RESOURCE, tmpBuff);
_ultoa((ULONG)pIsochAttachBuffers->nNumberOfDescriptors, tmpBuff, 16);
SetDlgItemText(hDlg, IDC_ISOCH_LOOP_NUM_DESCRIPTORS, tmpBuff);
if (pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags & DESCRIPTOR_SYNCH_ON_SY)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_SYNCH_ON_SY, BST_CHECKED);
if (pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags & DESCRIPTOR_SYNCH_ON_TAG)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_SYNCH_ON_TAG, BST_CHECKED);
if (pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags & DESCRIPTOR_SYNCH_ON_TIME)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_SYNCH_ON_TIME, BST_CHECKED);
if (pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags & DESCRIPTOR_USE_SY_TAG_IN_FIRST)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_USE_SY_TAG_IN_FIRST, BST_CHECKED);
if (pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags & DESCRIPTOR_TIME_STAMP_ON_COMPLETION)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_TIME_STAMP_COMPLETE, BST_CHECKED);
if (pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags & DESCRIPTOR_PRIORITY_TIME_DELIVERY)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_PRI_TIME_DELIVERY, BST_CHECKED);
_ultoa((ULONG)pIsochAttachBuffers->R3_IsochDescriptor[0].ulLength, tmpBuff, 16);
SetDlgItemText(hDlg, IDC_ISOCH_LOOP_LENGTH, tmpBuff);
_ultoa((ULONG)pIsochAttachBuffers->R3_IsochDescriptor[0].ulTag, tmpBuff, 16);
SetDlgItemText(hDlg, IDC_ISOCH_LOOP_TAG_VALUE, tmpBuff);
_ultoa((ULONG)pIsochAttachBuffers->R3_IsochDescriptor[0].CycleTime.CL_CycleOffset, tmpBuff, 16);
SetDlgItemText(hDlg, IDC_ISOCH_LOOP_CYCLE_OFFSET, tmpBuff);
_ultoa((ULONG)pIsochAttachBuffers->R3_IsochDescriptor[0].CycleTime.CL_SecondCount, tmpBuff, 16);
SetDlgItemText(hDlg, IDC_ISOCH_LOOP_SECOND_COUNT, tmpBuff);
_ultoa((ULONG)pIsochAttachBuffers->R3_IsochDescriptor[0].nMaxBytesPerFrame, tmpBuff, 16);
SetDlgItemText(hDlg, IDC_ISOCH_LOOP_BYTES_PER_FRAME, tmpBuff);
_ultoa((ULONG)pIsochAttachBuffers->R3_IsochDescriptor[0].ulSynch, tmpBuff, 16);
SetDlgItemText(hDlg, IDC_ISOCH_LOOP_SYNCH_VALUE, tmpBuff);
_ultoa((ULONG)pIsochAttachBuffers->R3_IsochDescriptor[0].CycleTime.CL_CycleCount, tmpBuff, 16);
SetDlgItemText(hDlg, IDC_ISOCH_LOOP_CYCLE_COUNT, tmpBuff);
if (pIsochAttachBuffers->R3_IsochDescriptor[0].bUseCallback)
CheckDlgButton( hDlg, IDC_ISOCH_LOOP_USE_CALLBACK, BST_CHECKED);
return(TRUE);
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
pIsochLoopbackParams->ulLoopFlag = 0;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_LISTEN))
pIsochLoopbackParams->ulLoopFlag |= RESOURCE_USED_IN_LISTENING;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_TALK))
pIsochLoopbackParams->ulLoopFlag |= RESOURCE_USED_IN_TALKING;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_CIRCULAR))
pIsochLoopbackParams->ulLoopFlag |= RESOURCE_BUFFERS_CIRCULAR;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_STRIP_QUADS))
pIsochLoopbackParams->ulLoopFlag |= RESOURCE_STRIP_ADDITIONAL_QUADLETS;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_SYNC_TIME))
pIsochLoopbackParams->ulLoopFlag |= RESOURCE_SYNCH_ON_TIME;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_PACKET_BASED))
pIsochLoopbackParams->ulLoopFlag |= RESOURCE_USE_PACKET_BASED;
GetDlgItemText(hDlg, IDC_ISOCH_LOOP_RESOURCE, tmpBuff, STRING_SIZE);
if (!sscanf (tmpBuff, "%p", &(pIsochAttachBuffers->hResource)))
{
// failed to get the handle, just return here
EndDialog(hDlg, TRUE);
return FALSE;
}
GetDlgItemText(hDlg, IDC_ISOCH_LOOP_NUM_DESCRIPTORS, tmpBuff, STRING_SIZE);
pIsochAttachBuffers->nNumberOfDescriptors = strtoul(tmpBuff, NULL, 16);
GetDlgItemText(hDlg, IDC_ISOCH_LOOP_LENGTH, tmpBuff, STRING_SIZE);
pIsochAttachBuffers->R3_IsochDescriptor[0].ulLength = strtoul(tmpBuff, NULL, 16);
GetDlgItemText(hDlg, IDC_ISOCH_LOOP_TAG_VALUE, tmpBuff, STRING_SIZE);
pIsochAttachBuffers->R3_IsochDescriptor[0].ulTag = strtoul(tmpBuff, NULL, 16);
GetDlgItemText(hDlg, IDC_ISOCH_LOOP_CYCLE_OFFSET, tmpBuff, STRING_SIZE);
pIsochAttachBuffers->R3_IsochDescriptor[0].CycleTime.CL_CycleOffset = strtoul(tmpBuff, NULL, 16);
GetDlgItemText(hDlg, IDC_ISOCH_LOOP_SECOND_COUNT, tmpBuff, STRING_SIZE);
pIsochAttachBuffers->R3_IsochDescriptor[0].CycleTime.CL_SecondCount = strtoul(tmpBuff, NULL, 16);
GetDlgItemText(hDlg, IDC_ISOCH_LOOP_BYTES_PER_FRAME, tmpBuff, STRING_SIZE);
pIsochAttachBuffers->R3_IsochDescriptor[0].nMaxBytesPerFrame = strtoul(tmpBuff, NULL, 16);
GetDlgItemText(hDlg, IDC_ISOCH_LOOP_SYNCH_VALUE, tmpBuff, STRING_SIZE);
pIsochAttachBuffers->R3_IsochDescriptor[0].ulSynch = strtoul(tmpBuff, NULL, 16);
GetDlgItemText(hDlg, IDC_ISOCH_LOOP_CYCLE_COUNT, tmpBuff, STRING_SIZE);
pIsochAttachBuffers->R3_IsochDescriptor[0].CycleTime.CL_CycleCount = strtoul(tmpBuff, NULL, 16);
pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags = 0;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_SYNCH_ON_SY))
pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags |= DESCRIPTOR_SYNCH_ON_SY;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_SYNCH_ON_TAG))
pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags |= DESCRIPTOR_SYNCH_ON_TAG;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_SYNCH_ON_TIME))
pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags |= DESCRIPTOR_SYNCH_ON_TIME;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_USE_SY_TAG_IN_FIRST))
pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags |= DESCRIPTOR_USE_SY_TAG_IN_FIRST;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_TIME_STAMP_COMPLETE))
pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags |= DESCRIPTOR_TIME_STAMP_ON_COMPLETION;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_PRI_TIME_DELIVERY))
pIsochAttachBuffers->R3_IsochDescriptor[0].fulFlags |= DESCRIPTOR_PRIORITY_TIME_DELIVERY;
if (IsDlgButtonChecked(hDlg, IDC_ISOCH_LOOP_USE_CALLBACK))
pIsochAttachBuffers->R3_IsochDescriptor[0].bUseCallback = TRUE;
else
pIsochAttachBuffers->R3_IsochDescriptor[0].bUseCallback = FALSE;
EndDialog(hDlg, TRUE);
return(TRUE);
case IDCANCEL:
EndDialog(hDlg, FALSE);
return(TRUE);
default:
return(TRUE);
} // switch
break; // WM_COMMAND
default:
break;
} // switch
return(FALSE);
} // IsochLoopbackDlgProc
void
w1394_IsochStartLoopback(
HWND hWnd,
PSTR szDeviceName,
PISOCH_LOOPBACK_PARAMS IsochLoopbackParams
)
{
TRACE(TL_TRACE, (hWnd, "Enter w1394_IsochStartLoopback\r\n"));
IsochLoopbackParams->ulLoopFlag = RESOURCE_USED_IN_TALKING;
IsochLoopbackParams->nIterations = 0;
IsochLoopbackParams->bAutoFill = TRUE;
IsochLoopbackParams->bAutoAlloc = TRUE;
IsochLoopbackParams->isochAttachBuffers.hResource = NULL;
IsochLoopbackParams->isochAttachBuffers.nNumberOfDescriptors = 1;
IsochLoopbackParams->isochAttachBuffers.R3_IsochDescriptor[0].fulFlags = 0;
IsochLoopbackParams->isochAttachBuffers.R3_IsochDescriptor[0].ulLength = 153600;
IsochLoopbackParams->isochAttachBuffers.R3_IsochDescriptor[0].nMaxBytesPerFrame = 640;
IsochLoopbackParams->isochAttachBuffers.R3_IsochDescriptor[0].ulSynch = 0;
IsochLoopbackParams->isochAttachBuffers.R3_IsochDescriptor[0].ulTag = 0;
IsochLoopbackParams->isochAttachBuffers.R3_IsochDescriptor[0].CycleTime.CL_CycleOffset = 0;
IsochLoopbackParams->isochAttachBuffers.R3_IsochDescriptor[0].CycleTime.CL_CycleCount = 0;
IsochLoopbackParams->isochAttachBuffers.R3_IsochDescriptor[0].CycleTime.CL_SecondCount = 0;
IsochLoopbackParams->isochAttachBuffers.R3_IsochDescriptor[0].bUseCallback = TRUE;
IsochLoopbackParams->isochAttachBuffers.R3_IsochDescriptor[0].bAutoDetach = TRUE;
// do our dialog box
if (DialogBoxParam( (HINSTANCE) GetWindowLongPtr(hWnd, GWLP_HINSTANCE),
"IsochLoopback",
hWnd,
IsochLoopbackDlgProc,
(LPARAM)IsochLoopbackParams
)) {
GetLocalTime(&IsochStartTime);
IsochStartLoopback(hWnd, szDeviceName, IsochLoopbackParams);
isochLoopbackStarted = TRUE;
}
TRACE(TL_TRACE, (hWnd, "Exit w1394_IsochStartLoopback\r\n"));
return;
} // w1394_IsochStartLoopback
void
w1394_IsochStopLoopback(
HWND hWnd,
PISOCH_LOOPBACK_PARAMS IsochLoopbackParams
)
{
TRACE(TL_TRACE, (hWnd, "Enter w1394_IsochStopLoopback\r\n"));
#ifdef LOGGER
Logger_WriteTestLog( "1394",
"Isoch Loopback",
NULL,
IsochLoopbackParams->ulPass,
IsochLoopbackParams->ulFail,
&IsochStartTime,
NULL,
NULL
);
#endif
IsochStopLoopback( IsochLoopbackParams );
isochLoopbackStarted = FALSE;
TRACE(TL_TRACE, (hWnd, "Exit w1394_IsochStopLoopback\r\n"));
return;
} // w1394_IsochStopLoopback
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -