ÒýÑÔ
USB×ÜÏßÊÇ1995Äê΢Èí¡¢IBMµÈ¹«Ë¾ÍƳöµÄÒ»ÖÖÐÂÐÍͨÐűê×¼×ÜÏߣ¬ÌصãÊÇËٶȿ졢¼Û¸ñµÍ¡¢¶ÀÁ¢¹©µç¡¢Ö§³ÖÈȲå°ÎµÈ£¬Æä°æ±¾´ÓÔçÆÚµÄ1.0¡¢1.1ÒѾ·¢Õ¹µ½Ä¿Ç°µÄ2.0°æ±¾£¬2.0°æ±¾µÄ×î¸ßÊý¾Ý´«ÊäËٶȴﵽ480Mbit/s£¬ÄÜÂú×ã°üÀ¨ÊÓƵÔÚÄڵĶàÖÖ¸ßËÙÍⲿÉ豸µÄÊý¾Ý´«ÊäÒªÇó£¬ÓÉÓÚÆäÖÚ¶àµÄÓŵ㣬USB×ÜÏßÔ½À´Ô½¶àµÄ±»Ó¦Óõ½¼ÆËã»úÓëÍâÉèµÄ½Ó¿ÚÖУ¬Ð¾Æ¬³§¼ÒÒ²ÌṩÁ˶àÖÖUSB½Ó¿ÚоƬ¹©Éè¼ÆÕßʹÓã¬ÎªÁË¿ª·¢³ö¹¦ÄÜÇ¿´óµÄUSBÉ豸£¬Éè¼ÆÕßÍùÍùÐèÒª×Ô¼º¿ª·¢USBÉ豸Çý¶¯³ÌÐò£¬Çý¶¯³ÌÐò¿ª·¢Ò»Ö±ÊÇWINDOWS¿ª·¢ÖнÏÄѵÄÒ»¸ö·½Ã棬µ«ÊÇͨ¹ýʹÓÃרÃŵÄÇý¶¯³ÌÐò¿ª·¢°üÄܼõС¿ª·¢µÄÄѶȣ¬Ìá¸ß¹¤×÷ЧÂÊ£¬±¾ÎÄʹÓÃCompuware Numega¹«Ë¾µÄDriverStudio3.2¿ª·¢°ü£¬¿ª·¢ÁË»ùÓÚPHILIPS¹«Ë¾USB2.0¿ØÖÆоƬISP1581µÄUSBÉ豸Çý¶¯³ÌÐò¡£
USBÉ豸Çý¶¯³ÌÐòµÄÄ£ÐÍ
ͼ1 USBÇý¶¯³ÌÐòÄ£ÐÍ
USBÉ豸Çý¶¯³ÌÐòÊÇÒ»ÖÖµäÐ͵ÄWDM(Windows Driver Model)Çý¶¯³ÌÐò£¬Æä³ÌÐòÄ£ÐÍÈçͼ1Ëùʾ¡£Óû§Ó¦ÓóÌÐò¹¤×÷ÔÚWindows²Ù×÷ϵͳµÄÓû§Ä£Ê½²ã£¬Ëü²»ÄÜÖ±½Ó·ÃÎÊUSBÉ豸£¬µ±ÐèÒª·ÃÎÊʱ£¬Í¨¹ýµ÷ÓòÙ×÷ϵͳµÄAPI(Application programming interface)º¯ÊýÉú³ÉI/OÇëÇóÐÅÏ¢°ü(IRP)£¬IRP±»´«Êäµ½¹¤×÷ÓÚÄÚºËģʽ²ãµÄÉ豸Çý¶¯³ÌÐò£¬²¢Í¨¹ýÇý¶¯³ÌÐòÍê³ÉÓëUBSÍâÉèͨÐÅ¡£É豸Çý¶¯³ÌÐò°üÀ¨Á½²ã£ºº¯ÊýÇý¶¯³ÌÐò²ãºÍ×ÜÏßÇý¶¯³ÌÐò²ã£¬º¯ÊýÇý¶¯³ÌÐòÒ»·½Ãæͨ¹ýIRP¼°APIº¯ÊýÓëÓ¦ÓóÌÐòͨÐÅ£¬ÁíÒ»·½Ãæµ÷ÓÃÏàÓ¦µÄ×ÜÏßÇý¶¯³ÌÐò£¬×ÜÏßÇý¶¯³ÌÐòÍê³ÉºÍÍâÉèÓ²¼þͨÐÅ¡£USB×ÜÏßÇý¶¯³ÌÐòÒѾÓɲÙ×÷ϵͳÌṩ£¬Çý¶¯³ÌÐò¿ª·¢µÄÖصãÊǺ¯ÊýÇý¶¯³ÌÐò¡£
USBÉ豸Çý¶¯³ÌÐòµÄÉè¼Æ
ʹÓÃDriverStudio3.2¿ª·¢USBÉ豸Çý¶¯³ÌÐò
¸ÃÇý¶¯³ÌÐòµÄÖ÷Òª¹¦ÄÜ°üÀ¨£º´Ó¿ØÖƶ˵ã0¶ÁÈ¡¹æ¶¨¸öÊýµÄÊý¾Ý¡¢Ïò¶Ëµã0·¢³ö¿ØÖÆÃüÁî¡¢´Ó¶Ëµã2ÅúÁ¿¶ÁÊý¾Ý¡¢Ïò¶Ëµã2ÅúÁ¿Ð´Êý¾Ý£¬Çý¶¯³ÌÐòµÄ¿ª·¢²ÉÓÃDriverStudio3.2Çý¶¯³ÌÐò¿ª·¢°ü¼°VC++6.0£¬Ê¹Óÿª·¢°üÖеÄÏòµ¼³ÌÐòDriverWizard¾Í¿ÉÒÔ·½±ãµÄÉú³ÉÇý¶¯³ÌÐò¿ò¼Ü¡¢Ä£¿é¼°²¿·Ö³ÌÐòÔ´´úÂ룬¿ª·¢ÕßÖ»ÐèÒªÔÚ¹¦ÄÜÄ£¿éÖмÓÈë×Ô¼ºµÄʵÏÖ³ÌÐò¾ÍÄÜÍê³É¸´ÔÓµÄUSBÉ豸Çý¶¯³ÌÐòÉè¼Æ£¬ÏÂÃæ½éÉÜʹÓÃDriverWizardÉú³ÉISP1581Çý¶¯³ÌÐòµÄ¹ý³Ì£º
1)Æô¶¯DriverWizard£¬Ñ¡ÔñDriverWorks Project´´ÔìÒ»¸öÃûΪUSBDIOµÄVC++ÏîÄ¿;
2)ÔÚÇý¶¯³ÌÐòÀàÐÍÖÐÑ¡ÔñWDM Driver£¬WDM Function Driver,ÔÚÓ²¼þÉ豸ËùÖ§³ÖµÄ×ÜÏßÀàÐÍÖÐÑ¡ÔñUSB(WDM Only)£¬ÔÚUSB Vendor ID(³§ÉÌʶ±ðÂë)ÖÐÌîд0741£¬ÔÚUSB Product ID(²úƷʶ±ðÂë)ÖÐÌîд0821;
3)Ôö¼ÓUSBÉ豸¶Ëµã£¬ÉèÖö˵ã2ΪÅúÁ¿ÊäÈë/Êä³ö´«Ê䷽ʽ;
4)ÔÚÇý¶¯³ÌÐòÖ§³ÖµÄ¹¦ÄÜÏîÖÐÑ¡ÔñRead¡¢Write¡¢Device Control¡¢Cleanup;
5)Ñ¡Ôñ×Ô¶¯²úÉúÅúÁ¿¶Á¼°ÅúÁ¿Ð´³ÌÐò´úÂë;
6)ÔÚI/OÇëÇóIRP´¦Àí·½Ê½ÖÐÑ¡ÔñNone£¬¼´IRP²»ÅŶÓ;
7)ÔڽӿڵĴò¿ª·½Ê½ÖÐÑ¡ÔñSymbolic link:UsbdioDevice£¬¼´Ó¦ÓóÌÐòÒÔ·ûºÅÁ´½ÓÃû´ò¿ªÉ豸;
8)¶¨ÒåÓ¦ÓóÌÐòµ÷ÓÃDeviceIoControlº¯Êý¶ÔWDMÇý¶¯³ÌÐòͨÐŵĿØÖÆÃüÁ½á¹ûÈçͼ2Ëùʾ¡£
ͼ2 ¶¨Òå¿ØÖÆ´úÂë
9)×îºóÑ¡ÔñÍê³É²¢È·ÈÏÉú³ÉеÄÏîÄ¿ÐÅÏ¢£¬Ïòµ¼³ÌÐò¾Í»áÔÚusbdioĿ¼ÖÐÉú³ÉÒ»¸öÃûΪUSBDIOµÄÏîÄ¿Îļþ£¬ÆäÖаüÀ¨ÁËISP1581Çý¶¯³ÌÐò¿ò¼Ü¡¢Ä£¿é¼°²¿·ÖÔ´´úÂë¡£
USBÉ豸Çý¶¯³ÌÐòµÄ±à³Ì
ÔÚʹÓÃDriverWizardÉú³ÉÇý¶¯³ÌÐò¿ò¼Ü¡¢Ä£¿é¼°²¿·Ö³ÌÐòÔ´´úÂëºó£¬¿ª·¢ÕßÖ»ÐèÍê³Éͼ2ÖÐÈý¸ö¿ØÖÆ´úÂëËù¶ÔÓ¦µÄÈý¸ö¹¦ÄÜÄ£¿éµÄ±à³Ì£ºÄ£¿éUSBDIO_IOCTL_ID_CODE_HandlerµÄ¹¦ÄÜÊÇ´Ó¿ØÖƶ˵ã0¶ÁÈ¡Êý¾Ý£¬Ä£¿éUSBDIO_IOCTL_TEST_COMMAND_HandlerµÄ¹¦ÄÜÊÇÏò¿ØÖƶ˵ã0·¢ËÍÒ»¸ö¿ØÖÆÃüÁģ¿éUSBDIO_IOCTL_DMA_COMMAND_HandlerµÄ¹¦ÄÜÊÇÏò¿ØÖƶ˵ã0·¢ËÍÒ»¸öÒªÇóUSBÉ豸½øÐÐDMA´«ÊäµÄ¿ØÖÆÃüÁÏÂÃæÊǵÚÒ»¸öÄ£¿éµÄ±à³ÌʵÀý¡£
NTSTATUS USBDIODevice::USBDIO_IOCTL_ID_CODE_Handler(KIrp I)
{
NTSTATUS status = STATUS_SUCCESS;
t << Entering USBDIODevice::USBDIO_IOCTL_ID_CODE_Handler, << I << EOL;
PURB pUrb;
ULONG numData;
numData=*(PUCHAR)I.IoctlBuffer();//ÉèÖöÁÈ¡µÄÊý¾Ý¸öÊý
pUrb=m_Lower.BuildVendorRequest(
(PUCHAR)I.IoctlBuffer(),//Çý¶¯³ÌÐò´æ·Å¶ÁÈ¡µÄÊý¾ÝµÄÄÚ´æÇø
numData,//wLength£¬¶ÁÈ¡µÄÊý¾Ý¸öÊý
0,
0x0c,//bRequest
0,//wValue
TRUE,//input
TRUE,
NULL,
0x0472,//wIndex,´«Êäµ½¹Ì¼þ³ÌÐòµÄ¶ÁÊýÃüÁîÂë
URB_FUNCTION_VENDOR_ENDPOINT,
NULL
);
if(pUrb==NULL)
{
I.Information() =0;
status=STATUS_INSUFFICIENT_RESOURCES;
}
else
{
I.Information() =numData;
status=m_Lower.SubmitUrb(pUrb,NULL,NULL,0);
delete pUrb;
}
return status;
}
×÷Õߣº³ÂÐÂÖÒ Öйúµç×ӿƼ¼¼¯ÍŹ«Ë¾µÚ¶þÊ®Ñо¿Ëù À´Ô´£ºµç×Ó²úÆ·ÊÀ½ç