| 1 | /* |
| 2 | * Shinko/Sinfonia Common Code |
| 3 | * |
| 4 | * (c) 2019-2025 Solomon Peachy <[email protected]> |
| 5 | * |
| 6 | * The latest version of this program can be found at: |
| 7 | * |
| 8 | * https://git.shaftnet.org/gitea/slp/selphy_print.git |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License as published by the Free |
| 12 | * Software Foundation; either version 2 of the License, or (at your option) |
| 13 | * any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, but |
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 17 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 18 | * for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 22 | * |
| 23 | * SPDX-License-Identifier: GPL-2.0+ |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #define LIBSINFONIA_VER "0.22" |
| 28 | |
| 29 | #define SINFONIA_HDR1_LEN 0x10 |
| 30 | #define SINFONIA_HDR2_LEN 0x64 |
| 31 | #define SINFONIA_HDR_LEN (SINFONIA_HDR1_LEN + SINFONIA_HDR2_LEN) |
| 32 | #define SINFONIA_DPI 300 |
| 33 | |
| 34 | struct sinfonia_job_param { |
| 35 | uint32_t columns; |
| 36 | uint32_t rows; |
| 37 | |
| 38 | uint32_t method; |
| 39 | uint32_t media; |
| 40 | uint32_t oc_mode; |
| 41 | |
| 42 | uint32_t quality; |
| 43 | |
| 44 | int mattedepth; |
| 45 | uint32_t dust; |
| 46 | |
| 47 | uint32_t ext_flags; |
| 48 | }; |
| 49 | #define EXT_FLAG_PLANARYMC 0x01 |
| 50 | #define EXT_FLAG_BACKPRINT 0x02 |
| 51 | #define EXT_FLAG_DOUBLESLUG 0x04 |
| 52 | |
| 53 | struct sinfonia_printjob { |
| 54 | struct dyesub_job_common common; |
| 55 | struct sinfonia_job_param jp; |
| 56 | |
| 57 | uint8_t *databuf; |
| 58 | int datalen; |
| 59 | }; |
| 60 | |
| 61 | int sinfonia_read_parse(int data_fd, uint32_t model, |
| 62 | struct sinfonia_printjob *job); |
| 63 | |
| 64 | int sinfonia_raw10_read_parse(int data_fd, struct sinfonia_printjob *job); |
| 65 | int sinfonia_raw18_read_parse(int data_fd, struct sinfonia_printjob *job); |
| 66 | int sinfonia_raw28_read_parse(int data_fd, struct sinfonia_printjob *job); |
| 67 | void sinfonia_cleanup_job(const void *vjob); |
| 68 | |
| 69 | int sinfonia_panorama_splitjob(struct sinfonia_printjob *injob, |
| 70 | uint16_t max_rows, |
| 71 | struct sinfonia_printjob **newjobs); |
| 72 | |
| 73 | /* mapping param IDs to names */ |
| 74 | struct sinfonia_param { |
| 75 | const uint8_t id; |
| 76 | const char *descr; |
| 77 | }; |
| 78 | |
| 79 | /* Known param IDs */ |
| 80 | enum { |
| 81 | PARAM_UNK_01 = 0x01, // 6145 = 0x32, 8810 = 0x01, 7000 = 0x01 |
| 82 | PARAM_UNK_02 = 0x02, // 6145 = 0xffffffff |
| 83 | PARAM_UNK_03 = 0x02, // 6145 = 0xffffffff |
| 84 | PARAM_UNK_04 = 0x04, // 6145 = 0xffffffff |
| 85 | PARAM_UNK_05 = 0x05, // 6145 = 0xffffffff |
| 86 | |
| 87 | PARAM_UNK_10 = 0x10, // 2245 = 0x7b, 6900 = 0x79 |
| 88 | PARAM_UNK_11 = 0x11, // 2245 = 0x72, 6900 = 0x73, 8810 = 0x01, 7000 = 0x01 |
| 89 | PARAM_UNK_12 = 0x12, // 6145 = 0xffffffc4, 8810 = 0x69, 7000 = 0x69 (Matte Gloss?) |
| 90 | PARAM_UNK_13 = 0x13, // 6145 = 0xffffffe2, 8810 = 0xc3, 7000 = 0xc3 (Matte Degloss Black?) |
| 91 | PARAM_UNK_14 = 0x14, // 6145 = 0xffffffc7, 8810 = 0xcd, 7000 = 0xcd (Matte Degloss White?) |
| 92 | PARAM_UNK_15 = 0x15, // 6145 = 0xffffffec |
| 93 | PARAM_UNK_16 = 0x16, // 6145 = 0x00 |
| 94 | |
| 95 | PARAM_OC_PRINT = 0x20, // 6145 ONLY |
| 96 | PARAM_UNK_21 = 0x21, // 6145 = 0x69, 8810 = 0x3e8, 7000 = 0xe39 (Exit Speed with Sorter 4x6?) |
| 97 | PARAM_UNK_22 = 0x22, // 6145 = 0xc3, 8810 = 0x41a, 7000 = 0x41a (Exit Speed with Sorter 8x6?) |
| 98 | PARAM_UNK_23 = 0x23, // 6145 = 0xc3, 8810 = 0x152, 7000 = 0x152 (Exit Speed with Backprinting?) |
| 99 | PARAM_UNK_24 = 0x24, // 8810 = 0x44c, 7000 = 0x44c (Exit Speed without PPAC 4x6?) |
| 100 | PARAM_UNK_25 = 0x25, // 8810 = 0x44c, 7000 = 0x44c (Exit Speed without PPAC 8x6?) |
| 101 | PARAM_UNK_2F = 0x2f, // 8810 = 0x320, 7000 = 0x320 |
| 102 | |
| 103 | PARAM_UNK_31 = 0x31, // 2245 = 0x64, 6900 = 0x62, 6145 = 0x68 |
| 104 | PARAM_UNK_32 = 0x32, // 2245 = 0x64, 6900 = 0x69 |
| 105 | PARAM_UNK_33 = 0x33, // 2245 = 0x64, 6900 = 0x66 |
| 106 | PARAM_UNK_34 = 0x34, // 2245 = 0x00, 6900 = 0x00 |
| 107 | PARAM_UNK_35 = 0x35, // 2245 = 0x00, 6900 = 0x00 |
| 108 | PARAM_UNK_36 = 0x36, // 2245 = 0x00, 6900 = 0x07 |
| 109 | PARAM_UNK_37 = 0x37, // 6900 = 0x65 |
| 110 | PARAM_UNK_38 = 0x38, // 6900 = 0x00 |
| 111 | PARAM_UNK_39 = 0x39, // 6900 = 0x56 |
| 112 | PARAM_UNK_3A = 0x3a, // 6900 = 0x08 |
| 113 | PARAM_UNK_3B = 0x3b, // 6900 = 0x69 |
| 114 | PARAM_UNK_3C = 0x3c, // 6900 = 0xc3 |
| 115 | |
| 116 | PARAM_UNK_3D = 0x3d, // 6900 = 0xcd // XXX same as PAPER_PRESV? |
| 117 | |
| 118 | PARAM_PAPER_PRESV = 0x3d, // 6145 only? // XXX EK6900 too |
| 119 | |
| 120 | PARAM_DRIVER_MODE = 0x3e, // 6145, 2245, 6245, 6900 ONLY |
| 121 | PARAM_PAPER_MODE = 0x3f, // 2245, 6245, 6900 ONLY |
| 122 | |
| 123 | PARAM_UNK_40 = 0x40, // 2245 = 0xff |
| 124 | PARAM_UNK_41 = 0x41, // 2245 = 0x00, 8810 = 0x5d, 7000 = 0x6d |
| 125 | PARAM_UNK_42 = 0x42, // 8810 = 0x48, 7000 = 0x51 |
| 126 | PARAM_UNK_43 = 0x43, // 8810 = 0x7c, 7000 = 0x3b |
| 127 | PARAM_UNK_44 = 0x44, // 8810 = 0x88, 7000 = 0x82 |
| 128 | PARAM_UNK_45 = 0x45, // 8810 = 0x00, 7000 = 0x00 |
| 129 | PARAM_UNK_46 = 0x46, // 8810 = 0x02, 7000 = 0x00 |
| 130 | PARAM_UNK_47 = 0x47, // 8810 = 0x03, 7000 = 0x28 |
| 131 | PARAM_UNK_48 = 0x48, // 8810 = 0x08, 7000 = 0x02 |
| 132 | |
| 133 | PARAM_REGION_CODE = 0x53, // 6145 ONLY |
| 134 | PARAM_SLEEP_TIME = 0x54, // 6145, 2245, 6245 ONLY |
| 135 | PARAM_UNK_55 = 0x55, // 6145 = 0xff |
| 136 | PARAM_UNK_56 = 0x56, // 6145 = 0xff |
| 137 | PARAM_UNK_57 = 0x57, // 6145 = 0x00 |
| 138 | PARAM_UNK_58 = 0x58, // 6145 = 0xff |
| 139 | |
| 140 | PARAM_UNK_60 = 0x60, // 6145 = 0xa2 |
| 141 | PARAM_UNK_61 = 0x61, // 6145 = 0xa7, 8810 = 0x50 |
| 142 | PARAM_UNK_62 = 0x62, // 8810 = 0x31 |
| 143 | PARAM_UNK_63 = 0x63, // 8810 = 0x30 |
| 144 | PARAM_UNK_64 = 0x64, // 8810 = 0x30 |
| 145 | |
| 146 | PARAM_UNK_70 = 0x70, // 2245 = 0x22f8, 6145 = 0x24ba, 6900 = 0x14bd |
| 147 | PARAM_UNK_71 = 0x71, // 2245 = 0x01, 6900 = 0x01 |
| 148 | PARAM_UNK_72 = 0x72, // 6145 = 0x84 |
| 149 | PARAM_UNK_73 = 0x73, // 6145 = 0x8b |
| 150 | PARAM_UNK_74 = 0x74, // 6145 = 0x89 |
| 151 | PARAM_UNK_75 = 0x75, // 6145 = 0x80 |
| 152 | |
| 153 | PARAM_UNK_81 = 0x81, // 8810 = 0xffffffff, 7000 = 0xffffffff |
| 154 | PARAM_UNK_82 = 0x82, // 8810 = 0xfffffff9, 7000 = 0xfffffffe |
| 155 | PARAM_UNK_83 = 0x83, // 8810 = 0xfffffffc, 7000 = 0xffffffee |
| 156 | PARAM_UNK_84 = 0x84, // 8810 = 0x02, 7000 = 0x01 |
| 157 | PARAM_UNK_8A = 0x8a, // 8810 = 0x05 |
| 158 | PARAM_UNK_8B = 0x8b, // 8810 = 0x05 |
| 159 | PARAM_UNK_8C = 0x8c, // 8810 = 0x00 |
| 160 | PARAM_UNK_8D = 0x8d, // 8810 = 0x00 |
| 161 | |
| 162 | PARAM_UNK_91 = 0x91, // 2245 = 0xfffffffc, 6145 = 0xfffffffa, 8810 = 0x7e, 7000 = 0x6c, 6900 = 0xfffffffc |
| 163 | PARAM_UNK_92 = 0x92, // 2245 = 0x00, 6145 = 0x06, 8810 = 0x7d, 7000 = 0x87, 6900 = 0x00 |
| 164 | PARAM_UNK_93 = 0x93, // 2245 = 0x06, 6145 = 0x06, 8810 = 0x77, 7000 = 0x67, 6900 = 0x00 |
| 165 | PARAM_UNK_94 = 0x94, // 7000 = 0x76 |
| 166 | |
| 167 | PARAM_UNK_A0 = 0xa0, // 2245 = 0x01, 8810 = 0x05, 7000 = 0x05 |
| 168 | PARAM_UNK_A1 = 0xa1, // 2245 = 0xffffffff, 8810 = 0x00, 7000 = 0x00, 6900 = 0xffffffff |
| 169 | PARAM_UNK_A2 = 0xa2, // 2245 = 0xffffffff, 8810 = 0x08, 7000 = 0x10, 6900 = 0xffffffff |
| 170 | PARAM_UNK_A3 = 0xa3, // 2245 = 0xffffffff, 8810 = 0x30, 7000 = 0x3b, 6900 = 0xffffffff |
| 171 | PARAM_UNK_A4 = 0xa4, // 2245 = 0xffffffff, 8810 = 0x30, 7000 = 0x3b, 6900 = 0xffffffff |
| 172 | PARAM_UNK_A5 = 0xa5, // 2245 = 0x42, 6145 = 0x4d, 8810 = 0x46, 7000 = 0x3e (Thermal Protect Lamaination?), 6900 = 0x49 |
| 173 | PARAM_UNK_A6 = 0xa6, // 2245 = 0x00, 6145 = 0x01, 8810 = 0x01, 7000 = 0x01, 6900 = 0x00 |
| 174 | PARAM_UNK_A7 = 0xa7, // 2245 = 0x01, 8810 = 0x14, 7000 = 0x14, 6900 = 0x01, |
| 175 | PARAM_UNK_A8 = 0xa8, // 2245 = 0x01, 6145 = 0x01, 8810 = 0x01, 7000 = 0x01, 6900 = 0x00 |
| 176 | PARAM_UNK_A9 = 0xa9, // 6145 = 0xffffffff, 8810 = 0xffffffff, 7000 = 0xffffffff |
| 177 | |
| 178 | PARAM_UNK_B0 = 0xb0, // 2245 = 0x1a/00, 6900 = 0x18 (VARIES?) |
| 179 | PARAM_UNK_B1 = 0xb1, // 2245 = 0x70/79, 6900 - 0x7d (VARIES?) |
| 180 | |
| 181 | PARAM_UNK_C0 = 0xc0, // 6900 = 0x05 |
| 182 | PARAM_UNK_C1 = 0xc1, // 8810 = 0x02, 7000 = 0x02, 6900 = 0x02d0 |
| 183 | PARAM_UNK_C2 = 0xc2, // 8810 = 0xc8, 7000 = 0xc8 |
| 184 | PARAM_UNK_C3 = 0xc3, // 8810 = 0xc8, 7000 = 0xc8 |
| 185 | PARAM_UNK_C4 = 0xc4, // 8810 = 0x4d0, 7000 = 0x200 |
| 186 | |
| 187 | PARAM_UNK_D3 = 0xd3, // 6145 = 0x00 |
| 188 | PARAM_UNK_D4 = 0xd4, // 6145 = 0x00 |
| 189 | PARAM_UNK_D5 = 0xd5, // 6145 = 0xff |
| 190 | PARAM_UNK_D6 = 0xd6, // 6145 = 0xff |
| 191 | PARAM_UNK_D7 = 0xd7, // 6145 = 0x00 |
| 192 | PARAM_UNK_D8 = 0xd8, // 6145 = 0xff |
| 193 | PARAM_UNK_DC = 0xdc, // 2245 = 0x00 |
| 194 | PARAM_UNK_DD = 0xdd, // 2245 = 0x0c, 6900 = 0x16 |
| 195 | PARAM_UNK_DE = 0xde, // 2245 = 0x32, 6900 = 0x14 |
| 196 | PARAM_UNK_DF = 0xdf, // 2245 = 0x00. 6900 = 0x00 |
| 197 | |
| 198 | PARAM_UNK_E1 = 0xe1, // 2245 = 0x33/49, 6145 = 0x213e, 6900 = 0x5301 (VARIES?) |
| 199 | PARAM_UNK_E2 = 0xe2, // 2245 = 0x33/49, 6145 = 0x213e, 6900 = 0x5301 (VARIES?) |
| 200 | PARAM_UNK_E3 = 0xe3, // 6145 = 0x00 |
| 201 | PARAM_UNK_E4 = 0xe4, // 2245 = 0x78/ad, 6145 = 0x43ab, 6900 = 0x545f (VARIES?) |
| 202 | PARAM_UNK_E5 = 0xe5, // 2245 = 0x33/49, 6145 = 0x213e, 6900 = 0x5301 (VARIES?) |
| 203 | PARAM_UNK_E6 = 0xe6, // 2245 = 0x0194/219, 6145 = 0x00, 6900 = 0x14bfd (VARIES?) |
| 204 | PARAM_UNK_E7 = 0xe7, // 2245 = 0x0194/219, 6145 = 0x84f8, 6900 = 0x14bfd (VARIES?) |
| 205 | PARAM_UNK_E8 = 0xe8, // 2245 = 0x00, 6145 = 0x84f8, 6900 = 0x00 |
| 206 | PARAM_UNK_E9 = 0xe9, // 2245 = 0x00, 6145 = 0x84f8, 6900 = 0x00 |
| 207 | PARAM_UNK_EA = 0xea, // 2245 = 0x33/49, 6145 = 0x00, 6900 = 0x5301 (VARIES?) |
| 208 | PARAM_UNK_EB = 0xeb, // 2245 = 0x0194/219, 6900 = 14bfd (VARIES?) |
| 209 | PARAM_UNK_EC = 0xec, // 6900 = 0x00 |
| 210 | PARAM_UNK_ED = 0xed, // 6900 = 0x00 |
| 211 | |
| 212 | PARAM_UNK_F0 = 0xf0, // 6900 = 0x1197 |
| 213 | PARAM_UNK_F1 = 0xf1, // 8810 = 0x22, 7000 = 0x68 |
| 214 | PARAM_UNK_F2 = 0xf2, // 8810 = 0x22, 7000 = 0x68 |
| 215 | PARAM_UNK_F3 = 0xf3, // 8810 = 0x47, 7000 = 0x94 |
| 216 | PARAM_UNK_F4 = 0xf4, // 8810 = 0x22, 7000 = 0x68 |
| 217 | }; |
| 218 | |
| 219 | // S6145, S2245, S6245 |
| 220 | #define PARAM_DRIVER_WIZOFF 0x00000000 |
| 221 | #define PARAM_DRIVER_WIZON 0x00000001 |
| 222 | |
| 223 | // S6145, S2245, S6245 |
| 224 | #define PARAM_PAPER_NOCUT 0x00000000 |
| 225 | #define PARAM_PAPER_CUTLOAD 0x00000001 |
| 226 | |
| 227 | // S6145, S6245 |
| 228 | #define PARAM_SLEEP_5MIN 0x00000000 |
| 229 | #define PARAM_SLEEP_15MIN 0x00000001 |
| 230 | #define PARAM_SLEEP_30MIN 0x00000002 |
| 231 | #define PARAM_SLEEP_60MIN 0x00000003 |
| 232 | #define PARAM_SLEEP_120MIN 0x00000004 |
| 233 | #define PARAM_SLEEP_240MIN 0x00000005 |
| 234 | |
| 235 | /* Common usb functions */ |
| 236 | struct sinfonia_usbdev { |
| 237 | struct dyesub_connection *conn; |
| 238 | |
| 239 | const struct sinfonia_param *params; |
| 240 | int params_count; |
| 241 | |
| 242 | char const *(*error_codes)(uint8_t major, uint8_t minor); |
| 243 | }; |
| 244 | int sinfonia_docmd(struct sinfonia_usbdev *usbh, |
| 245 | const uint8_t *cmd, int cmdlen, |
| 246 | uint8_t *resp, int resplen, |
| 247 | int *num); |
| 248 | int sinfonia_flashled(struct sinfonia_usbdev *usbh); |
| 249 | int sinfonia_canceljob(struct sinfonia_usbdev *usbh, int id); |
| 250 | int sinfonia_getparam(struct sinfonia_usbdev *usbh, int target, uint32_t *param); |
| 251 | int sinfonia_setparam(struct sinfonia_usbdev *usbh, int target, uint32_t param); |
| 252 | int sinfonia_getfwinfo(struct sinfonia_usbdev *usbh); |
| 253 | int sinfonia_geterrorlog(struct sinfonia_usbdev *usbh); |
| 254 | int sinfonia_resetcurve(struct sinfonia_usbdev *usbh, int target, int id); |
| 255 | int sinfonia_gettonecurve(struct sinfonia_usbdev *usbh, int type, char *fname); |
| 256 | int sinfonia_settonecurve(struct sinfonia_usbdev *usbh, int target, char *fname); |
| 257 | int sinfonia_button_set(struct sinfonia_usbdev *dev, int enable); |
| 258 | |
| 259 | int sinfonia_query_serno(struct dyesub_connection *conn, char *buf, int buf_len); |
| 260 | int sinfonia_dumpallparams(struct sinfonia_usbdev *usbh, int known); |
| 261 | const char *sinfonia_paramname(struct sinfonia_usbdev *usbh, int id); |
| 262 | |
| 263 | #define BANK_STATUS_FREE 0x00 |
| 264 | #define BANK_STATUS_XFER 0x01 |
| 265 | #define BANK_STATUS_FULL 0x02 |
| 266 | #define BANK_STATUS_PRINTING 0x12 /* Not on S2145 */ |
| 267 | |
| 268 | const char *sinfonia_bank_statuses(uint8_t v); |
| 269 | |
| 270 | #define UPDATE_TARGET2_FIRMWARE 0x00 |
| 271 | #define UPDATE_TARGET2_TONE 0x01 |
| 272 | |
| 273 | #define UPDATE_TARGET_FIRMWARE_DSP 0x00 |
| 274 | #define UPDATE_TARGET_FIRMWARE_MAIN 0x01 |
| 275 | #define UPDATE_TARGET_FIRMWARE_TABLE 0x02 |
| 276 | |
| 277 | #define UPDATE_TARGET_TONE_USER 0x03 |
| 278 | #define UPDATE_TARGET_TONE_CURRENT 0x04 |
| 279 | |
| 280 | #define UPDATE_TARGET2_LAM 0x00 // ??? |
| 281 | |
| 282 | #define UPDATE_TARGET_LAM_USER 0x10 |
| 283 | #define UPDATE_TARGET_LAM_DEF 0x11 |
| 284 | #define UPDATE_TARGET_LAM_CUR 0x12 |
| 285 | |
| 286 | /* Update is three channels, Y, M, C; |
| 287 | each is 256 entries of 11-bit data padded to 16-bits. |
| 288 | Printer expects LE data. We use BE data on disk. |
| 289 | */ |
| 290 | #define TONE_CURVE_SIZE (256*3) |
| 291 | const char *sinfonia_update_targets (uint8_t v); |
| 292 | |
| 293 | #define TONECURVE_INIT 0x00 |
| 294 | #define TONECURVE_USER 0x01 |
| 295 | #define TONECURVE_CURRENT 0x02 |
| 296 | |
| 297 | const char *sinfonia_tonecurve_statuses (uint8_t v); |
| 298 | |
| 299 | struct sinfonia_error_item { |
| 300 | uint8_t major; |
| 301 | uint8_t minor; |
| 302 | uint32_t print_counter; |
| 303 | } __attribute__((packed)); |
| 304 | |
| 305 | #define ERROR_NONE 0x00 |
| 306 | #define ERROR_INVALID_PARAM 0x01 |
| 307 | #define ERROR_MAIN_APP_INACTIVE 0x02 |
| 308 | #define ERROR_COMMS_TIMEOUT 0x03 |
| 309 | #define ERROR_MAINT_NEEDED 0x04 |
| 310 | #define ERROR_INAPP_COMMAND 0x05 |
| 311 | #define ERROR_PRINTER 0x11 |
| 312 | #define ERROR_BUFFER_FULL 0x21 |
| 313 | |
| 314 | const char *sinfonia_error_str(uint8_t v); |
| 315 | |
| 316 | enum { |
| 317 | MEDIA_TYPE_UNKNOWN = 0x00, |
| 318 | MEDIA_TYPE_PAPER = 0x01, |
| 319 | }; |
| 320 | |
| 321 | const char *sinfonia_media_types(uint8_t v); |
| 322 | |
| 323 | #define PRINT_MODE_NO_OC 0x01 |
| 324 | #define PRINT_MODE_GLOSSY 0x02 |
| 325 | #define PRINT_MODE_MATTE 0x03 |
| 326 | const char *sinfonia_print_modes(uint8_t v); |
| 327 | |
| 328 | #define PRINT_METHOD_STD 0x00 |
| 329 | #define PRINT_METHOD_COMBO_2 0x02 |
| 330 | #define PRINT_METHOD_COMBO_3 0x03 // S6245 only |
| 331 | #define PRINT_METHOD_SPLIT 0x04 |
| 332 | #define PRINT_METHOD_COMBO_4 0x05 // S2245 only |
| 333 | #define PRINT_METHOD_DOUBLE 0x08 // S6145 only |
| 334 | #define PRINT_METHOD_DISABLE_ERR 0x10 // S6245 only |
| 335 | #define PRINT_METHOD_NOTRIM 0x80 // S6145 only |
| 336 | |
| 337 | const char *sinfonia_print_methods (uint8_t v); |
| 338 | |
| 339 | #define FWINFO_TARGET_MAIN_BOOT 0x01 |
| 340 | #define FWINFO_TARGET_MAIN_APP 0x02 |
| 341 | #define FWINFO_TARGET_PRINT_TABLES 0x03 |
| 342 | #define FWINFO_TARGET_DSP 0x04 |
| 343 | #define FWINFO_TARGET_USB 0x06 |
| 344 | #define FWINFO_TARGET_PRINT_TABLES2 0x07 |
| 345 | |
| 346 | const char *sinfonia_fwinfo_targets (uint8_t v); |
| 347 | |
| 348 | /* Common command structs */ |
| 349 | struct sinfonia_cmd_hdr { |
| 350 | uint16_t cmd; |
| 351 | uint16_t len; /* Not including this header */ |
| 352 | } __attribute__((packed)); |
| 353 | |
| 354 | struct sinfonia_status_hdr { |
| 355 | uint8_t result; |
| 356 | uint8_t error; |
| 357 | uint8_t printer_major; |
| 358 | uint8_t printer_minor; |
| 359 | uint8_t reserved[2]; |
| 360 | uint8_t mode; /* S2245, S6245 and EK605 only, so far */ |
| 361 | uint8_t status; |
| 362 | uint16_t payload_len; |
| 363 | } __attribute__((packed)); |
| 364 | |
| 365 | struct sinfonia_cancel_cmd { |
| 366 | struct sinfonia_cmd_hdr hdr; |
| 367 | uint8_t id; |
| 368 | } __attribute__((packed)); |
| 369 | |
| 370 | struct sinfonia_fwinfo_cmd { |
| 371 | struct sinfonia_cmd_hdr hdr; |
| 372 | uint8_t target; |
| 373 | } __attribute__((packed)); |
| 374 | |
| 375 | struct sinfonia_fwinfo_resp { |
| 376 | struct sinfonia_status_hdr hdr; |
| 377 | uint8_t name[8]; |
| 378 | uint8_t type[16]; |
| 379 | uint8_t date[10]; |
| 380 | uint8_t major; |
| 381 | uint8_t minor; |
| 382 | uint16_t checksum; |
| 383 | } __attribute__((packed)); |
| 384 | |
| 385 | struct sinfonia_errorlog_resp { |
| 386 | struct sinfonia_status_hdr hdr; |
| 387 | uint8_t count; |
| 388 | struct sinfonia_error_item items[10]; /* Not all necessarily used */ |
| 389 | } __attribute__((packed)); |
| 390 | |
| 391 | |
| 392 | struct sinfonia_errorlog2_cmd { |
| 393 | struct sinfonia_cmd_hdr hdr; |
| 394 | uint16_t index; /* 0 is latest */ |
| 395 | } __attribute__((packed)); |
| 396 | |
| 397 | struct sinfonia_mediainfo_item { |
| 398 | uint8_t code; |
| 399 | uint16_t columns; |
| 400 | uint16_t rows; |
| 401 | uint8_t type; /* S2145, EK68xx, EK605 only -- MEDIA_TYPE_* */ |
| 402 | uint8_t method; /* PRINT_METHOD_* */ |
| 403 | uint8_t flag; /* EK68xx only */ |
| 404 | uint8_t reserved[2]; |
| 405 | } __attribute__((packed)); |
| 406 | |
| 407 | struct sinfonia_6x45_mediainfo_resp { |
| 408 | struct sinfonia_status_hdr hdr; |
| 409 | uint8_t ribbon_code; |
| 410 | uint8_t reserved; |
| 411 | uint8_t count; |
| 412 | struct sinfonia_mediainfo_item items[10]; /* Not all necessarily used */ |
| 413 | } __attribute__((packed)); |
| 414 | |
| 415 | /* resp needs to be at least sizeof(struct sinfonia_6x45_mediainfo_resp) */ |
| 416 | |
| 417 | int sinfonia_query_media(struct sinfonia_usbdev *usbh, |
| 418 | void *resp); |
| 419 | |
| 420 | struct sinfonia_setparam_cmd { |
| 421 | struct sinfonia_cmd_hdr hdr; |
| 422 | uint8_t target; |
| 423 | uint32_t param; |
| 424 | } __attribute__((packed)); |
| 425 | |
| 426 | struct sinfonia_diagnostic_cmd { |
| 427 | struct sinfonia_cmd_hdr hdr; |
| 428 | uint8_t arg1; |
| 429 | uint8_t arg2; |
| 430 | uint8_t arg3; |
| 431 | } __attribute__((packed)); |
| 432 | |
| 433 | struct sinfonia_getparam_cmd { |
| 434 | struct sinfonia_cmd_hdr hdr; |
| 435 | uint8_t target; |
| 436 | } __attribute__((packed)); |
| 437 | |
| 438 | struct sinfonia_getparam_resp { |
| 439 | struct sinfonia_status_hdr hdr; |
| 440 | uint32_t param; |
| 441 | } __attribute__((packed)); |
| 442 | |
| 443 | struct sinfonia_getprintidstatus_cmd { |
| 444 | struct sinfonia_cmd_hdr hdr; |
| 445 | uint8_t id; |
| 446 | } __attribute__((packed)); |
| 447 | |
| 448 | struct sinfonia_getprintidstatus_resp { |
| 449 | struct sinfonia_status_hdr hdr; |
| 450 | uint8_t id; |
| 451 | uint16_t remaining; |
| 452 | uint16_t finished; |
| 453 | uint16_t specified; |
| 454 | uint16_t status; |
| 455 | } __attribute__((packed)); |
| 456 | |
| 457 | #define IDSTATUS_WAITING 0x0000 |
| 458 | #define IDSTATUS_PRINTING 0x0100 |
| 459 | #define IDSTATUS_COMPLETED 0x0200 |
| 460 | #define IDSTATUS_ERROR 0xFFFF |
| 461 | |
| 462 | struct sinfonia_status_resp { |
| 463 | struct sinfonia_status_hdr hdr; |
| 464 | uint32_t count_lifetime; |
| 465 | uint32_t count_maint; |
| 466 | uint32_t count_paper; |
| 467 | uint32_t count_cutter; |
| 468 | uint32_t count_head; |
| 469 | uint32_t count_ribbon_left; |
| 470 | uint32_t reserved; |
| 471 | |
| 472 | uint8_t bank1_printid; |
| 473 | uint16_t bank1_remaining; |
| 474 | uint16_t bank1_finished; |
| 475 | uint16_t bank1_specified; |
| 476 | uint8_t bank1_status; |
| 477 | |
| 478 | uint8_t bank2_printid; |
| 479 | uint16_t bank2_remaining; |
| 480 | uint16_t bank2_finished; |
| 481 | uint16_t bank2_specified; |
| 482 | uint8_t bank2_status; |
| 483 | |
| 484 | uint8_t reserved2[16]; |
| 485 | uint8_t tonecurve_status; |
| 486 | uint8_t reserved3[6]; |
| 487 | } __attribute__((packed)); |
| 488 | |
| 489 | struct sinfonia_geteeprom_resp { |
| 490 | struct sinfonia_status_hdr hdr; |
| 491 | uint8_t data[256]; |
| 492 | } __attribute__((packed)); |
| 493 | |
| 494 | struct sinfonia_button_cmd { |
| 495 | struct sinfonia_cmd_hdr hdr; |
| 496 | uint8_t enabled; |
| 497 | } __attribute__((packed)); |
| 498 | |
| 499 | #define BUTTON_ENABLED 0x01 |
| 500 | #define BUTTON_DISABLED 0x00 |
| 501 | |
| 502 | struct sinfonia_reset_cmd { |
| 503 | struct sinfonia_cmd_hdr hdr; |
| 504 | uint8_t target; |
| 505 | uint8_t curveid; |
| 506 | } __attribute__((packed)); |
| 507 | |
| 508 | #define RESET_PRINTER 0x03 |
| 509 | #define RESET_TONE_CURVE 0x04 |
| 510 | #define TONE_CURVE_ID 0x01 |
| 511 | |
| 512 | struct sinfonia_readtone_cmd { |
| 513 | struct sinfonia_cmd_hdr hdr; |
| 514 | uint8_t target; |
| 515 | uint8_t curveid; |
| 516 | } __attribute__((packed)); |
| 517 | |
| 518 | #define READ_TONE_CURVE_USER 0x01 |
| 519 | #define READ_TONE_CURVE_CURR 0x02 |
| 520 | |
| 521 | struct sinfonia_readtone_resp { |
| 522 | struct sinfonia_status_hdr hdr; |
| 523 | uint16_t total_size; |
| 524 | } __attribute__((packed)); |
| 525 | |
| 526 | struct sinfonia_update_cmd { |
| 527 | struct sinfonia_cmd_hdr hdr; |
| 528 | uint8_t target; // UPDATE_TARGET_* |
| 529 | uint8_t target2; // UPDATE_TARGET2_* |
| 530 | uint8_t reset; // 1 to reset printer afterwards |
| 531 | uint8_t reserved[3]; |
| 532 | uint32_t size; // TONE_CURVE_SIZE or lamination data that is rows*cols bytes |
| 533 | } __attribute__((packed)); |
| 534 | |
| 535 | struct sinfonia_getserial_resp { |
| 536 | struct sinfonia_status_hdr hdr; |
| 537 | uint8_t data[8]; |
| 538 | } __attribute__((packed)); |
| 539 | |
| 540 | struct sinfonia_getextcounter_resp { |
| 541 | struct sinfonia_status_hdr hdr; |
| 542 | uint32_t lifetime_distance; /* Inches */ |
| 543 | uint32_t maint_distance; |
| 544 | uint32_t head_distance; |
| 545 | uint8_t reserved[32]; |
| 546 | } __attribute__((packed)); |
| 547 | |
| 548 | struct sinfonia_seteeprom_cmd { |
| 549 | struct sinfonia_cmd_hdr hdr; |
| 550 | uint8_t data[256]; /* Maxlen */ |
| 551 | } __attribute__((packed)); |
| 552 | |
| 553 | struct sinfonia_printcmd10_hdr { |
| 554 | struct sinfonia_cmd_hdr hdr; |
| 555 | uint8_t jobid; |
| 556 | uint16_t copies; |
| 557 | uint16_t columns; |
| 558 | uint16_t rows; |
| 559 | uint8_t media; |
| 560 | uint8_t oc_mode; |
| 561 | uint8_t method; |
| 562 | } __attribute__((packed)); |
| 563 | |
| 564 | struct sinfonia_printcmd18_hdr { |
| 565 | struct sinfonia_cmd_hdr hdr; |
| 566 | uint8_t jobid; |
| 567 | uint16_t copies; |
| 568 | uint16_t columns; |
| 569 | uint16_t rows; |
| 570 | uint16_t columns2; |
| 571 | uint16_t rows2; |
| 572 | uint8_t reserved[4]; // then nulls |
| 573 | uint8_t oc_mode; |
| 574 | uint8_t method; |
| 575 | uint8_t media; // reserved? |
| 576 | } __attribute__((packed)); |
| 577 | |
| 578 | struct sinfonia_printcmd28_hdr { |
| 579 | struct sinfonia_cmd_hdr hdr; |
| 580 | uint8_t jobid; |
| 581 | uint16_t copies; |
| 582 | uint16_t columns; |
| 583 | uint16_t rows; |
| 584 | uint8_t media; /* always 0 on S2245 */ |
| 585 | uint8_t reserved[7]; |
| 586 | uint8_t options; |
| 587 | uint8_t method; |
| 588 | uint8_t ipp; |
| 589 | uint8_t reserved2[10]; |
| 590 | } __attribute__((packed)); |
| 591 | |
| 592 | #define SINFONIA_PRINT28_OPTIONS_HQ 0x08 |
| 593 | #define SINFONIA_PRINT28_OC_MASK 0x03 |
| 594 | #define SINFONIA_PRINT28_OC_GLOSS 0x01 |
| 595 | #define SINFONIA_PRINT28_OC_MATTE 0x02 |
| 596 | |
| 597 | #define SINFONIA_PRINT28_METHOD_PRINT_MASK 0x07 |
| 598 | #define SINFONIA_PRINT28_METHOD_PRINT_COMBO 0x02 |
| 599 | #define SINFONIA_PRINT28_METHOD_PRINT_SPLIT 0x04 |
| 600 | #define SINFONIA_PRINT28_METHOD_PRINT_4SPLIT 0x05 |
| 601 | |
| 602 | #define SINFONIA_PRINT28_METHOD_ERR_RECOVERY 0x08 |
| 603 | #define SINFONIA_PRINT28_METHOD_PREHEAT 0x10 |
| 604 | #define SINFONIA_PRINT28_METHOD_IPPHDR 0x20 |
| 605 | |
| 606 | #define SINFONIA_PRINT28_IPP_RESP 0x01 |
| 607 | #define SINFONIA_PRINT28_IPP_CONTOUR 0x02 |
| 608 | |
| 609 | struct sinfonia_settime_cmd { |
| 610 | struct sinfonia_cmd_hdr hdr; |
| 611 | uint8_t enable; /* 0 or 1 */ |
| 612 | uint8_t second; |
| 613 | uint8_t minute; |
| 614 | uint8_t hour; |
| 615 | uint8_t day; |
| 616 | uint8_t month; |
| 617 | uint8_t year; |
| 618 | } __attribute__((packed)); |
| 619 | |
| 620 | struct sinfonia_usbfwdl_cmd { |
| 621 | struct sinfonia_cmd_hdr hdr; |
| 622 | uint8_t reset; |
| 623 | uint16_t unka; /* LE, 0x4000 on EK70xx? */ |
| 624 | uint16_t len; /* LE, Always seems to be 0xc000 */ |
| 625 | uint8_t payload[]; |
| 626 | } __attribute__((packed)); |
| 627 | |
| 628 | struct kodak701x_backprint { |
| 629 | struct sinfonia_cmd_hdr hdr; |
| 630 | uint8_t unk_0; // unknown. maybe the line number? |
| 631 | uint8_t null[6]; // always zero. |
| 632 | uint8_t unk_1; // length of text? (max 40) |
| 633 | uint8_t text[42]; // |
| 634 | } __attribute__((packed)); |
| 635 | |
| 636 | struct kodak8810_cutlist { |
| 637 | struct sinfonia_cmd_hdr hdr; |
| 638 | uint8_t entries; /* max 24 */ |
| 639 | uint16_t cut[36]; /* LE, row number to cut at. Deltas must be >= 12. */ |
| 640 | } __attribute__((packed)); |
| 641 | |
| 642 | #define CODE_4x6 0x00 |
| 643 | #define CODE_3_5x5 0x01 |
| 644 | #define CODE_5x7 0x03 |
| 645 | #define CODE_6x9 0x05 |
| 646 | #define CODE_6x8 0x06 |
| 647 | #define CODE_2x6 0x07 |
| 648 | #define CODE_6x6 0x08 |
| 649 | // XXX 09, 10, 11 om 5/6" sizes? |
| 650 | |
| 651 | #define CODE_8x10 0x10 |
| 652 | #define CODE_8x12 0x11 |
| 653 | #define CODE_8x4 0x20 |
| 654 | #define CODE_8x5 0x21 |
| 655 | #define CODE_8x6 0x22 |
| 656 | #define CODE_8x8 0x23 |
| 657 | #define CODE_8x4_2 0x30 |
| 658 | #define CODE_8x5_2 0x31 |
| 659 | #define CODE_8x6_2 0x32 |
| 660 | #define CODE_8x4_3 0x40 |
| 661 | |
| 662 | #define CODE_8x12K 0x02 /* Kodak 8810 */ |
| 663 | |
| 664 | #define CODE_6x4K 0x01 /* Kodak 605 & 70xx */ |
| 665 | #define CODE_6x8K 0x03 |
| 666 | #define CODE_5x7K 0x06 |
| 667 | #define CODE_5x4K 0x07 |
| 668 | #define CODE_5x5K 0x08 |
| 669 | #define CODE_5x7_5K 0x09 |
| 670 | #define CODE_5x3_5K 0x0d |
| 671 | #define CODE_6x6K 0x0e |
| 672 | |
| 673 | #define CODE_89x60mm 0x10 |
| 674 | #define CODE_89x59mm 0x11 |
| 675 | #define CODE_89x58mm 0x12 |
| 676 | #define CODE_89x57mm 0x13 |
| 677 | #define CODE_89x56mm 0x14 |
| 678 | #define CODE_89x55mm 0x15 |
| 679 | |
| 680 | const char *sinfonia_print_codes (uint8_t v, int eightinch); |
| 681 | |
| 682 | #define STATUS_READY 0x00 |
| 683 | #define STATUS_INIT_CPU 0x31 |
| 684 | #define STATUS_INIT_RIBBON 0x32 |
| 685 | #define STATUS_INIT_PAPER 0x33 |
| 686 | #define STATUS_THERMAL_PROTECT 0x34 |
| 687 | #define STATUS_USING_PANEL 0x35 |
| 688 | #define STATUS_SELF_DIAG 0x36 |
| 689 | #define STATUS_DOWNLOADING 0x37 |
| 690 | |
| 691 | #define STATUS_FEEDING_PAPER 0x61 |
| 692 | #define STATUS_PRE_HEAT 0x62 |
| 693 | #define STATUS_PRINT_Y 0x63 |
| 694 | #define STATUS_BACK_FEED_Y 0x64 |
| 695 | #define STATUS_PRINT_M 0x65 |
| 696 | #define STATUS_BACK_FEED_M 0x66 |
| 697 | #define STATUS_PRINT_C 0x67 |
| 698 | #define STATUS_BACK_FEED_C 0x68 |
| 699 | #define STATUS_PRINT_OP 0x69 |
| 700 | #define STATUS_PAPER_CUT 0x6A |
| 701 | #define STATUS_PAPER_EJECT 0x6B |
| 702 | #define STATUS_BACK_FEED_E 0x6C |
| 703 | #define STATUS_FINISHED 0x6D |
| 704 | |
| 705 | const char *sinfonia_status_str(uint8_t v); |
| 706 | |
| 707 | #define SINFONIA_CMD_GETSTATUS 0x0001 |
| 708 | #define SINFONIA_CMD_MEDIAINFO 0x0002 |
| 709 | #define SINFONIA_CMD_MODELNAME 0x0003 // 2145 |
| 710 | #define SINFONIA_CMD_ERRORLOG 0x0004 |
| 711 | #define SINFONIA_CMD_GETPARAM 0x0005 // !2145 |
| 712 | #define SINFONIA_CMD_GETSERIAL 0x0006 // !2145 |
| 713 | #define SINFONIA_CMD_PRINTSTAT 0x0007 // !2145 |
| 714 | #define SINFONIA_CMD_EXTCOUNTER 0x0008 // !2145 |
| 715 | |
| 716 | #define SINFONIA_CMD_MEMORYBANK 0x000A // 6145 |
| 717 | |
| 718 | #define SINFONIA_CMD_PRINTJOB 0x4001 |
| 719 | #define SINFONIA_CMD_CANCELJOB 0x4002 |
| 720 | #define SINFONIA_CMD_FLASHLED 0x4003 |
| 721 | #define SINFONIA_CMD_RESET 0x4004 |
| 722 | #define SINFONIA_CMD_READTONE 0x4005 |
| 723 | #define SINFONIA_CMD_BUTTON 0x4006 // 2145? |
| 724 | #define SINFONIA_CMD_SETPARAM 0x4007 // !2145 |
| 725 | |
| 726 | #define SINFONIA_CMD_SETLAMSTR 0x4008 // EK70xx, EK8810? (len 28) |
| 727 | #define SINFONIA_CMD_COMMPPA 0x4009 // EK70xx |
| 728 | #define SINFONIA_CMD_SETCUTLIST 0x4009 // EK8810 (len 73, count + 36 entries, 16bit LE) |
| 729 | #define SINFONIA_CMD_SETPPAPARM 0x400A // EK70xx |
| 730 | #define SINFONIA_CMD_WAKEUPSDBY 0x400A // EK8810 (len 1) |
| 731 | #define SINFONIA_CMD_BACKPRINT 0x400B // EK701x only! (len 50) |
| 732 | #define SINFONIA_CMD_UNKNOWN4C 0x400C // EK8810, panorama setup? |
| 733 | |
| 734 | #define SINFONIA_CMD_GETCORR 0x400D // 6145/2245/6900 |
| 735 | #define SINFONIA_CMD_GETEEPROM 0x400E // 6x45 |
| 736 | #define SINFONIA_CMD_SETEEPROM 0x400F // 6x45 |
| 737 | |
| 738 | #define SINFONIA_CMD_SETTIME 0x4011 // 6245, 2245 |
| 739 | |
| 740 | #define SINFONIA_CMD_UNIVERSAL 0x4080 // EK70xx |
| 741 | |
| 742 | #define SINFONIA_CMD_USBFWDL 0x8001 // EK70xx (len 5) |
| 743 | #define SINFONIA_CMD_MAINTPERM 0x8002 // EK70xx |
| 744 | #define SINFONIA_CMD_GETUNIQUE 0x8003 // 2145 |
| 745 | |
| 746 | #define SINFONIA_CMD_SELFDIAG 0xC001 // (len 3) |
| 747 | #define SINFONIA_CMD_DIAGRES 0xC002 |
| 748 | #define SINFONIA_CMD_FWINFO 0xC003 |
| 749 | #define SINFONIA_CMD_UPDATE 0xC004 |
| 750 | #define SINFONIA_CMD_GETEEPROM2 0xC005 // EK70xx |
| 751 | #define SINFONIA_CMD_SETEEPROM2 0xC006 // EK70xx |
| 752 | #define SINFONIA_CMD_SETUNIQUE 0xC007 // 2145 |
| 753 | #define SINFONIA_CMD_RESETERR 0xC008 |
| 754 | #define SINFONIA_CMD_GETSERIAL2 0xC009 // EK70xx (len 8) |
| 755 | |
| 756 | const char *sinfonia_cmd_names(uint16_t v); |
| 757 | |
| 758 | #define KODAK6_MEDIA_5R 0xff //XX 189-9160 |
| 759 | #define KODAK6_MEDIA_6R 0x0b // 197-4096 [ Also: 101-0867, 141-9597, 659-9054, 169-6418, DNP-900-060 ] |
| 760 | #define KODAK6_MEDIA_UNK 0x03 // ??? reported but unknown |
| 761 | #define KODAK6_MEDIA_6TR2 0x2c // 396-2941 |
| 762 | //#define KODAK6_MEDIA_5FR2 // 6900-compatible |
| 763 | //#define KODAK6_MEDIA_6FR2 // 6900-compatible, 102-5925 |
| 764 | #define KODAK6_MEDIA_NONE 0x00 |
| 765 | #define KODAK7_MEDIA_5R 0xfe //XX 164-9011 137-0600 |
| 766 | #define KODAK7_MEDIA_6R 0x29 // 659-9047 166-1925 396-2966 846-2004 103-7688 DNP-900-070 -- ALSO FUJI R68-D2P570 16578944 |
| 767 | //#define KODAK7_MEDIA_6TA2 |
| 768 | //#define KODAK7_MEDIA_5TA2 |
| 769 | |
| 770 | int kodak6_mediamax(int type); |
| 771 | const char *kodak6_mediatypes(int type); |
| 772 | void kodak6_dumpmediacommon(int type); |
| 773 | |
| 774 | #define RESULT_SUCCESS 0x01 |
| 775 | #define RESULT_FAIL 0x02 |
| 776 | |
| 777 | /* ********** Below are for the old S1145 (EK68xx) and S1245 only! */ |
| 778 | |
| 779 | enum { |
| 780 | TONE_TABLE_STANDARD = 0, |
| 781 | TONE_TABLE_USER = 1, |
| 782 | TONE_TABLE_CURRENT = 2, |
| 783 | }; |
| 784 | enum { |
| 785 | PARAM_TABLE_NONE = 0, |
| 786 | PARAM_TABLE_STANDARD = 1, |
| 787 | PARAM_TABLE_FINE = 2, |
| 788 | }; |
| 789 | |
| 790 | enum { |
| 791 | CMD_CODE_OK = 1, |
| 792 | CMD_CODE_BAD = 2, |
| 793 | }; |
| 794 | |
| 795 | enum { |
| 796 | STATUS_PRINTING = 1, |
| 797 | STATUS_IDLE = 2, |
| 798 | }; |
| 799 | |
| 800 | enum { |
| 801 | STATE_STATUS1_STANDBY = 1, |
| 802 | STATE_STATUS1_ERROR = 2, |
| 803 | STATE_STATUS1_WAIT = 3, |
| 804 | }; |
| 805 | |
| 806 | #define STATE_STANDBY_STATUS2 0x0 |
| 807 | |
| 808 | enum { |
| 809 | WAIT_STATUS2_INIT = 0, |
| 810 | WAIT_STATUS2_RIBBON = 1, |
| 811 | WAIT_STATUS2_THERMAL = 2, |
| 812 | WAIT_STATUS2_OPERATING = 3, |
| 813 | WAIT_STATUS2_BUSY = 4, |
| 814 | }; |
| 815 | |
| 816 | #define ERROR_STATUS2_CTRL_CIRCUIT (0x80000000) |
| 817 | #define ERROR_STATUS2_MECHANISM_CTRL (0x40000000) |
| 818 | #define ERROR_STATUS2_SENSOR (0x00002000) |
| 819 | #define ERROR_STATUS2_COVER_OPEN (0x00001000) |
| 820 | #define ERROR_STATUS2_TEMP_SENSOR (0x00000200) |
| 821 | #define ERROR_STATUS2_PAPER_JAM (0x00000100) |
| 822 | #define ERROR_STATUS2_PAPER_EMPTY (0x00000040) |
| 823 | #define ERROR_STATUS2_RIBBON_ERR (0x00000010) |
| 824 | |
| 825 | enum { |
| 826 | CTRL_CIR_ERROR_EEPROM1 = 0x01, |
| 827 | CTRL_CIR_ERROR_EEPROM2 = 0x02, |
| 828 | CTRL_CIR_ERROR_DSP = 0x04, |
| 829 | CTRL_CIR_ERROR_CRC_MAIN = 0x06, |
| 830 | CTRL_CIR_ERROR_DL_MAIN = 0x07, |
| 831 | CTRL_CIR_ERROR_CRC_DSP = 0x08, |
| 832 | CTRL_CIR_ERROR_DL_DSP = 0x09, |
| 833 | CTRL_CIR_ERROR_ASIC = 0x0a, |
| 834 | CTRL_CIR_ERROR_DRAM = 0x0b, |
| 835 | CTRL_CIR_ERROR_DSPCOMM = 0x29, |
| 836 | }; |
| 837 | |
| 838 | enum { |
| 839 | MECH_ERROR_HEAD_UP = 0x01, |
| 840 | MECH_ERROR_HEAD_DOWN = 0x02, |
| 841 | MECH_ERROR_MAIN_PINCH_UP = 0x03, |
| 842 | MECH_ERROR_MAIN_PINCH_DOWN = 0x04, |
| 843 | MECH_ERROR_SUB_PINCH_UP = 0x05, |
| 844 | MECH_ERROR_SUB_PINCH_DOWN = 0x06, |
| 845 | MECH_ERROR_FEEDIN_PINCH_UP = 0x07, |
| 846 | MECH_ERROR_FEEDIN_PINCH_DOWN = 0x08, |
| 847 | MECH_ERROR_FEEDOUT_PINCH_UP = 0x09, |
| 848 | MECH_ERROR_FEEDOUT_PINCH_DOWN = 0x0a, |
| 849 | MECH_ERROR_CUTTER_LR = 0x0b, |
| 850 | MECH_ERROR_CUTTER_RL = 0x0c, |
| 851 | }; |
| 852 | |
| 853 | enum { |
| 854 | SENSOR_ERROR_CUTTER = 0x05, |
| 855 | SENSOR_ERROR_HEAD_DOWN = 0x09, |
| 856 | SENSOR_ERROR_HEAD_UP = 0x0a, |
| 857 | SENSOR_ERROR_MAIN_PINCH_DOWN = 0x0b, |
| 858 | SENSOR_ERROR_MAIN_PINCH_UP = 0x0c, |
| 859 | SENSOR_ERROR_FEED_PINCH_DOWN = 0x0d, |
| 860 | SENSOR_ERROR_FEED_PINCH_UP = 0x0e, |
| 861 | SENSOR_ERROR_EXIT_PINCH_DOWN = 0x0f, |
| 862 | SENSOR_ERROR_EXIT_PINCH_UP = 0x10, |
| 863 | SENSOR_ERROR_LEFT_CUTTER = 0x11, |
| 864 | SENSOR_ERROR_RIGHT_CUTTER = 0x12, |
| 865 | SENSOR_ERROR_CENTER_CUTTER = 0x13, |
| 866 | SENSOR_ERROR_UPPER_CUTTER = 0x14, |
| 867 | SENSOR_ERROR_PAPER_FEED_COVER = 0x15, |
| 868 | }; |
| 869 | |
| 870 | enum { |
| 871 | TEMP_SENSOR_ERROR_HEAD_HIGH = 0x01, |
| 872 | TEMP_SENSOR_ERROR_HEAD_LOW = 0x02, |
| 873 | TEMP_SENSOR_ERROR_ENV_HIGH = 0x03, |
| 874 | TEMP_SENSOR_ERROR_ENV_LOW = 0x04, |
| 875 | }; |
| 876 | |
| 877 | enum { |
| 878 | COVER_OPEN_ERROR_UPPER = 0x01, |
| 879 | COVER_OPEN_ERROR_LOWER = 0x02, |
| 880 | }; |
| 881 | |
| 882 | enum { |
| 883 | PAPER_EMPTY_ERROR = 0x00, |
| 884 | }; |
| 885 | |
| 886 | enum { |
| 887 | RIBBON_ERROR = 0x00, |
| 888 | }; |
| 889 | |
| 890 | enum { |
| 891 | CURVE_TABLE_STATUS_INITIAL = 0x00, |
| 892 | CURVE_TABLE_STATUS_USERSET = 0x01, |
| 893 | CURVE_TABLE_STATUS_CURRENT = 0x02, |
| 894 | }; |
| 895 | |
| 896 | const char *sinfonia_1x45_status_str(uint8_t status1, uint32_t status2, uint8_t error); |