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 /** Host Sierra Wireless AR module class */
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_host_class_swar.h"
30 #include "ux_host_stack.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _ux_host_class_swar_ioctl PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* Chaoqiong Xiao, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function is the ioctl entry point for the application to */
46 /* configure the Swar device. */
47 /* */
48 /* */
49 /* INPUT */
50 /* */
51 /* swar Pointer to swar class */
52 /* ioctl_function ioctl function */
53 /* parameter pointer to structure */
54 /* */
55 /* OUTPUT */
56 /* */
57 /* Completion Status */
58 /* */
59 /* CALLS */
60 /* */
61 /* _ux_host_stack_endpoint_transfer_abort */
62 /* Abort transfer */
63 /* */
64 /* CALLED BY */
65 /* */
66 /* Storage Class */
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 /* */
76 /**************************************************************************/
_ux_host_class_swar_ioctl(UX_HOST_CLASS_SWAR * swar,ULONG ioctl_function,VOID * parameter)77 UINT _ux_host_class_swar_ioctl(UX_HOST_CLASS_SWAR *swar, ULONG ioctl_function,
78 VOID *parameter)
79 {
80
81 UINT status;
82
83 UX_PARAMETER_NOT_USED(parameter);
84
85 /* The command request will tell us we need to do here. */
86 switch (ioctl_function)
87 {
88
89 case UX_HOST_CLASS_SWAR_IOCTL_ABORT_IN_PIPE :
90
91 /* If trace is enabled, insert this event into the trace buffer. */
92 UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_SWAR_IOCTL_ABORT_IN_PIPE, swar, swar -> ux_host_class_swar_bulk_in_endpoint, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
93
94 /* We need to abort transactions on the bulk In pipe. */
95 _ux_host_stack_endpoint_transfer_abort(swar -> ux_host_class_swar_bulk_in_endpoint);
96
97 /* Status is successful. */
98 status = UX_SUCCESS;
99 break;
100
101 case UX_HOST_CLASS_SWAR_IOCTL_ABORT_OUT_PIPE :
102
103 /* If trace is enabled, insert this event into the trace buffer. */
104 UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_SWAR_IOCTL_ABORT_OUT_PIPE, swar, swar -> ux_host_class_swar_bulk_out_endpoint, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
105
106 /* We need to abort transactions on the bulk Out pipe. */
107 _ux_host_stack_endpoint_transfer_abort(swar -> ux_host_class_swar_bulk_out_endpoint);
108
109 /* Status is successful. */
110 status = UX_SUCCESS;
111 break;
112
113 default:
114
115 /* Error trap. */
116 _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_FUNCTION_NOT_SUPPORTED);
117
118 /* If trace is enabled, insert this event into the trace buffer. */
119 UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_FUNCTION_NOT_SUPPORTED, 0, 0, 0, UX_TRACE_ERRORS, 0, 0)
120
121 /* Function not supported. Return an error. */
122 status = UX_FUNCTION_NOT_SUPPORTED;
123 break;
124 }
125
126 /* Return status to caller. */
127 return(status);
128 }
129
130