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 /** Prolific 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_prolific.h"
30 #include "ux_host_stack.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _ux_host_class_prolific_entry PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* Chaoqiong Xiao, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function is the entry point of the prolific class. It will be */
46 /* called by the USBX stack enumeration module when there is a new */
47 /* prolific on the bus or when the USB prolific is removed. */
48 /* */
49 /* */
50 /* INPUT */
51 /* */
52 /* command Prolific class command */
53 /* */
54 /* OUTPUT */
55 /* */
56 /* Completion Status */
57 /* */
58 /* CALLS */
59 /* */
60 /* _ux_host_class_prolific_activate Activate prolific class */
61 /* _ux_host_class_prolific_deactivate Deactivate prolific class */
62 /* */
63 /* CALLED BY */
64 /* */
65 /* Acm Cdc Class */
66 /* */
67 /* RELEASE HISTORY */
68 /* */
69 /* DATE NAME DESCRIPTION */
70 /* */
71 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
72 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
73 /* resulting in version 6.1 */
74 /* */
75 /**************************************************************************/
_ux_host_class_prolific_entry(UX_HOST_CLASS_COMMAND * command)76 UINT _ux_host_class_prolific_entry(UX_HOST_CLASS_COMMAND *command)
77 {
78
79 UINT status;
80
81
82 /* The command request will tell us we need to do here, either a enumeration
83 query, an activation or a deactivation. */
84 switch (command -> ux_host_class_command_request)
85 {
86
87 case UX_HOST_CLASS_COMMAND_QUERY:
88
89 /* The query command is used to let the stack enumeration process know if we want to own
90 this device or not. */
91 if(((command -> ux_host_class_command_usage == UX_HOST_CLASS_COMMAND_USAGE_PIDVID) &&
92 (command -> ux_host_class_command_pid == 0x2303) &&
93 (command -> ux_host_class_command_vid == 0x67b)))
94 return(UX_SUCCESS);
95 else
96 return(UX_NO_CLASS_MATCH);
97
98 case UX_HOST_CLASS_COMMAND_ACTIVATE:
99
100 /* The activate command is used when the device inserted has found a parent and
101 is ready to complete the enumeration. */
102 status = _ux_host_class_prolific_activate(command);
103 return(status);
104
105 case UX_HOST_CLASS_COMMAND_DEACTIVATE:
106
107 /* The deactivate command is used when the device has been extracted either
108 directly or when its parents has been extracted. */
109 status = _ux_host_class_prolific_deactivate(command);
110 return(status);
111
112 default:
113
114 /* If trace is enabled, insert this event into the trace buffer. */
115 UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_FUNCTION_NOT_SUPPORTED, 0, 0, 0, UX_TRACE_ERRORS, 0, 0)
116
117 return(UX_FUNCTION_NOT_SUPPORTED);
118 }
119 }
120
121