00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 #include "USB_Type.h"
00086 #include "USB_Configuration.h"
00087 #include "USB_Register.h"
00088 #include "USB_Descriptor.h"
00089 #include "USB_ISR.h"
00090 #include "USB_CDC_UART.h"
00091 #include "USB_Main.h"
00092 #include "USB_Standard_Requests.h"
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 static BYTE code ONES_PACKET[2] = {0x01, 0x00};
00104 static BYTE code ZERO_PACKET[2] = {0x00, 0x00};
00105
00106
00107
00108
00109
00110 static void Get_Status(void);
00111 static void Clear_Feature(void);
00112 static void Set_Feature(void);
00113 static void Set_Address(void);
00114 static void Get_Descriptor(void);
00115 static void Get_Configuration(void);
00116 static void Set_Configuration(void);
00117 static void Get_Interface(void);
00118 static void Set_Interface(void);
00119 static bit Set_Halt( BYTE endpoint, BYTE status );
00120
00121
00122
00123
00124
00125 #if (defined USE_EP1_OUT) && !(defined ENABLE_EP1_OUT_ISO)
00126 #define USE_EP1_OUT_STATUS
00127 #endif
00128 #if (defined USE_EP2_OUT) && !(defined ENABLE_EP2_OUT_ISO)
00129 #define USE_EP2_OUT_STATUS
00130 #endif
00131 #if (defined USE_EP3_OUT) && !(defined ENABLE_EP3_OUT_ISO)
00132 #define USE_EP3_OUT_STATUS
00133 #endif
00134 #if (defined USE_EP1_IN) && !(defined ENABLE_EP1_IN_ISO)
00135 #define USE_EP1_IN_STATUS
00136 #endif
00137 #if (defined USE_EP2_IN) && !(defined ENABLE_EP2_IN_ISO)
00138 #define USE_EP2_IN_STATUS
00139 #endif
00140 #if (defined USE_EP3_IN) && !(defined ENABLE_EP3_IN_ISO)
00141 #define USE_EP3_IN_STATUS
00142 #endif
00143
00144
00145
00146
00147 #if defined SDCC
00148 #pragma nooverlay
00149 #endif // SDCC
00150
00151
00152
00153
00154
00155 void Standard_Device_Request( void )
00156 {
00157 switch(Setup.bRequest)
00158 {
00159 case GET_STATUS: Get_Status(); break;
00160 case CLEAR_FEATURE: Clear_Feature(); break;
00161 case SET_FEATURE: Set_Feature(); break;
00162 case SET_ADDRESS: Set_Address(); break;
00163 case GET_DESCRIPTOR: Get_Descriptor(); break;
00164 case GET_CONFIGURATION: Get_Configuration(); break;
00165 case SET_CONFIGURATION: Set_Configuration(); break;
00166 case GET_INTERFACE: Get_Interface(); break;
00167
00168
00169 case STD_REQ_RESERVE1:
00170 case STD_REQ_RESERVE2:
00171 case SET_DESCRIPTOR:
00172 case SET_INTERFACE:
00173 case SYNCH_FRAME:
00174 default: break;
00175 }
00176 }
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194 static void Get_Status(void)
00195 {
00196 bit aStatus;
00197
00198
00199 if ( (Setup.wValue.i == 0) && (Setup.wLength.i == 2) )
00200 {
00201
00202 switch( Setup.bmRequestType )
00203 {
00204 case IN_DEVICE:
00205 if ( Setup.wIndex.i == 0 )
00206 {
00207
00208 DataPtr = (BYTE*)&ZERO_PACKET;
00209 setup_handled = TRUE;
00210 }
00211 break;
00212
00213 case IN_INTERFACE:
00214
00215 if ( (USB_State == DEV_CONFIGURED) && (Setup.wIndex.i < DSC_NUM_INTERFACE) )
00216 {
00217
00218 DataPtr = (BYTE*)&ZERO_PACKET;
00219 setup_handled = TRUE;
00220 }
00221 break;
00222
00223 case IN_ENDPOINT:
00224
00225 if ((USB_State == DEV_CONFIGURED) && (Setup.wIndex.c[MSB] == 0) )
00226 {
00227 aStatus = EP_IDLE;
00228 switch ( Setup.wIndex.c[LSB] )
00229 {
00230 #ifdef USE_EP1_OUT_STATUS
00231 case EP1_OUT: aStatus = Ep_StatusOUT1; setup_handled = TRUE; break;
00232 #endif
00233 #ifdef USE_EP2_OUT_STATUS
00234 case EP2_OUT: aStatus = Ep_StatusOUT2; setup_handled = TRUE; break;
00235 #endif
00236 #ifdef USE_EP3_OUT_STATUS
00237 case EP3_OUT: aStatus = Ep_StatusOUT3; setup_handled = TRUE; break;
00238 #endif
00239 #ifdef USE_EP1_IN_STATUS
00240 case EP1_IN: aStatus = Ep_StatusIN1; setup_handled = TRUE; break;
00241 #endif
00242 #ifdef USE_EP2_IN_STATUS
00243 case EP2_IN: aStatus = Ep_StatusIN2; setup_handled = TRUE; break;
00244 #endif
00245 #ifdef USE_EP3_IN_STATUS
00246 case EP3_IN: aStatus = Ep_StatusIN3; setup_handled = TRUE; break;
00247 #endif
00248 default: break;
00249 }
00250 if (aStatus == EP_HALT)
00251 {
00252
00253 DataPtr = (BYTE*)&ONES_PACKET;
00254 } else {
00255
00256 DataPtr = (BYTE*)&ZERO_PACKET;
00257 }
00258 }
00259 break;
00260
00261 default:
00262 break;
00263 }
00264 }
00265
00266 if ( setup_handled )
00267 {
00268
00269 Ep_Status0 = EP_TX;
00270 DataSize = 2;
00271 }
00272 }
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288 static bit Set_Halt( BYTE endpoint, BYTE status )
00289 {
00290 BYTE controlReg;
00291
00292 switch ( endpoint ) {
00293
00294 #ifdef USE_EP1_OUT_STATUS
00295 case EP1_OUT: Ep_StatusOUT1 = status; break;
00296 #endif
00297 #ifdef USE_EP2_OUT_STATUS
00298 case EP2_OUT: Ep_StatusOUT2 = status; break;
00299 #endif
00300 #ifdef USE_EP3_OUT_STATUS
00301 case EP3_OUT: Ep_StatusOUT3 = status; break;
00302 #endif
00303 #ifdef USE_EP1_IN_STATUS
00304 case EP1_IN: Ep_StatusIN1 = status; break;
00305 #endif
00306 #ifdef USE_EP2_IN_STATUS
00307 case EP2_IN: Ep_StatusIN2 = status; break;
00308 #endif
00309 #ifdef USE_EP3_IN_STATUS
00310 case EP3_IN: Ep_StatusIN3 = status; break;
00311 #endif
00312 default: return FALSE;
00313 }
00314
00315 POLL_WRITE_BYTE (INDEX, endpoint & 0x7F);
00316 if ( endpoint & 0x80 ) {
00317 if ( status == EP_IDLE )
00318 controlReg = (rbInCLRDT | rbInFLUSH);
00319 else
00320 controlReg = (rbInCLRDT | rbInSDSTL | rbInFLUSH);
00321 POLL_WRITE_BYTE( EINCSRL, controlReg );
00322
00323 #if (defined ENABLE_EP1_IN_DOUBLE_BUF) || (defined ENABLE_EP2_IN_DOUBLE_BUF) || (defined ENABLE_EP3_IN_DOUBLE_BUF)
00324 {
00325 BYTE eincsrl;
00326 do {
00327 POLL_READ_BYTE( EINCSRL, eincsrl );
00328 } while ( eincsrl & rbInFLUSH );
00329 if ( eincsrl & rbInFIFONE ) {
00330 POLL_WRITE_BYTE( EINCSRL, controlReg );
00331 }
00332 }
00333 #endif
00334
00335 } else {
00336 if ( status == EP_IDLE )
00337 controlReg = (rbOutCLRDT | rbOutFLUSH);
00338 else
00339 controlReg = (rbOutCLRDT | rbOutSDSTL | rbOutFLUSH);
00340 POLL_WRITE_BYTE( EOUTCSRL, controlReg );
00341
00342 #if (defined ENABLE_EP1_OUT_DOUBLE_BUF) || (defined ENABLE_EP2_OUT_DOUBLE_BUF) || (defined ENABLE_EP3_OUT_DOUBLE_BUF)
00343 {
00344 BYTE eoutcsrl;
00345 do {
00346 POLL_READ_BYTE( EOUTCSRL, eoutcsrl );
00347 } while ( eoutcsrl & rbOutFLUSH );
00348 POLL_WRITE_BYTE( EOUTCSRL, controlReg );
00349 }
00350 #endif
00351
00352 }
00353
00354
00355 if ( endpoint == EP1_IN )
00356 IN1_FIFO_empty = TRUE;
00357 if ( endpoint == EP2_IN )
00358 IN2_FIFO_empty = TRUE;
00359 if ( endpoint == EP3_IN )
00360 IN2_FIFO_empty = TRUE;
00361 if ( endpoint == EP1_OUT )
00362 OUT1_FIFO_loaded = FALSE;
00363 if ( endpoint == EP2_OUT )
00364 OUT2_FIFO_loaded = FALSE;
00365 if ( endpoint == EP3_OUT )
00366 OUT3_FIFO_loaded = FALSE;
00367
00368 return TRUE;
00369 }
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380 static void Clear_Feature()
00381 {
00382 if ( (USB_State == DEV_CONFIGURED)
00383 && (Setup.wLength.i == 0) )
00384 {
00385 switch( Setup.bmRequestType )
00386 {
00387 case OUT_DEVICE:
00388 if ( (Setup.wValue.i == DEVICE_REMOTE_WAKEUP)
00389 && (Setup.wIndex.i == 0) )
00390 {
00391
00392 setup_handled = TRUE;
00393 }
00394 break;
00395
00396 case OUT_ENDPOINT:
00397 if ( (Setup.wValue.i == ENDPOINT_HALT)
00398 && (Setup.wIndex.c[MSB] == 0) )
00399 {
00400 if ( Set_Halt( Setup.wIndex.c[LSB], EP_IDLE ) )
00401 setup_handled = TRUE;
00402 }
00403 break;
00404
00405 default:
00406 break;
00407 }
00408 }
00409 }
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420 static void Set_Feature(void)
00421 {
00422 if ( (USB_State == DEV_CONFIGURED)
00423 && (Setup.wLength.i == 0) )
00424 {
00425 switch( Setup.bmRequestType )
00426 {
00427 case OUT_DEVICE:
00428 if ( (Setup.wValue.i == DEVICE_REMOTE_WAKEUP)
00429 && (Setup.wIndex.i == 0) )
00430 {
00431
00432 setup_handled = TRUE;
00433 }
00434 break;
00435
00436 case OUT_ENDPOINT:
00437 if ( (Setup.wValue.i == ENDPOINT_HALT)
00438 && (Setup.wIndex.c[MSB] == 0) )
00439 {
00440 if ( Set_Halt( Setup.wIndex.c[LSB], EP_HALT ) )
00441 setup_handled = TRUE;
00442 }
00443 break;
00444
00445 default:
00446 break;
00447 }
00448 }
00449 }
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459 static void Set_Address(void)
00460 {
00461 if ( (Setup.bmRequestType == OUT_DEVICE)
00462 && (Setup.wIndex.i == 0)
00463 && (Setup.wLength.i == 0)
00464 && (Setup.wValue.c[MSB] == 0) && ((Setup.wValue.c[LSB] & 0x80) == 0) )
00465 {
00466 if (Setup.wValue.c[LSB] != 0)
00467 {
00468 POLL_WRITE_BYTE(FADDR, Setup.wValue.c[LSB]);
00469
00470 USB_State = DEV_ADDRESS;
00471 }
00472 else
00473 {
00474 USB_State = DEV_DEFAULT;
00475 }
00476 setup_handled = TRUE;
00477 }
00478 }
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498 static void Get_Descriptor(void)
00499 {
00500 if ( Setup.bmRequestType == IN_DEVICE )
00501 {
00502 switch(Setup.wValue.c[MSB])
00503 {
00504 case DST_DEVICE:
00505 if ( (Setup.wValue.c[LSB] == 0) && (Setup.wIndex.i == 0) )
00506 {
00507 DataPtr = (BYTE*)&DeviceDesc;
00508 DataSize = sizeof( Tdevice_descriptor );
00509 setup_handled = TRUE;
00510 }
00511 break;
00512
00513 case DST_CONFIG:
00514 if ( (Setup.wValue.c[LSB] == 0) && (Setup.wIndex.i == 0) )
00515 {
00516 DataPtr = (BYTE*)&ConfigDescSet;
00517 DataSize = sizeof( Tconfiguration_desc_set );
00518 setup_handled = TRUE;
00519 }
00520 break;
00521
00522 case DST_STRING:
00523
00524 if ( Setup.wValue.c[LSB] < StringDescNum )
00525 {
00526 DataPtr = StringDescTable[Setup.wValue.c[LSB]];
00527 DataSize = *DataPtr;
00528 setup_handled = TRUE;
00529 }
00530 break;
00531
00532 default:
00533 break;
00534 }
00535 }
00536
00537
00538
00539
00540
00541 if ( setup_handled )
00542 {
00543 Ep_Status0 = EP_TX;
00544 if ( DataSize > Setup.wLength.i )
00545 DataSize = Setup.wLength.i;
00546 }
00547 }
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557 static void Get_Configuration(void)
00558 {
00559 if ( (Setup.bmRequestType == IN_DEVICE)
00560 && (Setup.wValue.i == 0)
00561 && (Setup.wIndex.i == 0)
00562 && (Setup.wLength.i == 1) )
00563 {
00564 if (USB_State == DEV_CONFIGURED)
00565 {
00566 DataPtr = (BYTE*)&ONES_PACKET;
00567 setup_handled = TRUE;
00568 }
00569 if (USB_State == DEV_ADDRESS)
00570 {
00571 DataPtr = (BYTE*)&ZERO_PACKET;
00572 setup_handled = TRUE;
00573 }
00574 }
00575
00576 if ( setup_handled )
00577 {
00578
00579 Ep_Status0 = EP_TX;
00580 DataSize = 1;
00581 }
00582 }
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596 #if (defined USE_EP1_OUT) && (defined USE_EP1_IN) && ((defined C8051F320_H) || (defined C8051F340_H))
00597 #define EP1_CONFIG_SPLIT rbInSPLIT // split EP FIFO
00598 #else
00599 #define EP1_CONFIG_SPLIT 0
00600 #endif
00601 #if !(defined USE_EP1_OUT) && (defined USE_EP1_IN) && ((defined C8051F320_H) || (defined C8051F340_H))
00602 #define EP1_CONFIG_IN rbInDIRSEL // set EP to IN
00603 #else
00604 #define EP1_CONFIG_IN 0
00605 #endif
00606 #ifdef ENABLE_EP1_IN_DOUBLE_BUF
00607 #define EP1_CONFIG_IN_DBLBUF rbInDBIEN // enable double buffer
00608 #else
00609 #define EP1_CONFIG_IN_DBLBUF 0
00610 #endif
00611 #ifdef ENABLE_EP1_IN_ISO
00612 #define EP1_CONFIG_IN_ISO rbInISO // set to isoc
00613 #else
00614 #define EP1_CONFIG_IN_ISO 0
00615 #endif
00616
00617 #ifdef ENABLE_EP1_OUT_DOUBLE_BUF
00618 #define EP1_CONFIG_OUT_DBLBUF rbOutDBOEN // enable double buffer
00619 #else
00620 #define EP1_CONFIG_OUT_DBLBUF 0
00621 #endif
00622 #ifdef ENABLE_EP1_OUT_ISO
00623 #define EP1_CONFIG_OUT_ISO rbOutISO // set to isoc
00624 #else
00625 #define EP1_CONFIG_OUT_ISO 0
00626 #endif
00627
00628
00629
00630 #if (defined USE_EP2_OUT) && (defined USE_EP2_IN)
00631 #define EP2_CONFIG_SPLIT rbInSPLIT // split EP FIFO
00632 #else
00633 #define EP2_CONFIG_SPLIT 0
00634 #endif
00635 #if !(defined USE_EP2_OUT) && (defined USE_EP2_IN)
00636 #define EP2_CONFIG_IN rbInDIRSEL // set EP to IN
00637 #else
00638 #define EP2_CONFIG_IN 0
00639 #endif
00640 #ifdef ENABLE_EP2_IN_DOUBLE_BUF
00641 #define EP2_CONFIG_IN_DBLBUF rbInDBIEN // enable double buffer
00642 #else
00643 #define EP2_CONFIG_IN_DBLBUF 0
00644 #endif
00645 #ifdef ENABLE_EP2_IN_ISO
00646 #define EP2_CONFIG_IN_ISO rbInISO // set to isoc
00647 #else
00648 #define EP2_CONFIG_IN_ISO 0
00649 #endif
00650
00651 #ifdef ENABLE_EP2_OUT_DOUBLE_BUF
00652 #define EP2_CONFIG_OUT_DBLBUF rbOutDBOEN // enable double buffer
00653 #else
00654 #define EP2_CONFIG_OUT_DBLBUF 0
00655 #endif
00656 #ifdef ENABLE_EP2_OUT_ISO
00657 #define EP2_CONFIG_OUT_ISO rbOutISO // set to isoc
00658 #else
00659 #define EP2_CONFIG_OUT_ISO 0
00660 #endif
00661
00662
00663
00664 #if (defined USE_EP3_OUT) && (defined USE_EP3_IN)
00665 #define EP3_CONFIG_SPLIT rbInSPLIT // split EP FIFO
00666 #else
00667 #define EP3_CONFIG_SPLIT 0
00668 #endif
00669 #if !(defined USE_EP3_OUT) && (defined USE_EP3_IN)
00670 #define EP3_CONFIG_IN rbInDIRSEL // set EP to IN
00671 #else
00672 #define EP3_CONFIG_IN 0
00673 #endif
00674 #ifdef ENABLE_EP3_IN_DOUBLE_BUF
00675 #define EP3_CONFIG_IN_DBLBUF rbInDBIEN // enable double buffer
00676 #else
00677 #define EP3_CONFIG_IN_DBLBUF 0
00678 #endif
00679 #ifdef ENABLE_EP3_IN_ISO
00680 #define EP3_CONFIG_IN_ISO rbInISO // set to isoc
00681 #else
00682 #define EP3_CONFIG_IN_ISO 0
00683 #endif
00684
00685 #ifdef ENABLE_EP3_OUT_DOUBLE_BUF
00686 #define EP3_CONFIG_OUT_DBLBUF rbOutDBOEN // enable double buffer
00687 #else
00688 #define EP3_CONFIG_OUT_DBLBUF 0
00689 #endif
00690 #ifdef ENABLE_EP3_OUT_ISO
00691 #define EP3_CONFIG_OUT_ISO rbOutISO // set to isoc
00692 #else
00693 #define EP3_CONFIG_OUT_ISO 0
00694 #endif
00695
00696 #define EP1_EOUTCSRH (EP1_CONFIG_OUT_DBLBUF | EP1_CONFIG_OUT_ISO)
00697 #define EP2_EOUTCSRH (EP2_CONFIG_OUT_DBLBUF | EP2_CONFIG_OUT_ISO)
00698 #define EP3_EOUTCSRH (EP3_CONFIG_OUT_DBLBUF | EP3_CONFIG_OUT_ISO)
00699 #define EP1_EINCSRH (EP1_CONFIG_IN_DBLBUF | EP1_CONFIG_IN_ISO | EP1_CONFIG_IN | EP1_CONFIG_SPLIT)
00700 #define EP2_EINCSRH (EP2_CONFIG_IN_DBLBUF | EP2_CONFIG_IN_ISO | EP2_CONFIG_IN | EP2_CONFIG_SPLIT)
00701 #define EP3_EINCSRH (EP3_CONFIG_IN_DBLBUF | EP3_CONFIG_IN_ISO | EP3_CONFIG_IN | EP3_CONFIG_SPLIT)
00702
00703
00704
00705 static void Set_Configuration(void)
00706 {
00707 if ( (Setup.bmRequestType == OUT_DEVICE)
00708 && (Setup.wIndex.i == 0)
00709 && (Setup.wLength.i == 0) )
00710 {
00711 switch( Setup.wValue.c[LSB] )
00712 {
00713 case 0:
00714 USB_State = DEV_ADDRESS;
00715
00716
00717 #ifdef USE_EP1_OUT_STATUS
00718 Ep_StatusOUT1 = EP_HALT;
00719 #endif
00720 #ifdef USE_EP2_OUT_STATUS
00721 Ep_StatusOUT2 = EP_HALT;
00722 #endif
00723 #ifdef USE_EP3_OUT_STATUS
00724 Ep_StatusOUT3 = EP_HALT;
00725 #endif
00726 #ifdef USE_EP1_IN_STATUS
00727 Ep_StatusIN1 = EP_HALT;
00728 #endif
00729 #ifdef USE_EP2_IN_STATUS
00730 Ep_StatusIN2 = EP_HALT;
00731 #endif
00732 #ifdef USE_EP3_IN_STATUS
00733 Ep_StatusIN3 = EP_HALT;
00734 #endif
00735 setup_handled = TRUE;
00736 break;
00737
00738 case 1:
00739 USB_State = DEV_CONFIGURED;
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750 #if (defined USE_EP1_OUT) || (defined USE_EP1_IN)
00751 POLL_WRITE_BYTE(INDEX, 1);
00752 #if (EP1_EINCSRH != 0)
00753 POLL_WRITE_BYTE(EINCSRH, EP1_EINCSRH);
00754 #endif
00755 #if (EP1_EOUTCSRH != 0)
00756 POLL_WRITE_BYTE(EOUTCSRH, EP1_EOUTCSRH);
00757 #endif
00758 #if defined USE_EP1_OUT
00759 POLL_WRITE_BYTE(OUTMAX, EP1_OUT_PACKET_SIZE);
00760 #endif
00761 #if defined USE_EP1_IN
00762 POLL_WRITE_BYTE(INMAX, EP1_IN_PACKET_SIZE);
00763 #endif
00764 #endif
00765
00766 #if (defined USE_EP2_OUT) || (defined USE_EP2_IN)
00767 POLL_WRITE_BYTE(INDEX, 2);
00768 #if (EP2_EINCSRH != 0)
00769 POLL_WRITE_BYTE(EINCSRH, EP2_EINCSRH);
00770 #endif
00771 #if (EP2_EOUTCSRH != 0)
00772 POLL_WRITE_BYTE(EOUTCSRH, EP2_EOUTCSRH);
00773 #endif
00774 #if defined USE_EP2_OUT
00775 POLL_WRITE_BYTE(OUTMAX, EP2_OUT_PACKET_SIZE);
00776 #endif
00777 #if defined USE_EP2_IN
00778 POLL_WRITE_BYTE(INMAX, EP2_IN_PACKET_SIZE);
00779 #endif
00780 #endif
00781
00782 #if (defined USE_EP3_OUT) || (defined USE_EP3_IN)
00783 POLL_WRITE_BYTE(INDEX, 3);
00784 #if (EP3_EINCSRH != 0)
00785 POLL_WRITE_BYTE(EINCSRH, EP3_EINCSRH);
00786 #endif
00787 #if (EP3_EOUTCSRH != 0)
00788 POLL_WRITE_BYTE(EOUTCSRH, EP3_EOUTCSRH);
00789 #endif
00790 #if defined USE_EP3_OUT
00791 POLL_WRITE_BYTE(OUTMAX, EP3_OUT_PACKET_SIZE);
00792 #endif
00793 #if defined USE_EP3_IN
00794 POLL_WRITE_BYTE(INMAX, EP3_IN_PACKET_SIZE);
00795 #endif
00796 #endif
00797
00798 #ifdef USE_EP1_OUT_STATUS
00799 Ep_StatusOUT1 = EP_IDLE;
00800 #endif
00801 #ifdef USE_EP2_OUT_STATUS
00802 Ep_StatusOUT2 = EP_IDLE;
00803 #endif
00804 #ifdef USE_EP3_OUT_STATUS
00805 Ep_StatusOUT3 = EP_IDLE;
00806 #endif
00807 #ifdef USE_EP1_IN_STATUS
00808 Ep_StatusIN1 = EP_IDLE;
00809 #endif
00810 #ifdef USE_EP2_IN_STATUS
00811 Ep_StatusIN2 = EP_IDLE;
00812 #endif
00813 #ifdef USE_EP3_IN_STATUS
00814 Ep_StatusIN3 = EP_IDLE;
00815 #endif
00816
00817 IN1_FIFO_empty = TRUE;
00818 IN2_FIFO_empty = TRUE;
00819 IN3_FIFO_empty = TRUE;
00820 OUT1_FIFO_loaded = FALSE;
00821 OUT2_FIFO_loaded = FALSE;
00822 OUT3_FIFO_loaded = FALSE;
00823
00824 cs_Line_State_Update = TRUE;
00825 CDC_Handle_INT_IN();
00826 Flush_COMbuffers();
00827
00828 setup_handled = TRUE;
00829 break;
00830
00831 default:
00832 break;
00833 }
00834 }
00835 }
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845 static void Get_Interface(void)
00846 {
00847 if ( (USB_State == DEV_CONFIGURED)
00848 && (Setup.bmRequestType == IN_INTERFACE)
00849 && (Setup.wValue.i == 0)
00850 && (Setup.wIndex.i < DSC_NUM_INTERFACE)
00851 && (Setup.wLength.i == 1) )
00852 {
00853 DataPtr = (BYTE*)&ZERO_PACKET;
00854 Ep_Status0 = EP_TX;
00855 DataSize = 1;
00856 setup_handled = TRUE;
00857 }
00858 }
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886