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 /** Pictbridge Application */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22
23 /* Include necessary system files. */
24
25 #define UX_SOURCE_CODE
26
27 #include "ux_api.h"
28 #include "ux_pictbridge.h"
29
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _ux_pictbridge_xml_function_input_startjob PORTABLE C */
36 /* 6.1.12 */
37 /* */
38 /* */
39 /* AUTHOR */
40 /* */
41 /* Chaoqiong Xiao, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function receives an order for a new job. It issues */
46 /* notification to the pictbridge thread. */
47 /* */
48 /* INPUT */
49 /* */
50 /* pictbridge Pictbridge instance */
51 /* input_variable Pointer to variable */
52 /* input_string Pointer to string */
53 /* */
54 /* OUTPUT */
55 /* */
56 /* Completion Status */
57 /* */
58 /* CALLS */
59 /* */
60 /* */
61 /* CALLED BY */
62 /* */
63 /* _ux_pictbridge_object_parse */
64 /* */
65 /* RELEASE HISTORY */
66 /* */
67 /* DATE NAME DESCRIPTION */
68 /* */
69 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
70 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
71 /* resulting in version 6.1 */
72 /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */
73 /* used macros for RTOS calls, */
74 /* resulting in version 6.1.12 */
75 /* */
76 /**************************************************************************/
_ux_pictbridge_xml_function_input_startjob(UX_PICTBRIDGE * pictbridge,UCHAR * input_variable,UCHAR * input_string,UCHAR * xml_parameter)77 UINT _ux_pictbridge_xml_function_input_startjob(UX_PICTBRIDGE *pictbridge,
78 UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
79 {
80 UX_PICTBRIDGE_EVENT *pictbridge_next_event;
81 UX_PICTBRIDGE_EVENT *pictbridge_event;
82
83 UX_PARAMETER_NOT_USED(input_string);
84 UX_PARAMETER_NOT_USED(input_variable);
85 UX_PARAMETER_NOT_USED(xml_parameter);
86
87 /* Compute the next entry in the event array. */
88 if ((pictbridge -> ux_pictbridge_event_array_head + 1) == pictbridge -> ux_pictbridge_event_array_end)
89
90 /* Start at the beginning of the list. */
91 pictbridge_next_event = pictbridge -> ux_pictbridge_event_array;
92 else
93
94 /* Point to the next entry in the event array. */
95 pictbridge_next_event = pictbridge -> ux_pictbridge_event_array_head + 1;
96
97 /* Check to see if we can store this event. */
98 if (pictbridge_next_event == pictbridge -> ux_pictbridge_event_array_tail)
99
100 /* No place to store this event, throw it away. */
101 return(UX_ERROR);
102
103 /* Current storage is in the current head. */
104 pictbridge_event = pictbridge -> ux_pictbridge_event_array_head;
105
106 /* Store the start job event in the pictbridge event queue. */
107 pictbridge_event -> ux_pictbridge_event_code = UX_PICTBRIDGE_EC_START_JOB;
108 pictbridge_event -> ux_pictbridge_event_parameter_1 = 0;
109 pictbridge_event -> ux_pictbridge_event_parameter_2 = 0;
110 pictbridge_event -> ux_pictbridge_event_parameter_3 = 0;
111
112 /* Advance the pictbridge event queue head. */
113 pictbridge -> ux_pictbridge_event_array_head = pictbridge_next_event;
114
115 /* Wake up the Pictbridge notification handler thread. */
116 _ux_system_semaphore_put(&pictbridge -> ux_pictbridge_notification_semaphore);
117
118 /* This function never fails. */
119 return(UX_SUCCESS);
120 }
121
122
123