?? dec55xxusbview.cpp
字號(hào):
// DEC55XXUSBView.cpp : implementation of the CDEC55XXUSBView class
//
#include "stdafx.h"
#include "DEC55XXUSB.h"
#include "seeddecusb.h"
#include "ezusbsys.h"
#include "DEC55XXUSBDoc.h"
#include "CntrItem.h"
#include "DEC55XXUSBView.h"
#define VR_USB_VERION 0xB8
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDEC55XXUSBView
IMPLEMENT_DYNCREATE(CDEC55XXUSBView, CRichEditView)
BEGIN_MESSAGE_MAP(CDEC55XXUSBView, CRichEditView)
//{{AFX_MSG_MAP(CDEC55XXUSBView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
ON_WM_DESTROY()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CRichEditView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CRichEditView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRichEditView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDEC55XXUSBView construction/destruction
CDEC55XXUSBView::CDEC55XXUSBView()
{
char buffer1[64];
VENDOR_OR_CLASS_REQUEST_CONTROL myRequest;
ULONG venderlong;
int recnBytes = 0;
// TODO: add construction code here
if(OpenDriver() == FALSE)
{
AfxMessageBox("打開USB驅(qū)動(dòng)失敗,請(qǐng)復(fù)位板卡");
}
//獲得當(dāng)前的USB工作的標(biāo)準(zhǔn)
/*發(fā)送命令,使DSP先定入固定的數(shù)據(jù)*/
myRequest.direction = 1;
myRequest.index = 0;
myRequest.value = 0;
myRequest.request = VR_USB_VERION;
// vendor specific request type (2)
myRequest.requestType=2;
// recepient is device (0)
myRequest.recepient=0;
/*傳回一個(gè)數(shù)據(jù)長度*/
venderlong = 1;
Sx2SendVendorReq(&myRequest,
&buffer1[0],
venderlong,
&recnBytes);
if(buffer1[0] ==0x55)
{
//CY7C68001 is working under USB 2.0
theApp.m_USB2or11 = 2;
theApp.m_USBbufferlong = 512; // 如果該參數(shù)設(shè)置不對(duì),將導(dǎo)致塊傳送出錯(cuò)
}
if(buffer1[0] ==0x54)
{
//CY7C68001 is working under USB 1.1
theApp.m_USB2or11 = 1;
theApp.m_USBbufferlong = 64;
}
}
CDEC55XXUSBView::~CDEC55XXUSBView()
{
CloseDriver();
}
BOOL CDEC55XXUSBView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CRichEditView::PreCreateWindow(cs);
}
void CDEC55XXUSBView::OnInitialUpdate()
{
CRichEditView::OnInitialUpdate();
// Set the printing margins (720 twips = 1/2 inch).
SetMargins(CRect(720, 720, 720, 720));
}
/////////////////////////////////////////////////////////////////////////////
// CDEC55XXUSBView printing
BOOL CDEC55XXUSBView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CDEC55XXUSBView::OnDestroy()
{
// Deactivate the item on destruction; this is important
// when a splitter view is being used.
CRichEditView::OnDestroy();
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
{
pActiveItem->Deactivate();
ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
}
}
/////////////////////////////////////////////////////////////////////////////
// CDEC55XXUSBView diagnostics
#ifdef _DEBUG
void CDEC55XXUSBView::AssertValid() const
{
CRichEditView::AssertValid();
}
void CDEC55XXUSBView::Dump(CDumpContext& dc) const
{
CRichEditView::Dump(dc);
}
CDEC55XXUSBDoc* CDEC55XXUSBView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDEC55XXUSBDoc)));
return (CDEC55XXUSBDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDEC55XXUSBView message handlers
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -