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 /**   Host Simulator Controller Driver                                    */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #define UX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "ux_api.h"
28 #include "ux_hcd_sim_host.h"
29 
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _ux_hcd_sim_host_controller_disable                 PORTABLE C      */
36 /*                                                           6.1.2        */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Chaoqiong Xiao, Microsoft Corporation                               */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function will disable the simulated host controller.           */
44 /*    The controller will release all its resources (memory, IO ...).     */
45 /*    After this, the controller will not send SOF any longer.            */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    hcd_sim_host                          Pointer to host controller    */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    Completion Status                                                   */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*                                                                        */
58 /*  CALLED BY                                                             */
59 /*                                                                        */
60 /*    Host Simulator Controller Driver                                    */
61 /*                                                                        */
62 /*  RELEASE HISTORY                                                       */
63 /*                                                                        */
64 /*    DATE              NAME                      DESCRIPTION             */
65 /*                                                                        */
66 /*  09-30-2020     Chaoqiong Xiao           Initial Version 6.1           */
67 /*  11-09-2020     Chaoqiong Xiao           Modified comment(s),          */
68 /*                                            did controller halt only,   */
69 /*                                            resulting in version 6.1.2  */
70 /*                                                                        */
71 /**************************************************************************/
_ux_hcd_sim_host_controller_disable(UX_HCD_SIM_HOST * hcd_sim_host)72 UINT  _ux_hcd_sim_host_controller_disable(UX_HCD_SIM_HOST *hcd_sim_host)
73 {
74 
75 UX_HCD  *hcd = hcd_sim_host -> ux_hcd_sim_host_hcd_owner;
76 
77 
78     /* Set the state of the controller to HALTED.  */
79     hcd -> ux_hcd_status =  UX_HCD_STATUS_HALTED;
80 
81     /* Return successful completion.  */
82     return(UX_SUCCESS);
83 }
84