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_transfer_request_process               PORTABLE C      */
38 /*                                                           6.1.10       */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Chaoqiong Xiao, Microsoft Corporation                               */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*     This function process the transfer that was completed either       */
46 /*     successfully because of a partial transmission or because of an    */
47 /*     error. The transfer descriptor tells us what to do with it, either */
48 /*     put a semaphore to the caller or invoke a completion routine. If a */
49 /*     completion routine is specified, the routine is called and no      */
50 /*     semaphore is put.                                                  */
51 /*                                                                        */
52 /*  INPUT                                                                 */
53 /*                                                                        */
54 /*    transfer_request                      Pointer to transfer request   */
55 /*                                                                        */
56 /*  OUTPUT                                                                */
57 /*                                                                        */
58 /*    None                                                                */
59 /*                                                                        */
60 /*  CALLS                                                                 */
61 /*                                                                        */
62 /*    (ux_transfer_request_completion_function) Transfer complete function*/
63 /*    _ux_host_semaphore_put                  Put producer semaphore      */
64 /*                                                                        */
65 /*  CALLED BY                                                             */
66 /*                                                                        */
67 /*    EHCI Controller Driver                                              */
68 /*                                                                        */
69 /*  RELEASE HISTORY                                                       */
70 /*                                                                        */
71 /*    DATE              NAME                      DESCRIPTION             */
72 /*                                                                        */
73 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
74 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
75 /*                                            resulting in version 6.1    */
76 /*  01-31-2022     Chaoqiong Xiao           Modified comment(s),          */
77 /*                                            refined macros names,       */
78 /*                                            resulting in version 6.1.10 */
79 /*                                                                        */
80 /**************************************************************************/
_ux_hcd_ehci_transfer_request_process(UX_TRANSFER * transfer_request)81 VOID  _ux_hcd_ehci_transfer_request_process(UX_TRANSFER *transfer_request)
82 {
83 
84     /* Check if there is a function for the transfer completion.  */
85     if (transfer_request -> ux_transfer_request_completion_function != UX_NULL)
86 
87         /* Yes, so we call it.  */
88         transfer_request -> ux_transfer_request_completion_function(transfer_request);
89     else
90 
91         /* There is a semaphore so send the signal to the class.  */
92         _ux_host_semaphore_put(&transfer_request -> ux_transfer_request_semaphore);
93 
94     /* Return to caller.  */
95     return;
96 }
97 
98