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 /** OHCI 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_ohci.h"
30 #include "ux_host_stack.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _ux_hcd_ohci_controller_disable PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* Chaoqiong Xiao, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function will disable the OHCI controller. The controller */
46 /* will release all its resources (memory, IO ...). After this, the */
47 /* controller will not send SOF any longer. All transactions should */
48 /* have been completed, all classes should have been closed. */
49 /* */
50 /* INPUT */
51 /* */
52 /* hcd_ohci Pointer to OHCI HCD */
53 /* */
54 /* OUTPUT */
55 /* */
56 /* Completion Status */
57 /* */
58 /* CALLS */
59 /* */
60 /* _ux_hcd_ohci_register_write Write OHCI register */
61 /* */
62 /* CALLED BY */
63 /* */
64 /* OHCI Controller Driver */
65 /* */
66 /* RELEASE HISTORY */
67 /* */
68 /* DATE NAME DESCRIPTION */
69 /* */
70 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
71 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
72 /* resulting in version 6.1 */
73 /* */
74 /**************************************************************************/
_ux_hcd_ohci_controller_disable(UX_HCD_OHCI * hcd_ohci)75 UINT _ux_hcd_ohci_controller_disable(UX_HCD_OHCI *hcd_ohci)
76 {
77
78 UX_HCD *hcd;
79 ULONG ohci_register;
80
81
82 /* Point to the generic portion of the host controller structure instance. */
83 hcd = hcd_ohci -> ux_hcd_ohci_hcd_owner;
84
85 /* Set the controller to disabled state. */
86 ohci_register = OHCI_HC_CR_RESET;
87 _ux_hcd_ohci_register_write(hcd_ohci, OHCI_HC_CONTROL, ohci_register);
88
89 /* Reflect the state of the controller in the main structure. */
90 hcd -> ux_hcd_status = UX_HCD_STATUS_HALTED;
91
92 /* Return successful completion. */
93 return(UX_SUCCESS);
94 }
95
96