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 /** USBX Component                                                        */
16 /**                                                                       */
17 /**   Device RNDIS Class                                                  */
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_device_class_rndis.h"
29 #include "ux_device_stack.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _ux_device_class_rndis_msg_reset                    PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Chaoqiong Xiao, Microsoft Corporation                               */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function analyzes and replies to the MSG RESET                 */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    rndis                           Pointer to rndis class              */
49 /*    transfer_request                Pointer to the transfer request     */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    None                                                                */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*    _ux_utility_long_put            Put 32-bit value                    */
58 /*                                                                        */
59 /*  CALLED BY                                                             */
60 /*                                                                        */
61 /*    RNDIS Class                                                         */
62 /*                                                                        */
63 /*  RELEASE HISTORY                                                       */
64 /*                                                                        */
65 /*    DATE              NAME                      DESCRIPTION             */
66 /*                                                                        */
67 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
68 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
69 /*                                            resulting in version 6.1    */
70 /*                                                                        */
71 /**************************************************************************/
_ux_device_class_rndis_msg_reset(UX_SLAVE_CLASS_RNDIS * rndis,UX_SLAVE_TRANSFER * transfer_request)72 UINT  _ux_device_class_rndis_msg_reset(UX_SLAVE_CLASS_RNDIS *rndis, UX_SLAVE_TRANSFER *transfer_request)
73 {
74 
75 UCHAR            *rndis_response;
76 
77     UX_PARAMETER_NOT_USED(transfer_request);
78 
79     /* If trace is enabled, insert this event into the trace buffer.  */
80     UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_RNDIS_MSG_RESET, rndis, 0, 0, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0)
81 
82     /* Now prepare the response.  */
83     rndis_response = rndis -> ux_slave_class_rndis_response;
84 
85     /* First store the command. */
86     _ux_utility_long_put(rndis_response + UX_DEVICE_CLASS_RNDIS_CMPLT_RESET_MESSAGE_TYPE, UX_DEVICE_CLASS_RNDIS_CMPLT_RESET);
87 
88     /* Then the length of the response. */
89     _ux_utility_long_put(rndis_response + UX_DEVICE_CLASS_RNDIS_CMPLT_RESET_MESSAGE_LENGTH, UX_DEVICE_CLASS_RNDIS_CMPLT_RESET_RESPONSE_LENGTH);
90 
91     /* Force the status to SUCCESS.  */
92     _ux_utility_long_put(rndis_response + UX_DEVICE_CLASS_RNDIS_CMPLT_RESET_STATUS, UX_DEVICE_CLASS_RNDIS_STATUS_SUCCESS);
93 
94     /* Set Addressing Reset field: no need to resend multicast address list.  */
95     _ux_utility_long_put(rndis_response + UX_DEVICE_CLASS_RNDIS_CMPLT_RESET_ADDRESSING_RESET, 0);
96 
97     /* Set the response length.  */
98     rndis -> ux_slave_class_rndis_response_length =   UX_DEVICE_CLASS_RNDIS_CMPLT_RESET_RESPONSE_LENGTH;
99 
100     /* We are done. Return UX_SUCCESS.  */
101     return(UX_SUCCESS);
102 }
103 
104