CAPS Universe documentation  1.0.4
All you need to know to be successful
Data Structures | Macros | Enumerations | Functions
samsung-spl2-series.h File Reference

Required definitions for SPL2 based printer. More...

Go to the source code of this file.

Data Structures

struct  spl2_job_options
 Options of the current job to print. More...
 
struct  spl2_drv
 Samsung SPL2 laser printer driver specific information. More...
 
struct  dictionary_collection
 The dictionary of same byte pattern to compress the band's data. More...
 
struct  spl2_band_buffer
 All required information to handle one band of print data. More...
 

Macros

#define caps_print_debug(fmt, ...)
 
#define ARRAY_SIZE(x)   (sizeof(x)/sizeof(x[0]))
 
#define DOTS_TO_BYTES(x)   (((x) + 7) / 8)
 
#define DOTS_TO_INDEX(x)   ((x) / 8)
 
#define MIN(x, y)   (x < y ? x : y)
 
#define _(string)   (string)
 
#define NLS_(string)   (string)
 
#define to_spl2_driver(x)   ((struct spl2_drv*)x)
 
#define COMPRESS_SAMPLE_SIZE   2048
 

Enumerations

enum  caps_drv_printer_id {
  CAPS_SPL2_UNKNOWN ,
  CAPS_SPL2_ML_1520 ,
  CAPS_SPL2_ML_1630 ,
  CAPS_SPL2_ML_1640 ,
  CAPS_SPL2_ML_2010 ,
  CAPS_SPL2_ML_2015 ,
  CAPS_SPL2_ML_2240 ,
  CAPS_SPL2_ML_2510
}
 Yet supported printers. More...
 

Functions

int spl2_driver_module_init (struct caps_drv *drvi, void *d)
 
int spl2_driver_module_exit (struct caps_drv *drvi, void *d)
 
int spl2_driver_page_setup (struct caps_drv *drvi, void *d)
 
int spl2_driver_runtime_adaptions (struct caps_drv *drvi, void *d)
 
int spl2_driver_job_setup (struct caps_drv *drvi, void *d)
 
int spl2_driver_page_print (struct caps_drv *drvi, void *d)
 
int spl2_driver_job_finish (struct caps_drv *drvi, void *d)
 
int spl2_driver_device_monitor (struct caps_drv *drvi, void *d)
 
int printer_driver_runtime_adaptions (struct caps_drv *drvi, struct spl2_drv *info)
 
int printer_driver_module_init (struct caps_drv *drvi, struct spl2_drv *info)
 
uint8_t drv_spl2_band_rotate (struct spl2_band_buffer *info)
 
int drv_spl2_band_compress (struct spl2_band_buffer *info)
 
unsigned drv_spl2_par_threads_get (struct caps_drv *drvi)
 
int ml1640_driver_page_print (struct caps_drv *drvi, void *d)
 

Detailed Description

Author
Jürgen Borleis
Warning
Use as experimental

Covers the following monochrome laser printers:

Macro Definition Documentation

◆ caps_print_debug

#define caps_print_debug (   fmt,
  ... 
)

◆ ARRAY_SIZE

#define ARRAY_SIZE (   x)    (sizeof(x)/sizeof(x[0]))

always useful

◆ DOTS_TO_BYTES

#define DOTS_TO_BYTES (   x)    (((x) + 7) / 8)

◆ DOTS_TO_INDEX

#define DOTS_TO_INDEX (   x)    ((x) / 8)

◆ MIN

#define MIN (   x,
 
)    (x < y ? x : y)

◆ _

#define _ (   string)    (string)

◆ NLS_

#define NLS_ (   string)    (string)

◆ to_spl2_driver

#define to_spl2_driver (   x)    ((struct spl2_drv*)x)

◆ COMPRESS_SAMPLE_SIZE

#define COMPRESS_SAMPLE_SIZE   2048

Sample size to calculate the dictionary for band data compression

High values are expensive, keep it as small as possible. Below 1024 results into a lausy compression. 1024 fails badly (no compression at all).

Todo:

Find out why 1024 fails so badly.

1025 looked good, because of a bug in the test reference routine. It was as bad as 1024.

Enumeration Type Documentation

◆ caps_drv_printer_id

The selection happes from withing the INI file, read from section [info] and key "device".

Enumerator
CAPS_SPL2_UNKNOWN 
CAPS_SPL2_ML_1520 
CAPS_SPL2_ML_1630 
CAPS_SPL2_ML_1640 
CAPS_SPL2_ML_2010 
CAPS_SPL2_ML_2015 
CAPS_SPL2_ML_2240 
CAPS_SPL2_ML_2510 

Function Documentation

◆ spl2_driver_module_init()

int spl2_driver_module_init ( struct caps_drv drvi,
void *  d 
)
Note
Called after caps_pp_instance_runtime_prepare() did its job

Used to allocate some driver specific memory.

◆ spl2_driver_module_exit()

int spl2_driver_module_exit ( struct caps_drv drvi,
void *  d 
)
Note
Called before termination to clean up memory use

◆ spl2_driver_page_setup()

int spl2_driver_page_setup ( struct caps_drv drvi,
void *  d 
)

◆ spl2_driver_runtime_adaptions()

int spl2_driver_runtime_adaptions ( struct caps_drv drvi,
void *  d 
)

◆ spl2_driver_job_setup()

int spl2_driver_job_setup ( struct caps_drv drvi,
void *  d 
)

◆ spl2_driver_page_print()

int spl2_driver_page_print ( struct caps_drv drvi,
void *  d 
)

◆ spl2_driver_job_finish()

int spl2_driver_job_finish ( struct caps_drv drvi,
void *  d 
)

◆ spl2_driver_device_monitor()

int spl2_driver_device_monitor ( struct caps_drv drvi,
void *  d 
)

◆ printer_driver_runtime_adaptions()

int printer_driver_runtime_adaptions ( struct caps_drv drvi,
struct spl2_drv info 
)

Adapt some features to the current run-time

Parameters
[in]drviThe framework handle
[in]infoOur private data
Return values
0On success
-EINVALIf this job cannot be printed

Printer driver specific run-time adaptions, in contrast to the generic spl2_driver_runtime_adaptions()

Called by the generic spl2_driver_runtime_adaptions().

◆ printer_driver_module_init()

int printer_driver_module_init ( struct caps_drv drvi,
struct spl2_drv info 
)

Do some special init for this printer: currently nothing to be done

Parameters
[in]drviThe framework handle
[in]infoOur private data
Return values
0On success
-EINVALIf this job cannot be printed

Printer driver specific initialisation, in contrast to the generic spl2_driver_module_init()

Called by the generic spl2_driver_module_init().

Printer driver specific initialisation, in contrast to the generic spl2_driver_module_init()

Called by the generic spl2_driver_module_init().

◆ drv_spl2_band_rotate()

uint8_t drv_spl2_band_rotate ( struct spl2_band_buffer info)

Rotate the input data into the band buffer for further processing.

Parameters
[in]infoAll we must know about the raw data and the resulting band
Returns
0xff if the whole band is empty, any value else

We got our data line by line. The band data must be in collumn by collumn. So, rotate the bytes (not the pixels!) for the band first.

This copies the data from the (line based) input buffer to the (collumn based) band buffer.

Precondition
band size must be large enough to hold all data from the input buffer e.g. at least 128 * line size

◆ drv_spl2_band_compress()

int drv_spl2_band_compress ( struct spl2_band_buffer info)

Compress/encode one band of printer data

Parameters
[in,out]infoInformation about the current band
Returns
0 on success (currently always)

◆ drv_spl2_par_threads_get()

unsigned drv_spl2_par_threads_get ( struct caps_drv drvi)

Get the amount of additional thread to be used to process indepenent bands

Parameters
[in]drviThe printer instance info
Return values
PositiveAmount of additional threads to use for processing (can be 0)

Since it makes no sense to run more threads than CPU cores are available, limit the number of threads to use here. The calculation is:

  • one thread for the main worker's loop
  • n additional threads up to the available CPU cores
Note
If 'threads' is set to '0', an autodetection is done
If 'threads' isn't set at all, the amount of additional threads is '1'
If 'threads' has an invalid setting, the amount of additional threads is '1'

@TODO in libcapsdriver! Generisch. Mit Doku, wie es pro Drucker zu überschreiben ist.

◆ ml1640_driver_page_print()

int ml1640_driver_page_print ( struct caps_drv drvi,
void *  d 
)

Convert one raw page and print it.

Parameters
[in]drviFull job description
[in]dThe info structure
Return values
0On success
negativeErrno else
-EBADFThe device seems gone offline

The image to process is expected as a monochrome bitmap, 8 pixel in one byte.

Precondition
For monochrome raster image data only (e.g. pixel size = 1)
A to be printed pixel must have its corresponding bit = 0, e,g, CAPS_RSTR_MONOCHROME0