最新回复
你是指什么重启,在固件还是驱动中.
如果是驱动中重启,使用的芯片带8051的话,可以使用以下函数
NTSTATUS Ezusb_8051Reset(
PDEVICE_OBJECT fdo,
UCHAR resetBit
)
/*++
Routine Description:
Uses the ANCHOR LOAD vendor specific command to either set or release the
8051 reset bit in the EZ-USB chip.
Arguments:
fdo - pointer to the device object for this instance of an Ezusb Device
resetBit - 1 sets the 8051 reset bit (holds the 8051 in reset)
0 clears the 8051 reset bit (8051 starts running)
Return Value:
STATUS_SUCCESS if successful,
STATUS_UNSUCCESSFUL otherwise
--*/
{
NTSTATUS ntStatus;
PURB urb = NULL;
urb = ExAllocatePool(NonPagedPool,
sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST));
if (urb)
{
// toggle the EZ-USB reset bit (harmless on FX2)
RtlZeroMemory(urb,sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST));
urb->UrbHeader.Length = sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST);
urb->UrbHeader.Function = URB_FUNCTION_VENDOR_DEVICE;
urb->UrbControlVendorClassRequest.TransferBufferLength = 1;
urb->UrbControlVendorClassRequest.TransferBuffer = &resetBit;
urb->UrbControlVendorClassRequest.TransferBufferMDL = NULL;
urb->UrbControlVendorClassRequest.Request = ANCHOR_LOAD_INTERNAL;
urb->UrbControlVendorClassRequest.Value = CPUCS_REG_EZUSB;
urb->UrbControlVendorClassRequest.Index = 0;
ntStatus = Ezusb_CallUSBD(fdo, urb);
// toggle the FX2 reset bit (harmless on EZ-USB)
RtlZeroMemory(urb,sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST));
urb->UrbHeader.Length = sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST);
urb->UrbHeader.Function = URB_FUNCTION_VENDOR_DEVICE;
urb->UrbControlVendorClassRequest.TransferBufferLength = 1;
urb->UrbControlVendorClassRequest.TransferBuffer = &resetBit;
urb->UrbControlVendorClassRequest.TransferBufferMDL = NULL;
urb->UrbControlVendorClassRequest.Request = ANCHOR_LOAD_INTERNAL;
urb->UrbControlVendorClassRequest.Value = CPUCS_REG_FX2;
urb->UrbControlVendorClassRequest.Index = 0;
ntStatus = Ezusb_CallUSBD(fdo, urb);
}
else
{
ntStatus = STATUS_NO_MEMORY;
}
if (urb)
ExFreePool(urb);
return ntStatus;
}
详情
回复
发表于 2007-10-24 09:23
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
EEWorld Datasheet 技术支持