📄 3100_2interface.lst
字号:
943 00943 01C0 178E btfss 0eh,6
944 00944 01C1 31C4 goto Sendbyte7
945 00945 01C2 0825 movfw TableCnt
946 00946 01C3 2F00 call DeviceReportTable
00947 Sendbyte7:
948 00948 01C4 001F movwr Tx0Fifo7
949 00949 01C5 0AA5 incf TableCnt,F
950 00950 01C6 0AA4 incf LengthCnt,F
951 00951 01C7 03A3 decf WLengthTemp,F
0952
00953 SetTgl:
954 00954 01C8 1940 movlw 40h
955 00955 01C9 0695 xorwf Tx0Reg,F
00956 SetCnt:
957 00957 01CA 19F0 movlw f0h
958 00958 01CB 0595 andwf Tx0Reg,F
959 00959 01CC 0824 movfw LengthCnt
960 00960 01CD 0495 iorwf Tx0Reg,F
961 00961 01CE 13D5 bsf 15h,7
962 00962 01CF 1213 bsf 13h,0
963 00963 01D0 0040 ret
0964
00965 ;==============================================================================
00966 ;Function:NoDataControl
00967 ; No data control task.
00968 ;==============================================================================
0969
00970 NoDataControl:
971 00971 01D1 19C0 movlw c0h
972 00972 01D2 0095 movwf Tx0Reg
973 00973 01D3 1213 bsf 13h,0
974 00974 01D4 0040 ret
0975
00976 ;==============================================================================
00977 ;Function:Tx0Task
00978 ; 1.Check transfer buffer, if we still have data to transfer
00979 ;==============================================================================
0980
00981 Tx0Task:
00982 Ep0In:
983 00983 01D5 108E bcf 0eh,2
984 00984 01D6 17CE btfss 0eh,7
985 00985 01D7 31DB goto Tx0TransCheck
0986
00987 SetNewAdr:
988 00988 01D8 081A movfw WValue
989 00989 01D9 0490 iorwf UsbFun,F
990 00990 01DA 11CE bcf 0eh,7
0991
00992 Tx0TransCheck:
993 00993 01DB 08A3 testz WLengthTemp
994 00994 01DC 1683 btfss 03h,2
995 00995 01DD 31E6 goto NormalTrans
996 00996 01DE 118E bcf 0eh,6
0997
998 00998 01DF 1940 movlw 40h
999 00999 01E0 0695 xorwf Tx0Reg,F
1000 01000 01E1 19F0 movlw f0h
1001 01001 01E2 0595 andwf Tx0Reg,F
1002 01002 01E3 13D5 bsf 15h,7
1003 01003 01E4 1213 bsf 13h,0
1004 01004 01E5 0040 ret
1005
01006 NormalTrans:
1007 01007 01E6 215F call Tx0Transfer
1008 01008 01E7 0040 ret
1009
01010 ;==============================================================================
01011 ;Function:Rc0Task
01012 ; In the case of the keyboard, check whitch command to be received, an ACK out
01013 ; occurs either in the case of the status phase of a control read, or the data
01014 ; out phase of a control write.
01015 ;==============================================================================
1016
01017 Rc0Task:
1018 01018 01E8 10CE bcf 0eh,3
1019 01019 01E9 1594 btfsc 14h,6
1020 01020 01EA 3243 goto Rc0TaskError
1021 01021 01EB 1554 btfsc 14h,5
1022 01022 01EC 3243 goto Rc0TaskError
1023 01023 01ED 1714 btfss 14h,4
1024 01024 01EE 3226 goto Ep0Out
1025 01025 01EF 15D4 btfsc 14h,7
1026 01026 01F0 3243 goto Rc0TaskError
1027 01027 01F1 190F movlw 0fh
1028 01028 01F2 0514 andwf Rc0Cnt,W
1029 01029 01F3 00B3 movwf AnyCountTemp
1030 01030 01F4 1908 movlw 08h
1031 01031 01F5 02B3 subwf AnyCountTemp,F
1032 01032 01F6 1683 btfss 03h,2
1033 01033 01F7 3243 goto Rc0TaskError
1034
01035 Ep0Setup:
1036 01036 01F8 1195 bcf 15h,6
1037 01037 01F9 1921 movlw HidSetRequest ;(21h)
1038 01038 01FA 0218 subwf BmRequestType,W
1039 01039 01FB 1483 btfsc 03h,2
1040 01040 01FC 3282 goto HidSetRequestTask
1041
1042 01042 01FD 19A1 movlw HidGetRequest ;(a1h)
1043 01043 01FE 0218 subwf BmRequestType,W
1044 01044 01FF 1483 btfsc 03h,2
1045 01045 0200 33C5 goto HidGetRequestTask
1046
1047 01047 0201 1905 movlw SetAddress ;(05h)
1048 01048 0202 0219 subwf BRequest,W
1049 01049 0203 1483 btfsc 03h,2
1050 01050 0204 32A7 goto SetAddressTask
1051
1052 01052 0205 1908 movlw GetConfiguration ;(08h)
1053 01053 0206 0219 subwf BRequest,W
1054 01054 0207 1483 btfsc 03h,2
1055 01055 0208 3320 goto GetConfigurationTask
1056
1057 01057 0209 1909 movlw SetConfiguration ;(09h)
1058 01058 020A 0219 subwf BRequest,W
1059 01059 020B 1483 btfsc 03h,2
1060 01060 020C 32AA goto SetConfigurationTask
1061
1062 01062 020D 1900 movlw GetStatus ;(00h)
1063 01063 020E 0219 subwf BRequest,W
1064 01064 020F 1483 btfsc 03h,2
1065 01065 0210 3374 goto GetStatusTask
1066
1067 01067 0211 190A movlw GetInterface ;(0ah)
1068 01068 0212 0219 subwf BRequest,W
1069 01069 0213 1483 btfsc 03h,2
1070 01070 0214 33AB goto GetInterfaceTask
1071
1072 01072 0215 190B movlw SetInterface ;(0bh)
1073 01073 0216 0219 subwf BRequest,W
1074 01074 0217 1483 btfsc 03h,2
1075 01075 0218 33B7 goto SetInterfaceTask
1076
1077 01077 0219 1901 movlw ClearFeature ;(01h)
1078 01078 021A 0219 subwf BRequest,W
1079 01079 021B 1483 btfsc 03h,2
1080 01080 021C 332C goto ClearFeatureTask
1081
1082 01082 021D 1903 movlw SetFeature ;(03h)
1083 01083 021E 0219 subwf BRequest,W
1084 01084 021F 1483 btfsc 03h,2
1085 01085 0220 334F goto SetFeatureTask
1086
1087 01087 0221 1906 movlw GetDescriptor ;(06h)
1088 01088 0222 0219 subwf BRequest,W
1089 01089 0223 1483 btfsc 03h,2
1090 01090 0224 32C6 goto GetDescriptorTask
1091
1092 01092 0225 3243 goto Rc0TaskError
1093
01094 Ep0Out:
1095 01095 0226 0814 movfw Rc0Cnt
1096 01096 0227 00B3 movwf AnyCountTemp
1097 01097 0228 190F movlw 0fh
1098 01098 0229 05B3 andwf AnyCountTemp,F
1099 01099 022A 08B3 testz AnyCountTemp
1100 01100 022B 1483 btfsc 03h,2
1101 01101 022C 3241 goto NoDataControlWrite
1102
01103 ControlWrite:
1104 01104 022D 0818 movfw Rc0Fifo0
1105 01105 022E 00B8 movwf InOutBuffer0
1106 01106 022F 0819 movfw Rc0Fifo1
1107 01107 0230 00B9 movwf InOutBuffer1
1108 01108 0231 081A movfw Rc0Fifo2
1109 01109 0232 00BA movwf InOutBuffer2
1110 01110 0233 081B movfw Rc0Fifo3
1111 01111 0234 00BB movwf InOutBuffer3
1112 01112 0235 081C movfw Rc0Fifo4
1113 01113 0236 00BC movwf InOutBuffer4
1114 01114 0237 081D movfw Rc0Fifo5
1115 01115 0238 00BD movwf InOutBuffer5
1116 01116 0239 081E movfw Rc0Fifo6
1117 01117 023A 00BE movwf InOutBuffer6
1118 01118 023B 081F movfw Rc0Fifo7
1119 01119 023C 00BF movwf InOutBuffer7
1120
1121 01121 023D 21D1 call NoDataControl
1122
1123 01123 023E 2266 call DataOutTask
1124
1125 01125 023F 2245 call CommandTask
1126 01126 0240 0040 ret
1127
01128 NoDataControlWrite:
1129 01129 0241 21D1 call NoDataControl
1130 01130 0242 0040 ret
1131
01132 Rc0TaskError:
1133 01133 0243 1355 bsf 15h,5
1134 01134 0244 0040 ret
1135
01136 ;==============================================================================
01137 ;Function:CommandTask
01138 ;==============================================================================
1139
01140 CommandTask:
1141 01141 0245 178F btfss 0fh,6
1142 01142 0246 0040 ret
1143
1144 01144 0247 118F bcf 0fh,6
1145
1146 01146 0248 1955 movlw 55h
1147 01147 0249 0238 subwf InOutBuffer0,W
1148 01148 024A 1683 btfss 03h,2
1149 01149 024B 0040 ret
1150 01150 024C 1953 movlw 53h
1151 01151 024D 0239 subwf InOutBuffer1,W
1152 01152 024E 1683 btfss 03h,2
1153 01153 024F 0040 ret
1154 01154 0250 1942 movlw 42h
1155 01155 0251 023A subwf InOutBuffer2,W
1156 01156 0252 1683 btfss 03h,2
1157 01157 0253 0040 ret
1158 01158 0254 1943 movlw 43h
1159 01159 0255 023B subwf InOutBuffer3,W
1160 01160 0256 1683 btfss 03h,2
1161 01161 0257 0040 ret
1162
1163 01163 0258 083D movfw InOutBuffer5
1164 01164 0259 00B6 movwf ReportDataLength
1165
01166 InputValueTest:
1167 01167 025A 1901 movlw InputValue
1168 01168 025B 023E subwf InOutBuffer6,W
1169 01169 025C 1683 btfss 03h,2
1170 01170 025D 3260 goto OutputValueTest
1171 01171 025E 13CF bsf 0fh,7
1172 01172 025F 0040 ret
1173
01174 OutputValueTest:
1175 01175 0260 1902 movlw OutputValue
1176 01176 0261 023E subwf InOutBuffer6,W
1177 01177 0262 1683 btfss 03h,2
1178 01178 0263 0040 ret
1179 01179 0264 134F bsf 0fh,5
1180 01180 0265 0040 ret
1181
01182 ;==============================================================================
01183 ;Function:DataOutTask
1184
01185 ;==============================================================================
1186
01187 DataOutTask:
1188 01188 0266 174F btfss 0fh,5
1189 01189 0267 0040 ret
1190
01191 GetData:
1192 01192 0268 1900 movlw 00h
1193 01193 0269 00B3 movwf AnyCountTemp
1194
1195 01195 026A 08B6 testz ReportDataLength
1196 01196 026B 1683 btfss 03h,2
1197 01197 026C 326F goto SaveOutData
1198
1199 01199 026D 114F bcf 0fh,5
1200 01200 026E 0040 ret
1201
01202 SaveOutData:
1203 01203 026F 1938 movlw InOutBuffer
1204 01204 0270 0084 movwf Fsr
1205 01205 0271 0833 movfw AnyCountTemp
1206 01206 0272 0784 addwf Fsr,F
1207 01207 0273 0800 movfw Indf
1208 01208 0274 00AF movwf UsbDataTemp
1209
1210 01210 0275 1940 movlw DataBuffer
1211 01211 0276 0084 movwf Fsr
1212 01212 0277 0336 decf ReportDataLength,W
1213 01213 0278 00B6 movwf ReportDataLength
1214 01214 0279 0784 addwf Fsr,F
1215 01215 027A 082F movfw UsbDataTemp
1216 01216 027B 0080 movwf Indf
1217 01217 027C 0AB3 incf AnyCountTemp,F
1218 01218 027D 1908 movlw 08h
1219 01219 027E 0233 subwf AnyCountTemp,W
1220 01220 027F 1683 btfss 03h,2
1221 01221 0280 326F goto SaveOutData
1222 01222 0281 0040 ret
1223
01224 ;==============================================================================
01225 ;Function:HidSetRequestTask(21,09)(21,0a)(21,0b)
01226 ; There are three Hid reports to be set:
01227 ; 1.Set Report is used to control the LEDs in the keyboard. An OUT packet
01228 ; will be received that will have a bit set for every LED that should be
01229 ; turned on.
01230 ; 2.Set Idle silences a particular report on the interrupt pipe until a new
01231 ; event occurs or the specified amount of time (wValueHi) passes.
01232 ; The resolution of the specified duration is 4ms (i.e the weight of the
01233 ; LSB is 4ms)
01234 ; 3.Set Protocol switches between the boot protocol and the report protocol.
01235 ; For boot protocol, wValue=0. For report protocol, wValue=1.
01236 ;==============================================================================
1237
01238 HidSetRequestTask:
1239 01239 0282 1909 movlw SetReport
1240 01240 0283 0219 subwf BRequest,W
1241 01241 0284 1483 btfsc 03h,2
1242 01242 0285 3295 goto HidSetReport
1243
1244 01244 0286 190A movlw SetIdle
1245 01245 0287 0219 subwf BRequest,W
1246 01246 0288 1483 btfsc 03h,2
1247 01247 0289 3291 goto HidSetIdle
1248
1249 01249 028A 190B movlw SetProtocol
1250 01250 028B 0219 subwf BRequest,W
1251 01251 028C 1683 btfss 03h,2
1252 01252 028D 32A5 goto HidSetRequestTaskError
1253
01254 HidSetProtocol:
1255 01255 028E 081A movfw WValue
1256 01256 028F 00AB movwf HidProtocolStatus
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -