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 /**   Pictbridge Application                                              */
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_pictbridge.h"
30 #include "ux_device_class_pima.h"
31 
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _ux_pictbridge_dpsclient_api_continue_job           PORTABLE C      */
38 /*                                                           6.1.12       */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Chaoqiong Xiao, Microsoft Corporation                               */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function creates the tag lines of the start job function       */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    pictbridge                            Pictbridge instance           */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    Completion Status                                                   */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*                                                                        */
58 /*  CALLED BY                                                             */
59 /*                                                                        */
60 /*    application                                                         */
61 /*                                                                        */
62 /*  RELEASE HISTORY                                                       */
63 /*                                                                        */
64 /*    DATE              NAME                      DESCRIPTION             */
65 /*                                                                        */
66 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
67 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
68 /*                                            used UX prefix to refer to  */
69 /*                                            TX symbols instead of using */
70 /*                                            them directly,              */
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_dpsclient_api_continue_job(UX_PICTBRIDGE * pictbridge)77 UINT _ux_pictbridge_dpsclient_api_continue_job(UX_PICTBRIDGE *pictbridge)
78 {
79 UINT                                status;
80 ULONG                               actual_flags;
81 
82     /* Prepare the object for capability. */
83     status = _ux_pictbridge_dpsclient_input_object_prepare(pictbridge, UX_PICTBRIDGE_OR_CONTINUE_JOB, 0, 0);
84 
85     /* Check status.  */
86     if (status != UX_SUCCESS)
87         return(status);
88 
89     /* We should wait for the host to send a script with the response.  */
90     status =  _ux_system_event_flags_get(&pictbridge -> ux_pictbridge_event_flags_group, UX_PICTBRIDGE_EVENT_FLAG_CONTINUE_JOB,
91                                         UX_AND_CLEAR, &actual_flags, UX_PICTBRIDGE_EVENT_TIMEOUT);
92 
93     /* Check status.  */
94     if (status != UX_SUCCESS)
95         return(UX_EVENT_ERROR);
96 
97     /* Ensure the flag was set.  */
98     if (actual_flags & UX_PICTBRIDGE_EVENT_FLAG_CONTINUE_JOB)
99 
100         /* Return completion status.  */
101         return(UX_SUCCESS);
102 
103     else
104 
105         /* Return completion status.  */
106         return(UX_ERROR);
107 }
108 
109