⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbop.h

📁 一个很好的基于USB开发的VC++资料.一个很好的基于USB开发的VC++资料
💻 H
字号:
/*----------------------------------------------------------------------------
文 件:USB下载器USB通信类.
功 能:提供下载过程USB通信.
时 间:2008-2
百强电子世界网http://www.bqmcu.com.cn 
飞雪浪子 QQ:570733482 jztdx@163.com
----------------------------------------------------------------------------*/
// USBOP.h: interface for the CUSBOP class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_USBOP_H__1160A1C7_6AF6_4B15_A091_316DB6090F4E__INCLUDED_)
#define AFX_USBOP_H__1160A1C7_6AF6_4B15_A091_316DB6090F4E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "usb.h"

#define USBDEV_SHARED_VENDOR    0x16c0  /* VOTI */
#define USBDEV_SHARED_PRODUCT   0x05dc  /* Obdev's free shared PID */

#define USB_ERROR_NOTFOUND  1
#define USB_ERROR_ACCESS    2
#define USB_ERROR_IO        3

#define USBASP_FUNC_CONNECT     1
#define USBASP_FUNC_DISCONNECT  2
#define USBASP_FUNC_TRANSMIT    3
#define USBASP_FUNC_READFLASH   4
#define USBASP_FUNC_ENABLEPROG  5
#define USBASP_FUNC_WRITEFLASH  6
#define USBASP_FUNC_READEEPROM  7
#define USBASP_FUNC_WRITEEEPROM 8
#define USBASP_FUNC_SPEED       9
#define USBASP_FUNC_UART        10
#define USBASP_FUNC_SETTING     11

#define PROG_STATE_IDLE         0
#define PROG_STATE_WRITEFLASH   1
#define PROG_STATE_READFLASH    2
#define PROG_STATE_READEEPROM   3
#define PROG_STATE_WRITEEEPROM  4

#define ISP_SCK_SLOW 0
#define ISP_SCK_FAST 1

#define USBASP_BLOCKFLAG_FIRST    1
#define USBASP_BLOCKFLAG_LAST     2

#define USBASP_READBLOCKSIZE   200
#define USBASP_WRITEBLOCKSIZE  200

class CUSBOP  
{
public:
	CUSBOP();
	virtual ~CUSBOP();
public:
	int usbaspOpen();
	BOOL usbaspClose();
	BOOL usbaspTransmit(unsigned char receive, unsigned char functionid,unsigned char send[4], unsigned char * buffer, int buffersize);
	BOOL usbaspConnect();
	BOOL usbaspDisconnect();
	int  usbaspInitialize();
	BOOL usbaspEnterProMode();
	unsigned char usbaspCheck(); //0 连接usb设备,其他没有正常连接
	BOOL usbaspEnable();
	int usbaspCmd(unsigned char cmd[4], unsigned char res[4]);
	int usbaspReceive(unsigned char *p);
	int usbaspSetting(unsigned char p[4]);
	BOOL mcuResert();
};

#endif // !defined(AFX_USBOP_H__1160A1C7_6AF6_4B15_A091_316DB6090F4E__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -