1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** USBX Component */ 17 /** */ 18 /** EHCI Controller Driver */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 24 /* Include necessary system files. */ 25 26 #define UX_SOURCE_CODE 27 28 #include "ux_api.h" 29 #include "ux_hcd_ehci.h" 30 #include "ux_host_stack.h" 31 32 33 /**************************************************************************/ 34 /* */ 35 /* FUNCTION RELEASE */ 36 /* */ 37 /* _ux_hcd_ehci_request_transfer PORTABLE C */ 38 /* 6.1 */ 39 /* AUTHOR */ 40 /* */ 41 /* Chaoqiong Xiao, Microsoft Corporation */ 42 /* */ 43 /* DESCRIPTION */ 44 /* */ 45 /* This function is the handler for all the transactions on the USB. */ 46 /* The transfer request passed as parameter contains the endpoint and */ 47 /* the device descriptors in addition to the type of transaction de */ 48 /* be executed. */ 49 /* */ 50 /* This function routes the transfer_request to according to the type */ 51 /* of transfer to be executed. */ 52 /* */ 53 /* INPUT */ 54 /* */ 55 /* hcd_ehci Pointer to EHCI controller */ 56 /* transfer_request Pointer to transfer request */ 57 /* */ 58 /* OUTPUT */ 59 /* */ 60 /* Completion Status */ 61 /* */ 62 /* CALLS */ 63 /* */ 64 /* _ux_hcd_ehci_request_control_transfer Start control transfer */ 65 /* _ux_hcd_ehci_request_bulk_transfer Start bulk transfer */ 66 /* _ux_hcd_ehci_request_interrupt_transfer Start interrupt transfer */ 67 /* _ux_hcd_ehci_request_isochronous_transfer Start iso transfer */ 68 /* */ 69 /* CALLED BY */ 70 /* */ 71 /* EHCI Controller Driver */ 72 /* */ 73 /* RELEASE HISTORY */ 74 /* */ 75 /* DATE NAME DESCRIPTION */ 76 /* */ 77 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ 78 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ 79 /* resulting in version 6.1 */ 80 /* */ 81 /**************************************************************************/ _ux_hcd_ehci_request_transfer(UX_HCD_EHCI * hcd_ehci,UX_TRANSFER * transfer_request)82UINT _ux_hcd_ehci_request_transfer(UX_HCD_EHCI *hcd_ehci, UX_TRANSFER *transfer_request) 83 { 84 85 UX_ENDPOINT *endpoint; 86 UINT status; 87 88 89 /* Get the pointer to the Endpoint. */ 90 endpoint = (UX_ENDPOINT *) transfer_request -> ux_transfer_request_endpoint; 91 92 /* We reset the actual length field of the transfer request as a safety measure. */ 93 transfer_request -> ux_transfer_request_actual_length = 0; 94 95 /* Isolate the endpoint type and route the transfer request. */ 96 switch ((endpoint -> ux_endpoint_descriptor.bmAttributes) & UX_MASK_ENDPOINT_TYPE) 97 { 98 99 case UX_CONTROL_ENDPOINT: 100 101 status = _ux_hcd_ehci_request_control_transfer(hcd_ehci, transfer_request); 102 break; 103 104 105 case UX_BULK_ENDPOINT: 106 107 status = _ux_hcd_ehci_request_bulk_transfer(hcd_ehci, transfer_request); 108 break; 109 110 111 case UX_INTERRUPT_ENDPOINT: 112 113 status = _ux_hcd_ehci_request_interrupt_transfer(hcd_ehci, transfer_request); 114 break; 115 116 117 case UX_ISOCHRONOUS_ENDPOINT: 118 119 status = _ux_hcd_ehci_request_isochronous_transfer(hcd_ehci, transfer_request); 120 break; 121 122 } 123 124 /* Note that it is physically impossible to have a wrong endpoint type here 125 so no error checking. */ 126 return(status); 127 } 128 129