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
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _ux_pictbridge_xml_function_input_startjob_printinfo */
37 /* PORTABLE C */
38 /* 6.1 */
39 /* */
40 /* */
41 /* AUTHOR */
42 /* */
43 /* Chaoqiong Xiao, Microsoft Corporation */
44 /* */
45 /* DESCRIPTION */
46 /* */
47 /* This function receives a printinfo data block tag. There can be */
48 /* many so we should create a new printinfo block into the startjob */
49 /* structure for each of them as they come. */
50 /* */
51 /* */
52 /* INPUT */
53 /* */
54 /* pictbridge Pictbridge instance */
55 /* input_variable Pointer to variable */
56 /* input_string Pointer to string */
57 /* */
58 /* OUTPUT */
59 /* */
60 /* Completion Status */
61 /* */
62 /* CALLS */
63 /* */
64 /* */
65 /* CALLED BY */
66 /* */
67 /* _ux_pictbridge_object_parse */
68 /* */
69 /* RELEASE HISTORY */
70 /* */
71 /* DATE NAME DESCRIPTION */
72 /* */
73 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
74 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
75 /* resulting in version 6.1 */
76 /* */
77 /**************************************************************************/
_ux_pictbridge_xml_function_input_startjob_printinfo(UX_PICTBRIDGE * pictbridge,UCHAR * input_variable,UCHAR * input_string,UCHAR * xml_parameter)78 UINT _ux_pictbridge_xml_function_input_startjob_printinfo(UX_PICTBRIDGE *pictbridge,
79 UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
80 {
81 UX_PICTBRIDGE_PRINTINFO *printinfo;
82
83 UX_PARAMETER_NOT_USED(input_string);
84 UX_PARAMETER_NOT_USED(input_variable);
85 UX_PARAMETER_NOT_USED(xml_parameter);
86
87 /* Allocate some memory for the print info structure. */
88 printinfo = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, sizeof(UX_PICTBRIDGE_PRINTINFO));
89
90 /* Check memory allocation. */
91 if (printinfo == UX_NULL)
92 {
93 /* Set the error flag in the jobinfo structure. */
94 pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_status = UX_ERROR;
95
96 /* Return an error. */
97 return(UX_MEMORY_INSUFFICIENT);
98 }
99
100 /* Store the current printinfo structure. */
101 pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current = printinfo;
102
103 /* We need to hook this instance, either it is the first or we have one or more previous instances. */
104 if (pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_start == UX_NULL)
105 {
106
107 /* This is the first instance of a printinfo block. */
108 pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_start = printinfo;
109
110 /* Make it the current as well. */
111 pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current = printinfo;
112
113 }
114 else
115 {
116 /* Store the new instance in the next instance pointer of the current instance. */
117 pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_next = printinfo;
118
119 /* And the new one becomes the current. */
120 pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current = printinfo;
121
122 }
123
124 /* This function did not fail. */
125 return(UX_SUCCESS);
126 }
127
128
129