CAPS Universe documentation  1.0.4
All you need to know to be successful
samsung-spl2-series.h
Go to the documentation of this file.
1#pragma once
2
3/*
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 *
6 * (c) 2021 Juergen Borleis <projects@caps-printing.org>
7 *
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 */
13
31#include <stddef.h>
32#include <stdint.h>
33#include <libcapsbase.h>
34#include <libcapsdriver.h>
35
36#include "samsung-spl2-header.h"
37
38#ifdef DEBUG
39# define caps_print_debug(fmt, ...) caps_print_debug_template(fmt, ##__VA_ARGS__)
40# else
41# define caps_print_debug(fmt, ...)
42#endif
43
45#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
46#define DOTS_TO_BYTES(x) (((x) + 7) / 8)
47#define DOTS_TO_INDEX(x) ((x) / 8)
48#define MIN(x, y) (x < y ? x : y)
49
50/* handle NLS */
51#ifdef ENABLE_NLS
52
53# ifndef PACKAGE
54# error "Missing 'PACKAGE' macro: include 'config.h' first"
55# endif
56
57# include <libintl.h>
58
59/* regular and inconspicuous NLS marker */
60# define _(string) dgettext(PACKAGE, string)
61
62#else /* ENABLE_NLS */
63
64# define _(string) (string)
65
66#endif /* !ENABLE_NLS */
67
68/* a more inconspicuous NLS marker used for all NLS strings in static data */
69#define NLS_(string) (string)
70
71#define to_spl2_driver(x) ((struct spl2_drv*)x)
72
73int spl2_driver_module_init(struct caps_drv *drvi, void *d) __nonnull();
74int spl2_driver_module_exit(struct caps_drv *drvi, void *d) __nonnull();
75int spl2_driver_page_setup(struct caps_drv *drvi, void *d) __nonnull();
76int spl2_driver_runtime_adaptions(struct caps_drv *drvi, void *d) __nonnull();
77int spl2_driver_job_setup(struct caps_drv *drvi, void *d) __nonnull();
78int spl2_driver_page_print(struct caps_drv *drvi, void *d) __nonnull();
79int spl2_driver_job_finish(struct caps_drv *drvi, void *d) __nonnull();
80int spl2_driver_device_monitor(struct caps_drv *drvi, void *d) __nonnull();
81
97};
98
101// unsigned copies; /**< Copies to print */
105 unsigned resolution_x;
106 unsigned resolution_y;
107 unsigned dots_to_skip;
108 unsigned opc_dots;
109};
110
114struct spl2_drv {
117 /* Static settings controlled by the user and used by the printer via PJL commands */
119 const char *altitude_level;
121 /* Settings controlled by the user on a per job base and used by the printer via PJL commands */
122 const char *paper_type;
123 const char *power_save_time;
124 const char *eco_mode;
126 unsigned qpdl_version;
128 unsigned thread_cnt;
134 /* Infos about the current job */
136};
144int printer_driver_runtime_adaptions(struct caps_drv *drvi, struct spl2_drv *info) __nonnull();
156int printer_driver_module_init(struct caps_drv *drvi, struct spl2_drv *info) __nonnull();
162 size_t offset;
163};
164
174#define COMPRESS_SAMPLE_SIZE 2048
175
183 /* processing/state data */
184 size_t line_sz;
186 /* the raw input data from the rasterizer */
187 uint8_t *input;
188 size_t input_sz;
189 /* the preprocessed band data with cleared margins and rotated as the printer requires the data */
190 uint8_t *band;
191 size_t band_sz;
192 /* the compressed data of @b band as it must be sent to the printer */
193 uint8_t *compressed;
200#ifdef DEBUG
201 unsigned repeated_bytes;
202 unsigned repeated_pattern;
203 unsigned pattern_compares;
204#endif
205};
206
207uint8_t drv_spl2_band_rotate(struct spl2_band_buffer *info) __nonnull();
225unsigned drv_spl2_par_threads_get(struct caps_drv *drvi) __nonnull();
226int ml1640_driver_page_print(struct caps_drv *drvi, void *d) __nonnull();
#define __nonnull(params)
Definition: libcapsbase.h:84
Basic API for everything else of the CAPS universe.
Generic printer driver specific API to simplify drivers.
Various data header definitions for the SPL data protocol.
format_type
The media format types to be sent in the page header's 'ptype' member.
Definition: samsung-spl2-header.h:28
uint8_t drv_spl2_band_rotate(struct spl2_band_buffer *info)
Definition: samsung-spl2-mono-algo-0x11.c:78
caps_drv_printer_id
Yet supported printers.
Definition: samsung-spl2-series.h:88
@ CAPS_SPL2_ML_2010
Definition: samsung-spl2-series.h:93
@ CAPS_SPL2_UNKNOWN
Definition: samsung-spl2-series.h:89
@ CAPS_SPL2_ML_1630
Definition: samsung-spl2-series.h:91
@ CAPS_SPL2_ML_1640
Definition: samsung-spl2-series.h:92
@ CAPS_SPL2_ML_2510
Definition: samsung-spl2-series.h:96
@ CAPS_SPL2_ML_2240
Definition: samsung-spl2-series.h:95
@ CAPS_SPL2_ML_1520
Definition: samsung-spl2-series.h:90
@ CAPS_SPL2_ML_2015
Definition: samsung-spl2-series.h:94
int spl2_driver_page_print(struct caps_drv *drvi, void *d)
Definition: samsung-spl2-series.c:310
int ml1640_driver_page_print(struct caps_drv *drvi, void *d)
Definition: samsung-spl2-protocol.c:549
int spl2_driver_module_init(struct caps_drv *drvi, void *d)
Definition: samsung-spl2-series.c:84
int spl2_driver_page_setup(struct caps_drv *drvi, void *d)
Definition: samsung-spl2-series.c:295
unsigned drv_spl2_par_threads_get(struct caps_drv *drvi)
Definition: samsung-spl2-series.c:164
int drv_spl2_band_compress(struct spl2_band_buffer *info)
Definition: samsung-spl2-mono-algo-0x11.c:364
#define COMPRESS_SAMPLE_SIZE
Definition: samsung-spl2-series.h:174
int printer_driver_runtime_adaptions(struct caps_drv *drvi, struct spl2_drv *info)
Definition: samsung-spl2-ml-1640-2240.c:749
int spl2_driver_runtime_adaptions(struct caps_drv *drvi, void *d)
Definition: samsung-spl2-series.c:207
int spl2_driver_job_setup(struct caps_drv *drvi, void *d)
Definition: samsung-spl2-series.c:305
int spl2_driver_job_finish(struct caps_drv *drvi, void *d)
Definition: samsung-spl2-series.c:300
int spl2_driver_module_exit(struct caps_drv *drvi, void *d)
Definition: samsung-spl2-series.c:99
int spl2_driver_device_monitor(struct caps_drv *drvi, void *d)
Definition: samsung-spl2-series.c:315
int printer_driver_module_init(struct caps_drv *drvi, struct spl2_drv *info)
Definition: samsung-spl2-ml-1640-2240.c:739
Defines an area by its left bottom and right top coordinates in floating point values.
Definition: libcapsbase.h:361
libcapsdriver internal data collection
Definition: libcapsdriver-local.h:124
Defines a simple rectangle by its width and length in floating point values.
Definition: libcapsbase.h:338
The dictionary of same byte pattern to compress the band's data.
Definition: samsung-spl2-series.h:160
int appearance
Definition: samsung-spl2-series.h:161
size_t offset
Definition: samsung-spl2-series.h:162
All required information to handle one band of print data.
Definition: samsung-spl2-series.h:182
size_t input_sz
Definition: samsung-spl2-series.h:188
uint8_t * compressed
Definition: samsung-spl2-series.h:193
uint8_t * band
Definition: samsung-spl2-series.h:190
size_t dictionary_size
Definition: samsung-spl2-series.h:199
size_t band_sz
Definition: samsung-spl2-series.h:191
size_t compressed_sz
Definition: samsung-spl2-series.h:194
struct dictionary_collection dictionary[2048]
Definition: samsung-spl2-series.h:198
size_t line_sz
Definition: samsung-spl2-series.h:184
size_t compressed_used
Definition: samsung-spl2-series.h:195
uint8_t * input
Definition: samsung-spl2-series.h:187
Samsung SPL2 laser printer driver specific information.
Definition: samsung-spl2-series.h:114
int jam_recovery
Definition: samsung-spl2-series.h:118
struct spl2_job_options job
Definition: samsung-spl2-series.h:135
unsigned qpdl_version
Definition: samsung-spl2-series.h:126
const char * power_save_time
Definition: samsung-spl2-series.h:123
enum caps_drv_printer_id sel_prn
Definition: samsung-spl2-series.h:115
const char * altitude_level
Definition: samsung-spl2-series.h:119
unsigned opc_width_at_600dpi
Definition: samsung-spl2-series.h:131
const char * eco_mode
Definition: samsung-spl2-series.h:124
const char * paper_type
Definition: samsung-spl2-series.h:122
unsigned thread_cnt
Definition: samsung-spl2-series.h:128
unsigned opc_width_at_1200dpi
Definition: samsung-spl2-series.h:132
unsigned opc_width_at_300dpi
Definition: samsung-spl2-series.h:130
Options of the current job to print.
Definition: samsung-spl2-series.h:100
unsigned resolution_x
Definition: samsung-spl2-series.h:105
enum format_type format_type
Definition: samsung-spl2-series.h:102
struct caps_rect format_size
Definition: samsung-spl2-series.h:103
unsigned resolution_y
Definition: samsung-spl2-series.h:106
struct caps_area format_margins
Definition: samsung-spl2-series.h:104
unsigned opc_dots
Definition: samsung-spl2-series.h:108
unsigned dots_to_skip
Definition: samsung-spl2-series.h:107