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 Video 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_video.h"
29 #include "ux_device_stack.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _ux_device_class_video_ioctl                        PORTABLE C      */
37 /*                                                           6.1.11       */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Chaoqiong Xiao, Microsoft Corporation                               */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function performs certain functions on the video instance      */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    video                                   Address of video class      */
49 /*                                                instance                */
50 /*    ioctl_function                          IOCTL function code         */
51 /*    parameter                               Parameter for function      */
52 /*                                                                        */
53 /*  OUTPUT                                                                */
54 /*                                                                        */
55 /*    Status                                                              */
56 /*                                                                        */
57 /*  CALLS                                                                 */
58 /*                                                                        */
59 /*                                                                        */
60 /*  CALLED BY                                                             */
61 /*                                                                        */
62 /*    ThreadX                                                             */
63 /*                                                                        */
64 /*  RELEASE HISTORY                                                       */
65 /*                                                                        */
66 /*    DATE              NAME                      DESCRIPTION             */
67 /*                                                                        */
68 /*  04-25-2022     Chaoqiong Xiao           Initial Version 6.1.11        */
69 /*                                                                        */
70 /**************************************************************************/
_ux_device_class_video_ioctl(UX_DEVICE_CLASS_VIDEO * video,ULONG ioctl_function,VOID * parameter)71 UINT _ux_device_class_video_ioctl(UX_DEVICE_CLASS_VIDEO *video, ULONG ioctl_function,
72                                     VOID *parameter)
73 {
74 
75 UINT                                                status;
76 VOID                                                **pptr_parameter;
77 
78 
79     /* Let's be optimist ! */
80     status = UX_SUCCESS;
81 
82     /* The command request will tell us what we need to do here.  */
83     switch (ioctl_function)
84     {
85 
86         case UX_DEVICE_CLASS_VIDEO_IOCTL_GET_ARG:
87 
88             /* Properly cast the parameter pointer.  */
89             pptr_parameter = (VOID **) parameter;
90 
91             /* Save argument.  */
92             *pptr_parameter = video -> ux_device_class_video_callbacks.ux_device_class_video_arg;
93 
94             break;
95 
96         default:
97 
98             /* Function not supported. Return an error.  */
99             status =  UX_FUNCTION_NOT_SUPPORTED;
100     }
101 
102     /* Return status to caller.  */
103     return(status);
104 
105 }
106