You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
//注意:使用这些函数需要1.5.30及以上的固件才支持
|
|
|
|
|
|
namespace USB2XXX
|
|
|
|
|
|
{
|
|
|
|
|
|
class TINYCHIP_PROGRAMER
|
|
|
|
|
|
{
|
|
|
|
|
|
//定义函数返回错误代码
|
|
|
|
|
|
public const Int32 TINYCHIP_SUCCESS = (0); //函数执行成功
|
|
|
|
|
|
public const Int32 TINYCHIP_ERR_OPEN_DEV = (-1); //打开设备失败
|
|
|
|
|
|
public const Int32 TINYCHIP_ERR_INIT_DEV = (-2); //初始化设备失败
|
|
|
|
|
|
public const Int32 TINYCHIP_ERR_FILE_FORMAT = (-3); //文件格式错误
|
|
|
|
|
|
public const Int32 TINYCHIP_ERR_BEGIN_PROG = (-4); //进入编程模式错误
|
|
|
|
|
|
public const Int32 TINYCHIP_ERR_CMD_FAIL = (-5); //命令执行失败
|
|
|
|
|
|
public const Int32 TINYCHIP_ERR_PRG_FAILD = (-6); //写Flash失败
|
|
|
|
|
|
public const Int32 TINYCHIP_ERR_FIND_CHIP = (-7); //寻找芯片失败
|
|
|
|
|
|
public const Int32 TINYCHIP_ERR_SET_BAUD = (-8); //设置波特率失败
|
|
|
|
|
|
public const Int32 TINYCHIP_ERR_SA = (-9); //安全访问出错
|
|
|
|
|
|
//函数定义
|
|
|
|
|
|
[DllImport("USB2XXX.dll")]
|
|
|
|
|
|
public static extern Int32 Tinychip_StartProg(Int32 DevHandle, byte LINChannel, byte NAD, Int32 SpeedValue, StringBuilder AppFileName);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|