Line No. | Rev | Author | Line |
---|---|---|---|
1 | 32 | kaklik | /****************************************************************************** |
2 | PCL 5 Printer Language Support |
||
3 | |||
4 | Summary: |
||
5 | This file provides support for the PCL 5 printer language when using the |
||
6 | USB Embedded Host Printer Client Driver. |
||
7 | |||
8 | Description: |
||
9 | This file provides support for the PCL 5 printer language when using the |
||
10 | USB Embedded Host Printer Client Driver. |
||
11 | |||
12 | There are several versions of the PCL printer language. This file is |
||
13 | targetted to support PCL 5. Unfortunately, printer language support is not |
||
14 | always advertised correctly by the printer. Some printers advertise only |
||
15 | PCL 6 support when they also support PCL 5. Therefore, the default value |
||
16 | for the LANGUAGE_ID_STRING_PCL string used in the routine |
||
17 | USBHostPrinterLanguagePCL5IsSupported() is set such that the routine will |
||
18 | return TRUE if any PCL language support is advertised. It is highly |
||
19 | recommended to test the target application with the specific printer(s) |
||
20 | that will be utilized, and, if possible, populate the |
||
21 | usbPrinterSpecificLanguage[] array in usb_config.c via the configuration |
||
22 | tool to manually select the printer language and its functional support. |
||
23 | |||
24 | Notes: |
||
25 | The PCL 5 coordinate origin is located at the top left corner of the paper. |
||
26 | The HP-GL/2 coordinate origin, however, is located at the bottom left corner |
||
27 | of the page. For consistency for the user, HP-GL/2 coordinate system is |
||
28 | adjusted to match the PCL coordinate system. This also matches the |
||
29 | coordinate system use by the Microchip Graphics library. |
||
30 | |||
31 | The black and white bit image polarity is 0=white, 1=black, which is |
||
32 | reversed from the Microchip Graphics Library polarity. This driver will |
||
33 | automatically convert the image data to the required format, as long as the |
||
34 | image data is located in ROM (USB_PRINTER_TRANSFER_FROM_ROM) or it is |
||
35 | copied from a RAM buffer (USB_PRINTER_TRANSFER_COPY_DATA). If the data is |
||
36 | to be sent directly from its original RAM location, the data must already |
||
37 | be in the format required by the printer language. |
||
38 | |||
39 | PCL 5 is not compatible with PCL 6; PCL 5 utilizes ASCII input, whereas |
||
40 | PCL 6 utilizes binary data. However, some printers that advertise support |
||
41 | for only PCL 5 do support PCL 6. |
||
42 | |||
43 | PCL 3 printers utilize many of the PCL 5 commands. The following |
||
44 | limitations exist with PCL 3: |
||
45 | * PCL 3 does not support vector graphics |
||
46 | * PCL 3 does not support image printing in landscape mode. The |
||
47 | page print will fail. |
||
48 | * Items must be sent to the page in the order that they are to be |
||
49 | printed from top to bottom. The printer cannot return to a |
||
50 | higher position on the page. |
||
51 | * PCL 3 does not support the USB_PRINTER_EJECT_PAGE command. Use the |
||
52 | USB_PRINTER_JOB_STOP and USB_PRINTER_JOB_START commands instead. |
||
53 | |||
54 | *******************************************************************************/ |
||
55 | //DOM-IGNORE-BEGIN |
||
56 | /****************************************************************************** |
||
57 | |||
58 | * FileName: usb_host_printer_pcl_5.h |
||
59 | * Dependencies: None |
||
60 | * Processor: PIC24/dsPIC30/dsPIC33/PIC32MX |
||
61 | * Compiler: C30 v3.10b/C32 v1.02 |
||
62 | * Company: Microchip Technology, Inc. |
||
63 | |||
64 | Software License Agreement |
||
65 | |||
66 | The software supplied herewith by Microchip Technology Incorporated |
||
67 | (the Company) for its PICmicro® Microcontroller is intended and |
||
68 | supplied to you, the Companys customer, for use solely and |
||
69 | exclusively on Microchip PICmicro Microcontroller products. The |
||
70 | software is owned by the Company and/or its supplier, and is |
||
71 | protected under applicable copyright laws. All rights are reserved. |
||
72 | Any use in violation of the foregoing restrictions may subject the |
||
73 | user to criminal sanctions under applicable laws, as well as to |
||
74 | civil liability for the breach of the terms and conditions of this |
||
75 | license. |
||
76 | |||
77 | THIS SOFTWARE IS PROVIDED IN AN AS IS CONDITION. NO WARRANTIES, |
||
78 | WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED |
||
79 | TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
||
80 | PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, |
||
81 | IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR |
||
82 | CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
||
83 | |||
84 | Change History: |
||
85 | Rev Description |
||
86 | ---- ----------------------------------- |
||
87 | 2.6a- No change |
||
88 | 2.7a |
||
89 | *******************************************************************************/ |
||
90 | //DOM-IGNORE-END |
||
91 | |||
92 | // ***************************************************************************** |
||
93 | // ***************************************************************************** |
||
94 | // Section: Constants |
||
95 | // ***************************************************************************** |
||
96 | // ***************************************************************************** |
||
97 | |||
98 | // This is the string that the printer language support determination |
||
99 | // routine will look for to determine if the printer supports this |
||
100 | // printer language. This string is case sensive. Some printers that |
||
101 | // report only PCL 6 support also support PCL 5. So it is recommended |
||
102 | // to use "PCL" as the search string, rather than "PCL 5", and verify |
||
103 | // that the correct output is produced by the target printer. |
||
104 | #define LANGUAGE_ID_STRING_PCL "PCL" |
||
105 | // These are the support flags that are set for the PCL 3 version of |
||
106 | // this language. |
||
107 | #define LANGUAGE_SUPPORT_FLAGS_PCL3 0 |
||
108 | // These are the support flags that are set for the PCL 5 version of |
||
109 | // this language. |
||
110 | #define LANGUAGE_SUPPORT_FLAGS_PCL5 USB_PRINTER_FUNCTION_SUPPORT_VECTOR_GRAPHICS |
||
111 | |||
112 | |||
113 | // ***************************************************************************** |
||
114 | // ***************************************************************************** |
||
115 | // Section: Function Prototypes |
||
116 | // ***************************************************************************** |
||
117 | // ***************************************************************************** |
||
118 | |||
119 | /**************************************************************************** |
||
120 | Function: |
||
121 | BYTE USBHostPrinterLanguagePCL5( BYTE address, |
||
122 | USB_PRINTER_COMMAND command, USB_DATA_POINTER data, DWORD size, BYTE transferFlags ) |
||
123 | |||
124 | Summary: |
||
125 | This function executes printer commands for a PCL 5 printer. |
||
126 | |||
127 | Description: |
||
128 | This function executes printer commands for a PCL 5 printer. When |
||
129 | the application issues a printer command, the printer client driver |
||
130 | determines what language to use to communicate with the printer, and |
||
131 | transfers the command to that language support routine. As much as |
||
132 | possible, commands are designed to produce the same output regardless |
||
133 | of what printer language is used. |
||
134 | |||
135 | Not all printer commands support data from both RAM and ROM. Unless |
||
136 | otherwise noted, the data pointer is assumed to point to RAM, regardless of |
||
137 | the value of transferFlags. Refer to the specific command to see if ROM |
||
138 | data is supported. |
||
139 | |||
140 | Preconditions: |
||
141 | None |
||
142 | |||
143 | Parameters: |
||
144 | BYTE address - Device's address on the bus |
||
145 | USB_PRINTER_COMMAND command - Command to execute. See the enumeration |
||
146 | USB_PRINTER_COMMAND for the list of |
||
147 | valid commands and their requirements. |
||
148 | USB_DATA_POINTER data - Pointer to the required data. Note that |
||
149 | the caller must set transferFlags |
||
150 | appropriately to indicate if the pointer is |
||
151 | a RAM pointer or a ROM pointer. |
||
152 | DWORD size - Size of the data. For some commands, this |
||
153 | parameter is used to hold the data itself. |
||
154 | BYTE transferFlags - Flags that indicate details about the |
||
155 | transfer operation. Refer to these flags |
||
156 | * USB_PRINTER_TRANSFER_COPY_DATA |
||
157 | * USB_PRINTER_TRANSFER_STATIC_DATA |
||
158 | * USB_PRINTER_TRANSFER_NOTIFY |
||
159 | * USB_PRINTER_TRANSFER_FROM_ROM |
||
160 | * USB_PRINTER_TRANSFER_FROM_RAM |
||
161 | |||
162 | Return Values: |
||
163 | USB_PRINTER_SUCCESS - The command was executed successfully. |
||
164 | USB_PRINTER_UNKNOWN_DEVICE - A printer with the indicated address is not |
||
165 | attached |
||
166 | USB_PRINTER_TOO_MANY_DEVICES - The printer status array does not have |
||
167 | space for another printer. |
||
168 | USB_PRINTER_OUT_OF_MEMORY - Not enough available heap space to |
||
169 | execute the command. |
||
170 | other - See possible return codes from the |
||
171 | function USBHostPrinterWrite(). |
||
172 | |||
173 | Remarks: |
||
174 | When developing new commands, keep in mind that the function |
||
175 | USBHostPrinterCommandReady() will be used before calling this function to |
||
176 | see if there is space available in the output transfer queue. |
||
177 | USBHostPrinterCommandReady() will routine TRUE if a single space is |
||
178 | available in the output queue. Therefore, each command can generate only |
||
179 | one output transfer. |
||
180 | |||
181 | Multiple printer languages may be used in a single application. The USB |
||
182 | Embedded Host Printer Client Driver will call the routine required for the |
||
183 | attached device. |
||
184 | ***************************************************************************/ |
||
185 | |||
186 | BYTE USBHostPrinterLanguagePCL5( BYTE address, |
||
187 | USB_PRINTER_COMMAND command, USB_DATA_POINTER data, DWORD size, BYTE transferFlags ); |
||
188 | |||
189 | |||
190 | /**************************************************************************** |
||
191 | Function: |
||
192 | BOOL USBHostPrinterLanguagePCL5IsSupported( char *deviceID, |
||
193 | USB_PRINTER_FUNCTION_SUPPORT *support ) |
||
194 | |||
195 | Summary: |
||
196 | This function determines if the printer with the given device ID string |
||
197 | supports the PCL 5 printer language. |
||
198 | |||
199 | Description: |
||
200 | This function determines if the printer with the given device ID string |
||
201 | supports the PCL 5 printer language. |
||
202 | |||
203 | Unfortunately, printer language support is not always advertised correctly |
||
204 | by the printer. Some printers advertise only PCL 6 support when they also |
||
205 | support PCL 5. Therefore, this routine will return TRUE if any PCL |
||
206 | language support is advertised. It is therefore highly recommended to test |
||
207 | the target application with the specific printer(s) that will be utilized. |
||
208 | |||
209 | Preconditions: |
||
210 | None |
||
211 | |||
212 | Parameters: |
||
213 | char *deviceID - Pointer to the "COMMAND SET:" portion of the device ID |
||
214 | string of the attached printer. |
||
215 | USB_PRINTER_FUNCTION_SUPPORT *support - Pointer to returned information |
||
216 | about what types of functions this printer supports. |
||
217 | |||
218 | Return Values: |
||
219 | TRUE - The printer supports PCL 5. |
||
220 | FALSE - The printer does not support PCL 5. |
||
221 | |||
222 | Remarks: |
||
223 | The caller must first locate the "COMMAND SET:" section of the device ID |
||
224 | string. To ensure that only the "COMMAND SET:" section of the device ID |
||
225 | string is checked, the ";" at the end of the section should be temporarily |
||
226 | replaced with a NULL. Otherwise, this function may find the printer |
||
227 | language string in the comments or other section, and incorrectly indicate |
||
228 | that the printer supports the language. |
||
229 | |||
230 | Device ID strings are case sensitive. |
||
231 | ***************************************************************************/ |
||
232 | |||
233 | BOOL USBHostPrinterLanguagePCL5IsSupported( char *deviceID, |
||
234 | USB_PRINTER_FUNCTION_SUPPORT *support ); |
||
235 |
Powered by WebSVN v2.8.3