1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** USBX Component */
16 /** */
17 /** OHCI Controller Driver */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22
23 /* Include necessary system files. */
24
25 #define UX_SOURCE_CODE
26
27 #include "ux_api.h"
28 #include "ux_hcd_ohci.h"
29 #include "ux_host_stack.h"
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _ux_hcd_ohci_transfer_request_process PORTABLE C */
37 /* 6.1.10 */
38 /* AUTHOR */
39 /* */
40 /* Chaoqiong Xiao, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function process the transfer request that was completed */
45 /* either with success or because of a partial transmission or */
46 /* because of an error. The transfer request descriptor tells us what */
47 /* to do with it, either put a semaphore to the caller or invoke a */
48 /* completion routine. If a completion routine is specified, the */
49 /* routine is called and no semaphore is put. */
50 /* */
51 /* INPUT */
52 /* */
53 /* transfer_request Pointer to transfer request */
54 /* */
55 /* OUTPUT */
56 /* */
57 /* None */
58 /* */
59 /* CALLS */
60 /* */
61 /* (ux_transfer_request_completion_function) Completion function */
62 /* _ux_host_semaphore_put Signal transfer complete */
63 /* */
64 /* CALLED BY */
65 /* */
66 /* OHCI Controller Driver */
67 /* */
68 /* RELEASE HISTORY */
69 /* */
70 /* DATE NAME DESCRIPTION */
71 /* */
72 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
73 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
74 /* resulting in version 6.1 */
75 /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
76 /* refined macros names, */
77 /* resulting in version 6.1.10 */
78 /* */
79 /**************************************************************************/
_ux_hcd_ohci_transfer_request_process(UX_TRANSFER * transfer_request)80 VOID _ux_hcd_ohci_transfer_request_process(UX_TRANSFER *transfer_request)
81 {
82
83 /* Check if there is a function for the transfer completion. */
84 if (transfer_request -> ux_transfer_request_completion_function != UX_NULL)
85
86 /* Yes, so we call it! */
87 transfer_request -> ux_transfer_request_completion_function(transfer_request);
88 else
89
90 /* There is a semaphore so send the signal to the class. */
91 _ux_host_semaphore_put(&transfer_request -> ux_transfer_request_semaphore);
92
93 /* Return to caller. */
94 return;
95 }
96