阅读:2039回复:2
求教cypress芯片firmware
;这是Cypress公布的利用Cy7c63723编写的USB和串口共用鼠标的例程节录
;=========================================================== ; Process EP0 SETUP packet ; ;=========================================================== ep0SetupReceived: mov A, NAK_IN_OUT ; clear setup bit to enable iowr EP0_MODE ; writes to EP0 DMA buffer mov A, [ep0DmaBuff + BMREQUESTTYPE] ; compact bmRequestType into 5 bit field and A, E3h ; clear bits 4-3-2, these unused for our purposes push A ; store value asr A ; move bits 7-6-5 into 4-3-2\'s place asr A ; asr A ; mov [intTemp], A ; store shifted value pop A ; get original value or A, [intTemp] ; or the two to get the 5-bit field and A, 1Fh ; clear bits 7-6-5 (asr wraps bit7) ;and后,A中的值为00h-1fh,这和bmRequestTypeJumptable的索引值范围刚好对应。 asl A ; shift to index jumptable ;为什么需要算术左移1位?这样,不是和bmRequestTypeJumptable的索引值范围不对应了吗? ;是不是jacc有特殊要求? jacc bmRequestTypeJumptable ; jump to handle bmRequestType ;******************************************************************** ; USB REQUEST JUMP TABLES ;******************************************************************** XPAGEOFF ORG D00h ; ; bmRequestTypes commented out are not used for this device, ; but may be used for your device. They are kept here as ; an example of how to use this jumptable. ; bmRequestTypeJumptable: jmp h2dStdDevice ; 00 jmp h2dStdInterface ; 01 jmp h2dStdEndpoint ; 02 jmp questNotSupported ;h2d_std_other 03 jmp requestNotSupported ; h2d_class_device 04 jmp h2dClassInterface ; 05 jmp requestNotSupported ; h2d_classEndpoint 06 jmp requestNotSupported ; h2d_class_other 07 jmp requestNotSupported ; h2d_vendor_device 08 jmp requestNotSupported ; h2d_vendorInterface 09 jmp requestNotSupported ; h2d_vendorEndpoint 0A jmp requestNotSupported ; h2d_vendor_other 0B jmp requestNotSupported ; 0C jmp requestNotSupported ; 0D jmp requestNotSupported ; 0E jmp requestNotSupported ; 0F jmp d2hStdDevice ; 10 jmp d2hStdInterface ; 11 jmp d2hStdEndpoint ; 12 jmp requestNotSupported ; d2h_std_other 13 jmp requestNotSupported ; d2h_class_device 14 jmp d2hClassInterface ; 15 jmp requestNotSupported ; d2h_classEndpoint 16 jmp requestNotSupported ; d2h_class_other 17 jmp requestNotSupported ; d2h_vendor_device 18 jmp requestNotSupported ; d2h_vendorInterface 19 jmp requestNotSupported ; d2h_vendorEndpoint 1A jmp requestNotSupported ; d2h_vendor_other 1B jmp requestNotSupported ; 1C jmp requestNotSupported ; 1D jmp requestNotSupported ; 1E jmp requestNotSupported ; 1F ; ; Transaction Types ; TRANS_NONE: equ 00h TRANS_CONTROL_READ: equ 02h TRANS_CONTROL_WRITE: equ 04h TRANS_NO_DATA_CONTROL: equ 06h ep0InReceived: mov A, [ep0Transtype] ; ep0Transtype用于存放上述Transaction Type值之一。 jacc ep0InJumptable ;ep0InReceived中断处理中,没有了asl,但是,这样后,好像和下面的ep0InJumptable索引值对不上。 ep0InJumptable: jmp requestNotSupported jmp controlReadDataStage jmp controlWriteStatusStage jmp noDataControlStatusStage ;望大家指点一下。谢谢。 |
|
沙发#
发布于:2004-03-01 16:09
由于后面的JMP指令是双地址的,故要Asl才能相配
|
|
|
板凳#
发布于:2004-03-02 12:02
;这是Cypress公布的利用Cy7c63723编写的USB和串口共用鼠标的例程节录 |
|
|